From e6d17eb78f3f650192f241d2fc7f2e49b7b51086 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 18 Dec 2021 01:31:14 -0500 Subject: [PATCH] decomp: finish `plant-boss` and `crates` (#1012) * stuck: `crates` has issues setting bitfield with `r0` * decomp: finish `plant-boss` except for 1 function * decomp: finish `crates` * address feedback --- decompiler/config/all-types.gc | 14 +- .../jak1_ntsc_black_label/type_casts.jsonc | 2 +- goal_src/engine/game/crates.gc | 1584 ++++++++- goal_src/levels/jungleb/plant-boss.gc | 2797 ++++++++++++++++ scripts/check-gsrc-file.py | 7 + scripts/update-goal-src.py | 3 +- .../reference/engine/game/crates_REF.gc | 1708 ++++++++++ .../levels/jungleb/plant-boss_REF.gc | 2897 +++++++++++++++++ test/offline/config.jsonc | 3 + 9 files changed, 8989 insertions(+), 26 deletions(-) create mode 100644 test/decompiler/reference/engine/game/crates_REF.gc create mode 100644 test/decompiler/reference/levels/jungleb/plant-boss_REF.gc diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index ab24615105..9fcbeede98 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -21165,7 +21165,7 @@ (bounce-on () _type_ :state 23) ;; state (notice-blue (handle) _type_ :state 24) (params-init (_type_ entity) none 25) - (art-init (_type_) none 26) + (art-init (_type_) crate 26) (params-set! (_type_ symbol symbol) none 27) (dummy-28 (_type_) none 28) (smush-update! (_type_) none 29) @@ -27610,7 +27610,7 @@ (plant-boss-back-arms-hit symbol) (plant-boss-back-arms-die symbol) (plant-boss-arm-die symbol) - plant-boss-arm-hit + (plant-boss-arm-hit basic) plant-boss-back-arms-idle plant-boss-arm-idle ) @@ -27627,12 +27627,12 @@ :size-assert #xc0 :flag-assert #x14005000c0 (:states - plant-boss-leaf-idle - plant-boss-leaf-die + (plant-boss-leaf-idle symbol) + (plant-boss-leaf-die basic) (plant-boss-leaf-open-idle symbol) plant-boss-leaf-close plant-boss-leaf-bounce - plant-boss-leaf-open + (plant-boss-leaf-open symbol) ) ) @@ -27663,9 +27663,9 @@ :size-assert #x124 :flag-assert #x1400c00124 (:states - plant-boss-root-die + (plant-boss-root-die symbol) (plant-boss-vine-die symbol) - plant-boss-vine-hit + (plant-boss-vine-hit basic) plant-boss-eat plant-boss-vine-idle plant-boss-root-idle diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 7257118d35..b5e6bf7cdc 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -5146,7 +5146,7 @@ "(code plant-boss-arm-die)": [ [3, "v1", "collide-shape-prim-group"], - [18, "a0", "collide-shape-prim-group"], + [[11, 26], "a0", "collide-shape-prim-mesh"], [58, "v1", "art-joint-anim"], [109, "v1", "art-joint-anim"], [165, "v1", "art-joint-anim"], diff --git a/goal_src/engine/game/crates.gc b/goal_src/engine/game/crates.gc index e8e6f1d949..6014c19552 100644 --- a/goal_src/engine/game/crates.gc +++ b/goal_src/engine/game/crates.gc @@ -5,41 +5,1591 @@ ;; name in dgo: crates ;; dgos: GAME, ENGINE -;; TODO - for swamp-obs -(deftype crate (process-drawable) - ((root-override collide-shape-moving :score 20 :offset 112) - (smush smush-control :inline :offset-assert 176) - (base vector :inline :offset-assert 208) - (look symbol :offset-assert 224) - (defense symbol :offset-assert 228) - (incomming-attack-id uint64 :offset-assert 232) - (target handle :offset-assert 240) - (child-count int32 :offset-assert 248) - (victory-anim spool-anim :offset-assert 252) +(declare-type crate process-drawable) +(declare-type crate-buzzer crate) + +;; DECOMP BEGINS + +(defskelgroup *crate-barrel-sg* crate + 17 + 21 + ((18 (meters 20)) (19 (meters 40)) (20 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +(defskelgroup *crate-bucket-sg* crate + 22 + 24 + ((23 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :longest-edge (meters 0) + :texture-level 2 + ) + +(defskelgroup *crate-wood-sg* crate + 0 + 16 + ((1 (meters 20)) (2 (meters 40)) (3 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +(defskelgroup *crate-iron-sg* crate + 4 + 16 + ((5 (meters 20)) (6 (meters 40)) (7 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +(defskelgroup *crate-steel-sg* crate + 8 + 16 + ((9 (meters 20)) (10 (meters 40)) (11 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +(defskelgroup *crate-darkeco-sg* crate + 12 + 16 + ((13 (meters 20)) (14 (meters 40)) (15 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +(deftype crate-bank (basic) + ((COLLIDE_YOFF float :offset-assert 4) + (COLLIDE_RADIUS float :offset-assert 8) + (DARKECO_EXPLODE_RADIUS float :offset-assert 12) ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + + +(define + *CRATE-bank* + (new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 4915.2 :DARKECO_EXPLODE_RADIUS 16384.0) + ) + +(deftype crate (process-drawable) + ((root-override collide-shape-moving :offset 112) + (smush smush-control :inline :offset-assert 176) + (base vector :inline :offset-assert 208) + (look symbol :offset-assert 224) + (defense symbol :offset-assert 228) + (incomming-attack-id uint64 :offset-assert 232) + (target handle :offset-assert 240) + (child-count int32 :offset-assert 248) + (victory-anim spool-anim :offset-assert 252) + ) + :heap-base #x90 :method-count-assert 30 :size-assert #x100 - :heap-base #x90 :flag-assert #x1e00900100 - ;; inherited inspect of process-drawable (:methods - (wait () _type_ :state 20) ;; state + (wait () _type_ :state 20) (die (symbol int) _type_ :state 21) (special-contents-die () _type_ :state 22) - (bounce-on () _type_ :state 23) ;; state + (bounce-on () _type_ :state 23) (notice-blue (handle) _type_ :state 24) (params-init (_type_ entity) none 25) - (art-init (_type_) none 26) + (art-init (_type_) crate 26) (params-set! (_type_ symbol symbol) none 27) (dummy-28 (_type_) none 28) (smush-update! (_type_) none 29) ) ) + +(method-set! crate 12 (method-of-type process run-logic?)) + +(defbehavior crate-post crate () + (rider-trans) + (smush-update! self) + (rider-post) + ) + +(set! (-> *part-id-table* 281) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 20 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 16.0) + (sp-rnd-flt spt-y (meters 0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 1.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 128.0 32.0 1.0) + (sp-rnd-flt spt-g 128.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 16.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.033333335) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 1.2) 1.0) + (sp-flt spt-accel-y 2.7306666) + (sp-int spt-timer 120) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-int-plain-rnd spt-next-time 30 59 1) + (sp-launcher-by-id spt-next-launcher 282) + (sp-rnd-flt spt-conerot-x (degrees 70.0) (degrees 20.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 282) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-fade-a -1.0666667) (sp-end)) + ) + ) + +(set! (-> *part-id-table* 283) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2)) + (sp-flt spt-num 4.0) + (sp-flt spt-y (meters 0.75)) + (sp-flt spt-scale-x (meters 6.0)) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.3) (meters 1.0) 1.0) + (sp-flt spt-r 192.0) + (sp-flt spt-g 192.0) + (sp-rnd-flt spt-b 64.0 128.0 1.0) + (sp-flt spt-a 0.0) + (sp-flt spt-scalevel-x (meters 0.009765625)) + (sp-rnd-flt spt-rotvel-z (degrees -0.15) (degrees 0.3) 1.0) + (sp-flt spt-scalevel-y (meters 0.009765625)) + (sp-flt spt-fade-a 2.1333334) + (sp-int spt-timer 30) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 284) + (sp-flt spt-rotate-y (degrees 0.0)) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 284) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-fade-a -2.1333334) (sp-end)) + ) + ) + +(set! (-> *part-id-table* 285) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 13 + (sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 1.0)) + (sp-flt spt-scale-x (meters 8.0)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 196.0) + (sp-flt spt-g 196.0) + (sp-flt spt-b 196.0) + (sp-flt spt-a 28.0) + (sp-int spt-timer 10) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 286) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 25 + (sp-tex spt-texture (new 'static 'texture-id :index #x6 :page #x2)) + (sp-flt spt-num 5.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z -2048.0 4096.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.6) (meters 0.00048828125) 2457.6) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 160.0) + (sp-flt spt-g 160.0) + (sp-flt spt-b 160.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 2 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 287) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 287) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-scalevel-x (meters -0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -3.4) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 288) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 25 + (sp-tex spt-texture (new 'static 'texture-id :index #x5 :page #x2)) + (sp-flt spt-num 4.5) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z -2048.0 4096.0 1.0) + (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 100.0) + (sp-flt spt-g 100.0) + (sp-flt spt-b 100.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 287) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-group-id-table* 71) (new 'static 'sparticle-launch-group + :length 5 + :duration #x5 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-crate-explode" + :launcher + (new 'static 'inline-array sparticle-group-item 5 + (sp-item 281) + (sp-item 283) + (sp-item 285) + (sp-item 286) + (sp-item 288) + ) + :bounds (new 'static 'sphere :w 49152.0) + ) + ) + +(set! (-> *part-group-id-table* 72) (new 'static 'sparticle-launch-group + :length 6 + :duration #x5 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-crate-steel-explode" + :launcher + (new 'static 'inline-array sparticle-group-item 6 + (sp-item 281) + (sp-item 283) + (sp-item 285) + (sp-item 288) + (sp-item 288) + (sp-item 288) + ) + :bounds (new 'static 'sphere :w 49152.0) + ) + ) + +(set! (-> *part-group-id-table* 73) + (new 'static 'sparticle-launch-group + :length 38 + :duration #x258 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-dark-eco-box-explosion" + :launcher + (new 'static 'inline-array sparticle-group-item 38 + (sp-item 295 :fade-after (meters 100.0) :period 600 :length 5 :binding 296) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 292 :fade-after (meters 160.0) :period 600 :length 5) + (sp-item 2095 :period 600 :length 5) + (sp-item 2096 :fade-after (meters 80.0) :falloff-to (meters 80.0) :period 600 :length 40) + (sp-item 2097 :period 600 :length 20) + (sp-item 2098 :fade-after (meters 120.0) :falloff-to (meters 120.0) :period 600 :length 20) + ) + :bounds (new 'static 'sphere :w 49152.0) + ) + ) + +(set! (-> *part-id-table* 2096) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 6.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 128.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 96.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 96.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.0016666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit14) + (sp-int-plain-rnd spt-next-time 30 29 1) + (sp-launcher-by-id spt-next-launcher 2099) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-radius (meters 2.0) (meters 4.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2099) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 5 + (sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g 0.0) + (sp-flt spt-fade-b 0.0) + (sp-flt spt-fade-a -1.4222223) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2098) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 14 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 3.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 180.0) 1.0) + (sp-flt spt-scale-y (meters 8.0)) + (sp-rnd-flt spt-r 64.0 192.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-flt spt-scalevel-y (meters 0.42666668)) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 60) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2095) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 12 + (sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 16.0)) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 192.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 64.0 1.0) + (sp-flt spt-a 96.0) + (sp-flt spt-fade-a -1.7454545) + (sp-int spt-timer 54) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2097) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 4.0) + (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.013333334) 1.0) + (sp-flt spt-scalevel-x (meters 0.013333334)) + (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.42666668) + (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0) + (sp-flt spt-friction 0.8) + (sp-int spt-timer 510) + (sp-cpuinfo-flags bit2 bit14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 110.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 295) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 14 + (sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2)) + (sp-flt spt-num 16.0) + (sp-flt spt-y (meters 1.0)) + (sp-flt spt-scale-x (meters 0.1)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.026666667) 1.0) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 240) + (sp-cpuinfo-flags bit3 bit14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 296) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-y (meters 0.0) (meters 16.0) 1.0) + (sp-rnd-flt spt-z 1228.8 1228.8 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.3) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-omega 0.0 65536.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.000909091)) + (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.26666668) + (sp-flt spt-fade-a -0.19393939) + (sp-int-plain-rnd spt-timer 90 149 1) + (sp-cpuinfo-flags bit2 bit3 bit7 bit14) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 297) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters -0.0006190476)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.01904762) + (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0) + (sp-int-plain-rnd spt-timer 30 299 1) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-int spt-next-time 240) + (sp-launcher-by-id spt-next-launcher 198) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 292) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 25 + (sp-tex spt-texture (new 'static 'texture-id :index #x5 :page #x2)) + (sp-rnd-flt spt-num 8.0 16.0 1.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z -2048.0 4096.0 1.0) + (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 128.0) + (sp-rnd-int spt-g 1115684864 1 32.0) + (sp-flt spt-b 32.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 301) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 301) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-scalevel-x (meters -0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -3.4) + (sp-end) + ) + ) + ) + +(defbehavior crate-standard-event-handler crate ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('attack) + (let ((s4-0 (-> arg3 param 2)) + (s5-0 (-> arg3 param 3)) + ) + (case (-> self defense) + (('iron) + (case (-> arg3 param 1) + (('flop 'uppercut 'explode 'darkeco 'eco-yellow 'bonk 'racer 'tube 'flut-bonk 'flut-attack) + (if (and + (logtest? (-> self fact options) (fact-options fop11)) + *target* + (zero? (logand (-> *target* control root-prim prim-core action) 512)) + ) + (return #f) + ) + (increment-success-for-hint (game-text-id sidekick-speech-hint-crate-iron)) + (increment-success-for-hint (game-text-id sage-voicebox-hint-crate-iron)) + (send-event arg0 'get-attack-count 1) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root-override trans y) (-> self base y))) + (if (not + (and (!= *kernel-boot-message* 'play) (= (-> *setting-control* current language) (language-enum japanese))) + ) + (level-hint-spawn + (game-text-id sage-voicebox-hint-crate-iron) + "sagevb36" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (case (-> (level-get-target-inside *level*) name) + (('training) + (if (and (can-hint-be-played? (game-text-id zero) (the-as entity #f) (the-as string #f)) (rand-vu-percent? 0.2)) + (clear-text-seen! *game-info* (game-text-id sidekick-speech-hint-crate-iron)) + ) + ) + ) + (level-hint-spawn + (game-text-id sidekick-speech-hint-crate-iron) + "sksp0005" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (set! (-> self incomming-attack-id) s4-0) + (if (not (!= (-> self smush amp) 0.0)) + (sound-play-by-name (static-sound-name "icrate-nobreak") (new-sound-id) 1024 0 0 1 #t) + ) + (activate! (-> self smush) 0.1 90 150 1.0 1.0) + (go-virtual bounce-on) + ) + #f + ) + ) + ) + (('steel) + (case (-> arg3 param 1) + (('explode 'darkeco 'eco-yellow 'bonk 'tube 'flut-bonk 'flut-attack 'racer) + (send-event arg0 'get-attack-count 1) + (when (logtest? (-> self draw status) 8) + (increment-success-for-hint (game-text-id sidekick-speech-hint-crate-steel)) + (level-hint-spawn + (game-text-id sidekick-speech-crate-steel-break1) + "sksp0004" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id sidekick-speech-crate-steel-break2) + "sksp009b" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root-override trans y) (-> self base y))) + (level-hint-spawn + (game-text-id sidekick-speech-hint-crate-steel) + "sksp0006" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (set! (-> self incomming-attack-id) s4-0) + (if (not (!= (-> self smush amp) 0.0)) + (sound-play-by-name (static-sound-name "scrate-nobreak") (new-sound-id) 1024 0 0 1 #t) + ) + (activate! (-> self smush) 0.1 90 150 1.0 1.0) + (go-virtual bounce-on) + ) + #f + ) + ) + ) + (('darkeco) + (let ((a1-32 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-32 from) self) + (set! (-> a1-32 num-params) 2) + (set! (-> a1-32 message) 'attack) + (set! (-> a1-32 param 0) (-> arg3 param 0)) + (let ((a0-57 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-57 mode) 'darkeco) + (set! (-> a1-32 param 1) (the-as uint a0-57)) + ) + (send-event-function arg0 a1-32) + ) + (when (= (-> arg0 type) target) + (level-hint-spawn + (game-text-id sidekick-speech-hint-crate-darkeco2) + "sksp009c" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id sidekick-speech-hint-crate-darkeco1) + "sksp0002" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (case (-> (level-get-target-inside *level*) name) + (('rolling) + (level-hint-spawn + (game-text-id sidekick-speech-hint-rolling-crate-darkeco) + "sksp0110" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (('firecanyon) + (level-hint-spawn + (game-text-id daxter-you-are-trying-to-avoid-dark-eco) + "sksp0082" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id daxter-maybe-i-should-drive) + "sksp0081" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + ) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (send-event arg0 'get-attack-count 1) + (go-virtual die #f (the-as int s5-0)) + ) + ) + ) + ) + (('touch) + (case (-> self defense) + (('darkeco) + (let ((a1-41 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-41 from) self) + (set! (-> a1-41 num-params) 2) + (set! (-> a1-41 message) 'attack) + (set! (-> a1-41 param 0) (-> arg3 param 0)) + (let ((a0-75 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-75 mode) 'darkeco) + (set! (-> a1-41 param 1) (the-as uint a0-75)) + ) + (send-event-function arg0 a1-41) + ) + (go-virtual die #f 0) + ) + ) + ) + (('bonk) + (when (= (-> self root-override trans y) (-> self base y)) + (activate! (-> self smush) -0.1 75 150 1.0 1.0) + (go-virtual bounce-on) + ) + ) + (('wake) + (let ((v0-0 (the-as object (logclear (-> self mask) (process-mask sleep))))) + (set! (-> self mask) (the-as process-mask v0-0)) + v0-0 + ) + ) + (('eco-blue) + (if (not (or + (= (-> self defense) 'darkeco) + (or (= (-> self next-state name) 'notice-blue) (= (-> self next-state name) 'die)) + (!= (-> self root-override trans y) (-> self base y)) + ) + ) + (go-virtual notice-blue (process->handle arg0)) + ) + ) + ) + ) + +(defstate wait (crate) + :virtual #t + :event + crate-standard-event-handler + :code + (behavior () + (suspend) + (dummy-47 (-> self root-override)) + (logior! (-> self mask) (process-mask sleep)) + (while #t + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior crate) ja-post) + ) + +(defstate bounce-on (crate) + :virtual #t + :event + crate-standard-event-handler + :code + (behavior () + (while (!= (-> self smush amp) 0.0) + (suspend) + ) + (go-virtual wait) + (none) + ) + :post + (the-as (function none :behavior crate) crate-post) + ) + +(defstate notice-blue (crate) + :virtual #t + :event + crate-standard-event-handler + :trans + (behavior () + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 2) + (set! (-> a1-0 message) 'query) + (set! (-> a1-0 param 0) (the-as uint 'powerup)) + (set! (-> a1-0 param 1) (the-as uint 3)) + (cond + ((not (send-event-function *target* a1-0)) + (logior! (-> self mask) (process-mask sleep-code)) + (if (not (!= (-> self smush amp) 0.0)) + (go-virtual wait) + ) + ) + (else + (logclear! (-> self mask) (process-mask sleep-code)) + ) + ) + ) + (none) + ) + :code + (behavior ((arg0 handle)) + (set! (-> self target) arg0) + (while #t + (let* ((gp-0 (handle->process (-> self target))) + (v1-4 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) + gp-0 + ) + ) + ) + (when v1-4 + (let* ((gp-1 (-> (the-as process-drawable v1-4) root)) + (v1-6 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) collide-shape)) + gp-1 + ) + ) + ) + (when v1-6 + (let* ((gp-2 (-> self root-override root-prim prim-core)) + (a1-3 (-> (the-as collide-shape v1-6) root-prim prim-core)) + (f30-0 (vector-vector-distance (the-as vector gp-2) (the-as vector a1-3))) + ) + (when (and (< f30-0 (-> *FACT-bank* suck-suck-dist)) (!= (-> self defense) 'steel)) + (logior! (-> self fact options) (fact-options can-collect)) + (go-virtual die #f 0) + ) + (when (rand-vu-percent? 0.5) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> gp-2 world-sphere quad)) + (dotimes (gp-3 3) + (+! (-> s5-0 data gp-3) (rand-vu-float-range -5324.8 5324.8)) + ) + (eco-blue-glow s5-0) + ) + ) + (activate! + (-> self smush) + (lerp-scale + (rand-vu-float-range 0.1 0.3) + (rand-vu-float-range 0.0 0.02) + f30-0 + (-> *FACT-bank* suck-suck-dist) + (-> *FACT-bank* suck-bounce-dist) + ) + 60 + 60 + 1.0 + 1.0 + ) + ) + ) + ) + ) + ) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior crate) crate-post) + ) + +(defstate die (crate) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (case (-> self defense) + (('darkeco) + (cond + ((= (-> arg0 type) target) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) self) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (-> arg3 param 0)) + (let ((a2-1 (new 'static 'attack-info :mask #x20))) + (set! (-> a2-1 mode) 'darkeco) + (set! (-> a1-4 param 1) (the-as uint a2-1)) + ) + (send-event-function arg0 a1-4) + ) + ) + (else + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) self) + (set! (-> a1-5 num-params) 4) + (set! (-> a1-5 message) 'attack) + (set! (-> a1-5 param 0) (-> arg3 param 0)) + (set! (-> a1-5 param 1) (the-as uint 'darkeco)) + (let ((v1-12 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-12) + (set! (-> a1-5 param 2) (the-as uint v1-12)) + ) + (set! (-> a1-5 param 3) (the-as uint 0)) + (send-event-function arg0 a1-5) + ) + ) + ) + ) + ) + ) + ) + ) + :trans + (behavior () + (case (-> self type) + ((crate-buzzer) + (if (and *target* (>= (-> *target* fact-info-target buzzer) 6.0)) + (spool-push *art-control* (-> self victory-anim name) 0 self -99.0) + ) + ) + ) + (none) + ) + :code + (behavior ((arg0 symbol) (arg1 int)) + (clear-collide-with-as (-> self root-override)) + (if (nonzero? (-> self sound)) + (stop! (-> self sound)) + ) + (if (and *target* (and + (logtest? (-> *target* control root-prim prim-core action) #x7200) + (!= (-> self fact pickup-type) 6) + (not arg0) + ) + ) + (logior! (-> self fact options) (fact-options fop6)) + ) + (when (not arg0) + (let ((s5-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) s5-1) 12) + (suspend) + ) + ) + (logior! (-> self draw status) 2) + (case (-> self look) + (('iron) + (sound-play-by-name (static-sound-name "icrate-break") (new-sound-id) 1024 0 0 1 #t) + ) + (('steel) + (sound-play-by-name (static-sound-name "scrate-break") (new-sound-id) 1024 0 0 1 #t) + ) + (('darkeco) + (sound-play-by-name (static-sound-name "dcrate-break") (new-sound-id) 1024 0 0 1 #t) + ) + (else + (sound-play-by-name (static-sound-name "wcrate-break") (new-sound-id) 1024 0 0 1 #t) + ) + ) + (case (-> self defense) + (('darkeco) + (let ((f0-0 + (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root-override trans) (target-pos 0)) 8192.0 40960.0) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 f0-0)) 90) + ) + (let ((s5-7 (get-process *default-dead-pool* touch-tracker #x4000))) + (when s5-7 + (let ((t9-15 (method-of-type touch-tracker activate))) + (t9-15 (the-as touch-tracker s5-7) self 'touch-tracker (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-7 + touch-tracker-init + (-> self root-override trans) + (-> *CRATE-bank* DARKECO_EXPLODE_RADIUS) + 30 + ) + (-> s5-7 ppointer) + ) + ) + ) + ) + (case (-> self look) + (('darkeco) + (let ((s5-8 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-8 + (let ((t9-18 (method-of-type part-tracker activate))) + (t9-18 (the-as part-tracker s5-8) *entity-pool* 'part-tracker (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-8 + part-tracker-init + (-> *part-group-id-table* 73) + -1 + #f + #f + #f + (-> self root-override trans) + ) + (-> s5-8 ppointer) + ) + ) + ) + (('steel 'iron) + (let ((s5-9 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-9 + (let ((t9-21 (method-of-type part-tracker activate))) + (t9-21 (the-as part-tracker s5-9) *entity-pool* 'part-tracker (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-9 + part-tracker-init + (-> *part-group-id-table* 72) + -1 + #f + #f + #f + (-> self root-override trans) + ) + (-> s5-9 ppointer) + ) + ) + ) + (else + (let ((s5-10 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-10 + (let ((t9-24 (method-of-type part-tracker activate))) + (t9-24 (the-as part-tracker s5-10) *entity-pool* 'part-tracker (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-10 + part-tracker-init + (-> *part-group-id-table* 71) + -1 + #f + #f + #f + (-> self root-override trans) + ) + (-> s5-10 ppointer) + ) + ) + ) + ) + ) + (case (-> self fact pickup-type) + (((pickup-type money) + (pickup-type buzzer) + (pickup-type eco-blue) + (pickup-type eco-yellow) + (pickup-type eco-red) + (pickup-type fuel-cell) + ) + (go-virtual special-contents-die) + ) + ) + (drop-pickup (-> self fact) #t *entity-pool* (the-as fact-info #f) arg1) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status complete) #t) + (let ((gp-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-1) 1500) + (suspend) + ) + ) + (none) + ) + ) + +(defstate special-contents-die (crate) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (when (= v1-0 'notify) + (case (-> arg3 param 0) + (('pickup) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) + (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) + (+! (-> self child-count) -1) + (when (<= (-> self child-count) 0) + (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) + (process-entity-status! self (entity-perm-status bit-4) #f) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> gp-0 user-int8 0) 2) + (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) + (set! (-> self mask) v0-0) + v0-0 + ) + ) + ) + ) + ) + ) + ) + ) + ) + :trans + (-> (method-of-type crate die) trans) + :code + (behavior () + (when (or + (= (-> self fact pickup-type) (pickup-type money)) + (= (-> self defense) 'iron) + (= (-> self defense) 'steel) + ) + (let ((a0-4 (-> self entity))) + (if (when a0-4 + (let ((a0-5 (-> a0-4 extra perm task))) + (if a0-5 + (= a0-5 (game-task none)) + ) + ) + ) + (set! (-> self entity extra perm task) (game-task complete)) + ) + ) + ) + (clear-collide-with-as (-> self root-override)) + (logior! (-> self draw status) 2) + (drop-pickup (-> self fact) #t self (the-as fact-info #f) 0) + (set! (-> self child-count) (+ (process-count self) -1)) + (process-entity-status! self (entity-perm-status bit-4) #t) + (let ((v1-21 (-> self entity extra perm))) + (logior! (-> v1-21 status) (entity-perm-status user-set-from-cstage)) + (set! (-> v1-21 user-int8 0) 1) + ) + (when (-> self child) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + (while (-> self child) + (suspend) + ) + ) + (none) + ) + ) + +(defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol)) + (params-init self arg0) + (set! (-> self root-override trans quad) (-> arg1 quad)) + (set! (-> self look) arg2) + (set! (-> self defense) arg2) + (art-init self) + (dummy-28 self) + (none) + ) + +(defmethod init-from-entity! crate ((obj crate) (arg0 entity-actor)) + (params-init obj arg0) + (art-init obj) + (dummy-28 obj) + (none) + ) + +(defmethod params-init crate ((obj crate) (arg0 entity)) + (stack-size-set! (-> obj main-thread) 128) + (logior! (-> obj mask) (process-mask crate)) + (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) default-collision-reaction) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing) + ) + (dummy-29 s4-0 1) + (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s3-0 prim-core collide-as) (the-as uint #x8080)) + (set! (-> s3-0 collide-with) (the-as uint 16)) + (set! (-> s3-0 prim-core action) (the-as uint 3)) + (set! (-> s3-0 prim-core offense) 1) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 3072.0 0.0 6963.2) + (set-root-prim! s4-0 s3-0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (backup-collide-with-as s4-0) + (set! (-> obj root-override) s4-0) + ) + (set! (-> obj fact) + (new 'process 'fact-info obj (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc)) + ) + (let ((v1-27 (-> obj entity extra perm))) + (set! (-> obj fact pickup-amount) + (fmax 0.0 (- (-> obj fact pickup-amount) (the float (-> v1-27 user-int8 1)))) + ) + ) + (when (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete))) + (set! (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (when arg0 + (process-drawable-from-entity! obj (the-as entity-actor arg0)) + (logclear! (-> obj mask) (process-mask actor-pause)) + ) + (let ((a0-18 ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'crate-type + 'interp + -1000000000.0 + 'wood + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> obj look) (the-as symbol a0-18)) + (set! (-> obj defense) (the-as symbol a0-18)) + ) + (case (-> obj fact pickup-type) + (((pickup-type buzzer)) + (set! (-> obj type) crate-buzzer) + (when (= (-> obj look) 'wood) + (set! (-> obj look) 'iron) + (set! (-> obj defense) 'iron) + ) + ) + (else + (when (= (-> obj look) 'iron) + (set! (-> obj look) 'wood) + (set! (-> obj defense) 'wood) + ) + ) + ) + (none) + ) + +(defmethod art-init crate ((obj crate)) + (case (-> obj look) + (('iron) + (set! (-> obj root-override root-prim prim-core offense) 2) + (initialize-skeleton obj *crate-iron-sg* '()) + ) + (('steel) + (set! (-> obj root-override root-prim prim-core offense) 4) + (initialize-skeleton obj *crate-steel-sg* '()) + ) + (('darkeco) + (when (= (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-type) (pickup-type none)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (initialize-skeleton obj *crate-darkeco-sg* '()) + (set-vector! (-> obj draw color-mult) 0.8 0.8 0.8 1.0) + (set-vector! (-> obj draw color-emissive) 0.2 0.2 0.2 1.0) + ) + (('barrel) + (initialize-skeleton obj *crate-barrel-sg* '()) + ) + (('bucket) + (when (= (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-type) (pickup-type none)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (initialize-skeleton obj *crate-bucket-sg* '()) + ) + (('none) + (initialize-skeleton obj *crate-wood-sg* '()) + (logior! (-> obj draw status) 2) + ) + (else + (initialize-skeleton obj *crate-wood-sg* '()) + ) + ) + (cond + ((logtest? (fact-options fop16) (-> obj fact options)) + (set! (-> obj root-override root-prim prim-core offense) 4) + ) + ((logtest? (-> obj fact options) (fact-options fop15)) + (set! (-> obj root-override root-prim prim-core offense) 3) + ) + ((logtest? (-> obj fact options) (fact-options fop14)) + (set! (-> obj root-override root-prim prim-core offense) 2) + ) + ((logtest? (-> obj fact options) (fact-options fop13)) + (set! (-> obj root-override root-prim prim-core offense) 1) + ) + ) + (set! (-> obj base quad) (-> obj root-override trans quad)) + (crate-post) + (nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f)) + obj + ) + +(defmethod params-set! crate ((obj crate) (arg0 symbol) (arg1 symbol)) + (if arg0 + (set! (-> obj look) arg0) + ) + (if arg1 + (set! (-> obj defense) arg1) + ) + (none) + ) + +(defmethod dummy-28 crate ((obj crate)) + (if (>= (-> obj entity extra perm user-int8 0) 1) + (go (method-of-object obj die) #t 0) + ) + 0 + (go (method-of-object obj wait)) + 0 + (none) + ) + +(defmethod smush-update! crate ((obj crate)) + (let ((f0-0 (update! (-> obj smush)))) + (set! (-> obj root-override scale x) (+ 1.0 (* -0.5 f0-0))) + (set! (-> obj root-override scale y) (+ 1.0 f0-0)) + (set! (-> obj root-override scale z) (+ 1.0 (* -0.5 f0-0))) + ) + 0 + (none) + ) + (deftype barrel (crate) () + :heap-base #x90 :method-count-assert 30 - :heap-base #x90 :size-assert #x100 :flag-assert #x1e00900100 ) + + +(defmethod params-init barrel ((obj barrel) (arg0 entity)) + (let ((t9-0 (method-of-type crate params-init))) + (t9-0 obj arg0) + ) + (set! (-> obj look) 'barrel) + (none) + ) + +(deftype bucket (crate) + () + :heap-base #x90 + :method-count-assert 30 + :size-assert #x100 + :flag-assert #x1e00900100 + ) + + +(defmethod params-init bucket ((obj bucket) (arg0 entity)) + (let ((t9-0 (method-of-type crate params-init))) + (t9-0 obj arg0) + ) + (set! (-> obj look) 'bucket) + (none) + ) + +(set! (-> *part-group-id-table* 74) (new 'static 'sparticle-launch-group + :length 1 + :duration #x5 + :linger-duration #x1c2 + :name "group-buzzer-crate" + :launcher + (new 'static 'inline-array sparticle-group-item 1 (sp-item 302)) + :bounds (new 'static 'sphere :w 8192.0) + ) + ) + +(set! (-> *part-id-table* 302) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 1.0) (meters 1.0) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 96.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.02) (meters 0.01) 1.0) + (sp-flt spt-scalevel-x (meters 0.0033333334)) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.16) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-rnd-flt spt-conerot-x (degrees 60.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(deftype crate-buzzer (crate) + () + :heap-base #x90 + :method-count-assert 30 + :size-assert #x100 + :flag-assert #x1e00900100 + ) + + +(defmethod art-init crate-buzzer ((obj crate-buzzer)) + (let ((t9-0 (method-of-type crate art-init))) + (t9-0 obj) + ) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 74) obj)) + (set! (-> obj sound) (new + 'process + 'ambient-sound + (new 'static 'sound-spec + :mask #x82 + :num 1.0 + :group #x1 + :sound-name (static-sound-name "buzzer") + :volume #x400 + :pitch-mod -762 + :fo-max 40 + ) + (-> obj root-override trans) + ) + ) + (set! (-> obj victory-anim) (fuel-cell-pick-anim obj)) + (the-as crate obj) + ) + +(defstate wait (crate-buzzer) + :virtual #t + :trans + (behavior () + (when (and + (and + *target* + (>= 327680.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) + ) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 450) + (rand-vu-percent? 0.03) + ) + (spawn (-> self part) (-> self root-override trans)) + (activate! (-> self smush) 0.2 90 150 1.0 1.0) + (logclear! (-> self mask) (process-mask sleep-code)) + ) + (if (nonzero? (-> self sound)) + (update! (-> self sound)) + ) + (if (and *target* (>= (-> *target* fact-info-target buzzer) 6.0)) + (spool-push *art-control* (-> self victory-anim name) 0 self -99.0) + ) + (none) + ) + :code + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (suspend) + (dummy-47 (-> self root-override)) + (while #t + (set! (-> self state-time) (-> *display* base-frame-counter)) + (ja-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + (let ((f30-0 57001.605)) + (sound-play-by-name (static-sound-name "crate-jump") (new-sound-id) 1024 0 0 1 #t) + (while (or (!= (-> self smush amp) 0.0) (!= f30-0 0.0)) + (+! f30-0 (* -245760.0 (-> *display* seconds-per-frame))) + (+! (-> self root-override trans y) (* f30-0 (-> *display* seconds-per-frame))) + (when (< (-> self root-override trans y) (-> self base y)) + (set! (-> self root-override trans y) (-> self base y)) + (set! f30-0 (* -0.5 f30-0)) + (if (< (fabs f30-0) 16384.0) + (set! f30-0 0.0) + ) + ) + (crate-post) + (ja-post) + (suspend) + ) + ) + (set! (-> self root-override trans y) (-> self base y)) + ) + (none) + ) + :post + (the-as (function none :behavior crate-buzzer) #f) + ) + +(defstate bounce-on (crate-buzzer) + :virtual #t + :code + (behavior () + (while (!= (-> self smush amp) 0.0) + (spawn (-> self part) (-> self root-override trans)) + (suspend) + ) + (go-virtual wait) + (none) + ) + ) + +(deftype pickup-spawner (crate) + ((blocker entity-actor :offset-assert 256) + ) + :heap-base #xa0 + :method-count-assert 30 + :size-assert #x104 + :flag-assert #x1e00a00104 + ) + + +(defmethod params-init pickup-spawner ((obj pickup-spawner) (arg0 entity)) + (let ((t9-0 (method-of-type crate params-init))) + (t9-0 obj arg0) + ) + (set! (-> obj look) 'none) + (set! (-> obj blocker) #f) + (if (logtest? (-> obj fact options) (fact-options vent-blocked)) + (set! (-> obj blocker) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) + ) + (none) + ) + +(defmethod dummy-28 pickup-spawner ((obj pickup-spawner)) + (go (method-of-object obj wait)) + 0 + (none) + ) + +(defstate wait (pickup-spawner) + :virtual #t + :code + (behavior () + (while #t + (if (or (not (-> self blocker)) (logtest? (-> self blocker extra perm status) (entity-perm-status complete))) + (go-virtual die #t 0) + ) + (suspend) + ) + (none) + ) + ) + + + + diff --git a/goal_src/levels/jungleb/plant-boss.gc b/goal_src/levels/jungleb/plant-boss.gc index fea1311764..1d51a48e47 100644 --- a/goal_src/levels/jungleb/plant-boss.gc +++ b/goal_src/levels/jungleb/plant-boss.gc @@ -5,3 +5,2800 @@ ;; name in dgo: plant-boss ;; dgos: JUB, L1 +(declare-type plant-boss-leaf process-drawable) + +;; DECOMP BEGINS + +(deftype plant-boss (process-drawable) + ((root-override collide-shape :offset 112) + (neck joint-mod :offset-assert 176) + (body joint-mod :offset-assert 180) + (leaf (pointer plant-boss-leaf) 2 :offset-assert 184) + (energy float :offset-assert 192) + (health float :offset-assert 196) + (ate symbol :offset-assert 200) + (cycle-count int32 :offset-assert 204) + (snap-count int32 :offset-assert 208) + (attack-prim collide-shape-prim-sphere 3 :offset-assert 212) + (death-prim collide-shape-prim-mesh 3 :offset-assert 224) + (cam-tracker handle :offset-assert 240) + (want-aphid-count int32 :offset-assert 248) + (aphid-count int32 :offset-assert 252) + (aphid-spawn-time int64 :offset-assert 256) + (interp float :offset-assert 264) + (try int32 :offset-assert 268) + (camera handle :offset-assert 272) + (money handle :offset-assert 280) + (try-inc symbol :offset-assert 288) + ) + :heap-base #xc0 + :method-count-assert 20 + :size-assert #x124 + :flag-assert #x1400c00124 + (:states + (plant-boss-attack int) + (plant-boss-dead symbol) + (plant-boss-dead-bounce float) + plant-boss-dead-idle + plant-boss-eat + plant-boss-far-idle + (plant-boss-hit symbol) + plant-boss-idle + plant-boss-intro + (plant-boss-reset int) + (plant-boss-root-die symbol) + plant-boss-root-idle + plant-boss-spawn + (plant-boss-vine-die symbol) + (plant-boss-vine-hit basic) + plant-boss-vine-idle + plant-boss-vulnerable + ) + ) + + +(defmethod relocate plant-boss ((obj plant-boss) (arg0 int)) + (if (nonzero? (-> obj neck)) + (&+! (-> obj neck) arg0) + ) + (if (nonzero? (-> obj body)) + (&+! (-> obj body) arg0) + ) + (dotimes (v1-8 3) + (if (nonzero? (-> obj attack-prim v1-8)) + (&+! (-> obj attack-prim v1-8) arg0) + ) + (if (nonzero? (-> obj death-prim v1-8)) + (&+! (-> obj death-prim v1-8) arg0) + ) + ) + (the-as + plant-boss + ((the-as (function process-drawable int process-drawable) (find-parent-method plant-boss 7)) obj arg0) + ) + ) + +(deftype plant-boss-arm (process-drawable) + ((parent-override (pointer plant-boss) :offset 12) + (root-override collide-shape :offset 112) + (side int32 :offset-assert 176) + ) + :heap-base #x50 + :method-count-assert 20 + :size-assert #xb4 + :flag-assert #x14005000b4 + (:states + (plant-boss-arm-die symbol) + (plant-boss-arm-hit basic) + plant-boss-arm-idle + (plant-boss-back-arms-die symbol) + (plant-boss-back-arms-hit symbol) + plant-boss-back-arms-idle + ) + ) + + +(deftype plant-boss-leaf (process-drawable) + ((root-override collide-shape-moving :offset 112) + (side int32 :offset-assert 176) + (state-object symbol :offset-assert 180) + (state-time-frame int64 :offset-assert 184) + ) + :heap-base #x50 + :method-count-assert 20 + :size-assert #xc0 + :flag-assert #x14005000c0 + (:states + plant-boss-leaf-bounce + plant-boss-leaf-close + (plant-boss-leaf-die basic) + (plant-boss-leaf-idle symbol) + (plant-boss-leaf-open symbol) + (plant-boss-leaf-open-idle symbol) + ) + ) + + +(defskelgroup *plant-boss-sg* plant-boss + 0 + 3 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 10 20) + :longest-edge (meters 0) + :shadow 2 + ) + +(defskelgroup *plant-boss-arm-sg* plant-boss + 22 + 25 + ((23 (meters 999999))) + :bounds (static-spherem 0 0 0 20) + :longest-edge (meters 0) + :shadow 24 + ) + +(defskelgroup *plant-boss-leaf-sg* plant-boss + 37 + 42 + ((38 (meters 999999))) + :bounds (static-spherem 0 0 0 6) + :longest-edge (meters 0) + :shadow 39 + ) + +(defskelgroup *plant-boss-back-arms-sg* plant-boss + 30 + 33 + ((31 (meters 999999))) + :bounds (static-spherem 0 0 0 8) + :longest-edge (meters 0) + :shadow 32 + ) + +(defskelgroup *plant-boss-vine-sg* plant-boss + 48 + 50 + ((49 (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :longest-edge (meters 0) + ) + +(defskelgroup *plant-boss-root-sg* plant-boss + 53 + 55 + ((54 (meters 999999))) + :bounds (static-spherem 0 20 0 20) + :longest-edge (meters 0) + ) + +(define + *plant-boss-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center + (new 'static 'vector :w (the-as float #x2)) + :shadow-dir + (new 'static 'vector :y -1.0 :w 409600.0) + :bot-plane (new 'static 'plane :y 1.0 :w 37683.2) + :top-plane (new 'static 'plane :y 1.0 :w 4096.0) + ) + ) + ) + +(defbehavior plant-boss-generic-event-handler plant-boss ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (case arg2 + (('child-die) + (set! v0-0 (seekl (-> self aphid-count) 0 1)) + (set! (-> self aphid-count) (the-as int v0-0)) + v0-0 + ) + (('joint) + 24 + ) + (('try) + (-> self try) + ) + (('notify) + (case (-> arg3 param 0) + (('pickup) + (when (type-type? (-> arg0 type) money) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) + (set! v0-0 (seekl (-> gp-0 user-int8 1) 5 1)) + (set! (-> gp-0 user-int8 1) (the-as int v0-0)) + ) + v0-0 + ) + ) + ) + ) + (('target) + (case (-> arg3 param 0) + (('die) + (if (= (-> arg3 param 1) 'plant-boss) + (go plant-boss-eat) + ) + ) + ) + ) + ) + ) + +(defbehavior plant-boss-default-event-handler plant-boss ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touch 'attack) + (if (and + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 1) + ) + (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 13) + ) + ) + ) + (send-event arg0 'attack-or-shove (-> arg3 param 0) (new 'static 'attack-info)) + ) + ) + (else + (plant-boss-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + +(defbehavior plant-boss-post plant-boss () + (when *target* + (let ((gp-0 (-> *target* control root-prim prim-core))) + (set-target! (-> self neck) (the-as vector gp-0)) + (set-target! (-> self body) (the-as vector gp-0)) + ) + ) + (transform-post) + (none) + ) + +(defstate plant-boss-arm-idle (plant-boss-arm) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('hide 'die) + (go plant-boss-arm-die (the-as symbol (-> arg3 param 0))) + ) + (('hit) + (go plant-boss-arm-hit (the-as basic (-> arg3 param 0))) + ) + ) + ) + :code + (behavior () + (ja-channel-set! 2) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 25)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (let ((gp-1 (-> self skel root-channel 1))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 26)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (while #t + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-loop!) + ) + (let ((v1-16 (-> self skel root-channel 1))) + (set! (-> v1-16 frame-interp) (- (-> (new 'static 'array float 1 1.0) 0) (-> self parent-override 0 energy))) + ) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +(defstate plant-boss-arm-hit (plant-boss-arm) + :event + (-> plant-boss-arm-idle event) + :code + (behavior ((arg0 basic)) + (ja-channel-push! 1 30) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 29))) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 90.0) 0)) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 29)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 90.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 75) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 25))) + (set! (-> gp-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 25)) data 0 length) -1)) + ) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-2 frame-num) (ja-aframe (the-as float 90.0) 0)) + (joint-control-channel-group! gp-2 (the-as art-joint-anim (-> self draw art-group data 25)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! (-> a0-11 param 0) (the float (+ (-> a0-11 frame-group data 0 length) -1))) + (set! (-> a0-11 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-11 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (go plant-boss-arm-idle) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +(defstate plant-boss-arm-die (plant-boss-arm) + :code + (behavior ((arg0 symbol)) + (let ((a0-1 (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 0))) + (set! (-> self root-override root-prim local-sphere w) 81920.0) + (set! (-> (the-as collide-shape-prim-mesh a0-1) local-sphere w) 69632.0) + (set! (-> (the-as collide-shape-prim-mesh a0-1) collide-with) (the-as uint 16)) + (set! (-> (the-as collide-shape-prim-mesh a0-1) prim-core collide-as) (the-as uint 256)) + (set! (-> (the-as collide-shape-prim-mesh a0-1) prim-core offense) 4) + (let ((t9-0 (method-of-object (the-as collide-shape-prim-mesh a0-1) change-mesh)) + (v1-10 (-> self side)) + ) + (t9-0 (the-as collide-shape-prim-mesh a0-1) (if (= v1-10 1) + 1 + 0 + ) + ) + ) + ) + (cond + (arg0 + (ja-channel-set! 1) + ) + (else + (ja-channel-push! 1 75) + (let ((f30-0 (rand-vu-float-range (-> (new 'static 'array float 1 0.8) 0) (-> (new 'static 'array float 1 1.0) 0))) + ) + (case (-> self side) + ((1) + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> self draw art-group data 28))) + (set! (-> a0-6 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) data 0 length) -1)) + ) + (set! (-> a0-6 param 1) f30-0) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> self draw art-group data 28)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) f30-0) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((a0-9 (-> self skel root-channel 0))) + (set! (-> a0-9 frame-group) (the-as art-joint-anim (-> self draw art-group data 27))) + (set! (-> a0-9 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 27)) data 0 length) -1)) + ) + (set! (-> a0-9 param 1) f30-0) + (set! (-> a0-9 frame-num) 0.0) + (joint-control-channel-group! a0-9 (the-as art-joint-anim (-> self draw art-group data 27)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group data 0 length) -1))) + (set! (-> a0-10 param 1) f30-0) + (joint-control-channel-group-eval! a0-10 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + ) + ) + ) + (case (-> self side) + ((1) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 28)) + num-func-identity + ) + (set! (-> gp-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) data 0 length) -1)) + ) + ) + ) + (else + (let ((gp-2 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 27)) + num-func-identity + ) + (set! (-> gp-2 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 27)) data 0 length) -1)) + ) + ) + ) + ) + (set! (-> (dummy-34 (-> self root-override) (the-as uint 1)) prim-core action) (the-as uint 0)) + 0 + (set! (-> (dummy-34 (-> self root-override) (the-as uint 2)) prim-core action) (the-as uint 0)) + 0 + (dummy-47 (-> self root-override)) + (while #t + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +(defstate plant-boss-back-arms-idle (plant-boss-arm) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (or (= arg2 'touch) (= arg2 'attack)) + (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) + ) + (cond + ((= arg2 'hit) + (go plant-boss-back-arms-hit (the-as symbol (-> arg3 param 0))) + ) + ((= arg2 'die) + (go plant-boss-back-arms-die (the-as symbol (-> arg3 param 0))) + ) + ) + ) + :code + (behavior () + (while #t + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 33))) + (set! (-> a0-0 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 33)) data 0 length) -1)) + ) + (set! (-> a0-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-0 frame-num) 0.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim (-> self draw art-group data 33)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 param 0) (the float (+ (-> a0-1 frame-group data 0 length) -1))) + (set! (-> a0-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +(defstate plant-boss-back-arms-hit (plant-boss-arm) + :event + (-> plant-boss-back-arms-idle event) + :code + (behavior ((arg0 symbol)) + (ja-channel-push! 1 30) + (cond + ((or (= arg0 'spin) (= arg0 'spin-air)) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 36))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-1 frame-num) 0.0) + (joint-control-channel-group! gp-1 (the-as art-joint-anim (-> self draw art-group data 36)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 35))) + (set! (-> gp-3 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) 0.0) + (joint-control-channel-group! gp-3 (the-as art-joint-anim (-> self draw art-group data 35)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-4 (-> self skel root-channel 0))) + (set! (-> gp-4 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (let ((a0-13 (-> self skel root-channel 0))) + (set! (-> a0-13 param 0) (the float (+ (-> a0-13 frame-group data 0 length) -1))) + (set! (-> a0-13 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-13 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 75) + (let ((gp-5 (-> self skel root-channel 0))) + (set! (-> gp-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 33))) + (set! (-> gp-5 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 33)) data 0 length) -1)) + ) + (set! (-> gp-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-5 frame-num) (ja-aframe (the-as float 45.0) 0)) + (joint-control-channel-group! gp-5 (the-as art-joint-anim (-> self draw art-group data 33)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-17 (-> self skel root-channel 0))) + (set! (-> a0-17 param 0) (the float (+ (-> a0-17 frame-group data 0 length) -1))) + (set! (-> a0-17 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-17 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (go plant-boss-back-arms-idle) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +(defstate plant-boss-back-arms-die (plant-boss-arm) + :code + (behavior ((arg0 symbol)) + (cond + (arg0 + (ja-channel-set! 1) + ) + (else + (ja-channel-push! 1 75) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 34))) + (set! (-> a0-3 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 34)) data 0 length) -1)) + ) + (set! (-> a0-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-3 frame-num) 0.0) + (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> self draw art-group data 34)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group data 0 length) -1))) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (clear-collide-with-as (-> self root-override)) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-identity + ) + (set! (-> gp-0 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 34)) data 0 length) -1)) + ) + ) + (while #t + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +(defstate plant-boss-vine-idle (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('hide 'die) + (go plant-boss-vine-die (the-as symbol (-> arg3 param 0))) + ) + (('hit) + (go plant-boss-vine-hit (the-as basic (-> arg3 param 0))) + ) + ) + ) + :code + (behavior () + (let ((f30-0 (rand-vu-float-range (the-as float 0.9) (the-as float 1.1)))) + (while #t + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 50))) + (set! (-> a0-1 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 50)) data 0 length) -1)) + ) + (set! (-> a0-1 param 1) f30-0) + (set! (-> a0-1 frame-num) 0.0) + (joint-control-channel-group! a0-1 (the-as art-joint-anim (-> self draw art-group data 50)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 param 0) (the float (+ (-> a0-2 frame-group data 0 length) -1))) + (set! (-> a0-2 param 1) f30-0) + (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +(defstate plant-boss-vine-hit (plant-boss) + :event + (-> plant-boss-vine-idle event) + :code + (behavior ((arg0 basic)) + (ja-channel-push! 1 30) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 52))) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 52)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 75) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 50))) + (set! (-> gp-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 50)) data 0 length) -1)) + ) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-2 frame-num) (ja-aframe (the-as float 45.0) 0)) + (joint-control-channel-group! gp-2 (the-as art-joint-anim (-> self draw art-group data 50)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! (-> a0-11 param 0) (the float (+ (-> a0-11 frame-group data 0 length) -1))) + (set! (-> a0-11 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-11 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (go plant-boss-vine-idle) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +(defstate plant-boss-vine-die (plant-boss) + :code + (behavior ((arg0 symbol)) + (when (not arg0) + (let ((f30-0 (rand-vu-float-range (-> (new 'static 'array float 1 0.0) 0) (-> (new 'static 'array float 1 1.0) 0))) + (gp-0 (-> *display* base-frame-counter)) + ) + (until (>= (- (-> *display* base-frame-counter) gp-0) (the int (* 300.0 f30-0))) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-loop!) + ) + (suspend) + ) + ) + (ja-channel-push! 1 75) + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> self draw art-group data 51))) + (set! (-> a0-6 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 51)) data 0 length) -1)) + ) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> self draw art-group data 51)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +(defstate plant-boss-root-idle (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('hide 'die) + (go plant-boss-root-die (the-as symbol (-> arg3 param 0))) + ) + ) + ) + :code + (behavior () + (let ((f30-0 (rand-vu-float-range (the-as float 0.9) (the-as float 1.1)))) + (while #t + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 55))) + (set! (-> a0-1 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 55)) data 0 length) -1)) + ) + (set! (-> a0-1 param 1) f30-0) + (set! (-> a0-1 frame-num) 0.0) + (joint-control-channel-group! a0-1 (the-as art-joint-anim (-> self draw art-group data 55)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 param 0) (the float (+ (-> a0-2 frame-group data 0 length) -1))) + (set! (-> a0-2 param 1) f30-0) + (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +(defstate plant-boss-root-die (plant-boss) + :code + (behavior ((arg0 symbol)) + (when (not arg0) + (let ((gp-0 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-0) 1200) + (+! (-> self root-override trans z) (* -4096.0 (-> *display* seconds-per-frame))) + (suspend) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +(defbehavior plant-boss-arm-init plant-boss-arm ((arg0 vector) (arg1 float) (arg2 int)) + (stack-size-set! (-> self main-thread) 128) + (let ((s3-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((s2-0 (new 'process 'collide-shape-prim-group s3-0 (the-as uint 3) 0))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set! (-> s2-0 prim-core action) (the-as uint 1)) + (set! (-> s2-0 prim-core offense) 4) + (set-vector! (-> s2-0 local-sphere) 0.0 16384.0 0.0 16384.0) + (set-root-prim! s3-0 s2-0) + (let ((s1-0 (new 'process 'collide-shape-prim-mesh s3-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s1-0 prim-core collide-as) (the-as uint 0)) + (set! (-> s1-0 collide-with) (the-as uint 0)) + (set! (-> s1-0 prim-core action) (the-as uint 1)) + (set! (-> s1-0 prim-core offense) 0) + (set! (-> s1-0 transform-index) 5) + (set-vector! (-> s1-0 local-sphere) 0.0 0.0 0.0 81920.0) + (append-prim s2-0 s1-0) + ) + (let ((s1-1 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 1)))) + (set! (-> s1-1 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-1 collide-with) (the-as uint 16)) + (set! (-> s1-1 prim-core action) (the-as uint 1)) + (set! (-> s1-1 prim-core offense) 4) + (set-vector! (-> s1-1 local-sphere) 0.0 12288.0 0.0 12288.0) + (append-prim s2-0 s1-1) + ) + (let ((s1-2 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 2)))) + (set! (-> s1-2 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-2 collide-with) (the-as uint 16)) + (set! (-> s1-2 prim-core action) (the-as uint 1)) + (set! (-> s1-2 prim-core offense) 4) + (set-vector! (-> s1-2 local-sphere) 0.0 20480.0 0.0 12288.0) + (append-prim s2-0 s1-2) + ) + ) + (set! (-> s3-0 nav-radius) (* 0.75 (-> s3-0 root-prim local-sphere w))) + (backup-collide-with-as s3-0) + (set! (-> self root-override) s3-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-yaw-angle-clear-roll-pitch! (-> self root-override) arg1) + (set! (-> self side) arg2) + (initialize-skeleton self *plant-boss-arm-sg* '()) + (set! (-> self draw shadow-ctrl) *plant-boss-shadow-control*) + (go plant-boss-arm-idle) + (none) + ) + +(defbehavior plant-boss-back-arms-init plant-boss-arm ((arg0 vector) (arg1 float) (arg2 int)) + (stack-size-set! (-> self main-thread) 128) + (let ((s3-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((s2-0 (new 'process 'collide-shape-prim-group s3-0 (the-as uint 2) 0))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set! (-> s2-0 prim-core action) (the-as uint 1)) + (set! (-> s2-0 prim-core offense) 4) + (set-vector! (-> s2-0 local-sphere) -30720.0 6144.0 26624.0 16384.0) + (set-root-prim! s3-0 s2-0) + (let ((s1-0 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 0)))) + (set! (-> s1-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-0 collide-with) (the-as uint 16)) + (set! (-> s1-0 prim-core action) (the-as uint 1)) + (set! (-> s1-0 prim-core offense) 4) + (set-vector! (-> s1-0 local-sphere) -32768.0 6144.0 32768.0 4915.2) + (append-prim s2-0 s1-0) + ) + (let ((s1-1 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 0)))) + (set! (-> s1-1 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-1 collide-with) (the-as uint 16)) + (set! (-> s1-1 prim-core action) (the-as uint 1)) + (set! (-> s1-1 prim-core offense) 4) + (set-vector! (-> s1-1 local-sphere) -28672.0 6144.0 20480.0 4915.2) + (append-prim s2-0 s1-1) + ) + ) + (set! (-> s3-0 nav-radius) (* 0.75 (-> s3-0 root-prim local-sphere w))) + (backup-collide-with-as s3-0) + (set! (-> self root-override) s3-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-yaw-angle-clear-roll-pitch! (-> self root-override) arg1) + (set! (-> self side) arg2) + (initialize-skeleton self *plant-boss-back-arms-sg* '()) + (set! (-> self draw shadow-ctrl) *plant-boss-shadow-control*) + (go plant-boss-back-arms-idle) + (none) + ) + +(defbehavior plant-boss-vine-init plant-boss-arm ((arg0 vector) (arg1 vector) (arg2 float) (arg3 int)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self root-override) (the-as collide-shape (new 'process 'trsqv))) + (set-vector! (-> self root-override scale) arg2 arg2 arg2 (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (quaternion-zxy! (-> self root-override quat) arg1) + (set! (-> self side) arg3) + (initialize-skeleton self *plant-boss-vine-sg* '()) + (go plant-boss-vine-idle) + (none) + ) + +(defbehavior plant-boss-root-init plant-boss-arm ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 int)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self root-override) (the-as collide-shape (new 'process 'trsqv))) + (set! (-> self root-override scale quad) (-> arg2 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (quaternion-zxy! (-> self root-override quat) arg1) + (set! (-> self side) arg3) + (initialize-skeleton self *plant-boss-root-sg* '()) + (go plant-boss-root-idle) + (none) + ) + +(defstate plant-boss-leaf-idle (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('trigger) + (go plant-boss-leaf-open (the-as symbol (-> arg3 param 0))) + ) + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :code + (behavior ((arg0 symbol)) + (while #t + (case (-> self side) + ((1) + (dotimes (gp-0 4) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 43))) + (set! (-> a0-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 43)) data 0 length) -1)) + ) + (set! (-> a0-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> self draw art-group data 43)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group data 0 length) -1))) + (set! (-> a0-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (else + (dotimes (gp-1 5) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 40))) + (set! (-> a0-5 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 40)) data 0 length) -1)) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> self draw art-group data 40)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 param 0) (the float (+ (-> a0-6 frame-group data 0 length) -1))) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-6 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) ja-post) + ) + +(defstate plant-boss-leaf-open (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('kill) + (go plant-boss-leaf-close) + ) + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :trans + (the-as (function none :behavior plant-boss-leaf) rider-trans) + :code + (behavior ((arg0 symbol)) + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-1 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 30) + (case (-> self side) + ((1) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 44))) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 30.0) 0)) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 44)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 30.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (sound-play-by-name (static-sound-name "plant-leaf") (new-sound-id) 1024 0 0 1 #t) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 44))) + (set! (-> gp-3 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 44)) data 0 length) -1)) + ) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) (ja-aframe (the-as float 30.0) 0)) + (joint-control-channel-group! gp-3 (the-as art-joint-anim (-> self draw art-group data 44)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-14 (-> self skel root-channel 0))) + (set! (-> a0-14 param 0) (the float (+ (-> a0-14 frame-group data 0 length) -1))) + (set! (-> a0-14 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-14 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((gp-4 (-> self skel root-channel 0))) + (set! (-> gp-4 frame-group) (the-as art-joint-anim (-> self draw art-group data 41))) + (set! (-> gp-4 param 0) (ja-aframe (the-as float 30.0) 0)) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-4 frame-num) 0.0) + (joint-control-channel-group! gp-4 (the-as art-joint-anim (-> self draw art-group data 41)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-5 (-> self skel root-channel 0))) + (set! (-> gp-5 param 0) (ja-aframe (the-as float 30.0) 0)) + (set! (-> gp-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-5 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (sound-play-by-name (static-sound-name "plant-leaf") (new-sound-id) 1024 0 0 1 #t) + (let ((gp-7 (-> self skel root-channel 0))) + (set! (-> gp-7 frame-group) (the-as art-joint-anim (-> self draw art-group data 41))) + (set! (-> gp-7 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 41)) data 0 length) -1)) + ) + (set! (-> gp-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-7 frame-num) (ja-aframe (the-as float 30.0) 0)) + (joint-control-channel-group! gp-7 (the-as art-joint-anim (-> self draw art-group data 41)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-26 (-> self skel root-channel 0))) + (set! (-> a0-26 param 0) (the float (+ (-> a0-26 frame-group data 0 length) -1))) + (set! (-> a0-26 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-26 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (go plant-boss-leaf-open-idle #f) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) rider-post) + ) + +(defstate plant-boss-leaf-open-idle (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('kill) + (set! (-> self state-object) #t) + (let ((v0-0 (the-as object (+ (-> *display* base-frame-counter) (-> arg3 param 0))))) + (set! (-> self state-time-frame) (the-as int v0-0)) + v0-0 + ) + ) + (('bonk) + (if (not (-> self state-object)) + (go plant-boss-leaf-bounce) + ) + ) + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :trans + (the-as (function none :behavior plant-boss-leaf) rider-trans) + :code + (behavior ((arg0 symbol)) + (local-vars (v1-19 symbol)) + (set! (-> self state-object) arg0) + (case (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (((-> self draw art-group data 47) (-> self draw art-group data 46)) + (ja-channel-push! 1 30) + ) + ) + (case (-> self side) + ((1) + (let ((v1-10 (-> self skel root-channel 0))) + (set! (-> v1-10 frame-group) (the-as art-joint-anim (-> self draw art-group data 45))) + ) + ) + (else + (let ((v1-13 (-> self skel root-channel 0))) + (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> self draw art-group data 42))) + ) + ) + ) + (until v1-19 + (suspend) + (let ((a0-16 (-> self skel root-channel 0))) + (set! (-> a0-16 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-loop!) + ) + (set! v1-19 (and (-> self state-object) (< (-> self state-time-frame) (-> *display* base-frame-counter)))) + ) + (go plant-boss-leaf-close) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) rider-post) + ) + +(defstate plant-boss-leaf-bounce (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('kill) + (set! (-> self state-object) #t) + (let ((v0-0 (the-as object (+ (-> *display* base-frame-counter) (-> arg3 param 0))))) + (set! (-> self state-time-frame) (the-as int v0-0)) + v0-0 + ) + ) + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :trans + (the-as (function none :behavior plant-boss-leaf) rider-trans) + :code + (behavior () + (ja-channel-push! 1 30) + (case (-> self side) + ((1) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 47))) + (set! (-> a0-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 47)) data 0 length) -1)) + ) + (set! (-> a0-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> self draw art-group data 47)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group data 0 length) -1))) + (set! (-> a0-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 46))) + (set! (-> a0-5 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 46)) data 0 length) -1)) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> self draw art-group data 46)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 param 0) (the float (+ (-> a0-6 frame-group data 0 length) -1))) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-6 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (go plant-boss-leaf-open-idle (-> self state-object)) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) rider-post) + ) + +(defstate plant-boss-leaf-close (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :trans + (the-as (function none :behavior plant-boss-leaf) rider-trans) + :code + (behavior () + (case (-> self side) + ((1) + (sound-play-by-name (static-sound-name "plant-leaf") (new-sound-id) 1024 0 0 1 #t) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 frame-group) (the-as art-joint-anim (-> self draw art-group data 44))) + (set! (-> a0-4 param 0) 0.0) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-4 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 44)) data 0 length) -1)) + ) + (joint-control-channel-group! a0-4 (the-as art-joint-anim (-> self draw art-group data 44)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) 0.0) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (sound-play-by-name (static-sound-name "plant-leaf") (new-sound-id) 1024 0 0 1 #t) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 frame-group) (the-as art-joint-anim (-> self draw art-group data 41))) + (set! (-> a0-10 param 0) 0.0) + (set! (-> a0-10 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-10 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 41)) data 0 length) -1)) + ) + (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> self draw art-group data 41)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! (-> a0-11 param 0) 0.0) + (set! (-> a0-11 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-11 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (go plant-boss-leaf-idle #f) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) rider-post) + ) + +(defstate plant-boss-leaf-die (plant-boss-leaf) + :code + (behavior ((arg0 basic)) + (while #t + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) ja-post) + ) + +(defbehavior plant-boss-leaf-init plant-boss-leaf ((arg0 vector) (arg1 float) (arg2 int)) + (stack-size-set! (-> self main-thread) 128) + (let ((s3-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)))) + (set! (-> s3-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s3-0 reaction) default-collision-reaction) + (set! (-> s3-0 no-reaction) + (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing) + ) + (dummy-29 s3-0 1) + (let ((s2-0 (new 'process 'collide-shape-prim-mesh s3-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 2048)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set! (-> s2-0 prim-core action) (the-as uint 1)) + (set! (-> s2-0 prim-core offense) 4) + (set! (-> s2-0 transform-index) 8) + (set-vector! (-> s2-0 local-sphere) 0.0 0.0 12288.0 13926.4) + (set-root-prim! s3-0 s2-0) + ) + (set! (-> s3-0 nav-radius) (* 0.75 (-> s3-0 root-prim local-sphere w))) + (backup-collide-with-as s3-0) + (set! (-> self root-override) s3-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-yaw-angle-clear-roll-pitch! (-> self root-override) arg1) + (set! (-> self side) arg2) + (initialize-skeleton self *plant-boss-leaf-sg* '()) + (set! (-> self draw shadow-ctrl) *plant-boss-shadow-control*) + (go plant-boss-leaf-idle #f) + (none) + ) + +(defstate plant-boss-far-idle (plant-boss) + :code + (behavior () + (clear-pending-settings-from-process *setting-control* self 'music) + (let ((gp-0 (-> self child))) + (while gp-0 + (let ((s5-0 (ppointer->process gp-0))) + (set! gp-0 (-> gp-0 0 brother)) + (if (type-type? (-> s5-0 type) aphid) + (deactivate s5-0) + ) + ) + ) + ) + (set! (-> self aphid-count) 0) + (let ((v1-9 (-> self neck))) + (set! (-> v1-9 blend) 0.0) + ) + (let ((v1-10 (-> self body))) + (set! (-> v1-10 blend) 0.0) + ) + (set-mode! (-> self neck) (joint-mod-handler-mode flex-blend)) + (set-mode! (-> self body) (joint-mod-handler-mode flex-blend)) + (set! (-> self body flex-blend) 0.0) + (ja-channel-set! 1) + (while #t + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> self draw art-group data 9))) + (set! (-> a0-6 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) data 0 length) -1)) + ) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> self draw art-group data 9)) num-func-seek!) + ) + (until (ja-done? 0) + (set! (-> self energy) (seek (-> self energy) (the-as float 0.25) (-> *display* seconds-per-frame))) + (if (and + (and + *target* + (>= 245760.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) + ) + (< (fabs (- (-> (target-pos 0) y) (-> self root-override trans y))) 40960.0) + ) + (go plant-boss-intro) + ) + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group data 0 length) -1))) + (set! (-> a0-10 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-10 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +(defstate plant-boss-intro (plant-boss) + :code + (behavior ()) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +(defstate plant-boss-idle (plant-boss) + :event + plant-boss-default-event-handler + :enter + (behavior () + (set-setting! *setting-control* self 'music 'danger (-> (new 'static 'array float 1 0.0) 0) 0) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self body flex-blend) 0.0) + (set! (-> self neck flex-blend) (-> (new 'static 'array float 1 1.0) 0)) + (none) + ) + :trans + (behavior () + (let ((f30-0 (vector-vector-distance (target-pos 0) (-> self root-override trans)))) + (if (< 409600.0 f30-0) + (go plant-boss-far-idle) + ) + (if (and + (< f30-0 143360.0) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) (cond + ((>= (-> self try) 15) + 1500 + ) + ((>= (-> self try) 10) + 1200 + ) + ((>= (-> self try) 5) + 900 + ) + (else + 600 + ) + ) + ) + *target* + (zero? (logand (-> *target* state-flags) #x80f8)) + ) + (go plant-boss-attack 1) + ) + ) + (none) + ) + :code + (behavior () + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 7) + ) + (ja-channel-push! 1 150) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> gp-0 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) (ja-aframe (the-as float 60.0) 0)) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 12) + ) + (ja-channel-push! 1 75) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 13))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 75.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-1 frame-num) 0.0) + (joint-control-channel-group! gp-1 (the-as art-joint-anim (-> self draw art-group data 13)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 param 0) (ja-aframe (the-as float 75.0) 0)) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((a0-19 (-> self skel root-channel 0))) + (set! (-> a0-19 param 0) (the float (+ (-> a0-19 frame-group data 0 length) -1))) + (set! (-> a0-19 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-19 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 75) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> gp-3 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) (ja-aframe (the-as float 75.0) 0)) + (joint-control-channel-group! gp-3 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-23 (-> self skel root-channel 0))) + (set! (-> a0-23 param 0) (the float (+ (-> a0-23 frame-group data 0 length) -1))) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-23 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 10) + ) + ) + (else + (ja-channel-push! 1 75) + ) + ) + (while #t + (when (or (and *cheat-mode* (cpad-hold? 1 r3)) (zero? (-> self aphid-count))) + (let ((a0-35 (-> self skel root-channel 0))) + (set! (-> a0-35 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> a0-35 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> a0-35 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-35 frame-num) 0.0) + (joint-control-channel-group! a0-35 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (go plant-boss-vulnerable) + ) + (let ((a0-36 (-> self skel root-channel 0))) + (set! (-> a0-36 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> a0-36 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> a0-36 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-36 frame-num) 0.0) + (joint-control-channel-group! a0-36 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-37 (-> self skel root-channel 0))) + (set! (-> a0-37 param 0) (the float (+ (-> a0-37 frame-group data 0 length) -1))) + (set! (-> a0-37 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-37 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (when (and *cheat-mode* (cpad-hold? 1 r3)) + (let ((a0-43 (-> self skel root-channel 0))) + (set! (-> a0-43 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> a0-43 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> a0-43 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-43 frame-num) 0.0) + (joint-control-channel-group! a0-43 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (go plant-boss-vulnerable) + ) + (when (rand-vu-percent? (the-as float 0.2)) + (let ((a0-45 (-> self skel root-channel 0))) + (set! (-> a0-45 frame-group) (the-as art-joint-anim (-> self draw art-group data 4))) + (set! (-> a0-45 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) data 0 length) -1)) + ) + (set! (-> a0-45 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-45 frame-num) 0.0) + (joint-control-channel-group! a0-45 (the-as art-joint-anim (-> self draw art-group data 4)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-46 (-> self skel root-channel 0))) + (set! (-> a0-46 param 0) (the float (+ (-> a0-46 frame-group data 0 length) -1))) + (set! (-> a0-46 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-46 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (none) + ) + :post + plant-boss-post + ) + +(defstate plant-boss-spawn (plant-boss) + :event + plant-boss-default-event-handler + :enter + (behavior () + (when (not (-> self try-inc)) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) + (set! (-> gp-0 user-int8 0) (seekl (-> gp-0 user-int8 0) 255 1)) + (set! (-> self try) (-> gp-0 user-int8 0)) + ) + (set! (-> self try-inc) #t) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (+! (-> self cycle-count) 1) + (set! (-> self snap-count) 0) + (set! (-> self body flex-blend) 0.0) + (set! (-> self neck flex-blend) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> self want-aphid-count) (min (- 4 (the int (-> self health))) (cond + ((>= (-> self try) 15) + 1 + ) + ((>= (-> self try) 10) + 2 + ) + (else + 3 + ) + ) + ) + ) + (none) + ) + :trans + (behavior () + (let ((f0-0 (vector-vector-distance (target-pos 0) (-> self root-override trans)))) + (if (< 409600.0 f0-0) + (go plant-boss-far-idle) + ) + ) + (cond + ((zero? (-> self want-aphid-count)) + enter-state + (let ((v1-7 (the int (-> self health)))) + (go plant-boss-attack (cond + ((= v1-7 2) + 2 + ) + ((= v1-7 1) + 3 + ) + (else + 1 + ) + ) + ) + ) + ) + ((>= (- (-> *display* base-frame-counter) (-> self aphid-spawn-time)) 420) + (let ((gp-1 (get-process *default-dead-pool* aphid #x4000))) + (when (when gp-1 + (let ((t9-5 (method-of-type aphid activate))) + (t9-5 (the-as aphid gp-1) self 'aphid (the-as pointer #x70004000)) + ) + (run-now-in-process gp-1 aphid-init-by-other self (-> self root-override trans) (target-pos 0)) + (-> gp-1 ppointer) + ) + (+! (-> self aphid-count) 1) + (set! (-> self want-aphid-count) (seekl (-> self want-aphid-count) 0 1)) + (set! (-> self aphid-spawn-time) (-> *display* base-frame-counter)) + ) + ) + ) + ) + (none) + ) + :code + (-> plant-boss-idle code) + :post + plant-boss-post + ) + +(defstate plant-boss-vulnerable (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('attack) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 1) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'shove) + (set! (-> a1-2 param 0) (-> arg3 param 0)) + (let ((v1-6 (new 'static 'attack-info :mask #xc0))) + (set! (-> v1-6 shove-up) (-> (new 'static 'array float 1 8192.0) 0)) + (set! (-> v1-6 shove-back) 24576.0) + (set! (-> a1-2 param 1) (the-as uint v1-6)) + ) + (send-event-function arg0 a1-2) + ) + (go plant-boss-hit (the-as symbol (-> arg3 param 1))) + ) + ) + (else + (plant-boss-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self body flex-blend) 0.0) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self attack-prim 0 local-sphere w) 12288.0) + (set! (-> self attack-prim 0 prim-core offense) 4) + (logior! (-> self attack-prim 0 prim-core action) 1) + (none) + ) + :exit + (behavior () + (send-event (ppointer->process (-> self leaf 1)) 'kill 0) + (send-event (ppointer->process (-> self leaf 0)) 'kill 150) + (set! (-> self attack-prim 0 local-sphere w) 16384.0) + (set! (-> self attack-prim 0 prim-core offense) 0) + (set! (-> self attack-prim 0 prim-core action) (logand -2 (-> self attack-prim 0 prim-core action))) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 75) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 11))) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 60.0) 0)) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 11)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 60.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (send-event (ppointer->process (-> self leaf 1)) 'trigger) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 11))) + (set! (-> gp-2 param 0) (ja-aframe (the-as float 120.0) 0)) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-2 frame-num) (ja-aframe (the-as float 60.0) 0)) + (joint-control-channel-group! gp-2 (the-as art-joint-anim (-> self draw art-group data 11)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 param 0) (ja-aframe (the-as float 120.0) 0)) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (send-event (ppointer->process (-> self leaf 0)) 'trigger) + (let ((gp-4 (-> self skel root-channel 0))) + (set! (-> gp-4 frame-group) (the-as art-joint-anim (-> self draw art-group data 11))) + (set! (-> gp-4 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 11)) data 0 length) -1)) + ) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-4 frame-num) (ja-aframe (the-as float 120.0) 0)) + (joint-control-channel-group! gp-4 (the-as art-joint-anim (-> self draw art-group data 11)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-16 (-> self skel root-channel 0))) + (set! (-> a0-16 param 0) (the float (+ (-> a0-16 frame-group data 0 length) -1))) + (set! (-> a0-16 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((gp-5 (cond + ((>= (-> self try) 15) + 6000 + ) + ((>= (-> self try) 10) + 3600 + ) + ((>= (-> self try) 5) + 3000 + ) + (else + 2400 + ) + ) + ) + ) + (while (< (- (-> *display* base-frame-counter) (-> self state-time)) gp-5) + (let ((a0-18 (-> self skel root-channel 0))) + (set! (-> a0-18 frame-group) (the-as art-joint-anim (-> self draw art-group data 12))) + (set! (-> a0-18 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 12)) data 0 length) -1)) + ) + (set! (-> a0-18 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-18 frame-num) 0.0) + (joint-control-channel-group! a0-18 (the-as art-joint-anim (-> self draw art-group data 12)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-19 (-> self skel root-channel 0))) + (set! (-> a0-19 param 0) (the float (+ (-> a0-19 frame-group data 0 length) -1))) + (set! (-> a0-19 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-19 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (go plant-boss-spawn) + (none) + ) + :post + plant-boss-post + ) + +(defstate plant-boss-attack (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touch 'attack) + (when (and + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 1) + ) + (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 13) + ) + ) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack-or-shove) + (set! (-> a1-2 param 0) (-> arg3 param 0)) + (let ((a0-8 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-8 mode) 'plant-boss) + (set! (-> a1-2 param 1) (the-as uint a0-8)) + ) + (when (send-event-function arg0 a1-2) + (let ((v0-1 (the-as object #t))) + (set! (-> self ate) (the-as symbol v0-1)) + v0-1 + ) + ) + ) + ) + ) + (else + (plant-boss-default-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :code + (behavior ((arg0 int)) + (local-vars (v1-64 symbol)) + (+! (-> self snap-count) 1) + (set! (-> self ate) #f) + (set! (-> self interp) 0.0) + (let ((s5-0 #f)) + (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 7) + ) + (set! s5-0 #t) + ) + (ja-channel-push! 2 75) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 5)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (let ((s4-1 (-> self skel root-channel 1))) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim (-> self draw art-group data 6)) + num-func-identity + ) + (set! (-> s4-1 frame-num) 0.0) + ) + (when s5-0 + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 num-func) num-func-identity) + (set! (-> s5-1 frame-num) (ja-aframe (the-as float 100.0) 0)) + ) + (let ((s5-2 (-> self skel root-channel 1))) + (set! (-> s5-2 num-func) num-func-identity) + (set! (-> s5-2 frame-num) (ja-aframe (the-as float 100.0) 0)) + ) + ) + ) + (let ((f30-0 (lerp-scale + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (vector-vector-distance (target-pos 0) (-> self root-override trans)) + (the-as float 26624.0) + (the-as float 86016.0) + ) + ) + ) + (until (or v1-64 (ja-done? 0)) + (set! (-> self body flex-blend) (seek + (-> self body flex-blend) + (-> (new 'static 'array float 1 1.0) 0) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (set! (-> self neck flex-blend) (seek + (-> self neck flex-blend) + (-> (new 'static 'array float 1 0.0) 0) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (set! f30-0 (seek + f30-0 + (lerp-scale + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (vector-vector-distance (target-pos 0) (-> self root-override trans)) + (the-as float 26624.0) + (the-as float 86016.0) + ) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (set! (-> self interp) f30-0) + (let ((a0-19 (-> self skel root-channel 0))) + (set! (-> a0-19 param 0) (the float (+ (-> a0-19 frame-group data 0 length) -1))) + (set! (-> a0-19 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-19 (the-as art-joint-anim #f) num-func-seek!) + ) + (let ((a0-20 (-> self skel root-channel 1))) + (set! (-> a0-20 frame-interp) f30-0) + (set! (-> a0-20 param 0) 0.0) + (joint-control-channel-group-eval! a0-20 (the-as art-joint-anim #f) num-func-chan) + ) + (suspend) + (set! v1-64 (>= (ja-aframe-num 0) 149.0)) + ) + ) + (go plant-boss-reset arg0) + (none) + ) + :post + plant-boss-post + ) + +(defstate plant-boss-eat (plant-boss) + :event + plant-boss-generic-event-handler + :exit + (behavior () + (set! (-> self skel status) (logand -33 (-> self skel status))) + (let ((a0-4 (handle->process (-> self camera)))) + (if a0-4 + (deactivate a0-4) + ) + ) + (none) + ) + :code + (behavior () + (let ((f30-1 (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 5) + ) + (fmax (-> (new 'static 'array float 1 129.0) 0) (ja-aframe-num 0)) + (-> (new 'static 'array float 1 129.0) 0) + ) + ) + (gp-0 0) + ) + (send-event *camera* 'change-state cam-lookat 0) + (logior! (-> self skel status) 1) + (ja-channel-push! 2 30) + (let ((s5-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 18)) + num-func-identity + ) + (set! (-> s5-0 frame-num) (ja-aframe f30-1 0)) + ) + (let ((s5-1 (-> self skel root-channel 1))) + (set! (-> s5-1 frame-interp) (-> self interp)) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> self draw art-group data 19)) + num-func-identity + ) + (set! (-> s5-1 frame-num) (ja-aframe f30-1 0)) + ) + (until (>= (ja-aframe-num 0) 285.0) + (try-preload-stream *art-control* "$GAMCAM29" 0 self (the-as float -99.0)) + (set! (-> self energy) (seek (-> self energy) (the-as float 0.5) (* 0.2 (-> *display* seconds-per-frame)))) + (when (and (>= (ja-aframe-num 0) 175.0) (zero? gp-0)) + (set! gp-0 1) + (let ((s5-2 (get-process *default-dead-pool* othercam #x4000))) + (set! (-> self camera) + (ppointer->handle (when s5-2 + (let ((t9-11 (method-of-type othercam activate))) + (t9-11 (the-as othercam s5-2) self 'othercam (the-as pointer #x70004000)) + ) + (run-now-in-process s5-2 othercam-init-by-other self 28 #f #t) + (-> s5-2 ppointer) + ) + ) + ) + ) + (logior! (-> self skel status) 32) + (ambient-hint-spawn "gamcam29" (the-as vector #f) *entity-pool* 'ambient) + ) + (when (and (>= (ja-aframe-num 0) 236.0) (= gp-0 1)) + (set! gp-0 2) + (send-event (handle->process (-> self camera)) 'joint "camera2") + ) + (set! (-> self body flex-blend) + (seek (-> self body flex-blend) (-> (new 'static 'array float 1 0.0) 0) (-> *display* seconds-per-frame)) + ) + (set! (-> self interp) + (seek (-> self interp) (-> (new 'static 'array float 1 0.0) 0) (-> *display* seconds-per-frame)) + ) + (let ((a0-31 (-> self skel root-channel 0))) + (set! (-> a0-31 param 0) (the float (+ (-> a0-31 frame-group data 0 length) -1))) + (set! (-> a0-31 param 1) 0.66) + (joint-control-channel-group-eval! a0-31 (the-as art-joint-anim #f) num-func-seek!) + ) + (let ((a0-32 (-> self skel root-channel 1))) + (set! (-> a0-32 frame-interp) (-> self interp)) + (set! (-> a0-32 param 0) 0.0) + (joint-control-channel-group-eval! a0-32 (the-as art-joint-anim #f) num-func-chan) + ) + (suspend) + ) + ) + (ja-channel-push! 1 75) + (let ((a0-35 (-> self skel root-channel 0))) + (set! (-> a0-35 frame-group) (the-as art-joint-anim (-> self draw art-group data 20))) + (set! (-> a0-35 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 20)) data 0 length) -1)) + ) + (set! (-> a0-35 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-35 frame-num) 0.0) + (joint-control-channel-group! a0-35 (the-as art-joint-anim (-> self draw art-group data 20)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-36 (-> self skel root-channel 0))) + (set! (-> a0-36 param 0) (the float (+ (-> a0-36 frame-group data 0 length) -1))) + (set! (-> a0-36 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-36 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (send-event *target* 'end-mode) + (set! (-> self skel status) (logand -2 (-> self skel status))) + (go plant-boss-idle) + (none) + ) + :post + plant-boss-post + ) + +(defstate plant-boss-reset (plant-boss) + :event + (-> plant-boss-eat event) + :code + (behavior ((arg0 int)) + (let ((gp-0 #f)) + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 10) + ) + (set! gp-0 #t) + (ja-channel-push! 1 150) + ) + (else + (ja-channel-push! 1 300) + ) + ) + (let ((s4-0 (-> self skel root-channel 0))) + (set! (-> s4-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 7))) + (set! (-> s4-0 param 0) (ja-aframe (the-as float 210.0) 0)) + (set! (-> s4-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s4-0 frame-num) 0.0) + (joint-control-channel-group! s4-0 (the-as art-joint-anim (-> self draw art-group data 7)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (set! (-> self body flex-blend) + (seek (-> self body flex-blend) (-> (new 'static 'array float 1 0.0) 0) (-> *display* seconds-per-frame)) + ) + (if (>= 1 arg0) + (set! (-> self neck flex-blend) + (seek (-> self neck flex-blend) (-> (new 'static 'array float 1 1.0) 0) (-> *display* seconds-per-frame)) + ) + ) + (suspend) + (let ((s4-1 (-> self skel root-channel 0))) + (set! (-> s4-1 param 0) (ja-aframe (the-as float 210.0) 0)) + (set! (-> s4-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! s4-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (if (< 1 arg0) + (go plant-boss-attack (+ arg0 -1)) + ) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 7))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 240.0) 0)) + (set! (-> s5-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s5-1 frame-num) (ja-aframe (the-as float 210.0) 0)) + (joint-control-channel-group! s5-1 (the-as art-joint-anim (-> self draw art-group data 7)) num-func-seek!) + ) + (until (ja-done? 0) + (set! (-> self body flex-blend) + (seek (-> self body flex-blend) (-> (new 'static 'array float 1 0.0) 0) (-> *display* seconds-per-frame)) + ) + (set! (-> self neck flex-blend) (seek + (-> self neck flex-blend) + (-> (new 'static 'array float 1 1.0) 0) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (suspend) + (let ((s5-2 (-> self skel root-channel 0))) + (set! (-> s5-2 param 0) (ja-aframe (the-as float 240.0) 0)) + (set! (-> s5-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! s5-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((a0-23 (-> self skel root-channel 0))) + (set! (-> a0-23 param 0) (the float (+ (-> a0-23 frame-group data 0 length) -1))) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-23 (the-as art-joint-anim #f) num-func-seek!) + ) + (if gp-0 + (go plant-boss-spawn) + (go plant-boss-idle) + ) + ) + (none) + ) + :post + plant-boss-post + ) + +(defstate plant-boss-hit (plant-boss) + :event + (-> plant-boss-eat event) + :code + (behavior ((arg0 symbol)) + (let ((s5-0 (-> self child))) + (while s5-0 + (send-event (ppointer->process s5-0) 'hit arg0) + (set! s5-0 (-> s5-0 0 brother)) + ) + ) + (set! (-> self health) + (seek (-> self health) (-> (new 'static 'array float 1 0.0) 0) (-> (new 'static 'array float 1 1.0) 0)) + ) + (send-event (ppointer->process (-> self leaf 1)) 'kill 0) + (send-event (ppointer->process (-> self leaf 0)) 'kill 0) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-5 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 60) + (cond + ((= arg0 'spin) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 15))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-1 frame-num) 0.0) + (joint-control-channel-group! gp-1 (the-as art-joint-anim (-> self draw art-group data 15)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ((= arg0 'spin-air) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 16))) + (set! (-> gp-3 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) 0.0) + (joint-control-channel-group! gp-3 (the-as art-joint-anim (-> self draw art-group data 16)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-4 (-> self skel root-channel 0))) + (set! (-> gp-4 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((gp-5 (-> self skel root-channel 0))) + (set! (-> gp-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 14))) + (set! (-> gp-5 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-5 frame-num) 0.0) + (joint-control-channel-group! gp-5 (the-as art-joint-anim (-> self draw art-group data 14)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-6 (-> self skel root-channel 0))) + (set! (-> gp-6 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-6 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (if (= (-> self health) 0.0) + (go plant-boss-dead #f) + ) + (let ((a0-23 (-> self skel root-channel 0))) + (set! (-> a0-23 param 0) (the float (+ (-> a0-23 frame-group data 0 length) -1))) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-23 (the-as art-joint-anim #f) num-func-seek!) + ) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go plant-boss-spawn) + (none) + ) + :post + plant-boss-post + ) + +(defstate plant-boss-dead (plant-boss) + :event + plant-boss-generic-event-handler + :code + (behavior ((arg0 symbol)) + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self body flex-blend) 0.0) + (let* ((s5-0 (get-task-control (game-task jungle-plant))) + (v1-5 (get-reminder s5-0 0)) + ) + (save-reminder s5-0 (logior v1-5 1) 0) + ) + (cond + (arg0 + (ja-channel-set! 1) + (let ((s5-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> self draw art-group data 17)) + num-func-identity + ) + (set! (-> s5-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 17)) data 0 length) -1)) + ) + ) + (suspend) + (if (not (task-complete? *game-info* (-> self entity extra perm task))) + (birth-pickup-at-point + (-> self node-list data 42 bone transform vector 3) + (pickup-type fuel-cell) + (the float (-> self entity extra perm task)) + #f + self + (the-as fact-info #f) + ) + ) + ) + (else + (let ((s4-0 #f) + (s5-2 #f) + ) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group data 0 length) -1))) + (set! (-> a0-10 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-10 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 150) + (let ((a0-12 (-> self skel root-channel 0))) + (set! (-> a0-12 frame-group) (the-as art-joint-anim (-> self draw art-group data 17))) + (set! (-> a0-12 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 17)) data 0 length) -1)) + ) + (set! (-> a0-12 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-12 frame-num) 0.0) + (joint-control-channel-group! a0-12 (the-as art-joint-anim (-> self draw art-group data 17)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (when (< 100.0 (ja-aframe-num 0)) + (set-mode! (-> self neck) (joint-mod-handler-mode flex-blend)) + (set-mode! (-> self body) (joint-mod-handler-mode flex-blend)) + ) + (when (and (>= (ja-aframe-num 0) 180.0) (not s4-0)) + (let ((s4-1 (-> self child))) + (while s4-1 + (send-event (ppointer->process s4-1) 'hide #f) + (set! s4-1 (-> s4-1 0 brother)) + ) + ) + (set! s4-0 #t) + ) + (when (and (>= (ja-aframe-num 0) 189.0) (not s5-2)) + (process-entity-status! self (entity-perm-status complete) #t) + (when (not (task-complete? *game-info* (-> self entity extra perm task))) + (set! s5-2 #t) + (birth-pickup-at-point + (-> self node-list data 42 bone transform vector 3) + (pickup-type fuel-cell) + (the float (-> self entity extra perm task)) + #f + self + (the-as fact-info #f) + ) + ) + ) + (suspend) + (let ((a0-22 (-> self skel root-channel 0))) + (set! (-> a0-22 param 0) (the float (+ (-> a0-22 frame-group data 0 length) -1))) + (set! (-> a0-22 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-22 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + ) + (let ((s5-3 (-> self child))) + (while s5-3 + (send-event (ppointer->process s5-3) 'die arg0) + (set! s5-3 (-> s5-3 0 brother)) + ) + ) + (set! (-> self death-prim 0 collide-with) (the-as uint 16)) + (set! (-> self death-prim 0 prim-core collide-as) (the-as uint 256)) + (set! (-> self death-prim 0 prim-core offense) 4) + (logior! (-> self death-prim 0 prim-core action) 1) + (set! (-> self death-prim 1 prim-core collide-as) (the-as uint 256)) + (set! (-> self death-prim 1 collide-with) (the-as uint 16)) + (set! (-> self death-prim 1 prim-core offense) 4) + (logior! (-> self death-prim 1 prim-core action) 1) + (set! (-> (dummy-34 (-> self root-override) (the-as uint 8)) prim-core action) (the-as uint 0)) + 0 + (set! (-> (dummy-34 (-> self root-override) (the-as uint 16)) prim-core action) (the-as uint 0)) + 0 + (logior! (-> self mask) (process-mask actor-pause)) + (clear-pending-settings-from-process *setting-control* self 'music) + (go plant-boss-dead-idle) + (none) + ) + :post + (behavior () (plant-boss-post) (dummy-45 (-> self root-override)) (none)) + ) + +(defstate plant-boss-dead-idle (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('bonk) + (go plant-boss-dead-bounce (lerp-scale + (the-as float 0.1) + (-> (new 'static 'array float 1 1.0) 0) + (the-as float (-> arg3 param 1)) + (the-as float 40960.0) + (the-as float 81920.0) + ) + ) + ) + (else + (plant-boss-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :code + (behavior () + (ja-channel-set! 1) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 17)) + num-func-identity + ) + (set! (-> gp-0 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 17)) data 0 length) -1)) + ) + ) + (let ((gp-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-1) 1500) + (transform-post) + (dummy-45 (-> self root-override)) + (suspend) + ) + ) + (while #t + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + (none) + ) + ) + +(defstate plant-boss-dead-bounce (plant-boss) + :event + plant-boss-generic-event-handler + :trans + (the-as (function none :behavior plant-boss) rider-trans) + :code + (behavior ((arg0 float)) + (let ((v1-2 (-> self entity extra perm))) + (if (and (< 0.3 arg0) (and (not (handle->process (-> self money))) (< (-> v1-2 user-int8 1) 5))) + (set! (-> self money) (ppointer->handle (birth-pickup-at-point + (-> self node-list data 42 bone transform vector 3) + (pickup-type money) + (-> (new 'static 'array float 1 1.0) 0) + #t + self + (the-as fact-info #f) + ) + ) + ) + ) + ) + (ja-channel-set! 2) + (let ((s5-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 21)) + num-func-identity + ) + (set! (-> s5-0 frame-num) 0.0) + ) + (let ((s5-1 (-> self skel root-channel 1))) + (set! (-> s5-1 frame-interp) (- (-> (new 'static 'array float 1 1.0) 0) arg0)) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> self draw art-group data 17)) + num-func-identity + ) + (set! (-> s5-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 17)) data 0 length) -1)) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-13 (-> self skel root-channel 0))) + (set! (-> a0-13 param 0) (the float (+ (-> a0-13 frame-group data 0 length) -1))) + (set! (-> a0-13 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-13 (the-as art-joint-anim #f) num-func-seek!) + ) + (let ((v1-39 (-> self skel root-channel 1))) + (set! (-> v1-39 frame-interp) (- (-> (new 'static 'array float 1 1.0) 0) arg0)) + (set! (-> v1-39 num-func) num-func-identity) + (set! (-> v1-39 frame-num) (the float (+ (-> v1-39 frame-group data 0 length) -1))) + ) + ) + (go plant-boss-dead-idle) + (none) + ) + :post + (the-as (function none :behavior plant-boss) rider-post) + ) + +(defmethod init-from-entity! plant-boss ((obj plant-boss) (arg0 entity-actor)) + (stack-size-set! (-> obj main-thread) 512) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 5) 0))) + (set! (-> s3-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s3-0 collide-with) (the-as uint 16)) + (set! (-> s3-0 prim-core action) (the-as uint 1)) + (set! (-> s3-0 prim-core offense) 4) + (set-vector! (-> s3-0 local-sphere) 0.0 24576.0 32768.0 81920.0) + (set-root-prim! s4-0 s3-0) + (let ((s2-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 8)))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set! (-> s2-0 prim-core action) (the-as uint 1)) + (set! (-> s2-0 prim-core offense) 4) + (set-vector! (-> s2-0 local-sphere) 0.0 12288.0 12288.0 12288.0) + (append-prim s3-0 s2-0) + ) + (let ((s2-1 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 16)))) + (set! (-> s2-1 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-1 collide-with) (the-as uint 16)) + (set! (-> s2-1 prim-core action) (the-as uint 1)) + (set! (-> s2-1 prim-core offense) 4) + (set-vector! (-> s2-1 local-sphere) 0.0 20480.0 12288.0 12288.0) + (append-prim s3-0 s2-1) + ) + (let ((s2-2 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 5)))) + (set! (-> s2-2 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-2 collide-with) (the-as uint 16)) + (set! (-> s2-2 prim-core offense) 0) + (set! (-> s2-2 transform-index) 13) + (set-vector! (-> s2-2 local-sphere) 0.0 (-> (new 'static 'array float 1 8192.0) 0) 0.0 16384.0) + (append-prim s3-0 s2-2) + (set! (-> obj attack-prim 0) s2-2) + ) + (let ((s2-3 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s2-3 prim-core collide-as) (the-as uint 0)) + (set! (-> s2-3 collide-with) (the-as uint 0)) + (set! (-> s2-3 prim-core offense) 0) + (set! (-> s2-3 transform-index) 13) + (set-vector! (-> s2-3 local-sphere) 0.0 (-> (new 'static 'array float 1 8192.0) 0) 0.0 16384.0) + (append-prim s3-0 s2-3) + (set! (-> obj death-prim 0) s2-3) + ) + (let ((s2-4 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> s2-4 prim-core collide-as) (the-as uint 0)) + (set! (-> s2-4 collide-with) (the-as uint 0)) + (set! (-> s2-4 prim-core offense) 0) + (set! (-> s2-4 transform-index) 12) + (set-vector! (-> s2-4 local-sphere) 0.0 -24576.0 0.0 40960.0) + (append-prim s3-0 s2-4) + (set! (-> obj death-prim 1) s2-4) + ) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (backup-collide-with-as s4-0) + (set! (-> obj root-override) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton obj *plant-boss-sg* '()) + (set! (-> obj draw shadow-ctrl) *plant-boss-shadow-control*) + (let ((s5-1 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-1 + (let ((t9-18 (method-of-type plant-boss-arm activate))) + (t9-18 (the-as plant-boss-arm s5-1) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-1 + plant-boss-arm-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x -24576.0 :z 8192.0 :w 1.0)) + (-> (new 'static 'array float 1 -8192.0) 0) + 1 + ) + (-> s5-1 ppointer) + ) + ) + (let ((s5-2 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-2 + (let ((t9-21 (method-of-type plant-boss-arm activate))) + (t9-21 (the-as plant-boss-arm s5-2) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-2 + plant-boss-arm-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x 24576.0 :z 8192.0 :w 1.0)) + (-> (new 'static 'array float 1 8192.0) 0) + 0 + ) + (-> s5-2 ppointer) + ) + ) + (let ((s5-3 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-3 + (let ((t9-24 (method-of-type plant-boss-arm activate))) + (t9-24 (the-as plant-boss-arm s5-3) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-3 + plant-boss-back-arms-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :w 1.0)) + (-> (new 'static 'array float 1 0.0) 0) + 2 + ) + (-> s5-3 ppointer) + ) + ) + (let ((s5-4 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-4 + (let ((t9-27 (method-of-type plant-boss-arm activate))) + (t9-27 (the-as plant-boss-arm s5-4) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-4 + plant-boss-vine-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x 38912.0 :z 8192.0 :w 1.0)) + (new 'static 'vector :y 14563.556) + (-> (new 'static 'array float 1 1.0) 0) + 3 + ) + (-> s5-4 ppointer) + ) + ) + (let ((s5-5 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-5 + (let ((t9-30 (method-of-type plant-boss-arm activate))) + (t9-30 (the-as plant-boss-arm s5-5) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-5 + plant-boss-vine-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x -40960.0 :z 8192.0 :w 1.0)) + (new 'static 'vector :y -5461.3335) + (-> (new 'static 'array float 1 1.0) 0) + 3 + ) + (-> s5-5 ppointer) + ) + ) + (let ((s5-6 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-6 + (let ((t9-33 (method-of-type plant-boss-arm activate))) + (t9-33 (the-as plant-boss-arm s5-6) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-6 + plant-boss-vine-init + (vector+! + (new-stack-vector0) + (-> obj root-override trans) + (new 'static 'vector :x -29491.2 :z -7168.0 :w 1.0) + ) + (new 'static 'vector :x -1820.4445 :y -11286.756) + (-> (new 'static 'array float 1 0.8) 0) + 3 + ) + (-> s5-6 ppointer) + ) + ) + (let ((s5-7 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-7 + (let ((t9-36 (method-of-type plant-boss-arm activate))) + (t9-36 (the-as plant-boss-arm s5-7) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-7 + plant-boss-vine-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x 32768.0 :z -3072.0 :w 1.0)) + (new 'static 'vector :x -910.2222 :y 22755.555) + (-> (new 'static 'array float 1 0.8) 0) + 3 + ) + (-> s5-7 ppointer) + ) + ) + (let ((s5-8 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-8 + (let ((t9-39 (method-of-type plant-boss-arm activate))) + (t9-39 (the-as plant-boss-arm s5-8) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-8 + plant-boss-root-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x 18841.6 :z 4096.0 :w 1.0)) + (new 'static 'vector :y -4096.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + 4 + ) + (-> s5-8 ppointer) + ) + ) + (let ((s5-9 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-9 + (let ((t9-42 (method-of-type plant-boss-arm activate))) + (t9-42 (the-as plant-boss-arm s5-9) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-9 + plant-boss-root-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x -18841.6 :z 4096.0 :w 1.0)) + (new 'static 'vector :x 364.0889 :y 4096.0) + (new 'static 'vector :x 1.0 :y 1.25 :z 1.0) + 4 + ) + (-> s5-9 ppointer) + ) + ) + (let ((s5-10 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-10 + (let ((t9-45 (method-of-type plant-boss-arm activate))) + (t9-45 (the-as plant-boss-arm s5-10) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-10 + plant-boss-root-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :z -2048.0 :w 1.0)) + (new 'static 'vector :x 1820.4445) + (new 'static 'vector :x 0.9 :y 1.5 :z 1.0) + 4 + ) + (-> s5-10 ppointer) + ) + ) + (let ((s5-11 (get-process *default-dead-pool* plant-boss-leaf #x4000))) + (set! (-> obj leaf 0) + (the-as + (pointer plant-boss-leaf) + (when s5-11 + (let ((t9-48 (method-of-type plant-boss-leaf activate))) + (t9-48 (the-as plant-boss-leaf s5-11) obj 'plant-boss-leaf (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-11 + plant-boss-leaf-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :w 1.0)) + (-> (new 'static 'array float 1 0.0) 0) + 0 + ) + (-> s5-11 ppointer) + ) + ) + ) + ) + (let ((s5-12 (get-process *default-dead-pool* plant-boss-leaf #x4000))) + (set! (-> obj leaf 1) + (the-as + (pointer plant-boss-leaf) + (when s5-12 + (let ((t9-51 (method-of-type plant-boss-leaf activate))) + (t9-51 (the-as plant-boss-leaf s5-12) obj 'plant-boss-leaf (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-12 + plant-boss-leaf-init + (vector+! + (new-stack-vector0) + (-> obj root-override trans) + (new 'static 'vector :x -13189.12 :y 2838.528 :z 12288.0 :w 1.0) + ) + (-> (new 'static 'array float 1 0.0) 0) + 1 + ) + (-> s5-12 ppointer) + ) + ) + ) + ) + (set! (-> obj energy) 0.25) + (set! (-> obj health) 3.0) + (set! (-> obj cam-tracker) (the-as handle #f)) + (set! (-> obj camera) (the-as handle #f)) + (set! (-> obj money) (the-as handle #f)) + (set! (-> obj try-inc) #f) + (set! (-> obj neck) (new 'process 'joint-mod (joint-mod-handler-mode flex-blend) obj 13)) + (set-vector! + (-> obj neck twist-max) + 3640.889 + (-> (new 'static 'array float 1 8192.0) 0) + 0.0 + (-> (new 'static 'array float 1 1.0) 0) + ) + (set! (-> obj neck up) (the-as uint 0)) + (set! (-> obj neck nose) (the-as uint 1)) + (set! (-> obj neck ear) (the-as uint 2)) + (set! (-> obj body) (new 'process 'joint-mod (joint-mod-handler-mode flex-blend) obj 4)) + (set-vector! + (-> obj body twist-max) + 0.0 + (-> (new 'static 'array float 1 8192.0) 0) + 0.0 + (-> (new 'static 'array float 1 1.0) 0) + ) + (set! (-> obj body up) (the-as uint 1)) + (set! (-> obj body nose) (the-as uint 0)) + (set! (-> obj body ear) (the-as uint 2)) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete))) + (go plant-boss-dead #t) + ) + (go plant-boss-far-idle) + (none) + ) + + + + diff --git a/scripts/check-gsrc-file.py b/scripts/check-gsrc-file.py index 9692fd6097..6fe394313d 100644 --- a/scripts/check-gsrc-file.py +++ b/scripts/check-gsrc-file.py @@ -15,6 +15,7 @@ method_split_pattern = re.compile('t9-\d+\s\(method-of-object') function_split_pattern = re.compile('\(t9-\d+\)') missing_res_tag_pattern = re.compile('(sv-\d{2,} int)') decompiler_error_pattern = re.compile(';; ERROR') +missing_state_arg = re.compile('\s\(-> arg3 param \d\)\s') for file in files: src_path = "" @@ -53,6 +54,12 @@ for file in files: print("decompiler_error - {}:{}".format(file_path, lineno + 1)) throw_error = True continue + # todo - not good enough, ignore if there is only whitespace on the leftof the match + # missing_state_arg_match = missing_state_arg.search(line) + # if missing_state_arg_match: + # print("missing_state_arg - {}:{}".format(file_path, lineno + 1)) + # throw_error = True + # continue if throw_error: print("found potential problems!") diff --git a/scripts/update-goal-src.py b/scripts/update-goal-src.py index 09a63c9b62..376e12a972 100644 --- a/scripts/update-goal-src.py +++ b/scripts/update-goal-src.py @@ -32,7 +32,8 @@ files_with_modifications = [ "logic-target", "default-menu", "collide-shape", - "cam-states" + "cam-states", + "plant-boss" ] for file in files: diff --git a/test/decompiler/reference/engine/game/crates_REF.gc b/test/decompiler/reference/engine/game/crates_REF.gc new file mode 100644 index 0000000000..2c2bdedda7 --- /dev/null +++ b/test/decompiler/reference/engine/game/crates_REF.gc @@ -0,0 +1,1708 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defskelgroup *crate-barrel-sg* crate + 17 + 21 + ((18 (meters 20)) (19 (meters 40)) (20 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +;; failed to figure out what this is: +(defskelgroup *crate-bucket-sg* crate + 22 + 24 + ((23 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :longest-edge (meters 0) + :texture-level 2 + ) + +;; failed to figure out what this is: +(defskelgroup *crate-wood-sg* crate + 0 + 16 + ((1 (meters 20)) (2 (meters 40)) (3 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +;; failed to figure out what this is: +(defskelgroup *crate-iron-sg* crate + 4 + 16 + ((5 (meters 20)) (6 (meters 40)) (7 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +;; failed to figure out what this is: +(defskelgroup *crate-steel-sg* crate + 8 + 16 + ((9 (meters 20)) (10 (meters 40)) (11 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +;; failed to figure out what this is: +(defskelgroup *crate-darkeco-sg* crate + 12 + 16 + ((13 (meters 20)) (14 (meters 40)) (15 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :longest-edge (meters 0) + :texture-level 2 + ) + +;; definition of type crate-bank +(deftype crate-bank (basic) + ((COLLIDE_YOFF float :offset-assert 4) + (COLLIDE_RADIUS float :offset-assert 8) + (DARKECO_EXPLODE_RADIUS float :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type crate-bank +(defmethod inspect crate-bank ((obj crate-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~TCOLLIDE_YOFF: ~f~%" (-> obj COLLIDE_YOFF)) + (format #t "~TCOLLIDE_RADIUS: ~f~%" (-> obj COLLIDE_RADIUS)) + (format #t "~TDARKECO_EXPLODE_RADIUS: ~f~%" (-> obj DARKECO_EXPLODE_RADIUS)) + obj + ) + +;; definition for symbol *CRATE-bank*, type crate-bank +(define + *CRATE-bank* + (new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 4915.2 :DARKECO_EXPLODE_RADIUS 16384.0) + ) + +;; definition of type crate +(deftype crate (process-drawable) + ((root-override collide-shape-moving :offset 112) + (smush smush-control :inline :offset-assert 176) + (base vector :inline :offset-assert 208) + (look symbol :offset-assert 224) + (defense symbol :offset-assert 228) + (incomming-attack-id uint64 :offset-assert 232) + (target handle :offset-assert 240) + (child-count int32 :offset-assert 248) + (victory-anim spool-anim :offset-assert 252) + ) + :heap-base #x90 + :method-count-assert 30 + :size-assert #x100 + :flag-assert #x1e00900100 + (:methods + (wait () _type_ :state 20) + (die (symbol int) _type_ :state 21) + (special-contents-die () _type_ :state 22) + (bounce-on () _type_ :state 23) + (notice-blue (handle) _type_ :state 24) + (params-init (_type_ entity) none 25) + (art-init (_type_) crate 26) + (params-set! (_type_ symbol symbol) none 27) + (dummy-28 (_type_) none 28) + (smush-update! (_type_) none 29) + ) + ) + +;; definition for method 3 of type crate +(defmethod inspect crate ((obj crate)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tsmush: #~%" (-> obj smush)) + (format #t "~T~Tbase: ~`vector`P~%" (-> obj base)) + (format #t "~T~Tlook: ~A~%" (-> obj look)) + (format #t "~T~Tdefense: ~A~%" (-> obj defense)) + (format #t "~T~Tincomming-attack-id: ~D~%" (-> obj incomming-attack-id)) + (format #t "~T~Ttarget: ~D~%" (-> obj target)) + (format #t "~T~Tchild-count: ~D~%" (-> obj child-count)) + (format #t "~T~Tvictory-anim: ~A~%" (-> obj victory-anim)) + obj + ) + +;; failed to figure out what this is: +(method-set! crate 12 (method-of-type process run-logic?)) + +;; definition for function crate-post +(defbehavior crate-post crate () + (rider-trans) + (smush-update! self) + (rider-post) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 281) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 20 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 16.0) + (sp-rnd-flt spt-y (meters 0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 1.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 128.0 32.0 1.0) + (sp-rnd-flt spt-g 128.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 16.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.033333335) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 1.2) 1.0) + (sp-flt spt-accel-y 2.7306666) + (sp-int spt-timer 120) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-int-plain-rnd spt-next-time 30 59 1) + (sp-launcher-by-id spt-next-launcher 282) + (sp-rnd-flt spt-conerot-x (degrees 70.0) (degrees 20.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 282) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-fade-a -1.0666667) (sp-end)) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 283) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2)) + (sp-flt spt-num 4.0) + (sp-flt spt-y (meters 0.75)) + (sp-flt spt-scale-x (meters 6.0)) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.3) (meters 1.0) 1.0) + (sp-flt spt-r 192.0) + (sp-flt spt-g 192.0) + (sp-rnd-flt spt-b 64.0 128.0 1.0) + (sp-flt spt-a 0.0) + (sp-flt spt-scalevel-x (meters 0.009765625)) + (sp-rnd-flt spt-rotvel-z (degrees -0.15) (degrees 0.3) 1.0) + (sp-flt spt-scalevel-y (meters 0.009765625)) + (sp-flt spt-fade-a 2.1333334) + (sp-int spt-timer 30) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 284) + (sp-flt spt-rotate-y (degrees 0.0)) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 284) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-fade-a -2.1333334) (sp-end)) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 285) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 13 + (sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 1.0)) + (sp-flt spt-scale-x (meters 8.0)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 196.0) + (sp-flt spt-g 196.0) + (sp-flt spt-b 196.0) + (sp-flt spt-a 28.0) + (sp-int spt-timer 10) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 286) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 25 + (sp-tex spt-texture (new 'static 'texture-id :index #x6 :page #x2)) + (sp-flt spt-num 5.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z -2048.0 4096.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.6) (meters 0.00048828125) 2457.6) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 160.0) + (sp-flt spt-g 160.0) + (sp-flt spt-b 160.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 2 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 287) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 287) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-scalevel-x (meters -0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -3.4) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 288) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 25 + (sp-tex spt-texture (new 'static 'texture-id :index #x5 :page #x2)) + (sp-flt spt-num 4.5) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z -2048.0 4096.0 1.0) + (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 100.0) + (sp-flt spt-g 100.0) + (sp-flt spt-b 100.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 287) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-group-id-table* 71) (new 'static 'sparticle-launch-group + :length 5 + :duration #x5 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-crate-explode" + :launcher + (new 'static 'inline-array sparticle-group-item 5 + (sp-item 281) + (sp-item 283) + (sp-item 285) + (sp-item 286) + (sp-item 288) + ) + :bounds (new 'static 'sphere :w 49152.0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-group-id-table* 72) (new 'static 'sparticle-launch-group + :length 6 + :duration #x5 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-crate-steel-explode" + :launcher + (new 'static 'inline-array sparticle-group-item 6 + (sp-item 281) + (sp-item 283) + (sp-item 285) + (sp-item 288) + (sp-item 288) + (sp-item 288) + ) + :bounds (new 'static 'sphere :w 49152.0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-group-id-table* 73) + (new 'static 'sparticle-launch-group + :length 38 + :duration #x258 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-dark-eco-box-explosion" + :launcher + (new 'static 'inline-array sparticle-group-item 38 + (sp-item 295 :fade-after (meters 100.0) :period 600 :length 5 :binding 296) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 296 :flags (start-dead launch-asap) :binding 297) + (sp-item 297 :fade-after (meters 80.0) :falloff-to (meters 100.0) :flags (start-dead)) + (sp-item 292 :fade-after (meters 160.0) :period 600 :length 5) + (sp-item 2095 :period 600 :length 5) + (sp-item 2096 :fade-after (meters 80.0) :falloff-to (meters 80.0) :period 600 :length 40) + (sp-item 2097 :period 600 :length 20) + (sp-item 2098 :fade-after (meters 120.0) :falloff-to (meters 120.0) :period 600 :length 20) + ) + :bounds (new 'static 'sphere :w 49152.0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2096) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 6.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 128.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 96.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 96.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.0016666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit14) + (sp-int-plain-rnd spt-next-time 30 29 1) + (sp-launcher-by-id spt-next-launcher 2099) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-radius (meters 2.0) (meters 4.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2099) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 5 + (sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g 0.0) + (sp-flt spt-fade-b 0.0) + (sp-flt spt-fade-a -1.4222223) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2098) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 14 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 3.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 180.0) 1.0) + (sp-flt spt-scale-y (meters 8.0)) + (sp-rnd-flt spt-r 64.0 192.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-flt spt-scalevel-y (meters 0.42666668)) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 60) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2095) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 12 + (sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 16.0)) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 192.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 64.0 1.0) + (sp-flt spt-a 96.0) + (sp-flt spt-fade-a -1.7454545) + (sp-int spt-timer 54) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2097) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 4.0) + (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.013333334) 1.0) + (sp-flt spt-scalevel-x (meters 0.013333334)) + (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.42666668) + (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0) + (sp-flt spt-friction 0.8) + (sp-int spt-timer 510) + (sp-cpuinfo-flags bit2 bit14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 110.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 295) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 14 + (sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2)) + (sp-flt spt-num 16.0) + (sp-flt spt-y (meters 1.0)) + (sp-flt spt-scale-x (meters 0.1)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.026666667) 1.0) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 240) + (sp-cpuinfo-flags bit3 bit14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 296) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-y (meters 0.0) (meters 16.0) 1.0) + (sp-rnd-flt spt-z 1228.8 1228.8 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.3) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-omega 0.0 65536.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.000909091)) + (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.26666668) + (sp-flt spt-fade-a -0.19393939) + (sp-int-plain-rnd spt-timer 90 149 1) + (sp-cpuinfo-flags bit2 bit3 bit7 bit14) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 297) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters -0.0006190476)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.01904762) + (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0) + (sp-int-plain-rnd spt-timer 30 299 1) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-int spt-next-time 240) + (sp-launcher-by-id spt-next-launcher 198) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 292) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 25 + (sp-tex spt-texture (new 'static 'texture-id :index #x5 :page #x2)) + (sp-rnd-flt spt-num 8.0 16.0 1.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z -2048.0 4096.0 1.0) + (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 128.0) + (sp-rnd-int spt-g 1115684864 1 32.0) + (sp-flt spt-b 32.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 301) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 301) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-scalevel-x (meters -0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -3.4) + (sp-end) + ) + ) + ) + +;; definition for function crate-standard-event-handler +(defbehavior crate-standard-event-handler crate ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('attack) + (let ((s4-0 (-> arg3 param 2)) + (s5-0 (-> arg3 param 3)) + ) + (case (-> self defense) + (('iron) + (case (-> arg3 param 1) + (('flop 'uppercut 'explode 'darkeco 'eco-yellow 'bonk 'racer 'tube 'flut-bonk 'flut-attack) + (if (and + (logtest? (-> self fact options) (fact-options fop11)) + *target* + (zero? (logand (-> *target* control root-prim prim-core action) 512)) + ) + (return #f) + ) + (increment-success-for-hint (game-text-id sidekick-speech-hint-crate-iron)) + (increment-success-for-hint (game-text-id sage-voicebox-hint-crate-iron)) + (send-event arg0 'get-attack-count 1) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root-override trans y) (-> self base y))) + (if (not + (and (!= *kernel-boot-message* 'play) (= (-> *setting-control* current language) (language-enum japanese))) + ) + (level-hint-spawn + (game-text-id sage-voicebox-hint-crate-iron) + "sagevb36" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (case (-> (level-get-target-inside *level*) name) + (('training) + (if (and (can-hint-be-played? (game-text-id zero) (the-as entity #f) (the-as string #f)) (rand-vu-percent? 0.2)) + (clear-text-seen! *game-info* (game-text-id sidekick-speech-hint-crate-iron)) + ) + ) + ) + (level-hint-spawn + (game-text-id sidekick-speech-hint-crate-iron) + "sksp0005" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (set! (-> self incomming-attack-id) s4-0) + (if (not (!= (-> self smush amp) 0.0)) + (sound-play-by-name (static-sound-name "icrate-nobreak") (new-sound-id) 1024 0 0 1 #t) + ) + (activate! (-> self smush) 0.1 90 150 1.0 1.0) + (go-virtual bounce-on) + ) + #f + ) + ) + ) + (('steel) + (case (-> arg3 param 1) + (('explode 'darkeco 'eco-yellow 'bonk 'tube 'flut-bonk 'flut-attack 'racer) + (send-event arg0 'get-attack-count 1) + (when (logtest? (-> self draw status) 8) + (increment-success-for-hint (game-text-id sidekick-speech-hint-crate-steel)) + (level-hint-spawn + (game-text-id sidekick-speech-crate-steel-break1) + "sksp0004" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id sidekick-speech-crate-steel-break2) + "sksp009b" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (when (and (!= s4-0 (-> self incomming-attack-id)) (= (-> self root-override trans y) (-> self base y))) + (level-hint-spawn + (game-text-id sidekick-speech-hint-crate-steel) + "sksp0006" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (set! (-> self incomming-attack-id) s4-0) + (if (not (!= (-> self smush amp) 0.0)) + (sound-play-by-name (static-sound-name "scrate-nobreak") (new-sound-id) 1024 0 0 1 #t) + ) + (activate! (-> self smush) 0.1 90 150 1.0 1.0) + (go-virtual bounce-on) + ) + #f + ) + ) + ) + (('darkeco) + (let ((a1-32 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-32 from) self) + (set! (-> a1-32 num-params) 2) + (set! (-> a1-32 message) 'attack) + (set! (-> a1-32 param 0) (-> arg3 param 0)) + (let ((a0-57 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-57 mode) 'darkeco) + (set! (-> a1-32 param 1) (the-as uint a0-57)) + ) + (send-event-function arg0 a1-32) + ) + (when (= (-> arg0 type) target) + (level-hint-spawn + (game-text-id sidekick-speech-hint-crate-darkeco2) + "sksp009c" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id sidekick-speech-hint-crate-darkeco1) + "sksp0002" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (case (-> (level-get-target-inside *level*) name) + (('rolling) + (level-hint-spawn + (game-text-id sidekick-speech-hint-rolling-crate-darkeco) + "sksp0110" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (('firecanyon) + (level-hint-spawn + (game-text-id daxter-you-are-trying-to-avoid-dark-eco) + "sksp0082" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id daxter-maybe-i-should-drive) + "sksp0081" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + ) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (send-event arg0 'get-attack-count 1) + (go-virtual die #f (the-as int s5-0)) + ) + ) + ) + ) + (('touch) + (case (-> self defense) + (('darkeco) + (let ((a1-41 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-41 from) self) + (set! (-> a1-41 num-params) 2) + (set! (-> a1-41 message) 'attack) + (set! (-> a1-41 param 0) (-> arg3 param 0)) + (let ((a0-75 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-75 mode) 'darkeco) + (set! (-> a1-41 param 1) (the-as uint a0-75)) + ) + (send-event-function arg0 a1-41) + ) + (go-virtual die #f 0) + ) + ) + ) + (('bonk) + (when (= (-> self root-override trans y) (-> self base y)) + (activate! (-> self smush) -0.1 75 150 1.0 1.0) + (go-virtual bounce-on) + ) + ) + (('wake) + (let ((v0-0 (the-as object (logclear (-> self mask) (process-mask sleep))))) + (set! (-> self mask) (the-as process-mask v0-0)) + v0-0 + ) + ) + (('eco-blue) + (if (not (or + (= (-> self defense) 'darkeco) + (or (= (-> self next-state name) 'notice-blue) (= (-> self next-state name) 'die)) + (!= (-> self root-override trans y) (-> self base y)) + ) + ) + (go-virtual notice-blue (process->handle arg0)) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate wait (crate) + :virtual #t + :event + crate-standard-event-handler + :code + (behavior () + (suspend) + (dummy-47 (-> self root-override)) + (logior! (-> self mask) (process-mask sleep)) + (while #t + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior crate) ja-post) + ) + +;; failed to figure out what this is: +(defstate bounce-on (crate) + :virtual #t + :event + crate-standard-event-handler + :code + (behavior () + (while (!= (-> self smush amp) 0.0) + (suspend) + ) + (go-virtual wait) + (none) + ) + :post + (the-as (function none :behavior crate) crate-post) + ) + +;; failed to figure out what this is: +(defstate notice-blue (crate) + :virtual #t + :event + crate-standard-event-handler + :trans + (behavior () + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 2) + (set! (-> a1-0 message) 'query) + (set! (-> a1-0 param 0) (the-as uint 'powerup)) + (set! (-> a1-0 param 1) (the-as uint 3)) + (cond + ((not (send-event-function *target* a1-0)) + (logior! (-> self mask) (process-mask sleep-code)) + (if (not (!= (-> self smush amp) 0.0)) + (go-virtual wait) + ) + ) + (else + (logclear! (-> self mask) (process-mask sleep-code)) + ) + ) + ) + (none) + ) + :code + (behavior ((arg0 handle)) + (set! (-> self target) arg0) + (while #t + (let* ((gp-0 (handle->process (-> self target))) + (v1-4 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) + gp-0 + ) + ) + ) + (when v1-4 + (let* ((gp-1 (-> (the-as process-drawable v1-4) root)) + (v1-6 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) collide-shape)) + gp-1 + ) + ) + ) + (when v1-6 + (let* ((gp-2 (-> self root-override root-prim prim-core)) + (a1-3 (-> (the-as collide-shape v1-6) root-prim prim-core)) + (f30-0 (vector-vector-distance (the-as vector gp-2) (the-as vector a1-3))) + ) + (when (and (< f30-0 (-> *FACT-bank* suck-suck-dist)) (!= (-> self defense) 'steel)) + (logior! (-> self fact options) (fact-options can-collect)) + (go-virtual die #f 0) + ) + (when (rand-vu-percent? 0.5) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> gp-2 world-sphere quad)) + (dotimes (gp-3 3) + (+! (-> s5-0 data gp-3) (rand-vu-float-range -5324.8 5324.8)) + ) + (eco-blue-glow s5-0) + ) + ) + (activate! + (-> self smush) + (lerp-scale + (rand-vu-float-range 0.1 0.3) + (rand-vu-float-range 0.0 0.02) + f30-0 + (-> *FACT-bank* suck-suck-dist) + (-> *FACT-bank* suck-bounce-dist) + ) + 60 + 60 + 1.0 + 1.0 + ) + ) + ) + ) + ) + ) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior crate) crate-post) + ) + +;; failed to figure out what this is: +(defstate die (crate) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (case (-> self defense) + (('darkeco) + (cond + ((= (-> arg0 type) target) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) self) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (-> arg3 param 0)) + (let ((a2-1 (new 'static 'attack-info :mask #x20))) + (set! (-> a2-1 mode) 'darkeco) + (set! (-> a1-4 param 1) (the-as uint a2-1)) + ) + (send-event-function arg0 a1-4) + ) + ) + (else + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) self) + (set! (-> a1-5 num-params) 4) + (set! (-> a1-5 message) 'attack) + (set! (-> a1-5 param 0) (-> arg3 param 0)) + (set! (-> a1-5 param 1) (the-as uint 'darkeco)) + (let ((v1-12 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-12) + (set! (-> a1-5 param 2) (the-as uint v1-12)) + ) + (set! (-> a1-5 param 3) (the-as uint 0)) + (send-event-function arg0 a1-5) + ) + ) + ) + ) + ) + ) + ) + ) + :trans + (behavior () + (case (-> self type) + ((crate-buzzer) + (if (and *target* (>= (-> *target* fact-info-target buzzer) 6.0)) + (spool-push *art-control* (-> self victory-anim name) 0 self -99.0) + ) + ) + ) + (none) + ) + :code + (behavior ((arg0 symbol) (arg1 int)) + (clear-collide-with-as (-> self root-override)) + (if (nonzero? (-> self sound)) + (stop! (-> self sound)) + ) + (if (and *target* (and + (logtest? (-> *target* control root-prim prim-core action) #x7200) + (!= (-> self fact pickup-type) 6) + (not arg0) + ) + ) + (logior! (-> self fact options) (fact-options fop6)) + ) + (when (not arg0) + (let ((s5-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) s5-1) 12) + (suspend) + ) + ) + (logior! (-> self draw status) 2) + (case (-> self look) + (('iron) + (sound-play-by-name (static-sound-name "icrate-break") (new-sound-id) 1024 0 0 1 #t) + ) + (('steel) + (sound-play-by-name (static-sound-name "scrate-break") (new-sound-id) 1024 0 0 1 #t) + ) + (('darkeco) + (sound-play-by-name (static-sound-name "dcrate-break") (new-sound-id) 1024 0 0 1 #t) + ) + (else + (sound-play-by-name (static-sound-name "wcrate-break") (new-sound-id) 1024 0 0 1 #t) + ) + ) + (case (-> self defense) + (('darkeco) + (let ((f0-0 + (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root-override trans) (target-pos 0)) 8192.0 40960.0) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 f0-0)) 90) + ) + (let ((s5-7 (get-process *default-dead-pool* touch-tracker #x4000))) + (when s5-7 + (let ((t9-15 (method-of-type touch-tracker activate))) + (t9-15 (the-as touch-tracker s5-7) self 'touch-tracker (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-7 + touch-tracker-init + (-> self root-override trans) + (-> *CRATE-bank* DARKECO_EXPLODE_RADIUS) + 30 + ) + (-> s5-7 ppointer) + ) + ) + ) + ) + (case (-> self look) + (('darkeco) + (let ((s5-8 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-8 + (let ((t9-18 (method-of-type part-tracker activate))) + (t9-18 (the-as part-tracker s5-8) *entity-pool* 'part-tracker (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-8 + part-tracker-init + (-> *part-group-id-table* 73) + -1 + #f + #f + #f + (-> self root-override trans) + ) + (-> s5-8 ppointer) + ) + ) + ) + (('steel 'iron) + (let ((s5-9 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-9 + (let ((t9-21 (method-of-type part-tracker activate))) + (t9-21 (the-as part-tracker s5-9) *entity-pool* 'part-tracker (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-9 + part-tracker-init + (-> *part-group-id-table* 72) + -1 + #f + #f + #f + (-> self root-override trans) + ) + (-> s5-9 ppointer) + ) + ) + ) + (else + (let ((s5-10 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-10 + (let ((t9-24 (method-of-type part-tracker activate))) + (t9-24 (the-as part-tracker s5-10) *entity-pool* 'part-tracker (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-10 + part-tracker-init + (-> *part-group-id-table* 71) + -1 + #f + #f + #f + (-> self root-override trans) + ) + (-> s5-10 ppointer) + ) + ) + ) + ) + ) + (case (-> self fact pickup-type) + (((pickup-type money) + (pickup-type buzzer) + (pickup-type eco-blue) + (pickup-type eco-yellow) + (pickup-type eco-red) + (pickup-type fuel-cell) + ) + (go-virtual special-contents-die) + ) + ) + (drop-pickup (-> self fact) #t *entity-pool* (the-as fact-info #f) arg1) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status complete) #t) + (let ((gp-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-1) 1500) + (suspend) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate special-contents-die (crate) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (when (= v1-0 'notify) + (case (-> arg3 param 0) + (('pickup) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) + (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) + (+! (-> self child-count) -1) + (when (<= (-> self child-count) 0) + (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) + (process-entity-status! self (entity-perm-status bit-4) #f) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> gp-0 user-int8 0) 2) + (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) + (set! (-> self mask) v0-0) + v0-0 + ) + ) + ) + ) + ) + ) + ) + ) + ) + :trans + (-> (method-of-type crate die) trans) + :code + (behavior () + (when (or + (= (-> self fact pickup-type) (pickup-type money)) + (= (-> self defense) 'iron) + (= (-> self defense) 'steel) + ) + (let ((a0-4 (-> self entity))) + (if (when a0-4 + (let ((a0-5 (-> a0-4 extra perm task))) + (if a0-5 + (= a0-5 (game-task none)) + ) + ) + ) + (set! (-> self entity extra perm task) (game-task complete)) + ) + ) + ) + (clear-collide-with-as (-> self root-override)) + (logior! (-> self draw status) 2) + (drop-pickup (-> self fact) #t self (the-as fact-info #f) 0) + (set! (-> self child-count) (+ (process-count self) -1)) + (process-entity-status! self (entity-perm-status bit-4) #t) + (let ((v1-21 (-> self entity extra perm))) + (logior! (-> v1-21 status) (entity-perm-status user-set-from-cstage)) + (set! (-> v1-21 user-int8 0) 1) + ) + (when (-> self child) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + (while (-> self child) + (suspend) + ) + ) + (none) + ) + ) + +;; definition for function crate-init-by-other +;; Used lq/sq +(defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol)) + (params-init self arg0) + (set! (-> self root-override trans quad) (-> arg1 quad)) + (set! (-> self look) arg2) + (set! (-> self defense) arg2) + (art-init self) + (dummy-28 self) + (none) + ) + +;; definition for method 11 of type crate +(defmethod init-from-entity! crate ((obj crate) (arg0 entity-actor)) + (params-init obj arg0) + (art-init obj) + (dummy-28 obj) + (none) + ) + +;; definition for method 25 of type crate +;; INFO: Return type mismatch crate vs none. +(defmethod params-init crate ((obj crate) (arg0 entity)) + (stack-size-set! (-> obj main-thread) 128) + (logior! (-> obj mask) (process-mask crate)) + (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) default-collision-reaction) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing) + ) + (dummy-29 s4-0 1) + (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s3-0 prim-core collide-as) (the-as uint #x8080)) + (set! (-> s3-0 collide-with) (the-as uint 16)) + (set! (-> s3-0 prim-core action) (the-as uint 3)) + (set! (-> s3-0 prim-core offense) 1) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 3072.0 0.0 6963.2) + (set-root-prim! s4-0 s3-0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (backup-collide-with-as s4-0) + (set! (-> obj root-override) s4-0) + ) + (set! (-> obj fact) + (new 'process 'fact-info obj (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc)) + ) + (let ((v1-27 (-> obj entity extra perm))) + (set! (-> obj fact pickup-amount) + (fmax 0.0 (- (-> obj fact pickup-amount) (the float (-> v1-27 user-int8 1)))) + ) + ) + (when (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete))) + (set! (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (when arg0 + (process-drawable-from-entity! obj (the-as entity-actor arg0)) + (logclear! (-> obj mask) (process-mask actor-pause)) + ) + (let ((a0-18 ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'crate-type + 'interp + -1000000000.0 + 'wood + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> obj look) (the-as symbol a0-18)) + (set! (-> obj defense) (the-as symbol a0-18)) + ) + (case (-> obj fact pickup-type) + (((pickup-type buzzer)) + (set! (-> obj type) crate-buzzer) + (when (= (-> obj look) 'wood) + (set! (-> obj look) 'iron) + (set! (-> obj defense) 'iron) + ) + ) + (else + (when (= (-> obj look) 'iron) + (set! (-> obj look) 'wood) + (set! (-> obj defense) 'wood) + ) + ) + ) + (none) + ) + +;; definition for method 26 of type crate +;; Used lq/sq +(defmethod art-init crate ((obj crate)) + (case (-> obj look) + (('iron) + (set! (-> obj root-override root-prim prim-core offense) 2) + (initialize-skeleton obj *crate-iron-sg* '()) + ) + (('steel) + (set! (-> obj root-override root-prim prim-core offense) 4) + (initialize-skeleton obj *crate-steel-sg* '()) + ) + (('darkeco) + (when (= (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-type) (pickup-type none)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (initialize-skeleton obj *crate-darkeco-sg* '()) + (set-vector! (-> obj draw color-mult) 0.8 0.8 0.8 1.0) + (set-vector! (-> obj draw color-emissive) 0.2 0.2 0.2 1.0) + ) + (('barrel) + (initialize-skeleton obj *crate-barrel-sg* '()) + ) + (('bucket) + (when (= (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-type) (pickup-type none)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (initialize-skeleton obj *crate-bucket-sg* '()) + ) + (('none) + (initialize-skeleton obj *crate-wood-sg* '()) + (logior! (-> obj draw status) 2) + ) + (else + (initialize-skeleton obj *crate-wood-sg* '()) + ) + ) + (cond + ((logtest? (fact-options fop16) (-> obj fact options)) + (set! (-> obj root-override root-prim prim-core offense) 4) + ) + ((logtest? (-> obj fact options) (fact-options fop15)) + (set! (-> obj root-override root-prim prim-core offense) 3) + ) + ((logtest? (-> obj fact options) (fact-options fop14)) + (set! (-> obj root-override root-prim prim-core offense) 2) + ) + ((logtest? (-> obj fact options) (fact-options fop13)) + (set! (-> obj root-override root-prim prim-core offense) 1) + ) + ) + (set! (-> obj base quad) (-> obj root-override trans quad)) + (crate-post) + (nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f)) + obj + ) + +;; definition for method 27 of type crate +;; INFO: Return type mismatch crate vs none. +(defmethod params-set! crate ((obj crate) (arg0 symbol) (arg1 symbol)) + (if arg0 + (set! (-> obj look) arg0) + ) + (if arg1 + (set! (-> obj defense) arg1) + ) + (none) + ) + +;; definition for method 28 of type crate +;; INFO: Return type mismatch int vs none. +(defmethod dummy-28 crate ((obj crate)) + (if (>= (-> obj entity extra perm user-int8 0) 1) + (go (method-of-object obj die) #t 0) + ) + 0 + (go (method-of-object obj wait)) + 0 + (none) + ) + +;; definition for method 29 of type crate +;; INFO: Return type mismatch int vs none. +(defmethod smush-update! crate ((obj crate)) + (let ((f0-0 (update! (-> obj smush)))) + (set! (-> obj root-override scale x) (+ 1.0 (* -0.5 f0-0))) + (set! (-> obj root-override scale y) (+ 1.0 f0-0)) + (set! (-> obj root-override scale z) (+ 1.0 (* -0.5 f0-0))) + ) + 0 + (none) + ) + +;; definition of type barrel +(deftype barrel (crate) + () + :heap-base #x90 + :method-count-assert 30 + :size-assert #x100 + :flag-assert #x1e00900100 + ) + +;; definition for method 3 of type barrel +(defmethod inspect barrel ((obj barrel)) + (let ((t9-0 (method-of-type crate inspect))) + (t9-0 obj) + ) + obj + ) + +;; definition for method 25 of type barrel +;; INFO: Return type mismatch barrel vs none. +(defmethod params-init barrel ((obj barrel) (arg0 entity)) + (let ((t9-0 (method-of-type crate params-init))) + (t9-0 obj arg0) + ) + (set! (-> obj look) 'barrel) + (none) + ) + +;; definition of type bucket +(deftype bucket (crate) + () + :heap-base #x90 + :method-count-assert 30 + :size-assert #x100 + :flag-assert #x1e00900100 + ) + +;; definition for method 3 of type bucket +(defmethod inspect bucket ((obj bucket)) + (let ((t9-0 (method-of-type crate inspect))) + (t9-0 obj) + ) + obj + ) + +;; definition for method 25 of type bucket +;; INFO: Return type mismatch bucket vs none. +(defmethod params-init bucket ((obj bucket) (arg0 entity)) + (let ((t9-0 (method-of-type crate params-init))) + (t9-0 obj arg0) + ) + (set! (-> obj look) 'bucket) + (none) + ) + +;; failed to figure out what this is: +(set! (-> *part-group-id-table* 74) (new 'static 'sparticle-launch-group + :length 1 + :duration #x5 + :linger-duration #x1c2 + :name "group-buzzer-crate" + :launcher + (new 'static 'inline-array sparticle-group-item 1 (sp-item 302)) + :bounds (new 'static 'sphere :w 8192.0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 302) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 1.0) (meters 1.0) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 96.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.02) (meters 0.01) 1.0) + (sp-flt spt-scalevel-x (meters 0.0033333334)) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.16) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit12 bit14) + (sp-rnd-flt spt-conerot-x (degrees 60.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; definition of type crate-buzzer +(deftype crate-buzzer (crate) + () + :heap-base #x90 + :method-count-assert 30 + :size-assert #x100 + :flag-assert #x1e00900100 + ) + +;; definition for method 3 of type crate-buzzer +(defmethod inspect crate-buzzer ((obj crate-buzzer)) + (let ((t9-0 (method-of-type crate inspect))) + (t9-0 obj) + ) + obj + ) + +;; definition for method 26 of type crate-buzzer +;; INFO: Return type mismatch crate-buzzer vs crate. +(defmethod art-init crate-buzzer ((obj crate-buzzer)) + (let ((t9-0 (method-of-type crate art-init))) + (t9-0 obj) + ) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 74) obj)) + (set! (-> obj sound) (new + 'process + 'ambient-sound + (new 'static 'sound-spec + :mask #x82 + :num 1.0 + :group #x1 + :sound-name (static-sound-name "buzzer") + :volume #x400 + :pitch-mod -762 + :fo-max 40 + ) + (-> obj root-override trans) + ) + ) + (set! (-> obj victory-anim) (fuel-cell-pick-anim obj)) + (the-as crate obj) + ) + +;; failed to figure out what this is: +(defstate wait (crate-buzzer) + :virtual #t + :trans + (behavior () + (when (and + (and + *target* + (>= 327680.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) + ) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 450) + (rand-vu-percent? 0.03) + ) + (spawn (-> self part) (-> self root-override trans)) + (activate! (-> self smush) 0.2 90 150 1.0 1.0) + (logclear! (-> self mask) (process-mask sleep-code)) + ) + (if (nonzero? (-> self sound)) + (update! (-> self sound)) + ) + (if (and *target* (>= (-> *target* fact-info-target buzzer) 6.0)) + (spool-push *art-control* (-> self victory-anim name) 0 self -99.0) + ) + (none) + ) + :code + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (suspend) + (dummy-47 (-> self root-override)) + (while #t + (set! (-> self state-time) (-> *display* base-frame-counter)) + (ja-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + (let ((f30-0 57001.605)) + (sound-play-by-name (static-sound-name "crate-jump") (new-sound-id) 1024 0 0 1 #t) + (while (or (!= (-> self smush amp) 0.0) (!= f30-0 0.0)) + (+! f30-0 (* -245760.0 (-> *display* seconds-per-frame))) + (+! (-> self root-override trans y) (* f30-0 (-> *display* seconds-per-frame))) + (when (< (-> self root-override trans y) (-> self base y)) + (set! (-> self root-override trans y) (-> self base y)) + (set! f30-0 (* -0.5 f30-0)) + (if (< (fabs f30-0) 16384.0) + (set! f30-0 0.0) + ) + ) + (crate-post) + (ja-post) + (suspend) + ) + ) + (set! (-> self root-override trans y) (-> self base y)) + ) + (none) + ) + :post + (the-as (function none :behavior crate-buzzer) #f) + ) + +;; failed to figure out what this is: +(defstate bounce-on (crate-buzzer) + :virtual #t + :code + (behavior () + (while (!= (-> self smush amp) 0.0) + (spawn (-> self part) (-> self root-override trans)) + (suspend) + ) + (go-virtual wait) + (none) + ) + ) + +;; definition of type pickup-spawner +(deftype pickup-spawner (crate) + ((blocker entity-actor :offset-assert 256) + ) + :heap-base #xa0 + :method-count-assert 30 + :size-assert #x104 + :flag-assert #x1e00a00104 + ) + +;; definition for method 3 of type pickup-spawner +(defmethod inspect pickup-spawner ((obj pickup-spawner)) + (let ((t9-0 (method-of-type crate inspect))) + (t9-0 obj) + ) + (format #t "~T~Tblocker: ~A~%" (-> obj blocker)) + obj + ) + +;; definition for method 25 of type pickup-spawner +;; INFO: Return type mismatch pickup-spawner vs none. +(defmethod params-init pickup-spawner ((obj pickup-spawner) (arg0 entity)) + (let ((t9-0 (method-of-type crate params-init))) + (t9-0 obj arg0) + ) + (set! (-> obj look) 'none) + (set! (-> obj blocker) #f) + (if (logtest? (-> obj fact options) (fact-options vent-blocked)) + (set! (-> obj blocker) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) + ) + (none) + ) + +;; definition for method 28 of type pickup-spawner +;; INFO: Return type mismatch int vs none. +(defmethod dummy-28 pickup-spawner ((obj pickup-spawner)) + (go (method-of-object obj wait)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate wait (pickup-spawner) + :virtual #t + :code + (behavior () + (while #t + (if (or (not (-> self blocker)) (logtest? (-> self blocker extra perm status) (entity-perm-status complete))) + (go-virtual die #t 0) + ) + (suspend) + ) + (none) + ) + ) + + + + diff --git a/test/decompiler/reference/levels/jungleb/plant-boss_REF.gc b/test/decompiler/reference/levels/jungleb/plant-boss_REF.gc new file mode 100644 index 0000000000..a8e5bcdf80 --- /dev/null +++ b/test/decompiler/reference/levels/jungleb/plant-boss_REF.gc @@ -0,0 +1,2897 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type plant-boss +(deftype plant-boss (process-drawable) + ((root-override collide-shape :offset 112) + (neck joint-mod :offset-assert 176) + (body joint-mod :offset-assert 180) + (leaf (pointer plant-boss-leaf) 2 :offset-assert 184) + (energy float :offset-assert 192) + (health float :offset-assert 196) + (ate symbol :offset-assert 200) + (cycle-count int32 :offset-assert 204) + (snap-count int32 :offset-assert 208) + (attack-prim collide-shape-prim-sphere 3 :offset-assert 212) + (death-prim collide-shape-prim-mesh 3 :offset-assert 224) + (cam-tracker handle :offset-assert 240) + (want-aphid-count int32 :offset-assert 248) + (aphid-count int32 :offset-assert 252) + (aphid-spawn-time int64 :offset-assert 256) + (interp float :offset-assert 264) + (try int32 :offset-assert 268) + (camera handle :offset-assert 272) + (money handle :offset-assert 280) + (try-inc symbol :offset-assert 288) + ) + :heap-base #xc0 + :method-count-assert 20 + :size-assert #x124 + :flag-assert #x1400c00124 + (:states + (plant-boss-attack int) + (plant-boss-dead symbol) + (plant-boss-dead-bounce float) + plant-boss-dead-idle + plant-boss-eat + plant-boss-far-idle + (plant-boss-hit symbol) + plant-boss-idle + plant-boss-intro + (plant-boss-reset int) + (plant-boss-root-die symbol) + plant-boss-root-idle + plant-boss-spawn + (plant-boss-vine-die symbol) + (plant-boss-vine-hit basic) + plant-boss-vine-idle + plant-boss-vulnerable + ) + ) + +;; definition for method 3 of type plant-boss +(defmethod inspect plant-boss ((obj plant-boss)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tneck: ~A~%" (-> obj neck)) + (format #t "~T~Tbody: ~A~%" (-> obj body)) + (format #t "~T~Tleaf[2] @ #x~X~%" (-> obj leaf)) + (format #t "~T~Tenergy: ~f~%" (-> obj energy)) + (format #t "~T~Thealth: ~f~%" (-> obj health)) + (format #t "~T~Tate: ~A~%" (-> obj ate)) + (format #t "~T~Tcycle-count: ~D~%" (-> obj cycle-count)) + (format #t "~T~Tsnap-count: ~D~%" (-> obj snap-count)) + (format #t "~T~Tattack-prim[3] @ #x~X~%" (-> obj attack-prim)) + (format #t "~T~Tdeath-prim[3] @ #x~X~%" (-> obj death-prim)) + (format #t "~T~Tcam-tracker: ~D~%" (-> obj cam-tracker)) + (format #t "~T~Twant-aphid-count: ~D~%" (-> obj want-aphid-count)) + (format #t "~T~Taphid-count: ~D~%" (-> obj aphid-count)) + (format #t "~T~Taphid-spawn-time: ~D~%" (-> obj aphid-spawn-time)) + (format #t "~T~Tinterp: ~f~%" (-> obj interp)) + (format #t "~T~Ttry: ~D~%" (-> obj try)) + (format #t "~T~Tcamera: ~D~%" (-> obj camera)) + (format #t "~T~Tmoney: ~D~%" (-> obj money)) + (format #t "~T~Ttry-inc: ~A~%" (-> obj try-inc)) + obj + ) + +;; definition for method 7 of type plant-boss +;; INFO: Return type mismatch process-drawable vs plant-boss. +(defmethod relocate plant-boss ((obj plant-boss) (arg0 int)) + (if (nonzero? (-> obj neck)) + (&+! (-> obj neck) arg0) + ) + (if (nonzero? (-> obj body)) + (&+! (-> obj body) arg0) + ) + (dotimes (v1-8 3) + (if (nonzero? (-> obj attack-prim v1-8)) + (&+! (-> obj attack-prim v1-8) arg0) + ) + (if (nonzero? (-> obj death-prim v1-8)) + (&+! (-> obj death-prim v1-8) arg0) + ) + ) + (the-as + plant-boss + ((the-as (function process-drawable int process-drawable) (find-parent-method plant-boss 7)) obj arg0) + ) + ) + +;; definition of type plant-boss-arm +(deftype plant-boss-arm (process-drawable) + ((parent-override (pointer plant-boss) :offset 12) + (root-override collide-shape :offset 112) + (side int32 :offset-assert 176) + ) + :heap-base #x50 + :method-count-assert 20 + :size-assert #xb4 + :flag-assert #x14005000b4 + (:states + (plant-boss-arm-die symbol) + (plant-boss-arm-hit basic) + plant-boss-arm-idle + (plant-boss-back-arms-die symbol) + (plant-boss-back-arms-hit symbol) + plant-boss-back-arms-idle + ) + ) + +;; definition for method 3 of type plant-boss-arm +(defmethod inspect plant-boss-arm ((obj plant-boss-arm)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tside: ~D~%" (-> obj side)) + obj + ) + +;; definition of type plant-boss-leaf +(deftype plant-boss-leaf (process-drawable) + ((root-override collide-shape-moving :offset 112) + (side int32 :offset-assert 176) + (state-object symbol :offset-assert 180) + (state-time-frame int64 :offset-assert 184) + ) + :heap-base #x50 + :method-count-assert 20 + :size-assert #xc0 + :flag-assert #x14005000c0 + (:states + plant-boss-leaf-bounce + plant-boss-leaf-close + (plant-boss-leaf-die basic) + (plant-boss-leaf-idle symbol) + (plant-boss-leaf-open symbol) + (plant-boss-leaf-open-idle symbol) + ) + ) + +;; definition for method 3 of type plant-boss-leaf +(defmethod inspect plant-boss-leaf ((obj plant-boss-leaf)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tside: ~D~%" (-> obj side)) + (format #t "~T~Tstate-object: ~A~%" (-> obj state-object)) + (format #t "~T~Tstate-time-frame: ~D~%" (-> obj state-time-frame)) + obj + ) + +;; failed to figure out what this is: +(defskelgroup *plant-boss-sg* plant-boss + 0 + 3 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 10 20) + :longest-edge (meters 0) + :shadow 2 + ) + +;; failed to figure out what this is: +(defskelgroup *plant-boss-arm-sg* plant-boss + 22 + 25 + ((23 (meters 999999))) + :bounds (static-spherem 0 0 0 20) + :longest-edge (meters 0) + :shadow 24 + ) + +;; failed to figure out what this is: +(defskelgroup *plant-boss-leaf-sg* plant-boss + 37 + 42 + ((38 (meters 999999))) + :bounds (static-spherem 0 0 0 6) + :longest-edge (meters 0) + :shadow 39 + ) + +;; failed to figure out what this is: +(defskelgroup *plant-boss-back-arms-sg* plant-boss + 30 + 33 + ((31 (meters 999999))) + :bounds (static-spherem 0 0 0 8) + :longest-edge (meters 0) + :shadow 32 + ) + +;; failed to figure out what this is: +(defskelgroup *plant-boss-vine-sg* plant-boss + 48 + 50 + ((49 (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :longest-edge (meters 0) + ) + +;; failed to figure out what this is: +(defskelgroup *plant-boss-root-sg* plant-boss + 53 + 55 + ((54 (meters 999999))) + :bounds (static-spherem 0 20 0 20) + :longest-edge (meters 0) + ) + +;; definition for symbol *plant-boss-shadow-control*, type shadow-control +(define + *plant-boss-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center + (new 'static 'vector :w (the-as float #x2)) + :shadow-dir + (new 'static 'vector :y -1.0 :w 409600.0) + :bot-plane (new 'static 'plane :y 1.0 :w 37683.2) + :top-plane (new 'static 'plane :y 1.0 :w 4096.0) + ) + ) + ) + +;; definition for function plant-boss-generic-event-handler +(defbehavior plant-boss-generic-event-handler plant-boss ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (case arg2 + (('child-die) + (set! v0-0 (seekl (-> self aphid-count) 0 1)) + (set! (-> self aphid-count) (the-as int v0-0)) + v0-0 + ) + (('joint) + 24 + ) + (('try) + (-> self try) + ) + (('notify) + (case (-> arg3 param 0) + (('pickup) + (when (type-type? (-> arg0 type) money) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) + (set! v0-0 (seekl (-> gp-0 user-int8 1) 5 1)) + (set! (-> gp-0 user-int8 1) (the-as int v0-0)) + ) + v0-0 + ) + ) + ) + ) + (('target) + (case (-> arg3 param 0) + (('die) + (if (= (-> arg3 param 1) 'plant-boss) + (go plant-boss-eat) + ) + ) + ) + ) + ) + ) + +;; definition for function plant-boss-default-event-handler +(defbehavior plant-boss-default-event-handler plant-boss ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touch 'attack) + (if (and + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 1) + ) + (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 13) + ) + ) + ) + (send-event arg0 'attack-or-shove (-> arg3 param 0) (new 'static 'attack-info)) + ) + ) + (else + (plant-boss-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + +;; definition for function plant-boss-post +;; INFO: Return type mismatch int vs none. +(defbehavior plant-boss-post plant-boss () + (when *target* + (let ((gp-0 (-> *target* control root-prim prim-core))) + (set-target! (-> self neck) (the-as vector gp-0)) + (set-target! (-> self body) (the-as vector gp-0)) + ) + ) + (transform-post) + (none) + ) + +;; failed to figure out what this is: +(defstate plant-boss-arm-idle (plant-boss-arm) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('hide 'die) + (go plant-boss-arm-die (the-as symbol (-> arg3 param 0))) + ) + (('hit) + (go plant-boss-arm-hit (the-as basic (-> arg3 param 0))) + ) + ) + ) + :code + (behavior () + (ja-channel-set! 2) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 25)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (let ((gp-1 (-> self skel root-channel 1))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 26)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (while #t + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-loop!) + ) + (let ((v1-16 (-> self skel root-channel 1))) + (set! (-> v1-16 frame-interp) (- (-> (new 'static 'array float 1 1.0) 0) (-> self parent-override 0 energy))) + ) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-arm-hit (plant-boss-arm) + :event + (-> plant-boss-arm-idle event) + :code + (behavior ((arg0 basic)) + (ja-channel-push! 1 30) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 29))) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 90.0) 0)) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 29)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 90.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 75) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 25))) + (set! (-> gp-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 25)) data 0 length) -1)) + ) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-2 frame-num) (ja-aframe (the-as float 90.0) 0)) + (joint-control-channel-group! gp-2 (the-as art-joint-anim (-> self draw art-group data 25)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! (-> a0-11 param 0) (the float (+ (-> a0-11 frame-group data 0 length) -1))) + (set! (-> a0-11 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-11 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (go plant-boss-arm-idle) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-arm-die (plant-boss-arm) + :code + (behavior ((arg0 symbol)) + (let ((a0-1 (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 0))) + (set! (-> self root-override root-prim local-sphere w) 81920.0) + (set! (-> (the-as collide-shape-prim-mesh a0-1) local-sphere w) 69632.0) + (set! (-> (the-as collide-shape-prim-mesh a0-1) collide-with) (the-as uint 16)) + (set! (-> (the-as collide-shape-prim-mesh a0-1) prim-core collide-as) (the-as uint 256)) + (set! (-> (the-as collide-shape-prim-mesh a0-1) prim-core offense) 4) + (let ((t9-0 (method-of-object (the-as collide-shape-prim-mesh a0-1) change-mesh)) + (v1-10 (-> self side)) + ) + (t9-0 (the-as collide-shape-prim-mesh a0-1) (if (= v1-10 1) + 1 + 0 + ) + ) + ) + ) + (cond + (arg0 + (ja-channel-set! 1) + ) + (else + (ja-channel-push! 1 75) + (let ((f30-0 (rand-vu-float-range (-> (new 'static 'array float 1 0.8) 0) (-> (new 'static 'array float 1 1.0) 0))) + ) + (case (-> self side) + ((1) + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> self draw art-group data 28))) + (set! (-> a0-6 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) data 0 length) -1)) + ) + (set! (-> a0-6 param 1) f30-0) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> self draw art-group data 28)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) f30-0) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((a0-9 (-> self skel root-channel 0))) + (set! (-> a0-9 frame-group) (the-as art-joint-anim (-> self draw art-group data 27))) + (set! (-> a0-9 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 27)) data 0 length) -1)) + ) + (set! (-> a0-9 param 1) f30-0) + (set! (-> a0-9 frame-num) 0.0) + (joint-control-channel-group! a0-9 (the-as art-joint-anim (-> self draw art-group data 27)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group data 0 length) -1))) + (set! (-> a0-10 param 1) f30-0) + (joint-control-channel-group-eval! a0-10 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + ) + ) + ) + (case (-> self side) + ((1) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 28)) + num-func-identity + ) + (set! (-> gp-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) data 0 length) -1)) + ) + ) + ) + (else + (let ((gp-2 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 27)) + num-func-identity + ) + (set! (-> gp-2 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 27)) data 0 length) -1)) + ) + ) + ) + ) + (set! (-> (dummy-34 (-> self root-override) (the-as uint 1)) prim-core action) (the-as uint 0)) + 0 + (set! (-> (dummy-34 (-> self root-override) (the-as uint 2)) prim-core action) (the-as uint 0)) + 0 + (dummy-47 (-> self root-override)) + (while #t + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-back-arms-idle (plant-boss-arm) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (or (= arg2 'touch) (= arg2 'attack)) + (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) + ) + (cond + ((= arg2 'hit) + (go plant-boss-back-arms-hit (the-as symbol (-> arg3 param 0))) + ) + ((= arg2 'die) + (go plant-boss-back-arms-die (the-as symbol (-> arg3 param 0))) + ) + ) + ) + :code + (behavior () + (while #t + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 33))) + (set! (-> a0-0 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 33)) data 0 length) -1)) + ) + (set! (-> a0-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-0 frame-num) 0.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim (-> self draw art-group data 33)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 param 0) (the float (+ (-> a0-1 frame-group data 0 length) -1))) + (set! (-> a0-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-back-arms-hit (plant-boss-arm) + :event + (-> plant-boss-back-arms-idle event) + :code + (behavior ((arg0 symbol)) + (ja-channel-push! 1 30) + (cond + ((or (= arg0 'spin) (= arg0 'spin-air)) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 36))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-1 frame-num) 0.0) + (joint-control-channel-group! gp-1 (the-as art-joint-anim (-> self draw art-group data 36)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 35))) + (set! (-> gp-3 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) 0.0) + (joint-control-channel-group! gp-3 (the-as art-joint-anim (-> self draw art-group data 35)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-4 (-> self skel root-channel 0))) + (set! (-> gp-4 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (let ((a0-13 (-> self skel root-channel 0))) + (set! (-> a0-13 param 0) (the float (+ (-> a0-13 frame-group data 0 length) -1))) + (set! (-> a0-13 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-13 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 75) + (let ((gp-5 (-> self skel root-channel 0))) + (set! (-> gp-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 33))) + (set! (-> gp-5 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 33)) data 0 length) -1)) + ) + (set! (-> gp-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-5 frame-num) (ja-aframe (the-as float 45.0) 0)) + (joint-control-channel-group! gp-5 (the-as art-joint-anim (-> self draw art-group data 33)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-17 (-> self skel root-channel 0))) + (set! (-> a0-17 param 0) (the float (+ (-> a0-17 frame-group data 0 length) -1))) + (set! (-> a0-17 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-17 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (go plant-boss-back-arms-idle) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-back-arms-die (plant-boss-arm) + :code + (behavior ((arg0 symbol)) + (cond + (arg0 + (ja-channel-set! 1) + ) + (else + (ja-channel-push! 1 75) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 34))) + (set! (-> a0-3 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 34)) data 0 length) -1)) + ) + (set! (-> a0-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-3 frame-num) 0.0) + (joint-control-channel-group! a0-3 (the-as art-joint-anim (-> self draw art-group data 34)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group data 0 length) -1))) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (clear-collide-with-as (-> self root-override)) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-identity + ) + (set! (-> gp-0 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 34)) data 0 length) -1)) + ) + ) + (while #t + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-arm) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-vine-idle (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('hide 'die) + (go plant-boss-vine-die (the-as symbol (-> arg3 param 0))) + ) + (('hit) + (go plant-boss-vine-hit (the-as basic (-> arg3 param 0))) + ) + ) + ) + :code + (behavior () + (let ((f30-0 (rand-vu-float-range (the-as float 0.9) (the-as float 1.1)))) + (while #t + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 50))) + (set! (-> a0-1 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 50)) data 0 length) -1)) + ) + (set! (-> a0-1 param 1) f30-0) + (set! (-> a0-1 frame-num) 0.0) + (joint-control-channel-group! a0-1 (the-as art-joint-anim (-> self draw art-group data 50)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 param 0) (the float (+ (-> a0-2 frame-group data 0 length) -1))) + (set! (-> a0-2 param 1) f30-0) + (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-vine-hit (plant-boss) + :event + (-> plant-boss-vine-idle event) + :code + (behavior ((arg0 basic)) + (ja-channel-push! 1 30) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 52))) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 52)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 45.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 75) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 50))) + (set! (-> gp-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 50)) data 0 length) -1)) + ) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-2 frame-num) (ja-aframe (the-as float 45.0) 0)) + (joint-control-channel-group! gp-2 (the-as art-joint-anim (-> self draw art-group data 50)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! (-> a0-11 param 0) (the float (+ (-> a0-11 frame-group data 0 length) -1))) + (set! (-> a0-11 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-11 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (go plant-boss-vine-idle) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-vine-die (plant-boss) + :code + (behavior ((arg0 symbol)) + (when (not arg0) + (let ((f30-0 (rand-vu-float-range (-> (new 'static 'array float 1 0.0) 0) (-> (new 'static 'array float 1 1.0) 0))) + (gp-0 (-> *display* base-frame-counter)) + ) + (until (>= (- (-> *display* base-frame-counter) gp-0) (the int (* 300.0 f30-0))) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-loop!) + ) + (suspend) + ) + ) + (ja-channel-push! 1 75) + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> self draw art-group data 51))) + (set! (-> a0-6 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 51)) data 0 length) -1)) + ) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> self draw art-group data 51)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-root-idle (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('hide 'die) + (go plant-boss-root-die (the-as symbol (-> arg3 param 0))) + ) + ) + ) + :code + (behavior () + (let ((f30-0 (rand-vu-float-range (the-as float 0.9) (the-as float 1.1)))) + (while #t + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 55))) + (set! (-> a0-1 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 55)) data 0 length) -1)) + ) + (set! (-> a0-1 param 1) f30-0) + (set! (-> a0-1 frame-num) 0.0) + (joint-control-channel-group! a0-1 (the-as art-joint-anim (-> self draw art-group data 55)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 param 0) (the float (+ (-> a0-2 frame-group data 0 length) -1))) + (set! (-> a0-2 param 1) f30-0) + (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-root-die (plant-boss) + :code + (behavior ((arg0 symbol)) + (when (not arg0) + (let ((gp-0 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-0) 1200) + (+! (-> self root-override trans z) (* -4096.0 (-> *display* seconds-per-frame))) + (suspend) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +;; definition for function plant-boss-arm-init +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior plant-boss-arm-init plant-boss-arm ((arg0 vector) (arg1 float) (arg2 int)) + (stack-size-set! (-> self main-thread) 128) + (let ((s3-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((s2-0 (new 'process 'collide-shape-prim-group s3-0 (the-as uint 3) 0))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set! (-> s2-0 prim-core action) (the-as uint 1)) + (set! (-> s2-0 prim-core offense) 4) + (set-vector! (-> s2-0 local-sphere) 0.0 16384.0 0.0 16384.0) + (set-root-prim! s3-0 s2-0) + (let ((s1-0 (new 'process 'collide-shape-prim-mesh s3-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s1-0 prim-core collide-as) (the-as uint 0)) + (set! (-> s1-0 collide-with) (the-as uint 0)) + (set! (-> s1-0 prim-core action) (the-as uint 1)) + (set! (-> s1-0 prim-core offense) 0) + (set! (-> s1-0 transform-index) 5) + (set-vector! (-> s1-0 local-sphere) 0.0 0.0 0.0 81920.0) + (append-prim s2-0 s1-0) + ) + (let ((s1-1 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 1)))) + (set! (-> s1-1 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-1 collide-with) (the-as uint 16)) + (set! (-> s1-1 prim-core action) (the-as uint 1)) + (set! (-> s1-1 prim-core offense) 4) + (set-vector! (-> s1-1 local-sphere) 0.0 12288.0 0.0 12288.0) + (append-prim s2-0 s1-1) + ) + (let ((s1-2 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 2)))) + (set! (-> s1-2 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-2 collide-with) (the-as uint 16)) + (set! (-> s1-2 prim-core action) (the-as uint 1)) + (set! (-> s1-2 prim-core offense) 4) + (set-vector! (-> s1-2 local-sphere) 0.0 20480.0 0.0 12288.0) + (append-prim s2-0 s1-2) + ) + ) + (set! (-> s3-0 nav-radius) (* 0.75 (-> s3-0 root-prim local-sphere w))) + (backup-collide-with-as s3-0) + (set! (-> self root-override) s3-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-yaw-angle-clear-roll-pitch! (-> self root-override) arg1) + (set! (-> self side) arg2) + (initialize-skeleton self *plant-boss-arm-sg* '()) + (set! (-> self draw shadow-ctrl) *plant-boss-shadow-control*) + (go plant-boss-arm-idle) + (none) + ) + +;; definition for function plant-boss-back-arms-init +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior plant-boss-back-arms-init plant-boss-arm ((arg0 vector) (arg1 float) (arg2 int)) + (stack-size-set! (-> self main-thread) 128) + (let ((s3-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((s2-0 (new 'process 'collide-shape-prim-group s3-0 (the-as uint 2) 0))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set! (-> s2-0 prim-core action) (the-as uint 1)) + (set! (-> s2-0 prim-core offense) 4) + (set-vector! (-> s2-0 local-sphere) -30720.0 6144.0 26624.0 16384.0) + (set-root-prim! s3-0 s2-0) + (let ((s1-0 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 0)))) + (set! (-> s1-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-0 collide-with) (the-as uint 16)) + (set! (-> s1-0 prim-core action) (the-as uint 1)) + (set! (-> s1-0 prim-core offense) 4) + (set-vector! (-> s1-0 local-sphere) -32768.0 6144.0 32768.0 4915.2) + (append-prim s2-0 s1-0) + ) + (let ((s1-1 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 0)))) + (set! (-> s1-1 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-1 collide-with) (the-as uint 16)) + (set! (-> s1-1 prim-core action) (the-as uint 1)) + (set! (-> s1-1 prim-core offense) 4) + (set-vector! (-> s1-1 local-sphere) -28672.0 6144.0 20480.0 4915.2) + (append-prim s2-0 s1-1) + ) + ) + (set! (-> s3-0 nav-radius) (* 0.75 (-> s3-0 root-prim local-sphere w))) + (backup-collide-with-as s3-0) + (set! (-> self root-override) s3-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-yaw-angle-clear-roll-pitch! (-> self root-override) arg1) + (set! (-> self side) arg2) + (initialize-skeleton self *plant-boss-back-arms-sg* '()) + (set! (-> self draw shadow-ctrl) *plant-boss-shadow-control*) + (go plant-boss-back-arms-idle) + (none) + ) + +;; definition for function plant-boss-vine-init +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior plant-boss-vine-init plant-boss-arm ((arg0 vector) (arg1 vector) (arg2 float) (arg3 int)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self root-override) (the-as collide-shape (new 'process 'trsqv))) + (set-vector! (-> self root-override scale) arg2 arg2 arg2 (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (quaternion-zxy! (-> self root-override quat) arg1) + (set! (-> self side) arg3) + (initialize-skeleton self *plant-boss-vine-sg* '()) + (go plant-boss-vine-idle) + (none) + ) + +;; definition for function plant-boss-root-init +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior plant-boss-root-init plant-boss-arm ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 int)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self root-override) (the-as collide-shape (new 'process 'trsqv))) + (set! (-> self root-override scale quad) (-> arg2 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (quaternion-zxy! (-> self root-override quat) arg1) + (set! (-> self side) arg3) + (initialize-skeleton self *plant-boss-root-sg* '()) + (go plant-boss-root-idle) + (none) + ) + +;; failed to figure out what this is: +(defstate plant-boss-leaf-idle (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('trigger) + (go plant-boss-leaf-open (the-as symbol (-> arg3 param 0))) + ) + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :code + (behavior ((arg0 symbol)) + (while #t + (case (-> self side) + ((1) + (dotimes (gp-0 4) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 43))) + (set! (-> a0-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 43)) data 0 length) -1)) + ) + (set! (-> a0-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> self draw art-group data 43)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group data 0 length) -1))) + (set! (-> a0-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (else + (dotimes (gp-1 5) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 40))) + (set! (-> a0-5 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 40)) data 0 length) -1)) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> self draw art-group data 40)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 param 0) (the float (+ (-> a0-6 frame-group data 0 length) -1))) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-6 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-leaf-open (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('kill) + (go plant-boss-leaf-close) + ) + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :trans + (the-as (function none :behavior plant-boss-leaf) rider-trans) + :code + (behavior ((arg0 symbol)) + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-1 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 30) + (case (-> self side) + ((1) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 44))) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 30.0) 0)) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 44)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 30.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (sound-play-by-name (static-sound-name "plant-leaf") (new-sound-id) 1024 0 0 1 #t) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 44))) + (set! (-> gp-3 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 44)) data 0 length) -1)) + ) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) (ja-aframe (the-as float 30.0) 0)) + (joint-control-channel-group! gp-3 (the-as art-joint-anim (-> self draw art-group data 44)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-14 (-> self skel root-channel 0))) + (set! (-> a0-14 param 0) (the float (+ (-> a0-14 frame-group data 0 length) -1))) + (set! (-> a0-14 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-14 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((gp-4 (-> self skel root-channel 0))) + (set! (-> gp-4 frame-group) (the-as art-joint-anim (-> self draw art-group data 41))) + (set! (-> gp-4 param 0) (ja-aframe (the-as float 30.0) 0)) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-4 frame-num) 0.0) + (joint-control-channel-group! gp-4 (the-as art-joint-anim (-> self draw art-group data 41)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-5 (-> self skel root-channel 0))) + (set! (-> gp-5 param 0) (ja-aframe (the-as float 30.0) 0)) + (set! (-> gp-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-5 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (sound-play-by-name (static-sound-name "plant-leaf") (new-sound-id) 1024 0 0 1 #t) + (let ((gp-7 (-> self skel root-channel 0))) + (set! (-> gp-7 frame-group) (the-as art-joint-anim (-> self draw art-group data 41))) + (set! (-> gp-7 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 41)) data 0 length) -1)) + ) + (set! (-> gp-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-7 frame-num) (ja-aframe (the-as float 30.0) 0)) + (joint-control-channel-group! gp-7 (the-as art-joint-anim (-> self draw art-group data 41)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-26 (-> self skel root-channel 0))) + (set! (-> a0-26 param 0) (the float (+ (-> a0-26 frame-group data 0 length) -1))) + (set! (-> a0-26 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-26 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (go plant-boss-leaf-open-idle #f) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) rider-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-leaf-open-idle (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('kill) + (set! (-> self state-object) #t) + (let ((v0-0 (the-as object (+ (-> *display* base-frame-counter) (-> arg3 param 0))))) + (set! (-> self state-time-frame) (the-as int v0-0)) + v0-0 + ) + ) + (('bonk) + (if (not (-> self state-object)) + (go plant-boss-leaf-bounce) + ) + ) + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :trans + (the-as (function none :behavior plant-boss-leaf) rider-trans) + :code + (behavior ((arg0 symbol)) + (local-vars (v1-19 symbol)) + (set! (-> self state-object) arg0) + (case (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (((-> self draw art-group data 47) (-> self draw art-group data 46)) + (ja-channel-push! 1 30) + ) + ) + (case (-> self side) + ((1) + (let ((v1-10 (-> self skel root-channel 0))) + (set! (-> v1-10 frame-group) (the-as art-joint-anim (-> self draw art-group data 45))) + ) + ) + (else + (let ((v1-13 (-> self skel root-channel 0))) + (set! (-> v1-13 frame-group) (the-as art-joint-anim (-> self draw art-group data 42))) + ) + ) + ) + (until v1-19 + (suspend) + (let ((a0-16 (-> self skel root-channel 0))) + (set! (-> a0-16 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-loop!) + ) + (set! v1-19 (and (-> self state-object) (< (-> self state-time-frame) (-> *display* base-frame-counter)))) + ) + (go plant-boss-leaf-close) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) rider-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-leaf-bounce (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('kill) + (set! (-> self state-object) #t) + (let ((v0-0 (the-as object (+ (-> *display* base-frame-counter) (-> arg3 param 0))))) + (set! (-> self state-time-frame) (the-as int v0-0)) + v0-0 + ) + ) + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :trans + (the-as (function none :behavior plant-boss-leaf) rider-trans) + :code + (behavior () + (ja-channel-push! 1 30) + (case (-> self side) + ((1) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 47))) + (set! (-> a0-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 47)) data 0 length) -1)) + ) + (set! (-> a0-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! a0-2 (the-as art-joint-anim (-> self draw art-group data 47)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group data 0 length) -1))) + (set! (-> a0-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 46))) + (set! (-> a0-5 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 46)) data 0 length) -1)) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! a0-5 (the-as art-joint-anim (-> self draw art-group data 46)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 param 0) (the float (+ (-> a0-6 frame-group data 0 length) -1))) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-6 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (go plant-boss-leaf-open-idle (-> self state-object)) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) rider-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-leaf-close (plant-boss-leaf) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('die) + (go plant-boss-leaf-die (the-as basic (-> arg3 param 0))) + ) + ) + ) + :trans + (the-as (function none :behavior plant-boss-leaf) rider-trans) + :code + (behavior () + (case (-> self side) + ((1) + (sound-play-by-name (static-sound-name "plant-leaf") (new-sound-id) 1024 0 0 1 #t) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 frame-group) (the-as art-joint-anim (-> self draw art-group data 44))) + (set! (-> a0-4 param 0) 0.0) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-4 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 44)) data 0 length) -1)) + ) + (joint-control-channel-group! a0-4 (the-as art-joint-anim (-> self draw art-group data 44)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) 0.0) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (sound-play-by-name (static-sound-name "plant-leaf") (new-sound-id) 1024 0 0 1 #t) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 frame-group) (the-as art-joint-anim (-> self draw art-group data 41))) + (set! (-> a0-10 param 0) 0.0) + (set! (-> a0-10 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-10 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 41)) data 0 length) -1)) + ) + (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> self draw art-group data 41)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! (-> a0-11 param 0) 0.0) + (set! (-> a0-11 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-11 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (go plant-boss-leaf-idle #f) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) rider-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-leaf-die (plant-boss-leaf) + :code + (behavior ((arg0 basic)) + (while #t + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss-leaf) ja-post) + ) + +;; definition for function plant-boss-leaf-init +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior plant-boss-leaf-init plant-boss-leaf ((arg0 vector) (arg1 float) (arg2 int)) + (stack-size-set! (-> self main-thread) 128) + (let ((s3-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)))) + (set! (-> s3-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s3-0 reaction) default-collision-reaction) + (set! (-> s3-0 no-reaction) + (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing) + ) + (dummy-29 s3-0 1) + (let ((s2-0 (new 'process 'collide-shape-prim-mesh s3-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 2048)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set! (-> s2-0 prim-core action) (the-as uint 1)) + (set! (-> s2-0 prim-core offense) 4) + (set! (-> s2-0 transform-index) 8) + (set-vector! (-> s2-0 local-sphere) 0.0 0.0 12288.0 13926.4) + (set-root-prim! s3-0 s2-0) + ) + (set! (-> s3-0 nav-radius) (* 0.75 (-> s3-0 root-prim local-sphere w))) + (backup-collide-with-as s3-0) + (set! (-> self root-override) s3-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-yaw-angle-clear-roll-pitch! (-> self root-override) arg1) + (set! (-> self side) arg2) + (initialize-skeleton self *plant-boss-leaf-sg* '()) + (set! (-> self draw shadow-ctrl) *plant-boss-shadow-control*) + (go plant-boss-leaf-idle #f) + (none) + ) + +;; failed to figure out what this is: +(defstate plant-boss-far-idle (plant-boss) + :code + (behavior () + (clear-pending-settings-from-process *setting-control* self 'music) + (let ((gp-0 (-> self child))) + (while gp-0 + (let ((s5-0 (ppointer->process gp-0))) + (set! gp-0 (-> gp-0 0 brother)) + (if (type-type? (-> s5-0 type) aphid) + (deactivate s5-0) + ) + ) + ) + ) + (set! (-> self aphid-count) 0) + (let ((v1-9 (-> self neck))) + (set! (-> v1-9 blend) 0.0) + ) + (let ((v1-10 (-> self body))) + (set! (-> v1-10 blend) 0.0) + ) + (set-mode! (-> self neck) (joint-mod-handler-mode flex-blend)) + (set-mode! (-> self body) (joint-mod-handler-mode flex-blend)) + (set! (-> self body flex-blend) 0.0) + (ja-channel-set! 1) + (while #t + (let ((a0-6 (-> self skel root-channel 0))) + (set! (-> a0-6 frame-group) (the-as art-joint-anim (-> self draw art-group data 9))) + (set! (-> a0-6 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) data 0 length) -1)) + ) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! a0-6 (the-as art-joint-anim (-> self draw art-group data 9)) num-func-seek!) + ) + (until (ja-done? 0) + (set! (-> self energy) (seek (-> self energy) (the-as float 0.25) (-> *display* seconds-per-frame))) + (if (and + (and + *target* + (>= 245760.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) + ) + (< (fabs (- (-> (target-pos 0) y) (-> self root-override trans y))) 40960.0) + ) + (go plant-boss-intro) + ) + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group data 0 length) -1))) + (set! (-> a0-10 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-10 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-intro (plant-boss) + :post + (the-as (function none :behavior plant-boss) ja-post) + ) + +;; failed to figure out what this is: +(defstate plant-boss-idle (plant-boss) + :event + plant-boss-default-event-handler + :enter + (behavior () + (set-setting! *setting-control* self 'music 'danger (-> (new 'static 'array float 1 0.0) 0) 0) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self body flex-blend) 0.0) + (set! (-> self neck flex-blend) (-> (new 'static 'array float 1 1.0) 0)) + (none) + ) + :trans + (behavior () + (let ((f30-0 (vector-vector-distance (target-pos 0) (-> self root-override trans)))) + (if (< 409600.0 f30-0) + (go plant-boss-far-idle) + ) + (if (and + (< f30-0 143360.0) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) (cond + ((>= (-> self try) 15) + 1500 + ) + ((>= (-> self try) 10) + 1200 + ) + ((>= (-> self try) 5) + 900 + ) + (else + 600 + ) + ) + ) + *target* + (zero? (logand (-> *target* state-flags) #x80f8)) + ) + (go plant-boss-attack 1) + ) + ) + (none) + ) + :code + (behavior () + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 7) + ) + (ja-channel-push! 1 150) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> gp-0 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) (ja-aframe (the-as float 60.0) 0)) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 12) + ) + (ja-channel-push! 1 75) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 13))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 75.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-1 frame-num) 0.0) + (joint-control-channel-group! gp-1 (the-as art-joint-anim (-> self draw art-group data 13)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 param 0) (ja-aframe (the-as float 75.0) 0)) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((a0-19 (-> self skel root-channel 0))) + (set! (-> a0-19 param 0) (the float (+ (-> a0-19 frame-group data 0 length) -1))) + (set! (-> a0-19 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-19 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 75) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> gp-3 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) (ja-aframe (the-as float 75.0) 0)) + (joint-control-channel-group! gp-3 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-23 (-> self skel root-channel 0))) + (set! (-> a0-23 param 0) (the float (+ (-> a0-23 frame-group data 0 length) -1))) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-23 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 10) + ) + ) + (else + (ja-channel-push! 1 75) + ) + ) + (while #t + (when (or (and *cheat-mode* (cpad-hold? 1 r3)) (zero? (-> self aphid-count))) + (let ((a0-35 (-> self skel root-channel 0))) + (set! (-> a0-35 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> a0-35 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> a0-35 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-35 frame-num) 0.0) + (joint-control-channel-group! a0-35 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (go plant-boss-vulnerable) + ) + (let ((a0-36 (-> self skel root-channel 0))) + (set! (-> a0-36 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> a0-36 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> a0-36 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-36 frame-num) 0.0) + (joint-control-channel-group! a0-36 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-37 (-> self skel root-channel 0))) + (set! (-> a0-37 param 0) (the float (+ (-> a0-37 frame-group data 0 length) -1))) + (set! (-> a0-37 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-37 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (when (and *cheat-mode* (cpad-hold? 1 r3)) + (let ((a0-43 (-> self skel root-channel 0))) + (set! (-> a0-43 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> a0-43 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1)) + ) + (set! (-> a0-43 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-43 frame-num) 0.0) + (joint-control-channel-group! a0-43 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!) + ) + (go plant-boss-vulnerable) + ) + (when (rand-vu-percent? (the-as float 0.2)) + (let ((a0-45 (-> self skel root-channel 0))) + (set! (-> a0-45 frame-group) (the-as art-joint-anim (-> self draw art-group data 4))) + (set! (-> a0-45 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) data 0 length) -1)) + ) + (set! (-> a0-45 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-45 frame-num) 0.0) + (joint-control-channel-group! a0-45 (the-as art-joint-anim (-> self draw art-group data 4)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-46 (-> self skel root-channel 0))) + (set! (-> a0-46 param 0) (the float (+ (-> a0-46 frame-group data 0 length) -1))) + (set! (-> a0-46 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-46 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (none) + ) + :post + plant-boss-post + ) + +;; failed to figure out what this is: +(defstate plant-boss-spawn (plant-boss) + :event + plant-boss-default-event-handler + :enter + (behavior () + (when (not (-> self try-inc)) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) + (set! (-> gp-0 user-int8 0) (seekl (-> gp-0 user-int8 0) 255 1)) + (set! (-> self try) (-> gp-0 user-int8 0)) + ) + (set! (-> self try-inc) #t) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (+! (-> self cycle-count) 1) + (set! (-> self snap-count) 0) + (set! (-> self body flex-blend) 0.0) + (set! (-> self neck flex-blend) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> self want-aphid-count) (min (- 4 (the int (-> self health))) (cond + ((>= (-> self try) 15) + 1 + ) + ((>= (-> self try) 10) + 2 + ) + (else + 3 + ) + ) + ) + ) + (none) + ) + :trans + (behavior () + (let ((f0-0 (vector-vector-distance (target-pos 0) (-> self root-override trans)))) + (if (< 409600.0 f0-0) + (go plant-boss-far-idle) + ) + ) + (cond + ((zero? (-> self want-aphid-count)) + enter-state + (let ((v1-7 (the int (-> self health)))) + (go plant-boss-attack (cond + ((= v1-7 2) + 2 + ) + ((= v1-7 1) + 3 + ) + (else + 1 + ) + ) + ) + ) + ) + ((>= (- (-> *display* base-frame-counter) (-> self aphid-spawn-time)) 420) + (let ((gp-1 (get-process *default-dead-pool* aphid #x4000))) + (when (when gp-1 + (let ((t9-5 (method-of-type aphid activate))) + (t9-5 (the-as aphid gp-1) self 'aphid (the-as pointer #x70004000)) + ) + (run-now-in-process gp-1 aphid-init-by-other self (-> self root-override trans) (target-pos 0)) + (-> gp-1 ppointer) + ) + (+! (-> self aphid-count) 1) + (set! (-> self want-aphid-count) (seekl (-> self want-aphid-count) 0 1)) + (set! (-> self aphid-spawn-time) (-> *display* base-frame-counter)) + ) + ) + ) + ) + (none) + ) + :code + (-> plant-boss-idle code) + :post + plant-boss-post + ) + +;; failed to figure out what this is: +(defstate plant-boss-vulnerable (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('attack) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 1) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'shove) + (set! (-> a1-2 param 0) (-> arg3 param 0)) + (let ((v1-6 (new 'static 'attack-info :mask #xc0))) + (set! (-> v1-6 shove-up) (-> (new 'static 'array float 1 8192.0) 0)) + (set! (-> v1-6 shove-back) 24576.0) + (set! (-> a1-2 param 1) (the-as uint v1-6)) + ) + (send-event-function arg0 a1-2) + ) + (go plant-boss-hit (the-as symbol (-> arg3 param 1))) + ) + ) + (else + (plant-boss-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self body flex-blend) 0.0) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self attack-prim 0 local-sphere w) 12288.0) + (set! (-> self attack-prim 0 prim-core offense) 4) + (logior! (-> self attack-prim 0 prim-core action) 1) + (none) + ) + :exit + (behavior () + (send-event (ppointer->process (-> self leaf 1)) 'kill 0) + (send-event (ppointer->process (-> self leaf 0)) 'kill 150) + (set! (-> self attack-prim 0 local-sphere w) 16384.0) + (set! (-> self attack-prim 0 prim-core offense) 0) + (set! (-> self attack-prim 0 prim-core action) (logand -2 (-> self attack-prim 0 prim-core action))) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 75) + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 11))) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 60.0) 0)) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! gp-0 (the-as art-joint-anim (-> self draw art-group data 11)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 60.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (send-event (ppointer->process (-> self leaf 1)) 'trigger) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 11))) + (set! (-> gp-2 param 0) (ja-aframe (the-as float 120.0) 0)) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-2 frame-num) (ja-aframe (the-as float 60.0) 0)) + (joint-control-channel-group! gp-2 (the-as art-joint-anim (-> self draw art-group data 11)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 param 0) (ja-aframe (the-as float 120.0) 0)) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (send-event (ppointer->process (-> self leaf 0)) 'trigger) + (let ((gp-4 (-> self skel root-channel 0))) + (set! (-> gp-4 frame-group) (the-as art-joint-anim (-> self draw art-group data 11))) + (set! (-> gp-4 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 11)) data 0 length) -1)) + ) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-4 frame-num) (ja-aframe (the-as float 120.0) 0)) + (joint-control-channel-group! gp-4 (the-as art-joint-anim (-> self draw art-group data 11)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-16 (-> self skel root-channel 0))) + (set! (-> a0-16 param 0) (the float (+ (-> a0-16 frame-group data 0 length) -1))) + (set! (-> a0-16 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((gp-5 (cond + ((>= (-> self try) 15) + 6000 + ) + ((>= (-> self try) 10) + 3600 + ) + ((>= (-> self try) 5) + 3000 + ) + (else + 2400 + ) + ) + ) + ) + (while (< (- (-> *display* base-frame-counter) (-> self state-time)) gp-5) + (let ((a0-18 (-> self skel root-channel 0))) + (set! (-> a0-18 frame-group) (the-as art-joint-anim (-> self draw art-group data 12))) + (set! (-> a0-18 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 12)) data 0 length) -1)) + ) + (set! (-> a0-18 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-18 frame-num) 0.0) + (joint-control-channel-group! a0-18 (the-as art-joint-anim (-> self draw art-group data 12)) num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-19 (-> self skel root-channel 0))) + (set! (-> a0-19 param 0) (the float (+ (-> a0-19 frame-group data 0 length) -1))) + (set! (-> a0-19 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-19 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (go plant-boss-spawn) + (none) + ) + :post + plant-boss-post + ) + +;; failed to figure out what this is: +(defstate plant-boss-attack (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touch 'attack) + (when (and + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 1) + ) + (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 13) + ) + ) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack-or-shove) + (set! (-> a1-2 param 0) (-> arg3 param 0)) + (let ((a0-8 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-8 mode) 'plant-boss) + (set! (-> a1-2 param 1) (the-as uint a0-8)) + ) + (when (send-event-function arg0 a1-2) + (let ((v0-1 (the-as object #t))) + (set! (-> self ate) (the-as symbol v0-1)) + v0-1 + ) + ) + ) + ) + ) + (else + (plant-boss-default-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :code + (behavior ((arg0 int)) + (local-vars (v1-64 symbol)) + (+! (-> self snap-count) 1) + (set! (-> self ate) #f) + (set! (-> self interp) 0.0) + (let ((s5-0 #f)) + (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 7) + ) + (set! s5-0 #t) + ) + (ja-channel-push! 2 75) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 5)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (let ((s4-1 (-> self skel root-channel 1))) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim (-> self draw art-group data 6)) + num-func-identity + ) + (set! (-> s4-1 frame-num) 0.0) + ) + (when s5-0 + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 num-func) num-func-identity) + (set! (-> s5-1 frame-num) (ja-aframe (the-as float 100.0) 0)) + ) + (let ((s5-2 (-> self skel root-channel 1))) + (set! (-> s5-2 num-func) num-func-identity) + (set! (-> s5-2 frame-num) (ja-aframe (the-as float 100.0) 0)) + ) + ) + ) + (let ((f30-0 (lerp-scale + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (vector-vector-distance (target-pos 0) (-> self root-override trans)) + (the-as float 26624.0) + (the-as float 86016.0) + ) + ) + ) + (until (or v1-64 (ja-done? 0)) + (set! (-> self body flex-blend) (seek + (-> self body flex-blend) + (-> (new 'static 'array float 1 1.0) 0) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (set! (-> self neck flex-blend) (seek + (-> self neck flex-blend) + (-> (new 'static 'array float 1 0.0) 0) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (set! f30-0 (seek + f30-0 + (lerp-scale + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (vector-vector-distance (target-pos 0) (-> self root-override trans)) + (the-as float 26624.0) + (the-as float 86016.0) + ) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (set! (-> self interp) f30-0) + (let ((a0-19 (-> self skel root-channel 0))) + (set! (-> a0-19 param 0) (the float (+ (-> a0-19 frame-group data 0 length) -1))) + (set! (-> a0-19 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-19 (the-as art-joint-anim #f) num-func-seek!) + ) + (let ((a0-20 (-> self skel root-channel 1))) + (set! (-> a0-20 frame-interp) f30-0) + (set! (-> a0-20 param 0) 0.0) + (joint-control-channel-group-eval! a0-20 (the-as art-joint-anim #f) num-func-chan) + ) + (suspend) + (set! v1-64 (>= (ja-aframe-num 0) 149.0)) + ) + ) + (go plant-boss-reset arg0) + (none) + ) + :post + plant-boss-post + ) + +;; failed to figure out what this is: +(defstate plant-boss-eat (plant-boss) + :event + plant-boss-generic-event-handler + :exit + (behavior () + (set! (-> self skel status) (logand -33 (-> self skel status))) + (let ((a0-4 (handle->process (-> self camera)))) + (if a0-4 + (deactivate a0-4) + ) + ) + (none) + ) + :code + (behavior () + (let ((f30-1 (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 5) + ) + (fmax (-> (new 'static 'array float 1 129.0) 0) (ja-aframe-num 0)) + (-> (new 'static 'array float 1 129.0) 0) + ) + ) + (gp-0 0) + ) + (send-event *camera* 'change-state cam-lookat 0) + (logior! (-> self skel status) 1) + (ja-channel-push! 2 30) + (let ((s5-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 18)) + num-func-identity + ) + (set! (-> s5-0 frame-num) (ja-aframe f30-1 0)) + ) + (let ((s5-1 (-> self skel root-channel 1))) + (set! (-> s5-1 frame-interp) (-> self interp)) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> self draw art-group data 19)) + num-func-identity + ) + (set! (-> s5-1 frame-num) (ja-aframe f30-1 0)) + ) + (until (>= (ja-aframe-num 0) 285.0) + (try-preload-stream *art-control* "$GAMCAM29" 0 self (the-as float -99.0)) + (set! (-> self energy) (seek (-> self energy) (the-as float 0.5) (* 0.2 (-> *display* seconds-per-frame)))) + (when (and (>= (ja-aframe-num 0) 175.0) (zero? gp-0)) + (set! gp-0 1) + (let ((s5-2 (get-process *default-dead-pool* othercam #x4000))) + (set! (-> self camera) + (ppointer->handle (when s5-2 + (let ((t9-11 (method-of-type othercam activate))) + (t9-11 (the-as othercam s5-2) self 'othercam (the-as pointer #x70004000)) + ) + (run-now-in-process s5-2 othercam-init-by-other self 28 #f #t) + (-> s5-2 ppointer) + ) + ) + ) + ) + (logior! (-> self skel status) 32) + (ambient-hint-spawn "gamcam29" (the-as vector #f) *entity-pool* 'ambient) + ) + (when (and (>= (ja-aframe-num 0) 236.0) (= gp-0 1)) + (set! gp-0 2) + (send-event (handle->process (-> self camera)) 'joint "camera2") + ) + (set! (-> self body flex-blend) + (seek (-> self body flex-blend) (-> (new 'static 'array float 1 0.0) 0) (-> *display* seconds-per-frame)) + ) + (set! (-> self interp) + (seek (-> self interp) (-> (new 'static 'array float 1 0.0) 0) (-> *display* seconds-per-frame)) + ) + (let ((a0-31 (-> self skel root-channel 0))) + (set! (-> a0-31 param 0) (the float (+ (-> a0-31 frame-group data 0 length) -1))) + (set! (-> a0-31 param 1) 0.66) + (joint-control-channel-group-eval! a0-31 (the-as art-joint-anim #f) num-func-seek!) + ) + (let ((a0-32 (-> self skel root-channel 1))) + (set! (-> a0-32 frame-interp) (-> self interp)) + (set! (-> a0-32 param 0) 0.0) + (joint-control-channel-group-eval! a0-32 (the-as art-joint-anim #f) num-func-chan) + ) + (suspend) + ) + ) + (ja-channel-push! 1 75) + (let ((a0-35 (-> self skel root-channel 0))) + (set! (-> a0-35 frame-group) (the-as art-joint-anim (-> self draw art-group data 20))) + (set! (-> a0-35 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 20)) data 0 length) -1)) + ) + (set! (-> a0-35 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-35 frame-num) 0.0) + (joint-control-channel-group! a0-35 (the-as art-joint-anim (-> self draw art-group data 20)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((a0-36 (-> self skel root-channel 0))) + (set! (-> a0-36 param 0) (the float (+ (-> a0-36 frame-group data 0 length) -1))) + (set! (-> a0-36 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-36 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (send-event *target* 'end-mode) + (set! (-> self skel status) (logand -2 (-> self skel status))) + (go plant-boss-idle) + (none) + ) + :post + plant-boss-post + ) + +;; failed to figure out what this is: +(defstate plant-boss-reset (plant-boss) + :event + (-> plant-boss-eat event) + :code + (behavior ((arg0 int)) + (let ((gp-0 #f)) + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 10) + ) + (set! gp-0 #t) + (ja-channel-push! 1 150) + ) + (else + (ja-channel-push! 1 300) + ) + ) + (let ((s4-0 (-> self skel root-channel 0))) + (set! (-> s4-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 7))) + (set! (-> s4-0 param 0) (ja-aframe (the-as float 210.0) 0)) + (set! (-> s4-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s4-0 frame-num) 0.0) + (joint-control-channel-group! s4-0 (the-as art-joint-anim (-> self draw art-group data 7)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (set! (-> self body flex-blend) + (seek (-> self body flex-blend) (-> (new 'static 'array float 1 0.0) 0) (-> *display* seconds-per-frame)) + ) + (if (>= 1 arg0) + (set! (-> self neck flex-blend) + (seek (-> self neck flex-blend) (-> (new 'static 'array float 1 1.0) 0) (-> *display* seconds-per-frame)) + ) + ) + (suspend) + (let ((s4-1 (-> self skel root-channel 0))) + (set! (-> s4-1 param 0) (ja-aframe (the-as float 210.0) 0)) + (set! (-> s4-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! s4-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (if (< 1 arg0) + (go plant-boss-attack (+ arg0 -1)) + ) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 7))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 240.0) 0)) + (set! (-> s5-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s5-1 frame-num) (ja-aframe (the-as float 210.0) 0)) + (joint-control-channel-group! s5-1 (the-as art-joint-anim (-> self draw art-group data 7)) num-func-seek!) + ) + (until (ja-done? 0) + (set! (-> self body flex-blend) + (seek (-> self body flex-blend) (-> (new 'static 'array float 1 0.0) 0) (-> *display* seconds-per-frame)) + ) + (set! (-> self neck flex-blend) (seek + (-> self neck flex-blend) + (-> (new 'static 'array float 1 1.0) 0) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (suspend) + (let ((s5-2 (-> self skel root-channel 0))) + (set! (-> s5-2 param 0) (ja-aframe (the-as float 240.0) 0)) + (set! (-> s5-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! s5-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (let ((a0-23 (-> self skel root-channel 0))) + (set! (-> a0-23 param 0) (the float (+ (-> a0-23 frame-group data 0 length) -1))) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-23 (the-as art-joint-anim #f) num-func-seek!) + ) + (if gp-0 + (go plant-boss-spawn) + (go plant-boss-idle) + ) + ) + (none) + ) + :post + plant-boss-post + ) + +;; failed to figure out what this is: +(defstate plant-boss-hit (plant-boss) + :event + (-> plant-boss-eat event) + :code + (behavior ((arg0 symbol)) + (let ((s5-0 (-> self child))) + (while s5-0 + (send-event (ppointer->process s5-0) 'hit arg0) + (set! s5-0 (-> s5-0 0 brother)) + ) + ) + (set! (-> self health) + (seek (-> self health) (-> (new 'static 'array float 1 0.0) 0) (-> (new 'static 'array float 1 1.0) 0)) + ) + (send-event (ppointer->process (-> self leaf 1)) 'kill 0) + (send-event (ppointer->process (-> self leaf 0)) 'kill 0) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-5 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 60) + (cond + ((= arg0 'spin) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 frame-group) (the-as art-joint-anim (-> self draw art-group data 15))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-1 frame-num) 0.0) + (joint-control-channel-group! gp-1 (the-as art-joint-anim (-> self draw art-group data 15)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-2 (-> self skel root-channel 0))) + (set! (-> gp-2 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ((= arg0 'spin-air) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 16))) + (set! (-> gp-3 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) 0.0) + (joint-control-channel-group! gp-3 (the-as art-joint-anim (-> self draw art-group data 16)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-4 (-> self skel root-channel 0))) + (set! (-> gp-4 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((gp-5 (-> self skel root-channel 0))) + (set! (-> gp-5 frame-group) (the-as art-joint-anim (-> self draw art-group data 14))) + (set! (-> gp-5 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-5 frame-num) 0.0) + (joint-control-channel-group! gp-5 (the-as art-joint-anim (-> self draw art-group data 14)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (let ((gp-6 (-> self skel root-channel 0))) + (set! (-> gp-6 param 0) (ja-aframe (the-as float 20.0) 0)) + (set! (-> gp-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! gp-6 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + (if (= (-> self health) 0.0) + (go plant-boss-dead #f) + ) + (let ((a0-23 (-> self skel root-channel 0))) + (set! (-> a0-23 param 0) (the float (+ (-> a0-23 frame-group data 0 length) -1))) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-23 (the-as art-joint-anim #f) num-func-seek!) + ) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go plant-boss-spawn) + (none) + ) + :post + plant-boss-post + ) + +;; failed to figure out what this is: +(defstate plant-boss-dead (plant-boss) + :event + plant-boss-generic-event-handler + :code + (behavior ((arg0 symbol)) + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self body flex-blend) 0.0) + (let* ((s5-0 (get-task-control (game-task jungle-plant))) + (v1-5 (get-reminder s5-0 0)) + ) + (save-reminder s5-0 (logior v1-5 1) 0) + ) + (cond + (arg0 + (ja-channel-set! 1) + (let ((s5-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> self draw art-group data 17)) + num-func-identity + ) + (set! (-> s5-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 17)) data 0 length) -1)) + ) + ) + (suspend) + (if (not (task-complete? *game-info* (-> self entity extra perm task))) + (birth-pickup-at-point + (-> self node-list data 42 bone transform vector 3) + (pickup-type fuel-cell) + (the float (-> self entity extra perm task)) + #f + self + (the-as fact-info #f) + ) + ) + ) + (else + (let ((s4-0 #f) + (s5-2 #f) + ) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group data 0 length) -1))) + (set! (-> a0-10 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! a0-10 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-channel-push! 1 150) + (let ((a0-12 (-> self skel root-channel 0))) + (set! (-> a0-12 frame-group) (the-as art-joint-anim (-> self draw art-group data 17))) + (set! (-> a0-12 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 17)) data 0 length) -1)) + ) + (set! (-> a0-12 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-12 frame-num) 0.0) + (joint-control-channel-group! a0-12 (the-as art-joint-anim (-> self draw art-group data 17)) num-func-seek!) + ) + (until (ja-done? 0) + (ja-blend-eval) + (when (< 100.0 (ja-aframe-num 0)) + (set-mode! (-> self neck) (joint-mod-handler-mode flex-blend)) + (set-mode! (-> self body) (joint-mod-handler-mode flex-blend)) + ) + (when (and (>= (ja-aframe-num 0) 180.0) (not s4-0)) + (let ((s4-1 (-> self child))) + (while s4-1 + (send-event (ppointer->process s4-1) 'hide #f) + (set! s4-1 (-> s4-1 0 brother)) + ) + ) + (set! s4-0 #t) + ) + (when (and (>= (ja-aframe-num 0) 189.0) (not s5-2)) + (process-entity-status! self (entity-perm-status complete) #t) + (when (not (task-complete? *game-info* (-> self entity extra perm task))) + (set! s5-2 #t) + (birth-pickup-at-point + (-> self node-list data 42 bone transform vector 3) + (pickup-type fuel-cell) + (the float (-> self entity extra perm task)) + #f + self + (the-as fact-info #f) + ) + ) + ) + (suspend) + (let ((a0-22 (-> self skel root-channel 0))) + (set! (-> a0-22 param 0) (the float (+ (-> a0-22 frame-group data 0 length) -1))) + (set! (-> a0-22 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-22 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + ) + (let ((s5-3 (-> self child))) + (while s5-3 + (send-event (ppointer->process s5-3) 'die arg0) + (set! s5-3 (-> s5-3 0 brother)) + ) + ) + (set! (-> self death-prim 0 collide-with) (the-as uint 16)) + (set! (-> self death-prim 0 prim-core collide-as) (the-as uint 256)) + (set! (-> self death-prim 0 prim-core offense) 4) + (logior! (-> self death-prim 0 prim-core action) 1) + (set! (-> self death-prim 1 prim-core collide-as) (the-as uint 256)) + (set! (-> self death-prim 1 collide-with) (the-as uint 16)) + (set! (-> self death-prim 1 prim-core offense) 4) + (logior! (-> self death-prim 1 prim-core action) 1) + (set! (-> (dummy-34 (-> self root-override) (the-as uint 8)) prim-core action) (the-as uint 0)) + 0 + (set! (-> (dummy-34 (-> self root-override) (the-as uint 16)) prim-core action) (the-as uint 0)) + 0 + (logior! (-> self mask) (process-mask actor-pause)) + (clear-pending-settings-from-process *setting-control* self 'music) + (go plant-boss-dead-idle) + (none) + ) + :post + (behavior () (plant-boss-post) (dummy-45 (-> self root-override)) (none)) + ) + +;; failed to figure out what this is: +(defstate plant-boss-dead-idle (plant-boss) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('bonk) + (go plant-boss-dead-bounce (lerp-scale + (the-as float 0.1) + (-> (new 'static 'array float 1 1.0) 0) + (the-as float (-> arg3 param 1)) + (the-as float 40960.0) + (the-as float 81920.0) + ) + ) + ) + (else + (plant-boss-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :code + (behavior () + (ja-channel-set! 1) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 17)) + num-func-identity + ) + (set! (-> gp-0 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 17)) data 0 length) -1)) + ) + ) + (let ((gp-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-1) 1500) + (transform-post) + (dummy-45 (-> self root-override)) + (suspend) + ) + ) + (while #t + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate plant-boss-dead-bounce (plant-boss) + :event + plant-boss-generic-event-handler + :trans + (the-as (function none :behavior plant-boss) rider-trans) + :code + (behavior ((arg0 float)) + (let ((v1-2 (-> self entity extra perm))) + (if (and (< 0.3 arg0) (and (not (handle->process (-> self money))) (< (-> v1-2 user-int8 1) 5))) + (set! (-> self money) (ppointer->handle (birth-pickup-at-point + (-> self node-list data 42 bone transform vector 3) + (pickup-type money) + (-> (new 'static 'array float 1 1.0) 0) + #t + self + (the-as fact-info #f) + ) + ) + ) + ) + ) + (ja-channel-set! 2) + (let ((s5-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 21)) + num-func-identity + ) + (set! (-> s5-0 frame-num) 0.0) + ) + (let ((s5-1 (-> self skel root-channel 1))) + (set! (-> s5-1 frame-interp) (- (-> (new 'static 'array float 1 1.0) 0) arg0)) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> self draw art-group data 17)) + num-func-identity + ) + (set! (-> s5-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 17)) data 0 length) -1)) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-13 (-> self skel root-channel 0))) + (set! (-> a0-13 param 0) (the float (+ (-> a0-13 frame-group data 0 length) -1))) + (set! (-> a0-13 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! a0-13 (the-as art-joint-anim #f) num-func-seek!) + ) + (let ((v1-39 (-> self skel root-channel 1))) + (set! (-> v1-39 frame-interp) (- (-> (new 'static 'array float 1 1.0) 0) arg0)) + (set! (-> v1-39 num-func) num-func-identity) + (set! (-> v1-39 frame-num) (the float (+ (-> v1-39 frame-group data 0 length) -1))) + ) + ) + (go plant-boss-dead-idle) + (none) + ) + :post + (the-as (function none :behavior plant-boss) rider-post) + ) + +;; definition for method 11 of type plant-boss +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defmethod init-from-entity! plant-boss ((obj plant-boss) (arg0 entity-actor)) + (stack-size-set! (-> obj main-thread) 512) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 5) 0))) + (set! (-> s3-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s3-0 collide-with) (the-as uint 16)) + (set! (-> s3-0 prim-core action) (the-as uint 1)) + (set! (-> s3-0 prim-core offense) 4) + (set-vector! (-> s3-0 local-sphere) 0.0 24576.0 32768.0 81920.0) + (set-root-prim! s4-0 s3-0) + (let ((s2-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 8)))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set! (-> s2-0 prim-core action) (the-as uint 1)) + (set! (-> s2-0 prim-core offense) 4) + (set-vector! (-> s2-0 local-sphere) 0.0 12288.0 12288.0 12288.0) + (append-prim s3-0 s2-0) + ) + (let ((s2-1 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 16)))) + (set! (-> s2-1 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-1 collide-with) (the-as uint 16)) + (set! (-> s2-1 prim-core action) (the-as uint 1)) + (set! (-> s2-1 prim-core offense) 4) + (set-vector! (-> s2-1 local-sphere) 0.0 20480.0 12288.0 12288.0) + (append-prim s3-0 s2-1) + ) + (let ((s2-2 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 5)))) + (set! (-> s2-2 prim-core collide-as) (the-as uint 256)) + (set! (-> s2-2 collide-with) (the-as uint 16)) + (set! (-> s2-2 prim-core offense) 0) + (set! (-> s2-2 transform-index) 13) + (set-vector! (-> s2-2 local-sphere) 0.0 (-> (new 'static 'array float 1 8192.0) 0) 0.0 16384.0) + (append-prim s3-0 s2-2) + (set! (-> obj attack-prim 0) s2-2) + ) + (let ((s2-3 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s2-3 prim-core collide-as) (the-as uint 0)) + (set! (-> s2-3 collide-with) (the-as uint 0)) + (set! (-> s2-3 prim-core offense) 0) + (set! (-> s2-3 transform-index) 13) + (set-vector! (-> s2-3 local-sphere) 0.0 (-> (new 'static 'array float 1 8192.0) 0) 0.0 16384.0) + (append-prim s3-0 s2-3) + (set! (-> obj death-prim 0) s2-3) + ) + (let ((s2-4 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> s2-4 prim-core collide-as) (the-as uint 0)) + (set! (-> s2-4 collide-with) (the-as uint 0)) + (set! (-> s2-4 prim-core offense) 0) + (set! (-> s2-4 transform-index) 12) + (set-vector! (-> s2-4 local-sphere) 0.0 -24576.0 0.0 40960.0) + (append-prim s3-0 s2-4) + (set! (-> obj death-prim 1) s2-4) + ) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (backup-collide-with-as s4-0) + (set! (-> obj root-override) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton obj *plant-boss-sg* '()) + (set! (-> obj draw shadow-ctrl) *plant-boss-shadow-control*) + (let ((s5-1 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-1 + (let ((t9-18 (method-of-type plant-boss-arm activate))) + (t9-18 (the-as plant-boss-arm s5-1) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-1 + plant-boss-arm-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x -24576.0 :z 8192.0 :w 1.0)) + (-> (new 'static 'array float 1 -8192.0) 0) + 1 + ) + (-> s5-1 ppointer) + ) + ) + (let ((s5-2 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-2 + (let ((t9-21 (method-of-type plant-boss-arm activate))) + (t9-21 (the-as plant-boss-arm s5-2) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-2 + plant-boss-arm-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x 24576.0 :z 8192.0 :w 1.0)) + (-> (new 'static 'array float 1 8192.0) 0) + 0 + ) + (-> s5-2 ppointer) + ) + ) + (let ((s5-3 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-3 + (let ((t9-24 (method-of-type plant-boss-arm activate))) + (t9-24 (the-as plant-boss-arm s5-3) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-3 + plant-boss-back-arms-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :w 1.0)) + (-> (new 'static 'array float 1 0.0) 0) + 2 + ) + (-> s5-3 ppointer) + ) + ) + (let ((s5-4 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-4 + (let ((t9-27 (method-of-type plant-boss-arm activate))) + (t9-27 (the-as plant-boss-arm s5-4) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-4 + plant-boss-vine-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x 38912.0 :z 8192.0 :w 1.0)) + (new 'static 'vector :y 14563.556) + (-> (new 'static 'array float 1 1.0) 0) + 3 + ) + (-> s5-4 ppointer) + ) + ) + (let ((s5-5 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-5 + (let ((t9-30 (method-of-type plant-boss-arm activate))) + (t9-30 (the-as plant-boss-arm s5-5) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-5 + plant-boss-vine-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x -40960.0 :z 8192.0 :w 1.0)) + (new 'static 'vector :y -5461.3335) + (-> (new 'static 'array float 1 1.0) 0) + 3 + ) + (-> s5-5 ppointer) + ) + ) + (let ((s5-6 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-6 + (let ((t9-33 (method-of-type plant-boss-arm activate))) + (t9-33 (the-as plant-boss-arm s5-6) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-6 + plant-boss-vine-init + (vector+! + (new-stack-vector0) + (-> obj root-override trans) + (new 'static 'vector :x -29491.2 :z -7168.0 :w 1.0) + ) + (new 'static 'vector :x -1820.4445 :y -11286.756) + (-> (new 'static 'array float 1 0.8) 0) + 3 + ) + (-> s5-6 ppointer) + ) + ) + (let ((s5-7 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-7 + (let ((t9-36 (method-of-type plant-boss-arm activate))) + (t9-36 (the-as plant-boss-arm s5-7) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-7 + plant-boss-vine-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x 32768.0 :z -3072.0 :w 1.0)) + (new 'static 'vector :x -910.2222 :y 22755.555) + (-> (new 'static 'array float 1 0.8) 0) + 3 + ) + (-> s5-7 ppointer) + ) + ) + (let ((s5-8 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-8 + (let ((t9-39 (method-of-type plant-boss-arm activate))) + (t9-39 (the-as plant-boss-arm s5-8) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-8 + plant-boss-root-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x 18841.6 :z 4096.0 :w 1.0)) + (new 'static 'vector :y -4096.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + 4 + ) + (-> s5-8 ppointer) + ) + ) + (let ((s5-9 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-9 + (let ((t9-42 (method-of-type plant-boss-arm activate))) + (t9-42 (the-as plant-boss-arm s5-9) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-9 + plant-boss-root-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :x -18841.6 :z 4096.0 :w 1.0)) + (new 'static 'vector :x 364.0889 :y 4096.0) + (new 'static 'vector :x 1.0 :y 1.25 :z 1.0) + 4 + ) + (-> s5-9 ppointer) + ) + ) + (let ((s5-10 (get-process *default-dead-pool* plant-boss-arm #x4000))) + (when s5-10 + (let ((t9-45 (method-of-type plant-boss-arm activate))) + (t9-45 (the-as plant-boss-arm s5-10) obj 'plant-boss-arm (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-10 + plant-boss-root-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :z -2048.0 :w 1.0)) + (new 'static 'vector :x 1820.4445) + (new 'static 'vector :x 0.9 :y 1.5 :z 1.0) + 4 + ) + (-> s5-10 ppointer) + ) + ) + (let ((s5-11 (get-process *default-dead-pool* plant-boss-leaf #x4000))) + (set! (-> obj leaf 0) + (the-as + (pointer plant-boss-leaf) + (when s5-11 + (let ((t9-48 (method-of-type plant-boss-leaf activate))) + (t9-48 (the-as plant-boss-leaf s5-11) obj 'plant-boss-leaf (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-11 + plant-boss-leaf-init + (vector+! (new-stack-vector0) (-> obj root-override trans) (new 'static 'vector :w 1.0)) + (-> (new 'static 'array float 1 0.0) 0) + 0 + ) + (-> s5-11 ppointer) + ) + ) + ) + ) + (let ((s5-12 (get-process *default-dead-pool* plant-boss-leaf #x4000))) + (set! (-> obj leaf 1) + (the-as + (pointer plant-boss-leaf) + (when s5-12 + (let ((t9-51 (method-of-type plant-boss-leaf activate))) + (t9-51 (the-as plant-boss-leaf s5-12) obj 'plant-boss-leaf (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-12 + plant-boss-leaf-init + (vector+! + (new-stack-vector0) + (-> obj root-override trans) + (new 'static 'vector :x -13189.12 :y 2838.528 :z 12288.0 :w 1.0) + ) + (-> (new 'static 'array float 1 0.0) 0) + 1 + ) + (-> s5-12 ppointer) + ) + ) + ) + ) + (set! (-> obj energy) 0.25) + (set! (-> obj health) 3.0) + (set! (-> obj cam-tracker) (the-as handle #f)) + (set! (-> obj camera) (the-as handle #f)) + (set! (-> obj money) (the-as handle #f)) + (set! (-> obj try-inc) #f) + (set! (-> obj neck) (new 'process 'joint-mod (joint-mod-handler-mode flex-blend) obj 13)) + (set-vector! + (-> obj neck twist-max) + 3640.889 + (-> (new 'static 'array float 1 8192.0) 0) + 0.0 + (-> (new 'static 'array float 1 1.0) 0) + ) + (set! (-> obj neck up) (the-as uint 0)) + (set! (-> obj neck nose) (the-as uint 1)) + (set! (-> obj neck ear) (the-as uint 2)) + (set! (-> obj body) (new 'process 'joint-mod (joint-mod-handler-mode flex-blend) obj 4)) + (set-vector! + (-> obj body twist-max) + 0.0 + (-> (new 'static 'array float 1 8192.0) 0) + 0.0 + (-> (new 'static 'array float 1 1.0) 0) + ) + (set! (-> obj body up) (the-as uint 1)) + (set! (-> obj body nose) (the-as uint 0)) + (set! (-> obj body ear) (the-as uint 2)) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete))) + (go plant-boss-dead #t) + ) + (go plant-boss-far-idle) + (none) + ) diff --git a/test/offline/config.jsonc b/test/offline/config.jsonc index a5a81f3ee3..47bd9a8c1e 100644 --- a/test/offline/config.jsonc +++ b/test/offline/config.jsonc @@ -195,6 +195,9 @@ ], "manipy-idle": [ "code" // handle casts + ], + "plant-boss-intro": [ + "code" // cfg ] } }