From a75ecf176eb146abd0ba7040b3e0a67c499dcdaf Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Tue, 4 Jan 2022 23:10:53 -0500 Subject: [PATCH] decomp: finish `orbit-plat` and `sage-finalboss` (#1039) * decomp: finish `orbit-plat` and waiting on `sage-finalboss` inconsistency for gsrc * decomp: finish `sage-finalboss` except the relocate method * decomp: add fix to finish `sage-finalboss` * update formatting in unrelated files --- common/type_system/TypeSystem.cpp | 2 +- decompiler/IR2/FormExpressionAnalysis.cpp | 2 + decompiler/config/all-types.gc | 18 +- .../jak1_ntsc_black_label/type_casts.jsonc | 31 +- .../jak1_ntsc_black_label/var_names.jsonc | 6 - goal_src/levels/finalboss/light-eco.gc | 1589 +++++++---------- .../levels/finalboss/sage-finalboss-FIN.gc | 1159 ++++++++++++ goal_src/levels/sunken/orbit-plat.gc | 919 ++++++++++ sage-finalboss-FIN.manual_restore_reminder | 0 scripts/update-goal-src.py | 3 +- .../reference/engine/anim/bones-h_REF.gc | 3 +- .../engine/collide/collide-touch-h_REF.gc | 3 +- .../reference/engine/debug/anim-tester_REF.gc | 3 +- .../reference/engine/gfx/hw/display-h_REF.gc | 3 +- .../reference/engine/gfx/sky/sky-h_REF.gc | 3 +- .../reference/engine/math/vector-h_REF.gc | 3 +- .../reference/engine/sound/gsound_REF.gc | 3 +- .../reference/engine/util/sync-info-h_REF.gc | 3 +- .../reference/levels/beach/twister_REF.gc | 3 +- .../levels/common/battlecontroller_REF.gc | 3 +- .../levels/finalboss/light-eco_REF.gc | 4 + .../finalboss/sage-finalboss-FIN_REF.gc | 1237 +++++++++++++ .../reference/levels/jungle/fisher-JUN_REF.gc | 3 +- .../levels/jungle/junglesnake_REF.gc | 6 +- .../reference/levels/sunken/orbit-plat_REF.gc | 967 ++++++++++ test/offline/config.jsonc | 6 +- 26 files changed, 5013 insertions(+), 969 deletions(-) create mode 100644 sage-finalboss-FIN.manual_restore_reminder create mode 100644 test/decompiler/reference/levels/finalboss/sage-finalboss-FIN_REF.gc create mode 100644 test/decompiler/reference/levels/sunken/orbit-plat_REF.gc diff --git a/common/type_system/TypeSystem.cpp b/common/type_system/TypeSystem.cpp index 7d1bfe7405..1d738a40c6 100644 --- a/common/type_system/TypeSystem.cpp +++ b/common/type_system/TypeSystem.cpp @@ -1615,7 +1615,7 @@ std::string TypeSystem::generate_deftype_footer(const Type* type) const { result.append(" :pack-me\n"); } if (as_structure->is_allowed_misalign()) { - result.append(" :allow-misaligned"); + result.append(" :allow-misaligned\n"); } } diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index cd0ee3421d..cb05c3fecb 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -4881,6 +4881,8 @@ void ArrayFieldAccess::update_with_val(Form* new_val, {reg0_matcher, Matcher::integer(m_expected_stride)}); mult_matcher = Matcher::match_or({Matcher::cast("uint", mult_matcher), mult_matcher}); auto matcher = Matcher::fixed_op(FixedOperatorKind::ADDITION, {mult_matcher, reg1_matcher}); + matcher = Matcher::match_or({matcher, Matcher::fixed_op(FixedOperatorKind::ADDITION_PTR, + {reg1_matcher, mult_matcher})}); auto match_result = match(matcher, new_val); Form* idx = nullptr; Form* base = nullptr; diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 252353491f..bfea5ba4b8 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -27171,10 +27171,10 @@ ((part sparticle-launch-control :offset-assert 0) (active symbol :offset-assert 4) ) + :allow-misaligned :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 - :allow-misaligned ) (deftype sage-finalboss (process-taskable) @@ -33051,6 +33051,8 @@ (:methods (dummy-20 (_type_ vector vector) none 20) ) + (:states + orbit-plat-bottom-idle) ) (deftype orbit-plat (baseplat) @@ -33070,6 +33072,13 @@ (dummy-27 (_type_) symbol 27) (dummy-28 (_type_) symbol 28) ) + (:states + orbit-plat-wait-for-other + orbit-plat-idle + orbit-plat-riding + orbit-plat-rotating + orbit-plat-still + orbit-plat-reset) ) ;; - Functions @@ -33081,14 +33090,7 @@ ;; - Unknowns (define-extern *orbit-plat-sg* skeleton-group) -(define-extern orbit-plat-wait-for-other (state orbit-plat)) ;; unknown type -(define-extern orbit-plat-idle (state orbit-plat)) ;; unknown type -(define-extern orbit-plat-riding (state orbit-plat)) ;; unknown type -(define-extern orbit-plat-rotating (state orbit-plat)) ;; unknown type -(define-extern orbit-plat-still (state orbit-plat)) ;; unknown type -(define-extern orbit-plat-reset (state orbit-plat)) ;; unknown type (define-extern *orbit-plat-bottom-sg* skeleton-group) -(define-extern orbit-plat-bottom-idle (state orbit-plat-bottom)) ;; unknown type ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index cdb402b2db..32810cc2f1 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -4002,23 +4002,26 @@ "(method 32 sage-finalboss)": [ [[241, 245], "v1", "manipy"], - [[309, 313], "v1", "manipy"] + [[309, 313], "v1", "manipy"], + [313, "v1", "silodoor"] ], "(trans play-anim sage-finalboss)": [ - [[179, 183], "a0", "manipy"], - [[216, 220], "a0", "manipy"], - [[295, 299], "a1", "manipy"], - [[334, 338], "a1", "manipy"], - [[371, 375], "a1", "manipy"], - [391, "v0", "final-door"], - [396, "v0", "final-door"] - ], - - "(method 7 sage-finalboss)": [ - [2, "v1", "(inline-array sage-finalboss-particle)"], - [6, "v1", "(inline-array sage-finalboss-particle)"], - [10, "v1", "(inline-array sage-finalboss-particle)"] + [186, "v1", "process-drawable"], + [223, "v1", "process-drawable"], + [300, "v1", "process-drawable"], + [339, "v1", "process-drawable"], + [376, "v1", "process-drawable"], + [399, "gp", "final-door"], + [401, "a0", "final-door"] + // [[179, 183], "a0", "manipy"], + // [[182, 187], "v1", "manipy"], + // [[216, 220], "a0", "manipy"], + // [[295, 299], "a1", "manipy"], + // [[334, 338], "a1", "manipy"], + // [[371, 375], "a1", "manipy"], + // [391, "v0", "final-door"], + // [396, "v0", "final-door"] ], "(trans fisher-done)": [[[41, 46], "v1", "dma-packet"]], diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index e85211bf95..d67ef03b49 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -3607,12 +3607,6 @@ } }, - "(method 7 sage-finalboss)": { - "vars": { - "v1-0": ["v1-0", "(inline-array sage-finalboss-particle)"] - } - }, - "(code robotboss-white-eco-movie)": { "vars": { "gp-1": ["gp-1", "handle"] diff --git a/goal_src/levels/finalboss/light-eco.gc b/goal_src/levels/finalboss/light-eco.gc index 34bee770f6..00d5b393f7 100644 --- a/goal_src/levels/finalboss/light-eco.gc +++ b/goal_src/levels/finalboss/light-eco.gc @@ -72,489 +72,412 @@ :longest-edge (meters 0) ) -(set! - (-> *part-group-id-table* 690) - (new 'static 'sparticle-launch-group - :length 4 - :duration #xbb8 - :linger-duration #x5dc - :flags (sp-group-flag use-local-clock) - :name "group-light-eco-mother-growing" - :launcher - (new 'static 'inline-array sparticle-group-item 4 - (sp-item 2902) - (sp-item 2900) - (sp-item 2897) - (sp-item 2898) - ) - :bounds (new 'static 'sphere :w 131072.0) - ) - ) - -(set! - (-> *part-id-table* 2897) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 19 - (sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2)) - (sp-flt spt-num 0.5) - (sp-rnd-flt spt-scale-x (meters 10.5) (meters 4.5) 1.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 2.1) (meters 1.8) 1.0) - (sp-rnd-int spt-r 0 1 255.0) - (sp-rnd-int spt-g 0 1 255.0) - (sp-rnd-int spt-b 0 1 255.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 0.35555556) - (sp-int spt-timer 300) - (sp-cpuinfo-flags bit2 bit3 bit14) - (sp-int spt-next-time 90) - (sp-launcher-by-id spt-next-launcher 2899) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2899) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 2 - (sp-flt spt-fade-a -0.53333336) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2898) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 18 - (sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2)) - (sp-flt spt-num 0.06) - (sp-rnd-flt spt-scale-x (meters 20.0) (meters 4.5) 1.0) - (sp-int spt-rot-x 4) - (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) - (sp-flt spt-scale-y (meters 1.2)) - (sp-rnd-int spt-r 0 1 255.0) - (sp-rnd-int spt-g 0 1 255.0) - (sp-rnd-int spt-b 0 1 255.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-fade-a 0.32) - (sp-int spt-timer 300) - (sp-cpuinfo-flags bit2 bit3 bit14) - (sp-int spt-next-time 75) - (sp-launcher-by-id spt-next-launcher 232) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2900) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 22 - (sp-tex spt-texture (new 'static 'texture-id :page #x2)) - (sp-rnd-flt spt-num 0.05 0.05 1.0) - (sp-rnd-flt spt-x (meters -0.001) (meters 0.002) 1.0) - (sp-rnd-flt spt-y (meters -0.001) (meters 0.002) 1.0) - (sp-rnd-flt spt-z -4.096 8.192 1.0) - (sp-rnd-flt spt-scale-x (meters 10.0) (meters 5.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-rnd-flt spt-r 192.0 64.0 1.0) - (sp-rnd-flt spt-g 192.0 64.0 1.0) - (sp-rnd-flt spt-b 192.0 64.0 1.0) - (sp-flt spt-a 0.0) - (sp-flt spt-vel-y (meters 0.0)) - (sp-flt spt-scalevel-x (meters 0.016666668)) - (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.21333334) - (sp-int spt-timer 600) - (sp-cpuinfo-flags bit2 bit3) - (sp-int-plain-rnd spt-next-time 240 59 1) - (sp-launcher-by-id spt-next-launcher 2901) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2901) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 2 - (sp-flt spt-fade-a -0.21333334) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2902) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 23 - (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) - (sp-rnd-flt spt-num 1.0 8.0 1.0) - (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.2) 1.0) - (sp-copy-from-other spt-scale-y -4) - (sp-rnd-flt spt-r 192.0 64.0 1.0) - (sp-rnd-flt spt-g 192.0 64.0 1.0) - (sp-rnd-flt spt-b 192.0 64.0 1.0) - (sp-rnd-flt spt-a 32.0 64.0 1.0) - (sp-rnd-flt spt-vel-y (meters 0.10666667) (meters 0.21333334) 1.0) - (sp-flt spt-scalevel-x (meters -0.00083333335)) - (sp-copy-from-other spt-scalevel-y -4) - (sp-rnd-flt spt-accel-y -6.826667 -2.7306666 1.0) - (sp-flt spt-friction 0.9) - (sp-int-plain-rnd spt-timer 30 149 1) - (sp-cpuinfo-flags bit0 bit2 bit3) - (sp-flt spt-userdata 1638400.0) - (sp-func spt-func 'check-drop-level-lighteco-big-pops) - (sp-int-plain-rnd spt-next-time 45 299 1) - (sp-launcher-by-id spt-next-launcher 2903) - (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) - (sp-rnd-flt spt-conerot-y (degrees -1440.0) (degrees 2880.0) 1.0) - (sp-flt spt-conerot-radius (meters 4.0)) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2903) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 2 - (sp-flt spt-userdata 2252800.0) - (sp-end) - ) - ) - ) - -(defun - check-drop-level-lighteco-big-pops - ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) - (when (< (-> arg2 y) (-> arg1 user-float)) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (sp-kill-particle arg0 arg1) - (set-vector! gp-0 (-> arg2 x) (-> arg2 y) (-> arg2 z) 1.0) - (sp-launch-particles-var - *sp-particle-system-2d* - (-> *part-id-table* 2904) - gp-0 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 - ) - (sp-launch-particles-var - *sp-particle-system-2d* - (-> *part-id-table* 2905) - gp-0 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 - ) - ) - ) - (none) - ) - -(set! - (-> *part-id-table* 2905) - (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-rnd-flt spt-scale-x (meters 1.0) (meters 0.4) 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 255.0) - (sp-flt spt-g 255.0) - (sp-flt spt-b 255.0) - (sp-rnd-flt spt-a 16.0 32.0 1.0) - (sp-flt spt-fade-a -1.92) - (sp-int spt-timer 20) - (sp-cpuinfo-flags bit2 bit3) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2904) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 16 - (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) - (sp-rnd-flt spt-num 4.0 4.0 1.0) - (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.2) 1.0) - (sp-copy-from-other spt-scale-y -4) - (sp-rnd-flt spt-r 192.0 64.0 1.0) - (sp-rnd-flt spt-g 192.0 64.0 1.0) - (sp-rnd-flt spt-b 192.0 64.0 1.0) - (sp-rnd-flt spt-a 32.0 64.0 1.0) - (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.053333335) 1.0) - (sp-rnd-flt spt-accel-y -6.826667 -2.7306666 1.0) - (sp-flt spt-friction 0.85) - (sp-int-plain-rnd spt-timer 15 119 1) - (sp-cpuinfo-flags bit2 bit3) - (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) - (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) - (sp-end) - ) - ) - ) - -(set! - (-> *part-group-id-table* 691) - (new 'static 'sparticle-launch-group - :length 4 - :duration #xbb8 - :linger-duration #x5dc - :flags (sp-group-flag use-local-clock) - :name "group-light-eco-mother" - :launcher - (new 'static 'inline-array sparticle-group-item 4 - (sp-item 2902) - (sp-item 2900) - (sp-item 2897) - (sp-item 2898) - ) - :bounds (new 'static 'sphere :w 131072.0) - ) - ) - -(set! - (-> *part-group-id-table* 692) - (new 'static 'sparticle-launch-group - :length 2 - :duration #xbb8 - :linger-duration #x5dc - :flags (sp-group-flag use-local-clock) - :name "group-light-eco-child" - :launcher - (new 'static 'inline-array sparticle-group-item 2 - (sp-item 2906) - (sp-item 2907) - ) - :bounds (new 'static 'sphere :w 16384.0) - ) - ) - -(set! - (-> *part-id-table* 2907) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 22 - (sp-tex spt-texture (new 'static 'texture-id :page #x2)) - (sp-rnd-flt spt-num 0.025 0.025 1.0) - (sp-rnd-flt spt-x (meters -0.001) (meters 0.002) 1.0) - (sp-rnd-flt spt-y (meters -0.001) (meters 0.002) 1.0) - (sp-rnd-flt spt-z -4.096 8.192 1.0) - (sp-rnd-flt spt-scale-x (meters 2.0) (meters 0.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 192.0 64.0 1.0) - (sp-rnd-flt spt-g 192.0 64.0 1.0) - (sp-rnd-flt spt-b 192.0 64.0 1.0) - (sp-flt spt-a 0.0) - (sp-flt spt-vel-y (meters 0.0)) - (sp-flt spt-scalevel-x (meters 0.006666667)) - (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.85333335) - (sp-int spt-timer 300) - (sp-cpuinfo-flags bit2 bit3) - (sp-int-plain-rnd spt-next-time 120 29 1) - (sp-launcher-by-id spt-next-launcher 2908) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2908) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 2 - (sp-flt spt-fade-a -0.85333335) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2906) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 22 - (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) - (sp-rnd-flt spt-num 1.0 2.0 1.0) - (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.3) 1.0) - (sp-copy-from-other spt-scale-y -4) - (sp-rnd-flt spt-r 192.0 64.0 1.0) - (sp-rnd-flt spt-g 192.0 64.0 1.0) - (sp-rnd-flt spt-b 192.0 64.0 1.0) - (sp-rnd-flt spt-a 32.0 64.0 1.0) - (sp-rnd-flt spt-vel-y (meters 0.10666667) (meters 0.21333334) 1.0) - (sp-flt spt-scalevel-x (meters -0.00083333335)) - (sp-copy-from-other spt-scalevel-y -4) - (sp-rnd-flt spt-accel-y -6.826667 -2.7306666 1.0) - (sp-flt spt-friction 0.5) - (sp-int-plain-rnd spt-timer 30 149 1) - (sp-cpuinfo-flags bit0 bit2 bit3) - (sp-flt spt-userdata 1638400.0) - (sp-func spt-func 'check-drop-level-lighteco-pops) - (sp-int-plain-rnd spt-next-time 45 299 1) - (sp-launcher-by-id spt-next-launcher 2909) - (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) - (sp-rnd-flt spt-conerot-y (degrees -1440.0) (degrees 2880.0) 1.0) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2909) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 2 - (sp-flt spt-userdata 2048000.0) - (sp-end) - ) - ) - ) - -(defun - check-drop-level-lighteco-pops - ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) - (when (< (-> arg2 y) (-> arg1 user-float)) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (sp-kill-particle arg0 arg1) - (set-vector! gp-0 (-> arg2 x) (-> arg2 y) (-> arg2 z) 1.0) - (sp-launch-particles-var - *sp-particle-system-2d* - (-> *part-id-table* 2910) - gp-0 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 - ) - (sp-launch-particles-var - *sp-particle-system-2d* - (-> *part-id-table* 2911) - gp-0 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 - ) - ) - ) - (none) - ) - -(set! - (-> *part-id-table* 2911) - (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-rnd-flt spt-scale-x (meters 1.0) (meters 0.4) 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 255.0) - (sp-flt spt-g 255.0) - (sp-flt spt-b 255.0) - (sp-rnd-flt spt-a 16.0 32.0 1.0) - (sp-flt spt-fade-a -1.92) - (sp-int spt-timer 20) - (sp-cpuinfo-flags bit2 bit3) - (sp-end) - ) - ) - ) - -(set! - (-> *part-id-table* 2910) - (new 'static 'sparticle-launcher - :init-specs - (new 'static 'inline-array sp-field-init-spec 16 - (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) - (sp-rnd-flt spt-num 4.0 4.0 1.0) - (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.2) 1.0) - (sp-copy-from-other spt-scale-y -4) - (sp-rnd-flt spt-r 192.0 64.0 1.0) - (sp-rnd-flt spt-g 192.0 64.0 1.0) - (sp-rnd-flt spt-b 192.0 64.0 1.0) - (sp-rnd-flt spt-a 32.0 64.0 1.0) - (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.053333335) 1.0) - (sp-rnd-flt spt-accel-y -6.826667 -2.7306666 1.0) - (sp-flt spt-friction 0.85) - (sp-int-plain-rnd spt-timer 15 119 1) - (sp-cpuinfo-flags bit2 bit3) - (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) - (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) - (sp-end) - ) - ) - ) - -(defbehavior - light-eco-child-default-event-handler light-eco-child - ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (case arg2 - (('touch 'attack) - (when (= (-> arg0 type) target) - (send-event - (ppointer->process (-> self parent)) - 'trigger - (-> self angle-bit) - ) - (go light-eco-child-grabbed) +(set! (-> *part-group-id-table* 690) + (new 'static 'sparticle-launch-group + :length 4 + :duration #xbb8 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-light-eco-mother-growing" + :launcher + (new 'static 'inline-array sparticle-group-item 4 (sp-item 2902) (sp-item 2900) (sp-item 2897) (sp-item 2898)) + :bounds (new 'static 'sphere :w 131072.0) + ) ) + +(set! (-> *part-id-table* 2897) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 19 + (sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-scale-x (meters 10.5) (meters 4.5) 1.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 2.1) (meters 1.8) 1.0) + (sp-rnd-int spt-r 0 1 255.0) + (sp-rnd-int spt-g 0 1 255.0) + (sp-rnd-int spt-b 0 1 255.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 0.35555556) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 2899) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2899) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-fade-a -0.53333336) (sp-end)) + ) + ) + +(set! (-> *part-id-table* 2898) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 18 + (sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2)) + (sp-flt spt-num 0.06) + (sp-rnd-flt spt-scale-x (meters 20.0) (meters 4.5) 1.0) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 1.2)) + (sp-rnd-int spt-r 0 1 255.0) + (sp-rnd-int spt-g 0 1 255.0) + (sp-rnd-int spt-b 0 1 255.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-fade-a 0.32) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit3 bit14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 232) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2900) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 22 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-rnd-flt spt-num 0.05 0.05 1.0) + (sp-rnd-flt spt-x (meters -0.001) (meters 0.002) 1.0) + (sp-rnd-flt spt-y (meters -0.001) (meters 0.002) 1.0) + (sp-rnd-flt spt-z -4.096 8.192 1.0) + (sp-rnd-flt spt-scale-x (meters 10.0) (meters 5.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-rnd-flt spt-r 192.0 64.0 1.0) + (sp-rnd-flt spt-g 192.0 64.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-flt spt-a 0.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-flt spt-scalevel-x (meters 0.016666668)) + (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.21333334) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3) + (sp-int-plain-rnd spt-next-time 240 59 1) + (sp-launcher-by-id spt-next-launcher 2901) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2901) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-fade-a -0.21333334) (sp-end)) + ) + ) + +(set! (-> *part-id-table* 2902) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-rnd-flt spt-num 1.0 8.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.2) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 192.0 64.0 1.0) + (sp-rnd-flt spt-g 192.0 64.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.10666667) (meters 0.21333334) 1.0) + (sp-flt spt-scalevel-x (meters -0.00083333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -6.826667 -2.7306666 1.0) + (sp-flt spt-friction 0.9) + (sp-int-plain-rnd spt-timer 30 149 1) + (sp-cpuinfo-flags bit0 bit2 bit3) + (sp-flt spt-userdata 1638400.0) + (sp-func spt-func 'check-drop-level-lighteco-big-pops) + (sp-int-plain-rnd spt-next-time 45 299 1) + (sp-launcher-by-id spt-next-launcher 2903) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees -1440.0) (degrees 2880.0) 1.0) + (sp-flt spt-conerot-radius (meters 4.0)) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2903) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-userdata 2252800.0) (sp-end)) + ) + ) + +(defun check-drop-level-lighteco-big-pops ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (< (-> arg2 y) (-> arg1 user-float)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (sp-kill-particle arg0 arg1) + (set-vector! gp-0 (-> arg2 x) (-> arg2 y) (-> arg2 z) 1.0) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 2904) + gp-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 2905) + gp-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + (none) + ) + +(set! (-> *part-id-table* 2905) (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-rnd-flt spt-scale-x (meters 1.0) (meters 0.4) 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 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-flt spt-fade-a -1.92) + (sp-int spt-timer 20) + (sp-cpuinfo-flags bit2 bit3) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2904) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 16 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-rnd-flt spt-num 4.0 4.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.2) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 192.0 64.0 1.0) + (sp-rnd-flt spt-g 192.0 64.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.053333335) 1.0) + (sp-rnd-flt spt-accel-y -6.826667 -2.7306666 1.0) + (sp-flt spt-friction 0.85) + (sp-int-plain-rnd spt-timer 15 119 1) + (sp-cpuinfo-flags bit2 bit3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-group-id-table* 691) + (new 'static 'sparticle-launch-group + :length 4 + :duration #xbb8 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-light-eco-mother" + :launcher + (new 'static 'inline-array sparticle-group-item 4 (sp-item 2902) (sp-item 2900) (sp-item 2897) (sp-item 2898)) + :bounds (new 'static 'sphere :w 131072.0) + ) + ) + +(set! (-> *part-group-id-table* 692) + (new 'static 'sparticle-launch-group + :length 2 + :duration #xbb8 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-light-eco-child" + :launcher + (new 'static 'inline-array sparticle-group-item 2 (sp-item 2906) (sp-item 2907)) + :bounds (new 'static 'sphere :w 16384.0) + ) + ) + +(set! (-> *part-id-table* 2907) + (new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 22 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-rnd-flt spt-num 0.025 0.025 1.0) + (sp-rnd-flt spt-x (meters -0.001) (meters 0.002) 1.0) + (sp-rnd-flt spt-y (meters -0.001) (meters 0.002) 1.0) + (sp-rnd-flt spt-z -4.096 8.192 1.0) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 0.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 192.0 64.0 1.0) + (sp-rnd-flt spt-g 192.0 64.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-flt spt-a 0.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-flt spt-scalevel-x (meters 0.006666667)) + (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.85333335) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit3) + (sp-int-plain-rnd spt-next-time 120 29 1) + (sp-launcher-by-id spt-next-launcher 2908) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2908) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-fade-a -0.85333335) (sp-end)) + ) + ) + +(set! (-> *part-id-table* 2906) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 22 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-rnd-flt spt-num 1.0 2.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.3) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 192.0 64.0 1.0) + (sp-rnd-flt spt-g 192.0 64.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.10666667) (meters 0.21333334) 1.0) + (sp-flt spt-scalevel-x (meters -0.00083333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -6.826667 -2.7306666 1.0) + (sp-flt spt-friction 0.5) + (sp-int-plain-rnd spt-timer 30 149 1) + (sp-cpuinfo-flags bit0 bit2 bit3) + (sp-flt spt-userdata 1638400.0) + (sp-func spt-func 'check-drop-level-lighteco-pops) + (sp-int-plain-rnd spt-next-time 45 299 1) + (sp-launcher-by-id spt-next-launcher 2909) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees -1440.0) (degrees 2880.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2909) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 (sp-flt spt-userdata 2048000.0) (sp-end)) + ) + ) + +(defun check-drop-level-lighteco-pops ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (< (-> arg2 y) (-> arg1 user-float)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (sp-kill-particle arg0 arg1) + (set-vector! gp-0 (-> arg2 x) (-> arg2 y) (-> arg2 z) 1.0) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 2910) + gp-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 2911) + gp-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + (none) + ) + +(set! (-> *part-id-table* 2911) (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-rnd-flt spt-scale-x (meters 1.0) (meters 0.4) 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 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-flt spt-fade-a -1.92) + (sp-int spt-timer 20) + (sp-cpuinfo-flags bit2 bit3) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 2910) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 16 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-rnd-flt spt-num 4.0 4.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.2) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 192.0 64.0 1.0) + (sp-rnd-flt spt-g 192.0 64.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.053333335) 1.0) + (sp-rnd-flt spt-accel-y -6.826667 -2.7306666 1.0) + (sp-flt spt-friction 0.85) + (sp-int-plain-rnd spt-timer 15 119 1) + (sp-cpuinfo-flags bit2 bit3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(defbehavior light-eco-child-default-event-handler light-eco-child ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touch 'attack) + (when (= (-> arg0 type) target) + (send-event (ppointer->process (-> self parent)) 'trigger (-> self angle-bit)) + (go light-eco-child-grabbed) + ) ) - ) + ) ) (defmethod common-trans light-eco-child ((obj light-eco-child)) (let ((v1-1 (-> *display* base-frame-counter))) - (when (!= v1-1 (-> obj last-update-time)) - (set! (-> obj last-update-time) v1-1) - (let* ((s5-0 (new 'stack-no-clear 'vector)) - (s4-0 (-> obj rot)) - (f30-0 (-> s4-0 w)) - ) - (vector-v++! s4-0 (-> obj rotv)) - (set! - (-> s4-0 w) - (+ f30-0 (* (-> obj rotv w) (-> *display* seconds-per-frame))) + (when (!= v1-1 (-> obj last-update-time)) + (set! (-> obj last-update-time) v1-1) + (let* ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (-> obj rot)) + (f30-0 (-> s4-0 w)) + ) + (vector-v++! s4-0 (-> obj rotv)) + (set! (-> s4-0 w) (+ f30-0 (* (-> obj rotv w) (-> *display* seconds-per-frame)))) + (set-vector! s5-0 (cos (-> s4-0 x)) (cos (-> s4-0 y)) (cos (-> s4-0 z)) 1.0) + (vector-normalize! s5-0 1.0) + (quaternion-vector-angle! (-> obj root-override quat) s5-0 f30-0) + ) + (spawn (-> obj part) (-> obj root-override trans)) ) - (set-vector! - s5-0 - (cos (-> s4-0 x)) - (cos (-> s4-0 y)) - (cos (-> s4-0 z)) - 1.0 - ) - (vector-normalize! s5-0 1.0) - (quaternion-vector-angle! (-> obj root-override quat) s5-0 f30-0) - ) - (spawn (-> obj part) (-> obj root-override trans)) ) - ) (none) ) @@ -562,46 +485,32 @@ :event light-eco-child-default-event-handler :enter - (behavior () - (set! (-> self falling-start-time) (-> *display* base-frame-counter)) - (none) - ) + (behavior () (set! (-> self falling-start-time) (-> *display* base-frame-counter)) (none)) :trans (behavior () - (let - ((f30-0 - (fmin - (the - float - (- (-> *display* base-frame-counter) (-> self falling-start-time)) - ) - (-> self traj time) - ) + (let ((f30-0 + (fmin (the float (- (-> *display* base-frame-counter) (-> self falling-start-time))) (-> self traj time)) + ) + ) + (eval-position! (-> self traj) f30-0 (-> self root-override trans)) + (if (= f30-0 (-> self traj time)) + (go light-eco-child-hit-ground) + ) ) - ) - (eval-position! (-> self traj) f30-0 (-> self root-override trans)) - (if (= f30-0 (-> self traj time)) - (go light-eco-child-hit-ground) - ) + (common-trans self) + (none) ) - (common-trans self) - (none) - ) :code (behavior () - (while #t - (suspend) - (let ((a0-0 (-> self skel root-channel 0))) - (set! (-> a0-0 param 0) 1.0) - (joint-control-channel-group-eval! - a0-0 - (the-as art-joint-anim #f) - num-func-loop! + (while #t + (suspend) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 1.0) + (joint-control-channel-group-eval! a0-0 (the-as art-joint-anim #f) num-func-loop!) + ) ) - ) + (none) ) - (none) - ) :post (the-as (function none :behavior light-eco-child) transform-post) ) @@ -610,84 +519,52 @@ :event light-eco-child-default-event-handler :enter - (behavior () - (set! (-> self state-time) (-> *display* base-frame-counter)) - (none) - ) + (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) (none)) :trans (behavior () - (let - ((f30-0 - (+ - (-> self root-override transv y) - (* -544768.0 (-> *display* seconds-per-frame)) - ) + (let ((f30-0 (+ (-> self root-override transv y) (* -544768.0 (-> *display* seconds-per-frame))))) + (when (and (< f30-0 0.0) (>= (-> self ground-y) (-> self root-override trans y))) + (if (>= 4096.0 (fabs f30-0)) + (go light-eco-child-idle) + ) + (set! (-> self root-override transv y) 0.0) + (vector-normalize! (-> self root-override transv) (* 0.25 (vector-xz-length (-> self root-override transv)))) + (set! f30-0 (* 0.35 (- f30-0))) + ) + (set! (-> self root-override transv y) f30-0) ) - ) - (when - (and (< f30-0 0.0) (>= (-> self ground-y) (-> self root-override trans y))) - (if (>= 4096.0 (fabs f30-0)) - (go light-eco-child-idle) + (vector-v+! (-> self root-override trans) (-> self root-override trans) (-> self root-override transv)) + (let ((f0-8 (vector-vector-xz-distance + (-> self root-override trans) + (-> (the-as light-eco-mother (-> self parent 0)) root trans) + ) + ) + ) + (when (< 92610.56 f0-8) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector-! gp-1 (-> self root-override trans) (-> (the-as light-eco-mother (-> self parent 0)) root trans)) + (set! (-> gp-1 y) 0.0) + (vector-normalize! gp-1 92610.56) + (vector+! gp-1 gp-1 (-> (the-as light-eco-mother (-> self parent 0)) root trans)) + (set! (-> gp-1 y) (-> self root-override trans y)) + (set! (-> self root-override trans quad) (-> gp-1 quad)) + ) + ) ) - (set! (-> self root-override transv y) 0.0) - (vector-normalize! - (-> self root-override transv) - (* 0.25 (vector-xz-length (-> self root-override transv))) - ) - (set! f30-0 (* 0.35 (- f30-0))) - ) - (set! (-> self root-override transv y) f30-0) + (common-trans self) + (none) ) - (vector-v+! - (-> self root-override trans) - (-> self root-override trans) - (-> self root-override transv) - ) - (let - ((f0-8 - (vector-vector-xz-distance - (-> self root-override trans) - (-> (the-as light-eco-mother (-> self parent 0)) root trans) - ) - ) - ) - (when (< 92610.56 f0-8) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (vector-! - gp-1 - (-> self root-override trans) - (-> (the-as light-eco-mother (-> self parent 0)) root trans) - ) - (set! (-> gp-1 y) 0.0) - (vector-normalize! gp-1 92610.56) - (vector+! - gp-1 - gp-1 - (-> (the-as light-eco-mother (-> self parent 0)) root trans) - ) - (set! (-> gp-1 y) (-> self root-override trans y)) - (set! (-> self root-override trans quad) (-> gp-1 quad)) - ) - ) - ) - (common-trans self) - (none) - ) :code (behavior () - (while #t - (suspend) - (let ((a0-0 (-> self skel root-channel 0))) - (set! (-> a0-0 param 0) 1.0) - (joint-control-channel-group-eval! - a0-0 - (the-as art-joint-anim #f) - num-func-loop! + (while #t + (suspend) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 1.0) + (joint-control-channel-group-eval! a0-0 (the-as art-joint-anim #f) num-func-loop!) + ) ) - ) + (none) ) - (none) - ) :post (the-as (function none :behavior light-eco-child) transform-post) ) @@ -696,33 +573,26 @@ :event light-eco-child-default-event-handler :enter - (behavior () - (set! (-> self state-time) (-> *display* base-frame-counter)) - (none) - ) + (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) (none)) :trans (behavior () - (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 1200) - (go light-eco-child-die) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 1200) + (go light-eco-child-die) + ) + (common-trans self) + (none) ) - (common-trans self) - (none) - ) :code (behavior () - (while #t - (suspend) - (let ((a0-0 (-> self skel root-channel 0))) - (set! (-> a0-0 param 0) 1.0) - (joint-control-channel-group-eval! - a0-0 - (the-as art-joint-anim #f) - num-func-loop! + (while #t + (suspend) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 1.0) + (joint-control-channel-group-eval! a0-0 (the-as art-joint-anim #f) num-func-loop!) + ) ) - ) + (none) ) - (none) - ) :post (the-as (function none :behavior light-eco-child) transform-post) ) @@ -730,107 +600,80 @@ (defstate light-eco-child-die (light-eco-child) :code (behavior () - (send-event - (ppointer->process (-> self parent)) - 'untrigger - (-> self angle-bit) + (send-event (ppointer->process (-> self parent)) 'untrigger (-> self angle-bit)) + (clear-collide-with-as (-> self root-override)) + (logior! (-> self draw status) (draw-status drwf01)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (until (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + (suspend) + ) + (none) ) - (clear-collide-with-as (-> self root-override)) - (logior! (-> self draw status) 2) - (set! (-> self state-time) (-> *display* base-frame-counter)) - (until (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) - (suspend) - ) - (none) - ) ) (defstate light-eco-child-grabbed (light-eco-child) :code - (behavior () - (suspend) - 0 - (none) - ) + (behavior () (suspend) 0 (none)) ) -(defbehavior - light-eco-child-init-by-other light-eco-child - ((arg0 entity) (arg1 vector) (arg2 vector) (arg3 int)) +(defbehavior light-eco-child-init-by-other light-eco-child ((arg0 entity) (arg1 vector) (arg2 vector) (arg3 int)) (set! (-> self entity) arg0) (set! (-> self angle-bit) arg3) (set! (-> self ground-y) (-> arg2 y)) (set! (-> self last-update-time) 0) (set-vector! - (-> self rotv) - (rand-vu-float-range 5898.24 9539.129) - (rand-vu-float-range 5552.3555 9193.244) - (rand-vu-float-range 6007.467 9648.355) - (rand-vu-float-range 11013.688 18295.467) - ) - (set-vector! - (-> self rot) - (rand-vu-float-range 0.0 65536.0) - (rand-vu-float-range 0.0 65536.0) - (rand-vu-float-range 0.0 65536.0) - (rand-vu-float-range 0.0 65536.0) - ) - (let - ((s4-2 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) - (let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-2 (the-as uint 0)))) - (set! (-> s3-0 prim-core collide-as) (the-as uint 512)) - (set! (-> s3-0 collide-with) (the-as uint 16)) - (set! (-> s3-0 prim-core offense) 0) - (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 4096.0) - (set-root-prim! s4-2 s3-0) + (-> self rotv) + (rand-vu-float-range 5898.24 9539.129) + (rand-vu-float-range 5552.3555 9193.244) + (rand-vu-float-range 6007.467 9648.355) + (rand-vu-float-range 11013.688 18295.467) + ) + (set-vector! + (-> self rot) + (rand-vu-float-range 0.0 65536.0) + (rand-vu-float-range 0.0 65536.0) + (rand-vu-float-range 0.0 65536.0) + (rand-vu-float-range 0.0 65536.0) + ) + (let ((s4-2 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-2 (the-as uint 0)))) + (set! (-> s3-0 prim-core collide-as) (the-as uint 512)) + (set! (-> s3-0 collide-with) (the-as uint 16)) + (set! (-> s3-0 prim-core offense) 0) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 4096.0) + (set-root-prim! s4-2 s3-0) + ) + (set! (-> s4-2 nav-radius) (* 0.75 (-> s4-2 root-prim local-sphere w))) + (backup-collide-with-as s4-2) + (set! (-> self root-override) s4-2) ) - (set! (-> s4-2 nav-radius) (* 0.75 (-> s4-2 root-prim local-sphere w))) - (backup-collide-with-as s4-2) - (set! (-> self root-override) s4-2) - ) (set! (-> self root-override trans quad) (-> arg1 quad)) (set-vector! (-> self root-override scale) 2.0 2.0 2.0 1.0) (quaternion-identity! (-> self root-override quat)) - (setup-from-to-height! - (-> self traj) - (-> self root-override trans) - arg2 - 4096.0 - -4.551111 - ) + (setup-from-to-height! (-> self traj) (-> self root-override trans) arg2 4096.0 -4.551111) (let ((s4-3 (-> self root-override transv))) - (vector-! s4-3 arg2 arg1) - (set! (-> s4-3 y) 0.0) - (vector-normalize! s4-3 163840.0) - (set! (-> s4-3 y) -122880.0) - ) + (vector-! s4-3 arg2 arg1) + (set! (-> s4-3 y) 0.0) + (vector-normalize! s4-3 163840.0) + (set! (-> s4-3 y) -122880.0) + ) (logclear! (-> self mask) (process-mask actor-pause)) (initialize-skeleton self *light-eco-small-sg* '()) (ja-channel-set! 1) (let ((a0-21 (-> self skel root-channel 0))) - (set! - (-> a0-21 param 0) - (the float (+ (-> a0-21 frame-group data 0 length) -1)) + (set! (-> a0-21 param 0) (the float (+ (-> a0-21 frame-group data 0 length) -1))) + (set! (-> a0-21 param 1) 1.0) + (joint-control-channel-group! a0-21 (the-as art-joint-anim #f) num-func-seek!) ) - (set! (-> a0-21 param 1) 1.0) - (joint-control-channel-group! - a0-21 - (the-as art-joint-anim #f) - num-func-seek! - ) - ) (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 5)) - num-func-identity + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 5)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) ) - (set! (-> gp-1 frame-num) 0.0) - ) - (set! - (-> self part) - (create-launch-control (-> *part-group-id-table* 692) self) - ) + (set! (-> self part) (create-launch-control (-> *part-group-id-table* 692) self)) (transform-post) (go light-eco-child-appear) (none) @@ -838,187 +681,129 @@ (defmethod common-trans light-eco-mother ((obj light-eco-mother)) (let ((v1-1 (-> *display* base-frame-counter))) - (when (!= v1-1 (-> obj last-update-time)) - (set! (-> obj last-update-time) v1-1) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (set-vector! - s5-0 - (cos - (* 25.700392 (the float (mod (-> *display* base-frame-counter) 2550))) - ) - (cos - (* 24.59229 (the float (mod (-> *display* base-frame-counter) 2664))) - ) - (cos - (* 26.121408 (the float (mod (-> *display* base-frame-counter) 2508))) - ) - 1.0 - ) - (vector-normalize! s5-0 1.0) - (quaternion-vector-angle! - (-> obj root quat) - s5-0 - (* 48.860058 (the float (mod (-> *display* base-frame-counter) 1341))) - ) - ) - (cond - ((and *target* (logtest? (-> *target* state-flags) 256)) - (set! (-> obj last-spawned-time) (-> *display* base-frame-counter)) - (set! (-> obj delay-til-spawn) 2400) - ) - (else - (when - (>= - (- (-> *display* base-frame-counter) (-> obj last-spawned-time)) - (-> obj delay-til-spawn) + (when (!= v1-1 (-> obj last-update-time)) + (set! (-> obj last-update-time) v1-1) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set-vector! + s5-0 + (cos (* 25.700392 (the float (mod (-> *display* base-frame-counter) 2550)))) + (cos (* 24.59229 (the float (mod (-> *display* base-frame-counter) 2664)))) + (cos (* 26.121408 (the float (mod (-> *display* base-frame-counter) 2508)))) + 1.0 + ) + (vector-normalize! s5-0 1.0) + (quaternion-vector-angle! + (-> obj root quat) + s5-0 + (* 48.860058 (the float (mod (-> *display* base-frame-counter) 1341))) + ) ) - (when (spawn-child-eco obj) - (set! (-> obj last-spawned-time) (-> *display* base-frame-counter)) - (set! (-> obj delay-til-spawn) (rand-vu-int-range 300 600)) + (cond + ((and *target* (logtest? (-> *target* state-flags) 256)) + (set! (-> obj last-spawned-time) (-> *display* base-frame-counter)) + (set! (-> obj delay-til-spawn) 2400) + ) + (else + (when (>= (- (-> *display* base-frame-counter) (-> obj last-spawned-time)) (-> obj delay-til-spawn)) + (when (spawn-child-eco obj) + (set! (-> obj last-spawned-time) (-> *display* base-frame-counter)) + (set! (-> obj delay-til-spawn) (rand-vu-int-range 300 600)) + ) + ) + ) ) - ) + (update! (-> obj sound)) + 0 ) - ) - (update! (-> obj sound)) - 0 ) - ) (none) ) (defmethod spawn-child-eco light-eco-mother ((obj light-eco-mother)) (countdown (s3-0 4) - (let ((gp-0 (rand-vu-int-count 32))) - (when (zero? (logand (-> obj angle-mask) (ash 1 gp-0))) - (let ((f28-0 (* 2048.0 (the float gp-0))) - (f30-0 (rand-vu-float-range 61440.0 88514.56)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (set-vector! s4-0 (* (sin f28-0) f30-0) 0.0 (* (cos f28-0) f30-0) 1.0) - (vector+! s4-0 s4-0 (-> obj root trans)) - (set! (-> s4-0 y) 1974272.0) - (when - (or - (not *target*) - (>= (vector-vector-xz-distance s4-0 (target-pos 0)) 49152.0) - ) - (logior! (-> obj angle-mask) (ash 1 gp-0)) - (let ((s3-1 (get-process *default-dead-pool* light-eco-child #x4000))) - (when s3-1 - (let ((t9-7 (method-of-type light-eco-child activate))) - (t9-7 - (the-as light-eco-child s3-1) - obj - 'light-eco-child - (the-as pointer #x70004000) - ) + (let ((gp-0 (rand-vu-int-count 32))) + (when (zero? (logand (-> obj angle-mask) (ash 1 gp-0))) + (let ((f28-0 (* 2048.0 (the float gp-0))) + (f30-0 (rand-vu-float-range 61440.0 88514.56)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (set-vector! s4-0 (* (sin f28-0) f30-0) 0.0 (* (cos f28-0) f30-0) 1.0) + (vector+! s4-0 s4-0 (-> obj root trans)) + (set! (-> s4-0 y) 1974272.0) + (when (or (not *target*) (>= (vector-vector-xz-distance s4-0 (target-pos 0)) 49152.0)) + (logior! (-> obj angle-mask) (ash 1 gp-0)) + (let ((s3-1 (get-process *default-dead-pool* light-eco-child #x4000))) + (when s3-1 + (let ((t9-7 (method-of-type light-eco-child activate))) + (t9-7 (the-as light-eco-child s3-1) obj 'light-eco-child (the-as pointer #x70004000)) + ) + (run-now-in-process s3-1 light-eco-child-init-by-other (-> obj entity) (-> obj root trans) s4-0 gp-0) + (-> s3-1 ppointer) + ) + ) + (return #t) + ) ) - (run-now-in-process - s3-1 - light-eco-child-init-by-other - (-> obj entity) - (-> obj root trans) - s4-0 - gp-0 - ) - (-> s3-1 ppointer) - ) ) - (return #t) - ) ) - ) ) - ) #f ) -(defbehavior - light-eco-mother-default-event-handler light-eco-mother - ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) +(defbehavior light-eco-mother-default-event-handler light-eco-mother ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (let ((v1-0 arg2)) - (the-as int (cond - ((= v1-0 'untrigger) - (the-as int (when (= (-> arg0 type) light-eco-child) - (let* ((a1-3 (-> arg3 param 0)) - (v0-0 - (logxor (-> self angle-mask) (ash 1 a1-3)) - ) - ) - (set! (-> self angle-mask) v0-0) - v0-0 - ) - ) - ) - ) - ((= v1-0 'trigger) - (the-as int (when (not (-> self player-got-eco?)) - (set! (-> self player-got-eco?) #t) - (let - ((a1-5 - (new 'stack-no-clear 'event-message-block) + (the-as int (cond + ((= v1-0 'untrigger) + (the-as int (when (= (-> arg0 type) light-eco-child) + (let* ((a1-3 (-> arg3 param 0)) + (v0-0 (logxor (-> self angle-mask) (ash 1 a1-3))) + ) + (set! (-> self angle-mask) v0-0) + v0-0 + ) ) - ) - (set! (-> a1-5 from) self) - (set! (-> a1-5 num-params) 0) - (set! (-> a1-5 message) 'white-eco-picked-up) - (the-as - int - (send-event-function - (ppointer->process (-> self parent)) - a1-5 + ) + ) + ((= v1-0 'trigger) + (the-as int (when (not (-> self player-got-eco?)) + (set! (-> self player-got-eco?) #t) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) self) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'white-eco-picked-up) + (the-as int (send-event-function (ppointer->process (-> self parent)) a1-5)) + ) ) - ) - ) - ) + ) + ) + ((= v1-0 'beam-off) + (the-as int (go light-eco-mother-discipate)) + ) ) - ) - ((= v1-0 'beam-off) - (the-as int (go light-eco-mother-discipate)) - ) - ) + ) ) - ) ) (defstate light-eco-mother-appear (light-eco-mother) :event light-eco-mother-default-event-handler :trans - (behavior () - (common-trans self) - (spawn (-> self part2) (-> self root trans)) - (none) - ) + (behavior () (common-trans self) (spawn (-> self part2) (-> self root trans)) (none)) :code (behavior () - (while (!= (-> self root scale x) 12.0) - (let - ((f0-3 - (seek-with-smooth - (-> self root scale x) - 12.0 - (* 6.0 (-> *display* seconds-per-frame)) - 0.25 - 0.001 + (while (!= (-> self root scale x) 12.0) + (let ((f0-3 (seek-with-smooth (-> self root scale x) 12.0 (* 6.0 (-> *display* seconds-per-frame)) 0.25 0.001))) + (set-vector! (-> self root scale) f0-3 f0-3 f0-3 1.0) + ) + (suspend) + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 param 0) 1.0) + (joint-control-channel-group-eval! a0-1 (the-as art-joint-anim #f) num-func-loop!) ) - ) ) - (set-vector! (-> self root scale) f0-3 f0-3 f0-3 1.0) - ) - (suspend) - (let ((a0-1 (-> self skel root-channel 0))) - (set! (-> a0-1 param 0) 1.0) - (joint-control-channel-group-eval! - a0-1 - (the-as art-joint-anim #f) - num-func-loop! - ) - ) + (go light-eco-mother-active) + (none) ) - (go light-eco-mother-active) - (none) - ) :post (the-as (function none :behavior light-eco-mother) ja-post) ) @@ -1027,27 +812,18 @@ :event light-eco-mother-default-event-handler :trans - (behavior () - (common-trans self) - (spawn (-> self part) (-> self root trans)) - 0 - (none) - ) + (behavior () (common-trans self) (spawn (-> self part) (-> self root trans)) 0 (none)) :code (behavior () - (while #t - (suspend) - (let ((a0-0 (-> self skel root-channel 0))) - (set! (-> a0-0 param 0) 1.0) - (joint-control-channel-group-eval! - a0-0 - (the-as art-joint-anim #f) - num-func-loop! + (while #t + (suspend) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 1.0) + (joint-control-channel-group-eval! a0-0 (the-as art-joint-anim #f) num-func-loop!) + ) ) - ) + (none) ) - (none) - ) :post (the-as (function none :behavior light-eco-mother) ja-post) ) @@ -1056,67 +832,45 @@ :event light-eco-mother-default-event-handler :trans - (behavior () - (common-trans self) - (none) - ) + (behavior () (common-trans self) (none)) :code (behavior () - (while (!= (-> self root scale x) 0.0) - (let - ((f0-3 - (seek-with-smooth - (-> self root scale x) - 0.0 - (* 12.0 (-> *display* seconds-per-frame)) - 0.5 - 0.001 + (while (!= (-> self root scale x) 0.0) + (let ((f0-3 (seek-with-smooth (-> self root scale x) 0.0 (* 12.0 (-> *display* seconds-per-frame)) 0.5 0.001))) + (set-vector! (-> self root scale) f0-3 f0-3 f0-3 1.0) + ) + (suspend) + (let ((a0-1 (-> self skel root-channel 0))) + (set! (-> a0-1 param 0) 1.0) + (joint-control-channel-group-eval! a0-1 (the-as art-joint-anim #f) num-func-loop!) ) - ) ) - (set-vector! (-> self root scale) f0-3 f0-3 f0-3 1.0) - ) - (suspend) - (let ((a0-1 (-> self skel root-channel 0))) - (set! (-> a0-1 param 0) 1.0) - (joint-control-channel-group-eval! - a0-1 - (the-as art-joint-anim #f) - num-func-loop! + (logior! (-> self draw status) (draw-status drwf01)) + (until (not (-> self child)) + (suspend) ) - ) + (none) ) - (logior! (-> self draw status) 2) - (until (not (-> self child)) - (suspend) - ) - (none) - ) :post (the-as (function none :behavior light-eco-mother) ja-post) ) (defmethod deactivate light-eco-mother ((obj light-eco-mother)) (if (nonzero? (-> obj part2)) - (kill-and-free-particles (-> obj part2)) - ) + (kill-and-free-particles (-> obj part2)) + ) ((method-of-type projectile deactivate) (the-as projectile obj)) (none) ) (defmethod relocate light-eco-mother ((obj light-eco-mother) (arg0 int)) (if (nonzero? (-> obj part2)) - (&+! (-> obj part2) arg0) - ) - (the-as - light-eco-mother - ((method-of-type projectile relocate) (the-as projectile obj) arg0) - ) + (&+! (-> obj part2) arg0) + ) + (the-as light-eco-mother ((method-of-type projectile relocate) (the-as projectile obj) arg0)) ) -(defbehavior - light-eco-mother-init-by-other light-eco-mother - ((arg0 entity) (arg1 vector)) +(defbehavior light-eco-mother-init-by-other light-eco-mother ((arg0 entity) (arg1 vector)) (set! (-> self entity) arg0) (set! (-> self last-update-time) 0) (set! (-> self last-spawned-time) (-> *display* base-frame-counter)) @@ -1131,55 +885,44 @@ (initialize-skeleton self *light-eco-big-sg* '()) (ja-channel-set! 1) (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 0) (the float (+ (-> a0-7 frame-group data 0 length) -1))) + (set! (-> a0-7 param 1) 1.0) + (joint-control-channel-group! a0-7 (the-as art-joint-anim #f) num-func-seek!) ) - (set! (-> a0-7 param 1) 1.0) - (joint-control-channel-group! a0-7 (the-as art-joint-anim #f) num-func-seek!) - ) (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 2)) - num-func-identity + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 2)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) ) - (set! (-> gp-1 frame-num) 0.0) - ) - (set! - (-> self part) - (create-launch-control (-> *part-group-id-table* 691) self) - ) - (set! - (-> self part2) - (create-launch-control (-> *part-group-id-table* 690) self) - ) - (set! - (-> self sound) - (new - 'process - 'ambient-sound - (new 'static 'sound-spec - :mask #xc0 - :num 1.0 - :group #x1 - :sound-name (static-sound-name "white-eco-lp") - :volume #x400 - :fo-min #x12c - :fo-max #x190 - ) - (-> self root trans) - ) - ) + (set! (-> self part) (create-launch-control (-> *part-group-id-table* 691) self)) + (set! (-> self part2) (create-launch-control (-> *part-group-id-table* 690) self)) + (set! (-> self sound) (new + 'process + 'ambient-sound + (new 'static 'sound-spec + :mask #xc0 + :num 1.0 + :group #x1 + :sound-name (static-sound-name "white-eco-lp") + :volume #x400 + :fo-min #x12c + :fo-max #x190 + ) + (-> self root trans) + ) + ) (ja-post) (let ((f0-4 0.0)) - (countdown (v1-33 4) - (let ((a2-4 (the int (* 0.00048828125 f0-4)))) - (logior! (-> self angle-mask) (ash 1 a2-4)) - ) - (set! f0-4 (+ 16384.0 f0-4)) + (countdown (v1-33 4) + (let ((a2-4 (the int (* 0.00048828125 f0-4)))) + (logior! (-> self angle-mask) (ash 1 a2-4)) + ) + (set! f0-4 (+ 16384.0 f0-4)) + ) ) - ) (go light-eco-mother-appear) (none) ) diff --git a/goal_src/levels/finalboss/sage-finalboss-FIN.gc b/goal_src/levels/finalboss/sage-finalboss-FIN.gc index 24ebb85a9c..116f773b75 100644 --- a/goal_src/levels/finalboss/sage-finalboss-FIN.gc +++ b/goal_src/levels/finalboss/sage-finalboss-FIN.gc @@ -7,3 +7,1162 @@ ;; DECOMP BEGINS +(defskelgroup *robotboss-cinematic-sg* robotboss-cinematic + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 -10 0 2000) + :longest-edge (meters 0) + ) + +(defskelgroup *jak-white-sg* jak-white + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :longest-edge (meters 0) + ) + +(defskelgroup *plat-eco-finalboss-unlit-sg* plat-eco-finalboss + 0 + 8 + ((1 (meters 20)) (2 (meters 40)) (3 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :longest-edge (meters 0) + ) + +(defskelgroup *plat-eco-finalboss-lit-sg* plat-eco-finalboss + 4 + 8 + ((5 (meters 20)) (6 (meters 40)) (7 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :longest-edge (meters 0) + ) + +(deftype plat-eco-finalboss (plat-eco) + ((force-dest float :offset-assert 360) + (targ-dest float :offset-assert 364) + (dest float :offset-assert 368) + (speed float :offset-assert 372) + (touch-time int64 :offset-assert 376) + ) + :heap-base #x110 + :method-count-assert 33 + :size-assert #x180 + :flag-assert #x2101100180 + ) + + +(defmethod get-unlit-skel plat-eco-finalboss ((obj plat-eco-finalboss)) + *plat-eco-finalboss-unlit-sg* + ) + +(defmethod get-lit-skel plat-eco-finalboss ((obj plat-eco-finalboss)) + *plat-eco-finalboss-lit-sg* + ) + +(defmethod dummy-26 plat-eco-finalboss ((obj plat-eco-finalboss)) + (set! (-> obj force-dest) -1.0) + (set! (-> obj targ-dest) -1.0) + (set! (-> obj dest) 0.0) + (set! (-> obj speed) 0.1) + (logclear! (-> obj mask) (process-mask actor-pause)) + (process-entity-status! obj (entity-perm-status bit-3) #t) + (none) + ) + +(defstate plat-path-active (plat-eco-finalboss) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('target) + (process-entity-status! self (entity-perm-status complete) #t) + (let ((f0-0 (the-as float (-> arg3 param 0)))) + (set! (-> self force-dest) f0-0) + f0-0 + ) + ) + (('ridden 'edge-grabbed) + (if (>= (- (-> *display* base-frame-counter) (-> self touch-time)) 600) + (set! (-> self targ-dest) (cond + ((= (-> self path-pos) 0.0) + (set! (-> self force-dest) -1.0) + 0.99 + ) + ((= (-> self path-pos) 0.99) + 0.0 + ) + (else + (-> self targ-dest) + ) + ) + ) + ) + (set! (-> self touch-time) (-> *display* base-frame-counter)) + #f + ) + (else + (plat-event arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior ((arg0 plat)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (lods-assign! (-> self draw) (-> self lit-look)) + (process-entity-status! self (entity-perm-status complete) #t) + (cond + (arg0 + ) + (else + (dotimes (gp-1 5) + (spawn-projectile-blue *target*) + ) + ) + ) + (none) + ) + :trans + (behavior () + (let ((s5-0 (eval-path-curve! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp)) + (gp-0 (eval-path-curve! (-> self path) (new 'stack-no-clear 'vector) 1.0 'interp)) + ) + (if (>= (- (-> *display* base-frame-counter) (-> self touch-time)) 900) + (set! (-> self targ-dest) -1.0) + ) + (set! (-> self dest) + (cond + ((>= (-> self force-dest) 0.0) + (-> self force-dest) + ) + ((>= (-> self targ-dest) 0.0) + (-> self targ-dest) + ) + ((< (vector-vector-xz-distance (target-pos 0) s5-0) (vector-vector-xz-distance (target-pos 0) gp-0)) + 0.0 + ) + (else + 0.99 + ) + ) + ) + ) + (if (= (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self path-pos) (-> self dest)) + ) + (set! (-> self path-pos) + (seek (-> self path-pos) (-> self dest) (* (-> self speed) (-> *display* seconds-per-frame))) + ) + (eval-path-curve! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) + (if (< (vector-vector-distance (-> self root-override trans) (ear-trans)) 81920.0) + (sound-play-by-name + (static-sound-name "eco-plat-hover") + (-> self sound-id) + 1024 + 0 + 0 + 1 + (the-as symbol (-> self root-override trans)) + ) + ) + (plat-trans) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) self) + (set! (-> a1-8 num-params) 2) + (set! (-> a1-8 message) 'query) + (set! (-> a1-8 param 0) (the-as uint 'powerup)) + (set! (-> a1-8 param 1) (the-as uint 1)) + (when (send-event-function *target* a1-8) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> self force-dest) 0.0) + ) + ) + (none) + ) + ) + +(deftype sage-finalboss-particle (structure) + ((part sparticle-launch-control :offset-assert 0) + (active symbol :offset-assert 4) + ) + :allow-misaligned + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + + +(deftype sage-finalboss (process-taskable) + ((redsage handle :offset-assert 384) + (bluesage handle :offset-assert 392) + (yellowsage handle :offset-assert 400) + (assistant handle :offset-assert 408) + (robotplat handle :offset-assert 416) + (robotboss handle :offset-assert 424) + (silodoor handle :offset-assert 432) + (jak-white handle :offset-assert 440) + (left-door entity-actor :offset-assert 448) + (right-door entity-actor :offset-assert 452) + (kick-in-the-door symbol :offset-assert 456) + (kick-the-credits symbol :offset-assert 460) + (credit-fade float :offset-assert 464) + (palette-val float :offset-assert 468) + (particle sage-finalboss-particle 9 :inline :offset-assert 472) + (particle-whiteout sparticle-launch-control :offset-assert 616) + (credits-played symbol :offset-assert 620) + ) + :heap-base #x200 + :method-count-assert 53 + :size-assert #x270 + :flag-assert #x3502000270 + ) + + +(defmethod relocate sage-finalboss ((obj sage-finalboss) (arg0 int)) + (dotimes (v1-0 9) + (if (nonzero? (-> obj particle v1-0 part)) + (&+! (-> obj particle v1-0 part) arg0) + ) + ) + (if (nonzero? (-> obj particle-whiteout)) + (&+! (-> obj particle-whiteout) arg0) + ) + (the-as sage-finalboss ((method-of-type process-taskable relocate) obj arg0)) + ) + +(defmethod deactivate sage-finalboss ((obj sage-finalboss)) + (dotimes (s5-0 9) + (let ((a0-1 (-> obj particle s5-0 part))) + (if (nonzero? a0-1) + (kill-and-free-particles a0-1) + ) + ) + ) + (if (nonzero? (-> obj particle-whiteout)) + (kill-and-free-particles (-> obj particle-whiteout)) + ) + ((method-of-type process-taskable deactivate) obj) + (none) + ) + +(defskelgroup *sage-finalboss-sg* green-sagecage + 0 + 4 + ((1 (meters 20)) (2 (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :longest-edge (meters 0) + :shadow 3 + ) + +(defmethod play-reminder sage-finalboss ((obj sage-finalboss)) + (let ((s5-0 (entity-by-name "red-sagecage-1"))) + (when s5-0 + (let ((s4-0 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj redsage) + (ppointer->handle (when s4-0 + (let ((t9-2 (method-of-type manipy activate))) + (t9-2 (the-as manipy s4-0) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s4-0 manipy-init (-> obj root-override trans) s5-0 *redsage-sg* #f) + (-> s4-0 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj redsage)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj redsage)) 'blend-shape #t) + (send-event (handle->process (-> obj redsage)) 'center-joint 3) + (send-event (handle->process (-> obj redsage)) 'origin-joint-index 3) + ) + ) + (let ((s5-1 (entity-by-name "blue-sagecage-1"))) + (when s5-1 + (let ((s4-1 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj bluesage) + (ppointer->handle (when s4-1 + (let ((t9-10 (method-of-type manipy activate))) + (t9-10 (the-as manipy s4-1) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s4-1 manipy-init (-> obj root-override trans) s5-1 *bluesage-sg* #f) + (-> s4-1 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj bluesage)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj bluesage)) 'blend-shape #t) + (send-event (handle->process (-> obj bluesage)) 'center-joint 3) + (send-event (handle->process (-> obj bluesage)) 'origin-joint-index 3) + ) + ) + (let ((s5-2 (entity-by-name "yellow-sagecage-1"))) + (the-as + symbol + (when s5-2 + (let ((s4-2 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj yellowsage) + (ppointer->handle + (when s4-2 + (let ((t9-18 (method-of-type manipy activate))) + (t9-18 (the-as manipy s4-2) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s4-2 manipy-init (-> obj root-override trans) s5-2 *yellowsage-sg* #f) + (-> s4-2 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj yellowsage)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj yellowsage)) 'blend-shape #t) + (send-event (handle->process (-> obj yellowsage)) 'center-joint 3) + (send-event (handle->process (-> obj yellowsage)) 'origin-joint-index 3) + ) + ) + ) + ) + +(defmethod dummy-45 sage-finalboss ((obj sage-finalboss)) + (let ((s5-0 (entity-by-name "assistant-lavatube-end-3"))) + (when s5-0 + (let ((s4-0 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj assistant) + (ppointer->handle + (when s4-0 + (let ((t9-2 (method-of-type manipy activate))) + (t9-2 (the-as manipy s4-0) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s4-0 manipy-init (-> obj root-override trans) s5-0 *assistant-lavatube-end-sg* #f) + (-> s4-0 ppointer) + ) + ) + ) + ) + (let ((s5-1 (handle->process (-> obj assistant)))) + (if (the-as manipy s5-1) + (set! (-> (the-as manipy s5-1) draw level-index) (the-as uint (-> (level-get *level* 'finalboss) index))) + ) + ) + (send-event (handle->process (-> obj assistant)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj assistant)) 'blend-shape #t) + (send-event (handle->process (-> obj assistant)) 'center-joint 3) + (send-event (handle->process (-> obj assistant)) 'origin-joint-index 3) + ) + ) + (none) + ) + +(defmethod play-anim! sage-finalboss ((obj sage-finalboss) (arg0 symbol)) + (with-pp + (case (current-status (-> obj tasks)) + (((task-status unknown)) + (when arg0 + (close-current! (-> obj tasks)) + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) 0.0) + ) + (new 'static 'spool-anim + :name "green-sagecage-daxter-sacrifice" + :index 8 + :parts 6 + :command-list + '((1 blackout 0) (236 joint "cameraB") (439 joint "camera")) + ) + ) + (((task-status need-introduction)) + (when arg0 + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) 0.0) + (close-current! (-> obj tasks)) + (let ((s5-1 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj jak-white) + (ppointer->handle + (when s5-1 + (let ((t9-6 (method-of-type manipy activate))) + (t9-6 (the-as manipy s5-1) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s5-1 manipy-init (-> obj root-override trans) (-> obj entity) *jak-white-sg* #f) + (-> s5-1 ppointer) + ) + ) + ) + ) + (send-event + (handle->process (-> obj jak-white)) + 'eval + (lambda :behavior sage-finalboss () (set-vector! (-> self draw color-emissive) 0.5 0.5 0.5 0.0) (none)) + ) + (send-event (handle->process (-> obj jak-white)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj jak-white)) 'origin-joint-index 3) + (send-event (handle->process (-> obj jak-white)) 'blend-shape #t) + (let ((s5-2 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj robotboss) + (ppointer->handle + (when s5-2 + (let ((t9-13 (method-of-type manipy activate))) + (t9-13 (the-as manipy s5-2) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s5-2 manipy-init (-> obj root-override trans) (-> obj entity) *robotboss-cinematic-sg* #f) + (-> s5-2 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj robotboss)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj robotboss)) 'origin-joint-index 3) + (let ((v1-67 (handle->process (-> obj robotboss)))) + (if (the-as manipy v1-67) + (set! (-> (the-as manipy v1-67) draw bounds w) 2048000.0) + ) + ) + (let ((s5-3 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj silodoor) + (ppointer->handle + (when s5-3 + (let ((t9-18 (method-of-type manipy activate))) + (t9-18 (the-as manipy s5-3) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s5-3 manipy-init (-> obj root-override trans) (-> obj entity) *silodoor-sg* #f) + (-> s5-3 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj silodoor)) 'anim-mode 'clone-anim) + (let ((v1-84 (handle->process (-> obj silodoor)))) + (if (the-as manipy v1-84) + (set! (-> (the-as silodoor v1-84) draw bounds w) 2048000.0) + ) + ) + (send-event (process-by-name "silodoor-5" *active-pool*) 'hide) + (set-setting! *setting-control* pp 'music #f 0.0 0) + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (new 'static 'spool-anim + :name "green-sagecage-outro-beat-boss-a" + :index 9 + :parts 8 + :command-list + '((0 send-event self activate-particle 0) + (0 send-event self activate-particle 1) + (0 send-event self activate-particle 7) + (1 blackout 0) + (61 joint "cameraB") + (71 send-event self activate-particle 2) + (156 joint "camera") + (216 joint "cameraB") + (259 send-event self deactivate-particle 2) + (259 send-event self activate-particle 3) + (268 send-event self activate-particle 4) + (270 send-event self deactivate-particle 3) + (270 send-event self deactivate-particle 0) + (270 send-event self deactivate-particle 1) + (271 joint "camera") + (269 send-event self activate-particle 5) + (272 send-event self flash) + (272 eval (lambda :behavior sage-finalboss + () + (let ((a0-1 (get-task-control (game-task finalboss-movies)))) + (save-reminder a0-1 (logior (get-reminder a0-1 0) 1) 0) + ) + (none) + ) + ) + (273 send-event self deactivate-particle 5) + (333 joint "cameraB") + (395 joint "camera") + (453 joint "cameraB") + (478 send-event self deactivate-particle 4) + (478 send-event self activate-particle 6) + (482 send-event self deactivate-particle 6) + (583 joint "camera") + (640 send-event self deactivate-particle 7) + ) + ) + ) + (((task-status need-reminder-a)) + (when arg0 + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) 0.0) + (close-current! (-> obj tasks)) + (play-reminder obj) + (dummy-45 obj) + (set! (-> obj kick-the-credits) #t) + (let ((s5-5 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj robotplat) + (ppointer->handle + (when s5-5 + (let ((t9-30 (method-of-type manipy activate))) + (t9-30 (the-as manipy s5-5) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-5 + manipy-init + (-> obj root-override trans) + (-> obj entity) + *plat-eco-finalboss-lit-sg* + #f + ) + (-> s5-5 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj robotplat)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj robotplat)) 'origin-joint-index 3) + (set! (-> obj old-target-pos trans quad) + (-> (new 'static 'vector :x 11368946.0 :y 2215900.2 :z -19405602.0 :w 1.0) quad) + ) + (quaternion-copy! (-> obj old-target-pos quat) (new 'static 'quaternion :y -0.8472 :w 0.5312)) + (set-setting! *setting-control* pp 'music #f 0.0 0) + (set-setting! *setting-control* pp 'sfx-volume 'abs 0.0 0) + (set-setting! *setting-control* pp 'ambient-volume 'abs 0.0 0) + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (new 'static 'spool-anim + :name "green-sagecage-outro-beat-boss-b" + :index 10 + :parts 27 + :command-list + '((0 kill "crate-3250") + (0 kill "crate-3251") + (0 kill "crate-3252") + (0 kill "crate-3253") + (0 kill "crate-3254") + (0 kill "crate-3255") + (0 kill "crate-3256") + (0 kill "crate-3257") + (0 kill "crate-3258") + (0 kill "crate-3259") + (0 kill "plat-eco-finalboss-1") + (1 blackout 0) + (61 joint "cameraB") + (136 joint "camera") + (510 joint "cameraB") + (641 joint "camera") + (751 joint "cameraB") + (1096 joint "camera") + (1321 joint "cameraB") + (1521 joint "camera") + (1636 joint "cameraB") + (1751 joint "camera") + (1916 joint "cameraB") + (1996 joint "camera") + (2256 joint "cameraB") + ) + ) + ) + (((task-status need-reminder)) + (when arg0 + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) -13116.667) + (close-current! (-> obj tasks)) + (dummy-45 obj) + (send-event *camera* 'teleport) + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (cond + ((target-has-all-the-cells?) + (new 'static 'spool-anim + :name + "green-sagecage-outro-beat-boss-enough-cells" + :index 12 + :parts 6 + :command-list + '((0 send-event self fade) + (1 blackout 0) + (65 joint "cameraB") + (104 joint "camera") + (134 joint "cameraB") + (165 joint "camera") + (292 joint "cameraB") + (488 joint "camera") + (488 auto-save auto-save) + ) + ) + ) + (else + (if arg0 + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (new 'static 'spool-anim + :name + "green-sagecage-outro-beat-boss-need-cells" + :index 11 + :parts 8 + :command-list + '((0 send-event self fade) + (1 blackout 0) + (65 joint "cameraB") + (104 joint "camera") + (134 joint "cameraB") + (165 joint "camera") + (292 joint "cameraB") + (488 joint "camera") + (488 auto-save auto-save) + ) + ) + ) + ) + ) + (((task-status need-reward-speech)) + (when arg0 + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) -13116.667) + (close-current! (-> obj tasks)) + (dummy-45 obj) + (set! (-> obj left-door) (the-as entity-actor (entity-by-name "power-left-2"))) + (set! (-> obj right-door) (the-as entity-actor (entity-by-name "power-right-2"))) + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (new 'static 'spool-anim + :name "green-sagecage-outro-big-finish" + :index 13 + :parts 7 + :command-list + '((1 blackout 0) + (61 joint "cameraB") + (102 joint "camera") + (145 joint "cameraB") + (220 send-event "power-left-2" open) + (220 send-event "power-right-2" open) + (235 joint "camera") + (243 send-event self activate-particle 8) + (322 joint "cameraB") + (428 joint "camera") + (519 joint "cameraB") + (602 joint "camera") + ) + ) + ) + (else + (if arg0 + (format + 0 + "ERROR: : ~S playing anim for task status ~S~%" + (-> obj name) + (task-status->string (current-status (-> obj tasks))) + ) + ) + (-> obj draw art-group data 4) + ) + ) + ) + ) + +(defmethod get-art-elem sage-finalboss ((obj sage-finalboss)) + (-> obj draw art-group data 4) + ) + +(defbehavior sage-finalboss-credit-particle sage-finalboss () + (when (< 0.0 (-> self credit-fade)) + (if (> (-> self part matrix) 0) + (set-vector! + (sprite-get-user-hvdf (-> self part matrix)) + 2048.0 + 2048.0 + (+ -1024.0 (-> *math-camera* hvdf-off z)) + (-> *math-camera* hvdf-off w) + ) + ) + (set! (-> *part-id-table* 2827 init-specs 8 initial-valuef) (* 128.0 (-> self credit-fade))) + (cond + ((< (-> self credit-fade) 1.0) + (set! (-> *part-id-table* 2825 init-specs 1 initial-valuef) 0.0) + (set! (-> *part-id-table* 2826 init-specs 1 initial-valuef) 0.0) + ) + (else + (set! (-> *part-id-table* 2825 init-specs 1 initial-valuef) 1.0) + (set! (-> *part-id-table* 2826 init-specs 1 initial-valuef) 0.3) + ) + ) + (spawn (-> self part) *zero-vector*) + (set! (-> self credit-fade) (+ -0.008333334 (-> self credit-fade))) + ) + (none) + ) + +(defstate play-anim (sage-finalboss) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('fade) + (let ((f0-0 1.0)) + (set! (-> self credit-fade) f0-0) + f0-0 + ) + ) + (('flash) + (let ((f0-1 1.9921875)) + (set! (-> self palette-val) f0-1) + f0-1 + ) + ) + (('activate-particle) + (let ((v0-0 (the-as object #t))) + (set! (-> self particle (-> arg3 param 0) active) (the-as symbol v0-0)) + v0-0 + ) + ) + (('deactivate-particle) + (set! (-> self particle (-> arg3 param 0) active) #f) + #f + ) + ) + ) + :enter + (behavior () (set! (-> self credit-fade) 0.0) ((-> (method-of-type process-taskable play-anim) enter)) (none)) + :exit + (behavior () + (when (= (current-status (-> self tasks)) (task-status invalid)) + (cond + ((not (-> self credits-played)) + (set! (-> self kick-the-credits) #t) + ) + (else + (set-blackout-frames 0) + (initialize! *game-info* 'game (the-as game-save #f) "title-start") + ) + ) + ) + (let ((a0-4 (handle->process (-> self redsage)))) + (if a0-4 + (deactivate a0-4) + ) + ) + (let ((a0-8 (handle->process (-> self bluesage)))) + (if a0-8 + (deactivate a0-8) + ) + ) + (let ((a0-12 (handle->process (-> self yellowsage)))) + (if a0-12 + (deactivate a0-12) + ) + ) + (let ((a0-16 (handle->process (-> self assistant)))) + (if a0-16 + (deactivate a0-16) + ) + ) + (let ((a0-20 (handle->process (-> self robotplat)))) + (if a0-20 + (deactivate a0-20) + ) + ) + (let ((a0-24 (handle->process (-> self robotboss)))) + (if a0-24 + (deactivate a0-24) + ) + ) + (let ((a0-28 (handle->process (-> self jak-white)))) + (if a0-28 + (deactivate a0-28) + ) + ) + (let ((a0-32 (handle->process (-> self silodoor)))) + (if a0-32 + (deactivate a0-32) + ) + ) + (when (-> self left-door) + (let ((a1-9 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-9 from) self) + (set! (-> a1-9 num-params) 2) + (set! (-> a1-9 message) 'brightness) + (set! (-> a1-9 param 0) (the-as uint 1.0)) + (set! (-> a1-9 param 1) (the-as uint 0.0)) + (let ((t9-11 send-event-function) + (v1-61 (-> self left-door)) + ) + (t9-11 + (if v1-61 + (-> v1-61 extra process) + ) + a1-9 + ) + ) + ) + (set! (-> self left-door) #f) + ) + (when (-> self right-door) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) self) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'brightness) + (set! (-> a1-10 param 0) (the-as uint 1.0)) + (set! (-> a1-10 param 1) (the-as uint 0.0)) + (let ((t9-12 send-event-function) + (v1-71 (-> self right-door)) + ) + (t9-12 + (if v1-71 + (-> v1-71 extra process) + ) + a1-10 + ) + ) + ) + (set! (-> self right-door) #f) + ) + (cond + ((= (current-status (-> self tasks)) (task-status need-reward-speech)) + (if (target-has-all-the-cells?) + (set! (-> self kick-in-the-door) #t) + (start 'play (get-continue-by-name *game-info* "finalboss-start")) + ) + ) + ((= (current-status (-> self tasks)) (task-status invalid)) + ) + (else + (set-blackout-frames #x7530) + ) + ) + (dotimes (v1-84 9) + (set! (-> self particle v1-84 active) #f) + ) + ((-> (method-of-type process-taskable play-anim) exit)) + (none) + ) + :trans + (behavior () + (local-vars (f28-0 float)) + (when (-> self left-door) + (let ((f30-0 (ja-aframe-num 0))) + 0.0 + (let ((f30-1 + (cond + ((< f30-0 235.0) + (set! f28-0 1.0) + 0.0 + ) + ((< 320.0 f30-0) + (set! f28-0 1.0) + 0.0 + ) + (else + (if (> (-> self particle-whiteout matrix) 0) + (set-vector! + (sprite-get-user-hvdf (-> self particle-whiteout matrix)) + 2048.0 + 2048.0 + (+ -1024.0 (-> *math-camera* hvdf-off z)) + (-> *math-camera* hvdf-off w) + ) + ) + (set! (-> *part-id-table* 2965 init-specs 8 initial-valuef) (fmax 0.0 (fmin 128.0 (* 0.75 (+ -240.0 f30-0))))) + (spawn (-> self particle-whiteout) *zero-vector*) + (set! f28-0 (fmin 2.0 (fmax 0.0 (* 0.033333335 (+ -235.0 f30-0))))) + f28-0 + ) + ) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) 'brightness) + (set! (-> a1-1 param 0) (the-as uint f28-0)) + (set! (-> a1-1 param 1) (the-as uint f30-1)) + (let ((t9-3 send-event-function) + (v1-20 (-> self left-door)) + ) + (t9-3 + (if v1-20 + (-> v1-20 extra process) + ) + a1-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) 'brightness) + (set! (-> a1-2 param 0) (the-as uint f28-0)) + (set! (-> a1-2 param 1) (the-as uint f30-1)) + (let ((t9-4 send-event-function) + (v1-27 (-> self right-door)) + ) + (t9-4 + (if v1-27 + (-> v1-27 extra process) + ) + a1-2 + ) + ) + ) + ) + ) + ) + (when (and *target* (-> self particle 0 active)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (set! (-> a1-3 quad) (-> *target* draw origin quad)) + (set! (-> a1-3 y) 1970176.0) + (spawn (-> self particle 0 part) a1-3) + ) + ) + (when (and (handle->process (-> self jak-white)) (-> self particle 1 active)) + (let ((a0-17 (handle->process (-> self jak-white)))) + (spawn + (-> self particle 1 part) + (process-drawable-random-point! (the-as process-drawable a0-17) (new 'stack-no-clear 'vector)) + ) + ) + ) + (when (and (handle->process (-> self jak-white)) (-> self particle 2 active)) + (let* ((v1-52 (handle->process (-> self jak-white))) + (a1-11 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable v1-52) node-list data 52))) + ) + (spawn (-> self particle 2 part) a1-11) + ) + ) + (when (and (handle->process (-> self jak-white)) (-> self particle 3 active)) + (let* ((v1-63 (handle->process (-> self jak-white))) + (a1-15 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable v1-63) node-list data 52))) + ) + (spawn (-> self particle 3 part) a1-15) + ) + ) + (if (and (handle->process (-> self robotboss)) (-> self particle 4 active)) + (spawn (-> self particle 4 part) (process-drawable-random-point! + (the-as process-drawable (handle->process (-> self robotboss))) + (new 'stack-no-clear 'vector) + ) + ) + ) + (if (and (handle->process (-> self robotboss)) (-> self particle 5 active)) + (spawn + (-> self particle 5 part) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable (handle->process (-> self robotboss))) node-list data 15) + ) + ) + ) + (if (and (handle->process (-> self robotboss)) (-> self particle 6 active)) + (spawn + (-> self particle 6 part) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable (handle->process (-> self robotboss))) node-list data 6) + ) + ) + ) + (when (and (handle->process (-> self robotboss)) (-> self particle 7 active)) + (let ((gp-4 (new 'stack-no-clear 'vector))) + (vector<-cspace! gp-4 (-> (the-as process-drawable (handle->process (-> self robotboss))) node-list data 7)) + (spawn (-> self particle 7 part) gp-4) + ) + ) + (when (-> self particle 8 active) + (let ((gp-5 (search-process-tree *active-pool* (lambda ((arg0 final-door)) (= (-> arg0 type) power-left)))) + (a0-70 (search-process-tree *active-pool* (lambda ((arg0 final-door)) (= (-> arg0 type) power-left)))) + (a1-43 (new 'stack-no-clear 'vector)) + ) + (vector+! a1-43 (-> (the-as final-door gp-5) root trans) (-> (the-as final-door a0-70) root trans)) + (vector-float*! a1-43 a1-43 0.5) + (spawn (-> self particle 8 part) a1-43) + ) + ) + (sage-finalboss-credit-particle) + (let* ((f0-14 (- 0.0 (-> self palette-val))) + (f0-15 (if (< 0.0 f0-14) + (fmin 0.025 f0-14) + (fmax -0.025 f0-14) + ) + ) + ) + (+! (-> self palette-val) f0-15) + ) + (set! (-> *palette-fade-controls* control 2 fade) (-> self palette-val)) + (case (current-status (-> self tasks)) + (((task-status need-introduction)) + (spool-push *art-control* "green-sagecage-outro-beat-boss-a" 0 self -1.0) + ) + (((task-status need-reminder-a)) + (spool-push *art-control* "green-sagecage-outro-beat-boss-b" 0 self -1.0) + ) + (((task-status need-reminder)) + (if (target-has-all-the-cells?) + (spool-push *art-control* "green-sagecage-outro-beat-boss-enough-cells" 0 self -1.0) + (spool-push *art-control* "green-sagecage-outro-beat-boss-need-cells" 0 self -1.0) + ) + ) + (((task-status need-reward-speech)) + (spool-push *art-control* "green-sagecage-outro-big-finish" 0 self -1.0) + ) + ) + ((-> (method-of-type process-taskable play-anim) trans)) + (none) + ) + ) + +(defstate sage-finalboss-credits (sage-finalboss) + :exit + (behavior () + (when (= (current-status (-> self tasks)) (task-status invalid)) + (set-blackout-frames 0) + (initialize! *game-info* 'game (the-as game-save #f) "title-start") + ) + (none) + ) + :code + (behavior () + (local-vars (s5-0 symbol)) + (set! (-> self credits-played) #t) + (set-blackout-frames 0) + (set-blackout-frames 15) + (clear-pending-settings-from-process *setting-control* self 'sfx-volume) + (clear-pending-settings-from-process *setting-control* self 'ambient-volume) + (set-setting! *setting-control* self 'allow-pause #f 0.0 0) + (set-setting! *setting-control* self 'allow-progress #f 0.0 0) + (set-setting! *setting-control* self 'music 'ogreboss 0.0 0) + (set! (-> self state-time) (-> *display* game-frame-counter)) + (logior! (-> self draw status) (draw-status drwf01)) + (let ((gp-0 (-> self mask))) + (load-state-want-display-level 'finalboss 'special) + (logclear! (-> self mask) (process-mask pause progress)) + (push-setting! *setting-control* self 'process-mask 'set 0.0 8212) + (copy-settings-from-target! *setting-control*) + (let ((f30-0 0.0) + (f28-0 0.5) + ) + (until s5-0 + (hide-hud-quick) + (set! (-> self credit-fade) 1.0) + (sage-finalboss-credit-particle) + (set! s5-0 (draw-end-credits (the int f30-0))) + (if (and *cheat-mode* (cpad-pressed? 0 triangle)) + (set! s5-0 #t) + ) + (cond + ((paused?) + ) + ((and (< 1300.0 f30-0) (cpad-hold? 0 circle x)) + (set! f28-0 (seek f28-0 16.0 (* 4.0 (-> *display* seconds-per-frame)))) + (+! f30-0 (* f28-0 (-> *display* time-adjust-ratio))) + ) + (else + (set! f28-0 (seek f28-0 0.5 (* 16.0 (-> *display* seconds-per-frame)))) + (+! f30-0 (* f28-0 (-> *display* time-adjust-ratio))) + ) + ) + (suspend) + ) + ) + (set! (-> self mask) gp-0) + ) + (load-state-want-display-level 'finalboss 'display) + (clear-pending-settings-from-process *setting-control* self 'allow-pause) + (clear-pending-settings-from-process *setting-control* self 'allow-progress) + (clear-pending-settings-from-process *setting-control* self 'process-mask) + (clear-pending-settings-from-process *setting-control* self 'music) + (copy-settings-from-target! *setting-control*) + (set-blackout-frames 15) + (let ((gp-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-1) 15) + (suspend) + ) + ) + (go-virtual hidden) + (none) + ) + ) + +(defmethod should-display? sage-finalboss ((obj sage-finalboss)) + #f + ) + +(defbehavior sage-finalboss-extra-trans sage-finalboss () + (case (current-status (-> self tasks)) + (((task-status need-reminder-a) (task-status need-reminder)) + (send-event self 'play-anim) + ) + ) + (none) + ) + +(defbehavior sage-finalboss-extra-enter sage-finalboss () + (cond + ((-> self kick-the-credits) + (set! (-> self kick-the-credits) #f) + (go sage-finalboss-credits) + ) + ((-> self kick-in-the-door) + (set! (-> self kick-in-the-door) #f) + (entity-birth-no-kill (entity-by-type power-right)) + (entity-birth-no-kill (entity-by-type power-left)) + (send-event + *target* + 'change-mode + 'final-door + (search-process-tree *active-pool* (lambda ((arg0 final-door)) (= (-> arg0 type) power-right))) + (search-process-tree *active-pool* (lambda ((arg0 final-door)) (= (-> arg0 type) power-left))) + ) + ) + ) + (none) + ) + +(defstate hidden (sage-finalboss) + :virtual #t + :enter + (behavior () + (sage-finalboss-extra-enter) + ((-> (method-of-type process-taskable hidden) enter)) + (clear-pending-settings-from-process *setting-control* self 'allow-progress) + (none) + ) + :trans + (behavior () (sage-finalboss-extra-trans) ((-> (method-of-type process-taskable hidden) trans)) (none)) + ) + +(defstate idle (sage-finalboss) + :virtual #t + :enter + (behavior () (sage-finalboss-extra-enter) ((-> (method-of-type process-taskable idle) enter)) (none)) + :trans + (behavior () (sage-finalboss-extra-trans) ((-> (method-of-type process-taskable idle) trans)) (none)) + ) + +(defmethod init-from-entity! sage-finalboss ((obj sage-finalboss) (arg0 entity-actor)) + (dummy-40 obj arg0 *sage-finalboss-sg* 3 40 (new 'static 'vector :w 4096.0) 5) + (set! (-> obj tasks) (get-task-control (game-task finalboss-movies))) + (set! (-> obj redsage) (the-as handle #f)) + (set! (-> obj bluesage) (the-as handle #f)) + (set! (-> obj yellowsage) (the-as handle #f)) + (set! (-> obj assistant) (the-as handle #f)) + (set! (-> obj robotplat) (the-as handle #f)) + (set! (-> obj robotboss) (the-as handle #f)) + (set! (-> obj jak-white) (the-as handle #f)) + (set! (-> obj silodoor) (the-as handle #f)) + (set! (-> obj left-door) #f) + (set! (-> obj right-door) #f) + (set! (-> obj kick-in-the-door) #f) + (set! (-> obj kick-the-credits) #f) + (set! (-> obj credits-played) #f) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 682) obj)) + (set! (-> obj part matrix) (sprite-allocate-user-hvdf)) + (set! (-> obj particle-whiteout) (create-launch-control (-> *part-group-id-table* 706) obj)) + (set! (-> obj particle-whiteout matrix) (sprite-allocate-user-hvdf)) + (set! (-> obj particle 0 part) (create-launch-control (-> *part-group-id-table* 699) obj)) + (set! (-> obj particle 1 part) (create-launch-control (-> *part-group-id-table* 700) obj)) + (set! (-> obj particle 2 part) (create-launch-control (-> *part-group-id-table* 701) obj)) + (set! (-> obj particle 3 part) (create-launch-control (-> *part-group-id-table* 702) obj)) + (set! (-> obj particle 7 part) (create-launch-control (-> *part-group-id-table* 645) obj)) + (set! (-> obj particle 4 part) (create-launch-control (-> *part-group-id-table* 703) obj)) + (set! (-> obj particle 5 part) (create-launch-control (-> *part-group-id-table* 696) obj)) + (set! (-> obj particle 6 part) (create-launch-control (-> *part-group-id-table* 704) obj)) + (set! (-> obj particle 8 part) (create-launch-control (-> *part-group-id-table* 698) obj)) + (dotimes (v1-37 9) + (set! (-> obj particle v1-37 active) #f) + ) + (set! (-> obj palette-val) 0.0) + (set! (-> obj root-override trans y) (+ 2048.0 (-> obj root-override trans y))) + (if (not (should-display? obj)) + (go (method-of-object obj hidden)) + (go (method-of-object obj idle)) + ) + (none) + ) + + + + diff --git a/goal_src/levels/sunken/orbit-plat.gc b/goal_src/levels/sunken/orbit-plat.gc index 5d4641febe..41d0725498 100644 --- a/goal_src/levels/sunken/orbit-plat.gc +++ b/goal_src/levels/sunken/orbit-plat.gc @@ -5,3 +5,922 @@ ;; name in dgo: orbit-plat ;; dgos: L1, SUN, SUNKEN +(declare-type orbit-plat baseplat) + +;; DECOMP BEGINS + +(deftype orbit-plat-bottom (process-drawable) + ((parent-override (pointer orbit-plat) :offset 12) + (part2 sparticle-launch-control :offset-assert 176) + ) + :heap-base #x50 + :method-count-assert 21 + :size-assert #xb4 + :flag-assert #x15005000b4 + (:methods + (dummy-20 (_type_ vector vector) none 20) + ) + (:states + orbit-plat-bottom-idle + ) + ) + + +(defskelgroup *orbit-plat-bottom-sg* orbit-plat-bottom + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 2.8) + :longest-edge (meters 0) + ) + +(deftype orbit-plat (baseplat) + ((other entity-actor :offset-assert 228) + (rot-dir float :offset-assert 232) + (reset-trans vector :inline :offset-assert 240) + (is-reset? symbol :offset-assert 256) + (reset-length float :offset-assert 260) + (timeout float :offset-assert 264) + (plat-status uint64 :offset-assert 272) + ) + :heap-base #xb0 + :method-count-assert 29 + :size-assert #x118 + :flag-assert #x1d00b00118 + (:methods + (dummy-27 (_type_) symbol 27) + (dummy-28 (_type_) symbol 28) + ) + (:states + orbit-plat-idle + orbit-plat-reset + orbit-plat-riding + orbit-plat-rotating + orbit-plat-still + orbit-plat-wait-for-other + ) + ) + + +(defskelgroup *orbit-plat-sg* orbit-plat + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3.4) + :longest-edge (meters 0) + ) + +(set! (-> *part-group-id-table* 440) + (new 'static 'sparticle-launch-group + :length 4 + :duration #xbb8 + :linger-duration #x5dc + :name "group-orbit-plat-jet" + :launcher + (new 'static 'inline-array sparticle-group-item 4 + (sp-item 1715 :fade-after (meters 100.0) :falloff-to (meters 120.0) :period 150 :length 75) + (sp-item 1715 :fade-after (meters 100.0) :falloff-to (meters 120.0) :period 75 :length 96) + (sp-item 1715 :fade-after (meters 140.0) :falloff-to (meters 160.0) :period 90 :length 60) + (sp-item 1716 :fade-after (meters 100.0) :falloff-to (meters 100.0)) + ) + :bounds (new 'static 'sphere :w 24576.0) + ) + ) + +(set! (-> *part-id-table* 1716) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 18 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-rnd-flt spt-num 0.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.0) (meters 0.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-flt spt-r 0.0) + (sp-flt spt-g 64.0) + (sp-flt spt-b 48.0) + (sp-rnd-flt spt-a 32.0 96.0 1.0) + (sp-rnd-flt spt-vel-z (meters 0.02) (meters 0.0033333334) 1.0) + (sp-rnd-flt spt-scalevel-x (meters -0.013333334) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -1.7066667) + (sp-int spt-timer 75) + (sp-cpuinfo-flags bit2) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 15.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 1715) + (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-rnd-flt spt-num 1.0 2.0 1.0) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-sound) + :flags (sp-flag plain-v2) + :sound + (new 'static 'sound-spec + :mask #x1 + :num 0.05 + :group #x1 + :sound-name (static-sound-name "steam-medium") + :volume #x333 + ) + ) + (sp-rnd-flt spt-scale-x (meters 0.75) (meters 0.75) 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 0.0) + (sp-flt spt-g 96.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-vel-z (meters 0.053333335) (meters 0.0033333334) 1.0) + (sp-rnd-flt spt-scalevel-x (meters -0.013333334) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.8) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 75) + (sp-cpuinfo-flags bit2) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 15.0) 1.0) + (sp-end) + ) + ) + ) + +(set! (-> *part-id-table* 1717) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 16 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-rnd-flt spt-num 1.0 3.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.7) (meters 0.3) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 32.0) + (sp-rnd-flt spt-g 16.0 96.0 1.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 64.0) + (sp-rnd-flt spt-vel-z (meters 0.45) (meters 0.05) 1.0) + (sp-flt spt-fade-r -0.08888889) + (sp-int spt-timer 360) + (sp-cpuinfo-flags bit2 launch-along-z) + (sp-flt spt-conerot-x (degrees 0.0)) + (sp-flt spt-conerot-y (degrees 0.0)) + (sp-rnd-flt spt-conerot-radius (meters -3.0) (meters 4.0) 1.0) + (sp-end) + ) + ) + ) + +(defmethod dummy-20 orbit-plat-bottom ((obj orbit-plat-bottom) (arg0 vector) (arg1 vector)) + (let* ((s5-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (f30-0 (vector-length s5-1)) + ) + (let ((f28-0 (* 0.0005022321 f30-0))) + (set! (-> *part-id-table* 1717 init-specs 13 initial-valuef) (vector-y-angle s5-1)) + (set! (-> *part-id-table* 1717 init-specs 12 initial-valuef) (- (vector-x-angle s5-1))) + (set! (-> *part-id-table* 1717 init-specs 9 initial-valuef) (/ -32.0 f28-0)) + (set! (-> *part-id-table* 1717 init-specs 10 initial-valuef) (the-as float (the int f28-0))) + ) + (set! (-> *part-id-table* 1717 init-specs 1 random-rangef) (* 0.000009494358 f30-0)) + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 1717) + arg0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + 0 + (none) + ) + +(defstate orbit-plat-bottom-idle (orbit-plat-bottom) + :code + (behavior () + (while #t + (set! (-> self root trans quad) (-> self parent-override 0 root-override trans quad)) + (set! (-> self root trans y) (+ -5324.8 (-> self root trans y))) + (spawn (-> self part2) (-> self root trans)) + (let* ((a0-6 (-> self parent-override 0 other)) + (v1-9 (if a0-6 + (-> a0-6 extra process) + ) + ) + ) + (when v1-9 + (let ((f30-0 (atan + (- (-> (the-as orbit-plat v1-9) root-override trans x) (-> self root trans x)) + (- (-> (the-as orbit-plat v1-9) root-override trans z) (-> self root trans z)) + ) + ) + ) + (quaternion-axis-angle! (-> self root quat) 0.0 1.0 0.0 f30-0) + (let ((v1-16 (-> self parent-override 0 plat-status)) + (f30-1 (+ 16384.0 f30-0)) + ) + (cond + ((= v1-16 2) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set-vector! gp-0 0.0 -2048.0 8192.0 1.0) + (if (< (-> self parent-override 0 rot-dir) 0.0) + (set! f30-1 (+ 32768.0 f30-1)) + ) + (vector-rotate-around-y! gp-0 gp-0 f30-1) + (set! (-> *part-id-table* 1716 init-specs 16 initial-valuef) f30-1) + (set! (-> *part-id-table* 1715 init-specs 18 initial-valuef) f30-1) + (vector+! gp-0 gp-0 (-> self root trans)) + (spawn (-> self part) gp-0) + ) + ) + (else + (let* ((a0-18 (-> self parent-override 0 other)) + (v1-32 (if a0-18 + (-> a0-18 extra process) + ) + ) + ) + (when (and v1-32 (= (-> (the-as orbit-plat v1-32) plat-status) 2)) + (let ((gp-1 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-1 quad) (-> self root trans quad)) + (set! (-> gp-1 y) (+ -2048.0 (-> gp-1 y))) + (set! (-> s5-0 quad) (-> (the-as orbit-plat v1-32) root-override trans quad)) + (set! (-> s5-0 y) (+ -7372.8 (-> s5-0 y))) + (vector-! s4-0 s5-0 gp-1) + (vector-normalize! s4-0 1.0) + (vector+*! s5-0 gp-1 s4-0 26624.0) + (vector+*! gp-1 gp-1 s4-0 8192.0) + ) + (dummy-20 self gp-1 s5-0) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior orbit-plat-bottom) ja-post) + ) + +(defmethod relocate orbit-plat-bottom ((obj orbit-plat-bottom) (arg0 int)) + (if (nonzero? (-> obj part2)) + (&+! (-> obj part2) arg0) + ) + (the-as orbit-plat-bottom ((method-of-type process-drawable relocate) obj arg0)) + ) + +(defmethod deactivate orbit-plat-bottom ((obj orbit-plat-bottom)) + (if (nonzero? (-> obj part2)) + (kill-and-free-particles (-> obj part2)) + ) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +(defbehavior orbit-plat-bottom-init-by-other orbit-plat-bottom ((arg0 entity) (arg1 orbit-plat)) + (set! (-> self entity) arg0) + (set! (-> self mask) (logior (process-mask platform) (-> self mask))) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg1 root-override trans quad)) + (quaternion-copy! (-> self root quat) (-> arg1 root-override quat)) + (set! (-> self root scale quad) (-> arg1 root-override scale quad)) + (set! (-> self root trans y) (+ -5324.8 (-> self root trans y))) + (set! (-> self part) (create-launch-control (-> *part-group-id-table* 440) self)) + (set! (-> self part2) (create-launch-control (-> *part-group-id-table* 107) self)) + (initialize-skeleton self *orbit-plat-bottom-sg* '()) + (ja-channel-set! 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 2)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (go orbit-plat-bottom-idle) + (none) + ) + +(defstate orbit-plat-idle (orbit-plat) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'bonk) + (dummy-22 self) + ) + ((= v1-0 'go) + (go orbit-plat-rotating) + ) + ((= v1-0 'query-reset) + (if (not (-> self is-reset?)) + (go orbit-plat-reset) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'reset) + (let ((t9-3 send-event-function) + (v1-8 (-> self other)) + ) + (t9-3 + (if v1-8 + (-> v1-8 extra process) + ) + a1-1 + ) + ) + ) + ) + ((= v1-0 'reset) + (go orbit-plat-reset) + ) + ) + ) + ) + ) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 0)) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 0.0) + (set! (-> a0-0 param 1) 1.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim #f) num-func-seek!) + ) + (dotimes (gp-0 2) + (transform-post) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 param 0) 0.0) + (set! (-> a0-2 param 1) 1.0) + (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (while #t + (when (nonzero? (-> self root-override riders num-riders)) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'go) + (let ((t9-4 send-event-function) + (v1-14 (-> self other)) + ) + (t9-4 + (if v1-14 + (-> v1-14 extra process) + ) + a1-2 + ) + ) + ) + (go orbit-plat-riding) + ) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) 0.0) + (set! (-> a0-5 param 1) 1.0) + (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (when (not (-> self is-reset?)) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) self) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'query-reset) + (let ((t9-8 send-event-function) + (v1-26 (-> self other)) + ) + (t9-8 + (if v1-26 + (-> v1-26 extra process) + ) + a1-4 + ) + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +(defmethod dummy-28 orbit-plat ((obj orbit-plat)) + (when (>= (- (-> *display* base-frame-counter) (-> obj state-time)) (the int (* 300.0 (-> obj timeout)))) + (cond + (*target* + (let ((s5-0 (target-pos 0))) + (if (or + (>= (vector-vector-xz-distance s5-0 (-> obj root-override trans)) 102400.0) + (>= (- (-> obj root-override trans y) (-> s5-0 y)) 16384.0) + ) + (return #t) + ) + ) + ) + (else + (return #t) + ) + ) + ) + #f + ) + +(defstate orbit-plat-still (orbit-plat) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'bonk) + (dummy-22 self) + ) + ((= v1-0 'go) + (go orbit-plat-rotating) + ) + ) + ) + ) + ) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 0)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 0.0) + (set! (-> a0-0 param 1) 1.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim #f) num-func-seek!) + ) + (until (dummy-28 self) + (when (nonzero? (-> self root-override riders num-riders)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'go) + (let ((t9-1 send-event-function) + (v1-10 (-> self other)) + ) + (t9-1 + (if v1-10 + (-> v1-10 extra process) + ) + a1-1 + ) + ) + ) + (go orbit-plat-riding) + ) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) 0.0) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (go orbit-plat-idle) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +(defstate orbit-plat-riding (orbit-plat) + :event + (the-as (function process int symbol event-message-block object :behavior orbit-plat) plat-event) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 1)) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) (the float (+ (-> a0-0 frame-group data 0 length) -1))) + (set! (-> a0-0 param 1) 1.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim #f) num-func-seek!) + ) + (while #t + (when (zero? (-> self root-override riders num-riders)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'stop) + (let ((t9-1 send-event-function) + (v1-13 (-> self other)) + ) + (t9-1 + (if v1-13 + (-> v1-13 extra process) + ) + a1-1 + ) + ) + ) + (go orbit-plat-still) + ) + (suspend) + (when (not (ja-done? 0)) + (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) 1.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +(defun get-rotate-point! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float) (arg5 float)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector-! s5-0 arg2 arg1) + (when (!= arg4 0.0) + (set! (-> s2-0 x) (* arg4 (-> s5-0 z))) + (set! (-> s2-0 y) 0.0) + (set! (-> s2-0 z) (- (* arg4 (-> s5-0 x)))) + (vector-normalize! s2-0 (* arg5 (-> *display* seconds-per-frame))) + (+! (-> s5-0 x) (-> s2-0 x)) + (+! (-> s5-0 z) (-> s2-0 z)) + ) + ) + (vector-normalize! s5-0 (the-as float arg3)) + (vector+! arg0 arg1 s5-0) + ) + arg0 + ) + +(defun get-nav-point! ((arg0 vector) (arg1 orbit-plat) (arg2 vector) (arg3 float)) + (set! (-> arg1 nav target-pos quad) (-> arg2 quad)) + (logclear! (-> arg1 nav flags) (nav-control-flags bit19)) + (dummy-11 (-> arg1 nav) (-> arg1 nav target-pos)) + (let ((f0-0 (vector-length (-> arg1 nav travel)))) + (if (< arg3 f0-0) + (set! f0-0 arg3) + ) + (vector-normalize! (-> arg1 nav travel) (* f0-0 (-> *display* seconds-per-frame))) + ) + (set! (-> arg0 x) (+ (-> arg1 root-override trans x) (-> arg1 nav travel x))) + (set! (-> arg0 y) (-> arg1 root-override trans x)) + (set! (-> arg0 z) (+ (-> arg1 root-override trans z) (-> arg1 nav travel z))) + arg0 + ) + +(defstate orbit-plat-rotating (orbit-plat) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'bonk) + (dummy-22 self) + ) + ((= v1-0 'stop) + (go orbit-plat-still) + ) + ) + ) + ) + ) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () (none)) ;; TODO - fix! + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +;; WARN: disable def twice: 132. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod dummy-27 orbit-plat ((obj orbit-plat)) + (local-vars (v0-11 object)) + (let* ((v1-0 (-> obj other)) + (s5-0 (if v1-0 + (-> v1-0 extra process) + ) + ) + ) + (the-as + symbol + (cond + ((and + s5-0 + (< (vector-vector-xz-distance (the-as vector (&-> s5-0 stack 96)) (the-as vector (&-> s5-0 stack 128))) + (vector-vector-xz-distance (-> obj basetrans) (-> obj reset-trans)) + ) + ) + (cond + ((-> (the-as orbit-plat s5-0) is-reset?) + (when (!= (-> obj plat-status) 2) + (set! (-> obj plat-status) (the-as uint 2)) + (let ((f30-1 (atan + (- (-> obj basetrans x) (-> (the-as orbit-plat s5-0) basetrans x)) + (- (-> obj basetrans z) (-> (the-as orbit-plat s5-0) basetrans z)) + ) + ) + (f0-9 (atan + (- (-> obj reset-trans x) (-> (the-as orbit-plat s5-0) basetrans x)) + (- (-> obj reset-trans z) (-> (the-as orbit-plat s5-0) basetrans z)) + ) + ) + ) + (if (>= (deg- f0-9 f30-1) 0.0) + (set! (-> obj rot-dir) 1.0) + (set! (-> obj rot-dir) -1.0) + ) + ) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((a0-7 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (let ((v1-9 s4-0) + (a1-5 (-> obj other)) + ) + (set! (-> v1-9 quad) (-> (the-as orbit-plat (if a1-5 + (-> a1-5 extra process) + ) + ) + root-override + trans + quad + ) + ) + ) + (vector-! a0-7 (-> obj basetrans) s4-0) + (let ((f30-2 (vector-length a0-7))) + (get-rotate-point! s5-1 s4-0 (-> obj basetrans) (the-as vector f30-2) (-> obj rot-dir) 40960.0) + (cond + ((dummy-16 (-> obj nav) s5-1) + (set! (-> obj basetrans quad) (-> s5-1 quad)) + ) + (else + (set! (-> obj rot-dir) (- (-> obj rot-dir))) + (get-rotate-point! s5-1 s4-0 (-> obj basetrans) (the-as vector f30-2) (-> obj rot-dir) 40960.0) + (if (dummy-16 (-> obj nav) s5-1) + (set! (-> obj basetrans quad) (-> s5-1 quad)) + ) + ) + ) + ) + ) + ) + (when (>= 614.4 (vector-vector-xz-distance (-> obj basetrans) (-> obj reset-trans))) + (set! v0-11 (logior (nav-control-flags bit19) (-> obj nav flags))) + (set! (-> obj nav flags) (the-as nav-control-flags v0-11)) + v0-11 + ) + ) + (else + (let ((s5-2 (new 'stack-no-clear 'vector))) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (get-nav-point! s5-2 obj (-> obj reset-trans) 40960.0) + (let ((v1-20 s4-1) + (a0-19 (-> obj other)) + ) + (set! (-> v1-20 quad) (-> (the-as orbit-plat (if a0-19 + (-> a0-19 extra process) + ) + ) + root-override + trans + quad + ) + ) + ) + (set! (-> s5-2 y) (-> s4-1 y)) + (vector-! s5-2 s5-2 s4-1) + (vector-normalize! s5-2 (-> obj reset-length)) + (vector+! s5-2 s5-2 s4-1) + (when (not (dummy-16 (-> obj nav) s5-2)) + (logclear! (-> obj nav flags) (nav-control-flags bit19)) + (get-rotate-point! s5-2 s4-1 (-> obj basetrans) (the-as vector (-> obj reset-length)) 0.0 40960.0) + (when (not (dummy-16 (-> obj nav) s5-2)) + (get-rotate-point! + s5-2 + s4-1 + (-> obj basetrans) + (the-as vector (-> obj reset-length)) + (-> obj rot-dir) + 40960.0 + ) + (when (not (dummy-16 (-> obj nav) s5-2)) + (set! (-> obj rot-dir) (- (-> obj rot-dir))) + (get-rotate-point! + s5-2 + s4-1 + (-> obj basetrans) + (the-as vector (-> obj reset-length)) + (-> obj rot-dir) + 40960.0 + ) + ) + ) + ) + ) + (set! (-> s5-2 y) (-> obj basetrans y)) + (set! v0-11 (-> obj basetrans)) + (set! (-> (the-as vector v0-11) quad) (-> s5-2 quad)) + ) + v0-11 + ) + ) + ) + (else + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 quad) (-> obj basetrans quad)) + (get-nav-point! (-> obj basetrans) obj (-> obj reset-trans) 40960.0) + (let ((f0-29 (-> s5-3 y))) + (set! (-> obj basetrans y) f0-29) + f0-29 + ) + ) + ) + ) + ) + ) + ) + +(defstate orbit-plat-reset (orbit-plat) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'bonk) + (dummy-22 self) + ) + ((= v1-0 'go) + (go orbit-plat-rotating) + ) + ) + ) + ) + ) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 3)) + (logclear! (-> self nav flags) (nav-control-flags bit19)) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) 0.0) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + (while (zero? (logand (nav-control-flags bit19) (-> self nav flags))) + (dummy-27 self) + (when (nonzero? (-> self root-override riders num-riders)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'go) + (let ((t9-2 send-event-function) + (v1-13 (-> self other)) + ) + (t9-2 + (if v1-13 + (-> v1-13 extra process) + ) + a1-1 + ) + ) + ) + (go orbit-plat-riding) + ) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) 0.0) + (set! (-> a0-7 param 1) 1.0) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (set! (-> self is-reset?) #t) + (go orbit-plat-idle) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +(defstate orbit-plat-wait-for-other (orbit-plat) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 0)) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 0.0) + (set! (-> a0-0 param 1) 1.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim #f) num-func-seek!) + ) + (while #t + (let ((v1-3 (-> self other))) + (when (if v1-3 + (-> v1-3 extra process) + ) + (suspend) + (go orbit-plat-idle) + ) + ) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) 0.0) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) ja-post) + ) + +(defmethod init-from-entity! orbit-plat ((obj orbit-plat) (arg0 entity-actor)) + (set! (-> obj plat-status) (the-as uint 0)) + (set! (-> obj mask) (logior (process-mask platform) (-> obj mask))) + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) + (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 2048)) + (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) 4) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 13926.4) + (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) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton obj *orbit-plat-sg* '()) + (logior! (-> obj skel status) 1) + (ja-channel-set! 1) + (let ((s4-1 (-> obj skel root-channel 0))) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim (-> obj draw art-group data 2)) + num-func-identity + ) + (set! (-> s4-1 frame-num) 0.0) + ) + (ja-post) + (dummy-47 (-> obj root-override)) + (dummy-21 obj) + (set! (-> obj nav) (new 'process 'nav-control (-> obj root-override) 16 40960.0)) + (logior! (-> obj nav flags) (nav-control-flags display-marks bit3 bit5 bit6 bit7)) + (set! (-> obj nav gap-event) 'blocked) + (set! (-> obj other) (entity-actor-lookup arg0 'alt-actor 0)) + (let ((f0-7 (res-lump-float arg0 'scale :default 1.0))) + (set-vector! (-> obj root-override scale) f0-7 f0-7 f0-7 1.0) + ) + (set! (-> obj timeout) (res-lump-float arg0 'timeout :default 10.0)) + (set! (-> obj rot-dir) 1.0) + (set! (-> obj reset-trans quad) (-> obj basetrans quad)) + (set! (-> obj is-reset?) #t) + (let ((s5-1 (get-process *default-dead-pool* orbit-plat-bottom #x4000))) + (when s5-1 + (let ((t9-18 (method-of-type orbit-plat-bottom activate))) + (t9-18 (the-as orbit-plat-bottom s5-1) obj 'orbit-plat-bottom (the-as pointer #x70004000)) + ) + (run-now-in-process s5-1 orbit-plat-bottom-init-by-other (-> obj entity) obj) + (-> s5-1 ppointer) + ) + ) + (go orbit-plat-wait-for-other) + (none) + ) + + + + diff --git a/sage-finalboss-FIN.manual_restore_reminder b/sage-finalboss-FIN.manual_restore_reminder new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/update-goal-src.py b/scripts/update-goal-src.py index 6bd58ad1fd..10969ce9e9 100644 --- a/scripts/update-goal-src.py +++ b/scripts/update-goal-src.py @@ -34,7 +34,8 @@ files_with_modifications = [ "cam-states", "plant-boss", "helix-water", - "lavatube-energy" + "lavatube-energy", + "sage-finalboss-FIN" ] for file in files: diff --git a/test/decompiler/reference/engine/anim/bones-h_REF.gc b/test/decompiler/reference/engine/anim/bones-h_REF.gc index e9c48dd8f6..d8e617135f 100644 --- a/test/decompiler/reference/engine/anim/bones-h_REF.gc +++ b/test/decompiler/reference/engine/anim/bones-h_REF.gc @@ -166,7 +166,8 @@ (next uint32 :offset-assert 4) (sink basic :offset-assert 8) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) diff --git a/test/decompiler/reference/engine/collide/collide-touch-h_REF.gc b/test/decompiler/reference/engine/collide/collide-touch-h_REF.gc index 576a323cac..81415bc599 100644 --- a/test/decompiler/reference/engine/collide/collide-touch-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-touch-h_REF.gc @@ -120,7 +120,8 @@ (resolve-u int8 :offset-assert 8) (head touching-prims-entry :offset-assert 12) ) - :allow-misaligned :method-count-assert 18 + :allow-misaligned + :method-count-assert 18 :size-assert #x10 :flag-assert #x1200000010 (:methods diff --git a/test/decompiler/reference/engine/debug/anim-tester_REF.gc b/test/decompiler/reference/engine/debug/anim-tester_REF.gc index 0ef54e503d..b3387a48bf 100644 --- a/test/decompiler/reference/engine/debug/anim-tester_REF.gc +++ b/test/decompiler/reference/engine/debug/anim-tester_REF.gc @@ -28,7 +28,8 @@ (user-info-u uint32 :offset 72) (return-int int32 :offset-assert 76) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ) diff --git a/test/decompiler/reference/engine/gfx/hw/display-h_REF.gc b/test/decompiler/reference/engine/gfx/hw/display-h_REF.gc index 5f441409b8..68e84e556c 100644 --- a/test/decompiler/reference/engine/gfx/hw/display-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/hw/display-h_REF.gc @@ -134,7 +134,8 @@ (draw draw-env :offset-assert 12) (frame display-frame :offset-assert 16) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #x14 :flag-assert #x900000014 ) diff --git a/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc b/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc index bb2adb479e..1759a61288 100644 --- a/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc @@ -120,7 +120,8 @@ (min-halo float :offset-assert 16) (max-halo float :offset-assert 20) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) diff --git a/test/decompiler/reference/engine/math/vector-h_REF.gc b/test/decompiler/reference/engine/math/vector-h_REF.gc index 1590b1fa11..1c751ac62c 100644 --- a/test/decompiler/reference/engine/math/vector-h_REF.gc +++ b/test/decompiler/reference/engine/math/vector-h_REF.gc @@ -222,7 +222,8 @@ (y int32 :offset 4) (z int32 :offset 8) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) diff --git a/test/decompiler/reference/engine/sound/gsound_REF.gc b/test/decompiler/reference/engine/sound/gsound_REF.gc index fd79131193..92c1ebe866 100644 --- a/test/decompiler/reference/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound_REF.gc @@ -947,7 +947,8 @@ ((music symbol :offset-assert 0) (flava uint8 50 :offset-assert 4) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #x36 :flag-assert #x900000036 ) diff --git a/test/decompiler/reference/engine/util/sync-info-h_REF.gc b/test/decompiler/reference/engine/util/sync-info-h_REF.gc index b2d560656a..a45b68c33e 100644 --- a/test/decompiler/reference/engine/util/sync-info-h_REF.gc +++ b/test/decompiler/reference/engine/util/sync-info-h_REF.gc @@ -39,7 +39,8 @@ (m2 float :offset-assert 20) (yend float :offset-assert 24) ) - :allow-misaligned :method-count-assert 18 + :allow-misaligned + :method-count-assert 18 :size-assert #x1c :flag-assert #x120000001c ) diff --git a/test/decompiler/reference/levels/beach/twister_REF.gc b/test/decompiler/reference/levels/beach/twister_REF.gc index d25741ec7c..7f8b59464f 100644 --- a/test/decompiler/reference/levels/beach/twister_REF.gc +++ b/test/decompiler/reference/levels/beach/twister_REF.gc @@ -6,7 +6,8 @@ ((ry float :offset-assert 0) (max-dry float :offset-assert 4) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) diff --git a/test/decompiler/reference/levels/common/battlecontroller_REF.gc b/test/decompiler/reference/levels/common/battlecontroller_REF.gc index 625efbeb6c..569a12aabe 100644 --- a/test/decompiler/reference/levels/common/battlecontroller_REF.gc +++ b/test/decompiler/reference/levels/common/battlecontroller_REF.gc @@ -36,7 +36,8 @@ (max-pickup-count int8 :offset-assert 16) (pickup-count int8 :offset-assert 17) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #x12 :flag-assert #x900000012 ) diff --git a/test/decompiler/reference/levels/finalboss/light-eco_REF.gc b/test/decompiler/reference/levels/finalboss/light-eco_REF.gc index cb97a7cb4b..5244c4bf9a 100644 --- a/test/decompiler/reference/levels/finalboss/light-eco_REF.gc +++ b/test/decompiler/reference/levels/finalboss/light-eco_REF.gc @@ -996,3 +996,7 @@ (go light-eco-mother-appear) (none) ) + + + + diff --git a/test/decompiler/reference/levels/finalboss/sage-finalboss-FIN_REF.gc b/test/decompiler/reference/levels/finalboss/sage-finalboss-FIN_REF.gc new file mode 100644 index 0000000000..439955b838 --- /dev/null +++ b/test/decompiler/reference/levels/finalboss/sage-finalboss-FIN_REF.gc @@ -0,0 +1,1237 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defskelgroup *robotboss-cinematic-sg* robotboss-cinematic + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 -10 0 2000) + :longest-edge (meters 0) + ) + +;; failed to figure out what this is: +(defskelgroup *jak-white-sg* jak-white + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :longest-edge (meters 0) + ) + +;; failed to figure out what this is: +(defskelgroup *plat-eco-finalboss-unlit-sg* plat-eco-finalboss + 0 + 8 + ((1 (meters 20)) (2 (meters 40)) (3 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :longest-edge (meters 0) + ) + +;; failed to figure out what this is: +(defskelgroup *plat-eco-finalboss-lit-sg* plat-eco-finalboss + 4 + 8 + ((5 (meters 20)) (6 (meters 40)) (7 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :longest-edge (meters 0) + ) + +;; definition of type plat-eco-finalboss +(deftype plat-eco-finalboss (plat-eco) + ((force-dest float :offset-assert 360) + (targ-dest float :offset-assert 364) + (dest float :offset-assert 368) + (speed float :offset-assert 372) + (touch-time int64 :offset-assert 376) + ) + :heap-base #x110 + :method-count-assert 33 + :size-assert #x180 + :flag-assert #x2101100180 + ) + +;; definition for method 3 of type plat-eco-finalboss +(defmethod inspect plat-eco-finalboss ((obj plat-eco-finalboss)) + (let ((t9-0 (method-of-type plat-eco inspect))) + (t9-0 obj) + ) + (format #t "~T~Tforce-dest: ~f~%" (-> obj force-dest)) + (format #t "~T~Ttarg-dest: ~f~%" (-> obj targ-dest)) + (format #t "~T~Tdest: ~f~%" (-> obj dest)) + (format #t "~T~Tspeed: ~f~%" (-> obj speed)) + (format #t "~T~Ttouch-time: ~D~%" (-> obj touch-time)) + obj + ) + +;; definition for method 23 of type plat-eco-finalboss +(defmethod get-unlit-skel plat-eco-finalboss ((obj plat-eco-finalboss)) + *plat-eco-finalboss-unlit-sg* + ) + +;; definition for method 27 of type plat-eco-finalboss +(defmethod get-lit-skel plat-eco-finalboss ((obj plat-eco-finalboss)) + *plat-eco-finalboss-lit-sg* + ) + +;; definition for method 26 of type plat-eco-finalboss +;; INFO: Return type mismatch int vs none. +(defmethod dummy-26 plat-eco-finalboss ((obj plat-eco-finalboss)) + (set! (-> obj force-dest) -1.0) + (set! (-> obj targ-dest) -1.0) + (set! (-> obj dest) 0.0) + (set! (-> obj speed) 0.1) + (logclear! (-> obj mask) (process-mask actor-pause)) + (process-entity-status! obj (entity-perm-status bit-3) #t) + (none) + ) + +;; failed to figure out what this is: +(defstate plat-path-active (plat-eco-finalboss) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('target) + (process-entity-status! self (entity-perm-status complete) #t) + (let ((f0-0 (the-as float (-> arg3 param 0)))) + (set! (-> self force-dest) f0-0) + f0-0 + ) + ) + (('ridden 'edge-grabbed) + (if (>= (- (-> *display* base-frame-counter) (-> self touch-time)) 600) + (set! (-> self targ-dest) (cond + ((= (-> self path-pos) 0.0) + (set! (-> self force-dest) -1.0) + 0.99 + ) + ((= (-> self path-pos) 0.99) + 0.0 + ) + (else + (-> self targ-dest) + ) + ) + ) + ) + (set! (-> self touch-time) (-> *display* base-frame-counter)) + #f + ) + (else + (plat-event arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior ((arg0 plat)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (lods-assign! (-> self draw) (-> self lit-look)) + (process-entity-status! self (entity-perm-status complete) #t) + (cond + (arg0 + ) + (else + (dotimes (gp-1 5) + (spawn-projectile-blue *target*) + ) + ) + ) + (none) + ) + :trans + (behavior () + (let ((s5-0 (eval-path-curve! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp)) + (gp-0 (eval-path-curve! (-> self path) (new 'stack-no-clear 'vector) 1.0 'interp)) + ) + (if (>= (- (-> *display* base-frame-counter) (-> self touch-time)) 900) + (set! (-> self targ-dest) -1.0) + ) + (set! (-> self dest) + (cond + ((>= (-> self force-dest) 0.0) + (-> self force-dest) + ) + ((>= (-> self targ-dest) 0.0) + (-> self targ-dest) + ) + ((< (vector-vector-xz-distance (target-pos 0) s5-0) (vector-vector-xz-distance (target-pos 0) gp-0)) + 0.0 + ) + (else + 0.99 + ) + ) + ) + ) + (if (= (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self path-pos) (-> self dest)) + ) + (set! (-> self path-pos) + (seek (-> self path-pos) (-> self dest) (* (-> self speed) (-> *display* seconds-per-frame))) + ) + (eval-path-curve! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) + (if (< (vector-vector-distance (-> self root-override trans) (ear-trans)) 81920.0) + (sound-play-by-name + (static-sound-name "eco-plat-hover") + (-> self sound-id) + 1024 + 0 + 0 + 1 + (the-as symbol (-> self root-override trans)) + ) + ) + (plat-trans) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) self) + (set! (-> a1-8 num-params) 2) + (set! (-> a1-8 message) 'query) + (set! (-> a1-8 param 0) (the-as uint 'powerup)) + (set! (-> a1-8 param 1) (the-as uint 1)) + (when (send-event-function *target* a1-8) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> self force-dest) 0.0) + ) + ) + (none) + ) + ) + +;; definition of type sage-finalboss-particle +(deftype sage-finalboss-particle (structure) + ((part sparticle-launch-control :offset-assert 0) + (active symbol :offset-assert 4) + ) + :allow-misaligned + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type sage-finalboss-particle +(defmethod inspect sage-finalboss-particle ((obj sage-finalboss-particle)) + (format #t "[~8x] ~A~%" obj 'sage-finalboss-particle) + (format #t "~Tpart: ~A~%" (-> obj part)) + (format #t "~Tactive: ~A~%" (-> obj active)) + obj + ) + +;; definition of type sage-finalboss +(deftype sage-finalboss (process-taskable) + ((redsage handle :offset-assert 384) + (bluesage handle :offset-assert 392) + (yellowsage handle :offset-assert 400) + (assistant handle :offset-assert 408) + (robotplat handle :offset-assert 416) + (robotboss handle :offset-assert 424) + (silodoor handle :offset-assert 432) + (jak-white handle :offset-assert 440) + (left-door entity-actor :offset-assert 448) + (right-door entity-actor :offset-assert 452) + (kick-in-the-door symbol :offset-assert 456) + (kick-the-credits symbol :offset-assert 460) + (credit-fade float :offset-assert 464) + (palette-val float :offset-assert 468) + (particle sage-finalboss-particle 9 :inline :offset-assert 472) + (particle-whiteout sparticle-launch-control :offset-assert 616) + (credits-played symbol :offset-assert 620) + ) + :heap-base #x200 + :method-count-assert 53 + :size-assert #x270 + :flag-assert #x3502000270 + ) + +;; definition for method 3 of type sage-finalboss +(defmethod inspect sage-finalboss ((obj sage-finalboss)) + (let ((t9-0 (method-of-type process-taskable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tredsage: ~D~%" (-> obj redsage)) + (format #t "~T~Tbluesage: ~D~%" (-> obj bluesage)) + (format #t "~T~Tyellowsage: ~D~%" (-> obj yellowsage)) + (format #t "~T~Tassistant: ~D~%" (-> obj assistant)) + (format #t "~T~Trobotplat: ~D~%" (-> obj robotplat)) + (format #t "~T~Trobotboss: ~D~%" (-> obj robotboss)) + (format #t "~T~Tsilodoor: ~D~%" (-> obj silodoor)) + (format #t "~T~Tjak-white: ~D~%" (-> obj jak-white)) + (format #t "~T~Tleft-door: ~A~%" (-> obj left-door)) + (format #t "~T~Tright-door: ~A~%" (-> obj right-door)) + (format #t "~T~Tkick-in-the-door: ~A~%" (-> obj kick-in-the-door)) + (format #t "~T~Tkick-the-credits: ~A~%" (-> obj kick-the-credits)) + (format #t "~T~Tcredit-fade: ~f~%" (-> obj credit-fade)) + (format #t "~T~Tpalette-val: ~f~%" (-> obj palette-val)) + (format #t "~T~Tparticle[9] @ #x~X~%" (-> obj particle)) + (format #t "~T~Tparticle-whiteout: ~A~%" (-> obj particle-whiteout)) + (format #t "~T~Tcredits-played: ~A~%" (-> obj credits-played)) + obj + ) + +;; definition for method 7 of type sage-finalboss +;; INFO: Return type mismatch process-taskable vs sage-finalboss. +(defmethod relocate sage-finalboss ((obj sage-finalboss) (arg0 int)) + (dotimes (v1-0 9) + (if (nonzero? (-> obj particle v1-0 part)) + (&+! (-> obj particle v1-0 part) arg0) + ) + ) + (if (nonzero? (-> obj particle-whiteout)) + (&+! (-> obj particle-whiteout) arg0) + ) + (the-as sage-finalboss ((method-of-type process-taskable relocate) obj arg0)) + ) + +;; definition for method 10 of type sage-finalboss +(defmethod deactivate sage-finalboss ((obj sage-finalboss)) + (dotimes (s5-0 9) + (let ((a0-1 (-> obj particle s5-0 part))) + (if (nonzero? a0-1) + (kill-and-free-particles a0-1) + ) + ) + ) + (if (nonzero? (-> obj particle-whiteout)) + (kill-and-free-particles (-> obj particle-whiteout)) + ) + ((method-of-type process-taskable deactivate) obj) + (none) + ) + +;; failed to figure out what this is: +(defskelgroup *sage-finalboss-sg* green-sagecage + 0 + 4 + ((1 (meters 20)) (2 (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :longest-edge (meters 0) + :shadow 3 + ) + +;; definition for method 44 of type sage-finalboss +;; INFO: Return type mismatch object vs symbol. +(defmethod play-reminder sage-finalboss ((obj sage-finalboss)) + (let ((s5-0 (entity-by-name "red-sagecage-1"))) + (when s5-0 + (let ((s4-0 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj redsage) + (ppointer->handle (when s4-0 + (let ((t9-2 (method-of-type manipy activate))) + (t9-2 (the-as manipy s4-0) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s4-0 manipy-init (-> obj root-override trans) s5-0 *redsage-sg* #f) + (-> s4-0 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj redsage)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj redsage)) 'blend-shape #t) + (send-event (handle->process (-> obj redsage)) 'center-joint 3) + (send-event (handle->process (-> obj redsage)) 'origin-joint-index 3) + ) + ) + (let ((s5-1 (entity-by-name "blue-sagecage-1"))) + (when s5-1 + (let ((s4-1 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj bluesage) + (ppointer->handle (when s4-1 + (let ((t9-10 (method-of-type manipy activate))) + (t9-10 (the-as manipy s4-1) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s4-1 manipy-init (-> obj root-override trans) s5-1 *bluesage-sg* #f) + (-> s4-1 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj bluesage)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj bluesage)) 'blend-shape #t) + (send-event (handle->process (-> obj bluesage)) 'center-joint 3) + (send-event (handle->process (-> obj bluesage)) 'origin-joint-index 3) + ) + ) + (let ((s5-2 (entity-by-name "yellow-sagecage-1"))) + (the-as + symbol + (when s5-2 + (let ((s4-2 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj yellowsage) + (ppointer->handle + (when s4-2 + (let ((t9-18 (method-of-type manipy activate))) + (t9-18 (the-as manipy s4-2) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s4-2 manipy-init (-> obj root-override trans) s5-2 *yellowsage-sg* #f) + (-> s4-2 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj yellowsage)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj yellowsage)) 'blend-shape #t) + (send-event (handle->process (-> obj yellowsage)) 'center-joint 3) + (send-event (handle->process (-> obj yellowsage)) 'origin-joint-index 3) + ) + ) + ) + ) + +;; definition for method 45 of type sage-finalboss +;; INFO: Return type mismatch object vs none. +(defmethod dummy-45 sage-finalboss ((obj sage-finalboss)) + (let ((s5-0 (entity-by-name "assistant-lavatube-end-3"))) + (when s5-0 + (let ((s4-0 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj assistant) + (ppointer->handle + (when s4-0 + (let ((t9-2 (method-of-type manipy activate))) + (t9-2 (the-as manipy s4-0) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s4-0 manipy-init (-> obj root-override trans) s5-0 *assistant-lavatube-end-sg* #f) + (-> s4-0 ppointer) + ) + ) + ) + ) + (let ((s5-1 (handle->process (-> obj assistant)))) + (if (the-as manipy s5-1) + (set! (-> (the-as manipy s5-1) draw level-index) (the-as uint (-> (level-get *level* 'finalboss) index))) + ) + ) + (send-event (handle->process (-> obj assistant)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj assistant)) 'blend-shape #t) + (send-event (handle->process (-> obj assistant)) 'center-joint 3) + (send-event (handle->process (-> obj assistant)) 'origin-joint-index 3) + ) + ) + (none) + ) + +;; definition for method 32 of type sage-finalboss +;; Used lq/sq +(defmethod play-anim! sage-finalboss ((obj sage-finalboss) (arg0 symbol)) + (with-pp + (case (current-status (-> obj tasks)) + (((task-status unknown)) + (when arg0 + (close-current! (-> obj tasks)) + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) 0.0) + ) + (new 'static 'spool-anim + :name "green-sagecage-daxter-sacrifice" + :index 8 + :parts 6 + :command-list + '((1 blackout 0) (236 joint "cameraB") (439 joint "camera")) + ) + ) + (((task-status need-introduction)) + (when arg0 + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) 0.0) + (close-current! (-> obj tasks)) + (let ((s5-1 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj jak-white) + (ppointer->handle + (when s5-1 + (let ((t9-6 (method-of-type manipy activate))) + (t9-6 (the-as manipy s5-1) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s5-1 manipy-init (-> obj root-override trans) (-> obj entity) *jak-white-sg* #f) + (-> s5-1 ppointer) + ) + ) + ) + ) + (send-event + (handle->process (-> obj jak-white)) + 'eval + (lambda :behavior sage-finalboss () (set-vector! (-> self draw color-emissive) 0.5 0.5 0.5 0.0) (none)) + ) + (send-event (handle->process (-> obj jak-white)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj jak-white)) 'origin-joint-index 3) + (send-event (handle->process (-> obj jak-white)) 'blend-shape #t) + (let ((s5-2 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj robotboss) + (ppointer->handle + (when s5-2 + (let ((t9-13 (method-of-type manipy activate))) + (t9-13 (the-as manipy s5-2) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s5-2 manipy-init (-> obj root-override trans) (-> obj entity) *robotboss-cinematic-sg* #f) + (-> s5-2 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj robotboss)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj robotboss)) 'origin-joint-index 3) + (let ((v1-67 (handle->process (-> obj robotboss)))) + (if (the-as manipy v1-67) + (set! (-> (the-as manipy v1-67) draw bounds w) 2048000.0) + ) + ) + (let ((s5-3 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj silodoor) + (ppointer->handle + (when s5-3 + (let ((t9-18 (method-of-type manipy activate))) + (t9-18 (the-as manipy s5-3) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process s5-3 manipy-init (-> obj root-override trans) (-> obj entity) *silodoor-sg* #f) + (-> s5-3 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj silodoor)) 'anim-mode 'clone-anim) + (let ((v1-84 (handle->process (-> obj silodoor)))) + (if (the-as manipy v1-84) + (set! (-> (the-as silodoor v1-84) draw bounds w) 2048000.0) + ) + ) + (send-event (process-by-name "silodoor-5" *active-pool*) 'hide) + (set-setting! *setting-control* pp 'music #f 0.0 0) + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (new 'static 'spool-anim + :name "green-sagecage-outro-beat-boss-a" + :index 9 + :parts 8 + :command-list + '((0 send-event self activate-particle 0) + (0 send-event self activate-particle 1) + (0 send-event self activate-particle 7) + (1 blackout 0) + (61 joint "cameraB") + (71 send-event self activate-particle 2) + (156 joint "camera") + (216 joint "cameraB") + (259 send-event self deactivate-particle 2) + (259 send-event self activate-particle 3) + (268 send-event self activate-particle 4) + (270 send-event self deactivate-particle 3) + (270 send-event self deactivate-particle 0) + (270 send-event self deactivate-particle 1) + (271 joint "camera") + (269 send-event self activate-particle 5) + (272 send-event self flash) + (272 eval (lambda :behavior sage-finalboss + () + (let ((a0-1 (get-task-control (game-task finalboss-movies)))) + (save-reminder a0-1 (logior (get-reminder a0-1 0) 1) 0) + ) + (none) + ) + ) + (273 send-event self deactivate-particle 5) + (333 joint "cameraB") + (395 joint "camera") + (453 joint "cameraB") + (478 send-event self deactivate-particle 4) + (478 send-event self activate-particle 6) + (482 send-event self deactivate-particle 6) + (583 joint "camera") + (640 send-event self deactivate-particle 7) + ) + ) + ) + (((task-status need-reminder-a)) + (when arg0 + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) 0.0) + (close-current! (-> obj tasks)) + (play-reminder obj) + (dummy-45 obj) + (set! (-> obj kick-the-credits) #t) + (let ((s5-5 (get-process *default-dead-pool* manipy #x4000))) + (set! (-> obj robotplat) + (ppointer->handle + (when s5-5 + (let ((t9-30 (method-of-type manipy activate))) + (t9-30 (the-as manipy s5-5) obj 'manipy (the-as pointer #x70004000)) + ) + (run-now-in-process + s5-5 + manipy-init + (-> obj root-override trans) + (-> obj entity) + *plat-eco-finalboss-lit-sg* + #f + ) + (-> s5-5 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> obj robotplat)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> obj robotplat)) 'origin-joint-index 3) + (set! (-> obj old-target-pos trans quad) + (-> (new 'static 'vector :x 11368946.0 :y 2215900.2 :z -19405602.0 :w 1.0) quad) + ) + (quaternion-copy! (-> obj old-target-pos quat) (new 'static 'quaternion :y -0.8472 :w 0.5312)) + (set-setting! *setting-control* pp 'music #f 0.0 0) + (set-setting! *setting-control* pp 'sfx-volume 'abs 0.0 0) + (set-setting! *setting-control* pp 'ambient-volume 'abs 0.0 0) + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (new 'static 'spool-anim + :name "green-sagecage-outro-beat-boss-b" + :index 10 + :parts 27 + :command-list + '((0 kill "crate-3250") + (0 kill "crate-3251") + (0 kill "crate-3252") + (0 kill "crate-3253") + (0 kill "crate-3254") + (0 kill "crate-3255") + (0 kill "crate-3256") + (0 kill "crate-3257") + (0 kill "crate-3258") + (0 kill "crate-3259") + (0 kill "plat-eco-finalboss-1") + (1 blackout 0) + (61 joint "cameraB") + (136 joint "camera") + (510 joint "cameraB") + (641 joint "camera") + (751 joint "cameraB") + (1096 joint "camera") + (1321 joint "cameraB") + (1521 joint "camera") + (1636 joint "cameraB") + (1751 joint "camera") + (1916 joint "cameraB") + (1996 joint "camera") + (2256 joint "cameraB") + ) + ) + ) + (((task-status need-reminder)) + (when arg0 + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) -13116.667) + (close-current! (-> obj tasks)) + (dummy-45 obj) + (send-event *camera* 'teleport) + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (cond + ((target-has-all-the-cells?) + (new 'static 'spool-anim + :name + "green-sagecage-outro-beat-boss-enough-cells" + :index 12 + :parts 6 + :command-list + '((0 send-event self fade) + (1 blackout 0) + (65 joint "cameraB") + (104 joint "camera") + (134 joint "cameraB") + (165 joint "camera") + (292 joint "cameraB") + (488 joint "camera") + (488 auto-save auto-save) + ) + ) + ) + (else + (if arg0 + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (new 'static 'spool-anim + :name + "green-sagecage-outro-beat-boss-need-cells" + :index 11 + :parts 8 + :command-list + '((0 send-event self fade) + (1 blackout 0) + (65 joint "cameraB") + (104 joint "camera") + (134 joint "cameraB") + (165 joint "camera") + (292 joint "cameraB") + (488 joint "camera") + (488 auto-save auto-save) + ) + ) + ) + ) + ) + (((task-status need-reward-speech)) + (when arg0 + (set-yaw-angle-clear-roll-pitch! (-> obj root-override) -13116.667) + (close-current! (-> obj tasks)) + (dummy-45 obj) + (set! (-> obj left-door) (the-as entity-actor (entity-by-name "power-left-2"))) + (set! (-> obj right-door) (the-as entity-actor (entity-by-name "power-right-2"))) + (set-setting! *setting-control* pp 'allow-progress #f 0.0 0) + ) + (new 'static 'spool-anim + :name "green-sagecage-outro-big-finish" + :index 13 + :parts 7 + :command-list + '((1 blackout 0) + (61 joint "cameraB") + (102 joint "camera") + (145 joint "cameraB") + (220 send-event "power-left-2" open) + (220 send-event "power-right-2" open) + (235 joint "camera") + (243 send-event self activate-particle 8) + (322 joint "cameraB") + (428 joint "camera") + (519 joint "cameraB") + (602 joint "camera") + ) + ) + ) + (else + (if arg0 + (format + 0 + "ERROR: : ~S playing anim for task status ~S~%" + (-> obj name) + (task-status->string (current-status (-> obj tasks))) + ) + ) + (-> obj draw art-group data 4) + ) + ) + ) + ) + +;; definition for method 31 of type sage-finalboss +(defmethod get-art-elem sage-finalboss ((obj sage-finalboss)) + (-> obj draw art-group data 4) + ) + +;; definition for function sage-finalboss-credit-particle +;; INFO: Return type mismatch float vs none. +(defbehavior sage-finalboss-credit-particle sage-finalboss () + (when (< 0.0 (-> self credit-fade)) + (if (> (-> self part matrix) 0) + (set-vector! + (sprite-get-user-hvdf (-> self part matrix)) + 2048.0 + 2048.0 + (+ -1024.0 (-> *math-camera* hvdf-off z)) + (-> *math-camera* hvdf-off w) + ) + ) + (set! (-> *part-id-table* 2827 init-specs 8 initial-valuef) (* 128.0 (-> self credit-fade))) + (cond + ((< (-> self credit-fade) 1.0) + (set! (-> *part-id-table* 2825 init-specs 1 initial-valuef) 0.0) + (set! (-> *part-id-table* 2826 init-specs 1 initial-valuef) 0.0) + ) + (else + (set! (-> *part-id-table* 2825 init-specs 1 initial-valuef) 1.0) + (set! (-> *part-id-table* 2826 init-specs 1 initial-valuef) 0.3) + ) + ) + (spawn (-> self part) *zero-vector*) + (set! (-> self credit-fade) (+ -0.008333334 (-> self credit-fade))) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate play-anim (sage-finalboss) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('fade) + (let ((f0-0 1.0)) + (set! (-> self credit-fade) f0-0) + f0-0 + ) + ) + (('flash) + (let ((f0-1 1.9921875)) + (set! (-> self palette-val) f0-1) + f0-1 + ) + ) + (('activate-particle) + (let ((v0-0 (the-as object #t))) + (set! (-> self particle (-> arg3 param 0) active) (the-as symbol v0-0)) + v0-0 + ) + ) + (('deactivate-particle) + (set! (-> self particle (-> arg3 param 0) active) #f) + #f + ) + ) + ) + :enter + (behavior () (set! (-> self credit-fade) 0.0) ((-> (method-of-type process-taskable play-anim) enter)) (none)) + :exit + (behavior () + (when (= (current-status (-> self tasks)) (task-status invalid)) + (cond + ((not (-> self credits-played)) + (set! (-> self kick-the-credits) #t) + ) + (else + (set-blackout-frames 0) + (initialize! *game-info* 'game (the-as game-save #f) "title-start") + ) + ) + ) + (let ((a0-4 (handle->process (-> self redsage)))) + (if a0-4 + (deactivate a0-4) + ) + ) + (let ((a0-8 (handle->process (-> self bluesage)))) + (if a0-8 + (deactivate a0-8) + ) + ) + (let ((a0-12 (handle->process (-> self yellowsage)))) + (if a0-12 + (deactivate a0-12) + ) + ) + (let ((a0-16 (handle->process (-> self assistant)))) + (if a0-16 + (deactivate a0-16) + ) + ) + (let ((a0-20 (handle->process (-> self robotplat)))) + (if a0-20 + (deactivate a0-20) + ) + ) + (let ((a0-24 (handle->process (-> self robotboss)))) + (if a0-24 + (deactivate a0-24) + ) + ) + (let ((a0-28 (handle->process (-> self jak-white)))) + (if a0-28 + (deactivate a0-28) + ) + ) + (let ((a0-32 (handle->process (-> self silodoor)))) + (if a0-32 + (deactivate a0-32) + ) + ) + (when (-> self left-door) + (let ((a1-9 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-9 from) self) + (set! (-> a1-9 num-params) 2) + (set! (-> a1-9 message) 'brightness) + (set! (-> a1-9 param 0) (the-as uint 1.0)) + (set! (-> a1-9 param 1) (the-as uint 0.0)) + (let ((t9-11 send-event-function) + (v1-61 (-> self left-door)) + ) + (t9-11 + (if v1-61 + (-> v1-61 extra process) + ) + a1-9 + ) + ) + ) + (set! (-> self left-door) #f) + ) + (when (-> self right-door) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) self) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'brightness) + (set! (-> a1-10 param 0) (the-as uint 1.0)) + (set! (-> a1-10 param 1) (the-as uint 0.0)) + (let ((t9-12 send-event-function) + (v1-71 (-> self right-door)) + ) + (t9-12 + (if v1-71 + (-> v1-71 extra process) + ) + a1-10 + ) + ) + ) + (set! (-> self right-door) #f) + ) + (cond + ((= (current-status (-> self tasks)) (task-status need-reward-speech)) + (if (target-has-all-the-cells?) + (set! (-> self kick-in-the-door) #t) + (start 'play (get-continue-by-name *game-info* "finalboss-start")) + ) + ) + ((= (current-status (-> self tasks)) (task-status invalid)) + ) + (else + (set-blackout-frames #x7530) + ) + ) + (dotimes (v1-84 9) + (set! (-> self particle v1-84 active) #f) + ) + ((-> (method-of-type process-taskable play-anim) exit)) + (none) + ) + :trans + (behavior () + (local-vars (f28-0 float)) + (when (-> self left-door) + (let ((f30-0 (ja-aframe-num 0))) + 0.0 + (let ((f30-1 + (cond + ((< f30-0 235.0) + (set! f28-0 1.0) + 0.0 + ) + ((< 320.0 f30-0) + (set! f28-0 1.0) + 0.0 + ) + (else + (if (> (-> self particle-whiteout matrix) 0) + (set-vector! + (sprite-get-user-hvdf (-> self particle-whiteout matrix)) + 2048.0 + 2048.0 + (+ -1024.0 (-> *math-camera* hvdf-off z)) + (-> *math-camera* hvdf-off w) + ) + ) + (set! (-> *part-id-table* 2965 init-specs 8 initial-valuef) (fmax 0.0 (fmin 128.0 (* 0.75 (+ -240.0 f30-0))))) + (spawn (-> self particle-whiteout) *zero-vector*) + (set! f28-0 (fmin 2.0 (fmax 0.0 (* 0.033333335 (+ -235.0 f30-0))))) + f28-0 + ) + ) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) 'brightness) + (set! (-> a1-1 param 0) (the-as uint f28-0)) + (set! (-> a1-1 param 1) (the-as uint f30-1)) + (let ((t9-3 send-event-function) + (v1-20 (-> self left-door)) + ) + (t9-3 + (if v1-20 + (-> v1-20 extra process) + ) + a1-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) 'brightness) + (set! (-> a1-2 param 0) (the-as uint f28-0)) + (set! (-> a1-2 param 1) (the-as uint f30-1)) + (let ((t9-4 send-event-function) + (v1-27 (-> self right-door)) + ) + (t9-4 + (if v1-27 + (-> v1-27 extra process) + ) + a1-2 + ) + ) + ) + ) + ) + ) + (when (and *target* (-> self particle 0 active)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (set! (-> a1-3 quad) (-> *target* draw origin quad)) + (set! (-> a1-3 y) 1970176.0) + (spawn (-> self particle 0 part) a1-3) + ) + ) + (when (and (handle->process (-> self jak-white)) (-> self particle 1 active)) + (let ((a0-17 (handle->process (-> self jak-white)))) + (spawn + (-> self particle 1 part) + (process-drawable-random-point! (the-as process-drawable a0-17) (new 'stack-no-clear 'vector)) + ) + ) + ) + (when (and (handle->process (-> self jak-white)) (-> self particle 2 active)) + (let* ((v1-52 (handle->process (-> self jak-white))) + (a1-11 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable v1-52) node-list data 52))) + ) + (spawn (-> self particle 2 part) a1-11) + ) + ) + (when (and (handle->process (-> self jak-white)) (-> self particle 3 active)) + (let* ((v1-63 (handle->process (-> self jak-white))) + (a1-15 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable v1-63) node-list data 52))) + ) + (spawn (-> self particle 3 part) a1-15) + ) + ) + (if (and (handle->process (-> self robotboss)) (-> self particle 4 active)) + (spawn (-> self particle 4 part) (process-drawable-random-point! + (the-as process-drawable (handle->process (-> self robotboss))) + (new 'stack-no-clear 'vector) + ) + ) + ) + (if (and (handle->process (-> self robotboss)) (-> self particle 5 active)) + (spawn + (-> self particle 5 part) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable (handle->process (-> self robotboss))) node-list data 15) + ) + ) + ) + (if (and (handle->process (-> self robotboss)) (-> self particle 6 active)) + (spawn + (-> self particle 6 part) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable (handle->process (-> self robotboss))) node-list data 6) + ) + ) + ) + (when (and (handle->process (-> self robotboss)) (-> self particle 7 active)) + (let ((gp-4 (new 'stack-no-clear 'vector))) + (vector<-cspace! gp-4 (-> (the-as process-drawable (handle->process (-> self robotboss))) node-list data 7)) + (spawn (-> self particle 7 part) gp-4) + ) + ) + (when (-> self particle 8 active) + (let ((gp-5 (search-process-tree *active-pool* (lambda ((arg0 final-door)) (= (-> arg0 type) power-left)))) + (a0-70 (search-process-tree *active-pool* (lambda ((arg0 final-door)) (= (-> arg0 type) power-left)))) + (a1-43 (new 'stack-no-clear 'vector)) + ) + (vector+! a1-43 (-> (the-as final-door gp-5) root trans) (-> (the-as final-door a0-70) root trans)) + (vector-float*! a1-43 a1-43 0.5) + (spawn (-> self particle 8 part) a1-43) + ) + ) + (sage-finalboss-credit-particle) + (let* ((f0-14 (- 0.0 (-> self palette-val))) + (f0-15 (if (< 0.0 f0-14) + (fmin 0.025 f0-14) + (fmax -0.025 f0-14) + ) + ) + ) + (+! (-> self palette-val) f0-15) + ) + (set! (-> *palette-fade-controls* control 2 fade) (-> self palette-val)) + (case (current-status (-> self tasks)) + (((task-status need-introduction)) + (spool-push *art-control* "green-sagecage-outro-beat-boss-a" 0 self -1.0) + ) + (((task-status need-reminder-a)) + (spool-push *art-control* "green-sagecage-outro-beat-boss-b" 0 self -1.0) + ) + (((task-status need-reminder)) + (if (target-has-all-the-cells?) + (spool-push *art-control* "green-sagecage-outro-beat-boss-enough-cells" 0 self -1.0) + (spool-push *art-control* "green-sagecage-outro-beat-boss-need-cells" 0 self -1.0) + ) + ) + (((task-status need-reward-speech)) + (spool-push *art-control* "green-sagecage-outro-big-finish" 0 self -1.0) + ) + ) + ((-> (method-of-type process-taskable play-anim) trans)) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate sage-finalboss-credits (sage-finalboss) + :exit + (behavior () + (when (= (current-status (-> self tasks)) (task-status invalid)) + (set-blackout-frames 0) + (initialize! *game-info* 'game (the-as game-save #f) "title-start") + ) + (none) + ) + :code + (behavior () + (local-vars (s5-0 symbol)) + (set! (-> self credits-played) #t) + (set-blackout-frames 0) + (set-blackout-frames 15) + (clear-pending-settings-from-process *setting-control* self 'sfx-volume) + (clear-pending-settings-from-process *setting-control* self 'ambient-volume) + (set-setting! *setting-control* self 'allow-pause #f 0.0 0) + (set-setting! *setting-control* self 'allow-progress #f 0.0 0) + (set-setting! *setting-control* self 'music 'ogreboss 0.0 0) + (set! (-> self state-time) (-> *display* game-frame-counter)) + (logior! (-> self draw status) (draw-status drwf01)) + (let ((gp-0 (-> self mask))) + (load-state-want-display-level 'finalboss 'special) + (logclear! (-> self mask) (process-mask pause progress)) + (push-setting! *setting-control* self 'process-mask 'set 0.0 8212) + (copy-settings-from-target! *setting-control*) + (let ((f30-0 0.0) + (f28-0 0.5) + ) + (until s5-0 + (hide-hud-quick) + (set! (-> self credit-fade) 1.0) + (sage-finalboss-credit-particle) + (set! s5-0 (draw-end-credits (the int f30-0))) + (if (and *cheat-mode* (cpad-pressed? 0 triangle)) + (set! s5-0 #t) + ) + (cond + ((paused?) + ) + ((and (< 1300.0 f30-0) (cpad-hold? 0 circle x)) + (set! f28-0 (seek f28-0 16.0 (* 4.0 (-> *display* seconds-per-frame)))) + (+! f30-0 (* f28-0 (-> *display* time-adjust-ratio))) + ) + (else + (set! f28-0 (seek f28-0 0.5 (* 16.0 (-> *display* seconds-per-frame)))) + (+! f30-0 (* f28-0 (-> *display* time-adjust-ratio))) + ) + ) + (suspend) + ) + ) + (set! (-> self mask) gp-0) + ) + (load-state-want-display-level 'finalboss 'display) + (clear-pending-settings-from-process *setting-control* self 'allow-pause) + (clear-pending-settings-from-process *setting-control* self 'allow-progress) + (clear-pending-settings-from-process *setting-control* self 'process-mask) + (clear-pending-settings-from-process *setting-control* self 'music) + (copy-settings-from-target! *setting-control*) + (set-blackout-frames 15) + (let ((gp-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-1) 15) + (suspend) + ) + ) + (go-virtual hidden) + (none) + ) + ) + +;; definition for method 39 of type sage-finalboss +(defmethod should-display? sage-finalboss ((obj sage-finalboss)) + #f + ) + +;; definition for function sage-finalboss-extra-trans +;; INFO: Return type mismatch object vs none. +(defbehavior sage-finalboss-extra-trans sage-finalboss () + (case (current-status (-> self tasks)) + (((task-status need-reminder-a) (task-status need-reminder)) + (send-event self 'play-anim) + ) + ) + (none) + ) + +;; definition for function sage-finalboss-extra-enter +;; INFO: Return type mismatch object vs none. +(defbehavior sage-finalboss-extra-enter sage-finalboss () + (cond + ((-> self kick-the-credits) + (set! (-> self kick-the-credits) #f) + (go sage-finalboss-credits) + ) + ((-> self kick-in-the-door) + (set! (-> self kick-in-the-door) #f) + (entity-birth-no-kill (entity-by-type power-right)) + (entity-birth-no-kill (entity-by-type power-left)) + (send-event + *target* + 'change-mode + 'final-door + (search-process-tree *active-pool* (lambda ((arg0 final-door)) (= (-> arg0 type) power-right))) + (search-process-tree *active-pool* (lambda ((arg0 final-door)) (= (-> arg0 type) power-left))) + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate hidden (sage-finalboss) + :virtual #t + :enter + (behavior () + (sage-finalboss-extra-enter) + ((-> (method-of-type process-taskable hidden) enter)) + (clear-pending-settings-from-process *setting-control* self 'allow-progress) + (none) + ) + :trans + (behavior () (sage-finalboss-extra-trans) ((-> (method-of-type process-taskable hidden) trans)) (none)) + ) + +;; failed to figure out what this is: +(defstate idle (sage-finalboss) + :virtual #t + :enter + (behavior () (sage-finalboss-extra-enter) ((-> (method-of-type process-taskable idle) enter)) (none)) + :trans + (behavior () (sage-finalboss-extra-trans) ((-> (method-of-type process-taskable idle) trans)) (none)) + ) + +;; definition for method 11 of type sage-finalboss +;; INFO: Return type mismatch object vs none. +(defmethod init-from-entity! sage-finalboss ((obj sage-finalboss) (arg0 entity-actor)) + (dummy-40 obj arg0 *sage-finalboss-sg* 3 40 (new 'static 'vector :w 4096.0) 5) + (set! (-> obj tasks) (get-task-control (game-task finalboss-movies))) + (set! (-> obj redsage) (the-as handle #f)) + (set! (-> obj bluesage) (the-as handle #f)) + (set! (-> obj yellowsage) (the-as handle #f)) + (set! (-> obj assistant) (the-as handle #f)) + (set! (-> obj robotplat) (the-as handle #f)) + (set! (-> obj robotboss) (the-as handle #f)) + (set! (-> obj jak-white) (the-as handle #f)) + (set! (-> obj silodoor) (the-as handle #f)) + (set! (-> obj left-door) #f) + (set! (-> obj right-door) #f) + (set! (-> obj kick-in-the-door) #f) + (set! (-> obj kick-the-credits) #f) + (set! (-> obj credits-played) #f) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 682) obj)) + (set! (-> obj part matrix) (sprite-allocate-user-hvdf)) + (set! (-> obj particle-whiteout) (create-launch-control (-> *part-group-id-table* 706) obj)) + (set! (-> obj particle-whiteout matrix) (sprite-allocate-user-hvdf)) + (set! (-> obj particle 0 part) (create-launch-control (-> *part-group-id-table* 699) obj)) + (set! (-> obj particle 1 part) (create-launch-control (-> *part-group-id-table* 700) obj)) + (set! (-> obj particle 2 part) (create-launch-control (-> *part-group-id-table* 701) obj)) + (set! (-> obj particle 3 part) (create-launch-control (-> *part-group-id-table* 702) obj)) + (set! (-> obj particle 7 part) (create-launch-control (-> *part-group-id-table* 645) obj)) + (set! (-> obj particle 4 part) (create-launch-control (-> *part-group-id-table* 703) obj)) + (set! (-> obj particle 5 part) (create-launch-control (-> *part-group-id-table* 696) obj)) + (set! (-> obj particle 6 part) (create-launch-control (-> *part-group-id-table* 704) obj)) + (set! (-> obj particle 8 part) (create-launch-control (-> *part-group-id-table* 698) obj)) + (dotimes (v1-37 9) + (set! (-> obj particle v1-37 active) #f) + ) + (set! (-> obj palette-val) 0.0) + (set! (-> obj root-override trans y) (+ 2048.0 (-> obj root-override trans y))) + (if (not (should-display? obj)) + (go (method-of-object obj hidden)) + (go (method-of-object obj idle)) + ) + (none) + ) diff --git a/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc b/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc index a6e6926c48..70c7d23cc8 100644 --- a/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc +++ b/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc @@ -216,7 +216,8 @@ (deadly-percent float :offset-assert 48) (powerup-percent float :offset-assert 52) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #x38 :flag-assert #x900000038 ) diff --git a/test/decompiler/reference/levels/jungle/junglesnake_REF.gc b/test/decompiler/reference/levels/jungle/junglesnake_REF.gc index ae451910bf..5332d7bb68 100644 --- a/test/decompiler/reference/levels/jungle/junglesnake_REF.gc +++ b/test/decompiler/reference/levels/jungle/junglesnake_REF.gc @@ -59,7 +59,8 @@ (ry float :offset-assert 4) (drag-delta-ry float :offset-assert 8) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) @@ -78,7 +79,8 @@ ((joint-index int32 :offset-assert 0) (flip-it symbol :offset-assert 4) ) - :allow-misaligned :method-count-assert 9 + :allow-misaligned + :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) diff --git a/test/decompiler/reference/levels/sunken/orbit-plat_REF.gc b/test/decompiler/reference/levels/sunken/orbit-plat_REF.gc new file mode 100644 index 0000000000..ee8adba689 --- /dev/null +++ b/test/decompiler/reference/levels/sunken/orbit-plat_REF.gc @@ -0,0 +1,967 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type orbit-plat-bottom +(deftype orbit-plat-bottom (process-drawable) + ((parent-override (pointer orbit-plat) :offset 12) + (part2 sparticle-launch-control :offset-assert 176) + ) + :heap-base #x50 + :method-count-assert 21 + :size-assert #xb4 + :flag-assert #x15005000b4 + (:methods + (dummy-20 (_type_ vector vector) none 20) + ) + (:states + orbit-plat-bottom-idle + ) + ) + +;; definition for method 3 of type orbit-plat-bottom +(defmethod inspect orbit-plat-bottom ((obj orbit-plat-bottom)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tpart2: ~A~%" (-> obj part2)) + obj + ) + +;; failed to figure out what this is: +(defskelgroup *orbit-plat-bottom-sg* orbit-plat-bottom + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 2.8) + :longest-edge (meters 0) + ) + +;; definition of type orbit-plat +(deftype orbit-plat (baseplat) + ((other entity-actor :offset-assert 228) + (rot-dir float :offset-assert 232) + (reset-trans vector :inline :offset-assert 240) + (is-reset? symbol :offset-assert 256) + (reset-length float :offset-assert 260) + (timeout float :offset-assert 264) + (plat-status uint64 :offset-assert 272) + ) + :heap-base #xb0 + :method-count-assert 29 + :size-assert #x118 + :flag-assert #x1d00b00118 + (:methods + (dummy-27 (_type_) symbol 27) + (dummy-28 (_type_) symbol 28) + ) + (:states + orbit-plat-idle + orbit-plat-reset + orbit-plat-riding + orbit-plat-rotating + orbit-plat-still + orbit-plat-wait-for-other + ) + ) + +;; definition for method 3 of type orbit-plat +(defmethod inspect orbit-plat ((obj orbit-plat)) + (let ((t9-0 (method-of-type baseplat inspect))) + (t9-0 obj) + ) + (format #t "~T~Tother: ~A~%" (-> obj other)) + (format #t "~T~Trot-dir: ~f~%" (-> obj rot-dir)) + (format #t "~T~Treset-trans: #~%" (-> obj reset-trans)) + (format #t "~T~Tis-reset?: ~A~%" (-> obj is-reset?)) + (format #t "~T~Treset-length: ~f~%" (-> obj reset-length)) + (format #t "~T~Ttimeout: ~f~%" (-> obj timeout)) + (format #t "~T~Tplat-status: ~D~%" (-> obj plat-status)) + obj + ) + +;; failed to figure out what this is: +(defskelgroup *orbit-plat-sg* orbit-plat + 0 + 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3.4) + :longest-edge (meters 0) + ) + +;; failed to figure out what this is: +(set! (-> *part-group-id-table* 440) + (new 'static 'sparticle-launch-group + :length 4 + :duration #xbb8 + :linger-duration #x5dc + :name "group-orbit-plat-jet" + :launcher + (new 'static 'inline-array sparticle-group-item 4 + (sp-item 1715 :fade-after (meters 100.0) :falloff-to (meters 120.0) :period 150 :length 75) + (sp-item 1715 :fade-after (meters 100.0) :falloff-to (meters 120.0) :period 75 :length 96) + (sp-item 1715 :fade-after (meters 140.0) :falloff-to (meters 160.0) :period 90 :length 60) + (sp-item 1716 :fade-after (meters 100.0) :falloff-to (meters 100.0)) + ) + :bounds (new 'static 'sphere :w 24576.0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 1716) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 18 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-rnd-flt spt-num 0.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.0) (meters 0.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-flt spt-r 0.0) + (sp-flt spt-g 64.0) + (sp-flt spt-b 48.0) + (sp-rnd-flt spt-a 32.0 96.0 1.0) + (sp-rnd-flt spt-vel-z (meters 0.02) (meters 0.0033333334) 1.0) + (sp-rnd-flt spt-scalevel-x (meters -0.013333334) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -1.7066667) + (sp-int spt-timer 75) + (sp-cpuinfo-flags bit2) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 15.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 1715) + (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-rnd-flt spt-num 1.0 2.0 1.0) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-sound) + :flags (sp-flag plain-v2) + :sound + (new 'static 'sound-spec + :mask #x1 + :num 0.05 + :group #x1 + :sound-name (static-sound-name "steam-medium") + :volume #x333 + ) + ) + (sp-rnd-flt spt-scale-x (meters 0.75) (meters 0.75) 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 0.0) + (sp-flt spt-g 96.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-vel-z (meters 0.053333335) (meters 0.0033333334) 1.0) + (sp-rnd-flt spt-scalevel-x (meters -0.013333334) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.8) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 75) + (sp-cpuinfo-flags bit2) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 15.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 1717) (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 16 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-rnd-flt spt-num 1.0 3.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.7) (meters 0.3) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 32.0) + (sp-rnd-flt spt-g 16.0 96.0 1.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 64.0) + (sp-rnd-flt spt-vel-z (meters 0.45) (meters 0.05) 1.0) + (sp-flt spt-fade-r -0.08888889) + (sp-int spt-timer 360) + (sp-cpuinfo-flags bit2 launch-along-z) + (sp-flt spt-conerot-x (degrees 0.0)) + (sp-flt spt-conerot-y (degrees 0.0)) + (sp-rnd-flt spt-conerot-radius (meters -3.0) (meters 4.0) 1.0) + (sp-end) + ) + ) + ) + +;; definition for method 20 of type orbit-plat-bottom +;; INFO: Return type mismatch int vs none. +(defmethod dummy-20 orbit-plat-bottom ((obj orbit-plat-bottom) (arg0 vector) (arg1 vector)) + (let* ((s5-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (f30-0 (vector-length s5-1)) + ) + (let ((f28-0 (* 0.0005022321 f30-0))) + (set! (-> *part-id-table* 1717 init-specs 13 initial-valuef) (vector-y-angle s5-1)) + (set! (-> *part-id-table* 1717 init-specs 12 initial-valuef) (- (vector-x-angle s5-1))) + (set! (-> *part-id-table* 1717 init-specs 9 initial-valuef) (/ -32.0 f28-0)) + (set! (-> *part-id-table* 1717 init-specs 10 initial-valuef) (the-as float (the int f28-0))) + ) + (set! (-> *part-id-table* 1717 init-specs 1 random-rangef) (* 0.000009494358 f30-0)) + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 1717) + arg0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate orbit-plat-bottom-idle (orbit-plat-bottom) + :code + (behavior () + (while #t + (set! (-> self root trans quad) (-> self parent-override 0 root-override trans quad)) + (set! (-> self root trans y) (+ -5324.8 (-> self root trans y))) + (spawn (-> self part2) (-> self root trans)) + (let* ((a0-6 (-> self parent-override 0 other)) + (v1-9 (if a0-6 + (-> a0-6 extra process) + ) + ) + ) + (when v1-9 + (let ((f30-0 (atan + (- (-> (the-as orbit-plat v1-9) root-override trans x) (-> self root trans x)) + (- (-> (the-as orbit-plat v1-9) root-override trans z) (-> self root trans z)) + ) + ) + ) + (quaternion-axis-angle! (-> self root quat) 0.0 1.0 0.0 f30-0) + (let ((v1-16 (-> self parent-override 0 plat-status)) + (f30-1 (+ 16384.0 f30-0)) + ) + (cond + ((= v1-16 2) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set-vector! gp-0 0.0 -2048.0 8192.0 1.0) + (if (< (-> self parent-override 0 rot-dir) 0.0) + (set! f30-1 (+ 32768.0 f30-1)) + ) + (vector-rotate-around-y! gp-0 gp-0 f30-1) + (set! (-> *part-id-table* 1716 init-specs 16 initial-valuef) f30-1) + (set! (-> *part-id-table* 1715 init-specs 18 initial-valuef) f30-1) + (vector+! gp-0 gp-0 (-> self root trans)) + (spawn (-> self part) gp-0) + ) + ) + (else + (let* ((a0-18 (-> self parent-override 0 other)) + (v1-32 (if a0-18 + (-> a0-18 extra process) + ) + ) + ) + (when (and v1-32 (= (-> (the-as orbit-plat v1-32) plat-status) 2)) + (let ((gp-1 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-1 quad) (-> self root trans quad)) + (set! (-> gp-1 y) (+ -2048.0 (-> gp-1 y))) + (set! (-> s5-0 quad) (-> (the-as orbit-plat v1-32) root-override trans quad)) + (set! (-> s5-0 y) (+ -7372.8 (-> s5-0 y))) + (vector-! s4-0 s5-0 gp-1) + (vector-normalize! s4-0 1.0) + (vector+*! s5-0 gp-1 s4-0 26624.0) + (vector+*! gp-1 gp-1 s4-0 8192.0) + ) + (dummy-20 self gp-1 s5-0) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior orbit-plat-bottom) ja-post) + ) + +;; definition for method 7 of type orbit-plat-bottom +;; INFO: Return type mismatch process-drawable vs orbit-plat-bottom. +(defmethod relocate orbit-plat-bottom ((obj orbit-plat-bottom) (arg0 int)) + (if (nonzero? (-> obj part2)) + (&+! (-> obj part2) arg0) + ) + (the-as orbit-plat-bottom ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; definition for method 10 of type orbit-plat-bottom +(defmethod deactivate orbit-plat-bottom ((obj orbit-plat-bottom)) + (if (nonzero? (-> obj part2)) + (kill-and-free-particles (-> obj part2)) + ) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; definition for function orbit-plat-bottom-init-by-other +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior orbit-plat-bottom-init-by-other orbit-plat-bottom ((arg0 entity) (arg1 orbit-plat)) + (set! (-> self entity) arg0) + (set! (-> self mask) (logior (process-mask platform) (-> self mask))) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg1 root-override trans quad)) + (quaternion-copy! (-> self root quat) (-> arg1 root-override quat)) + (set! (-> self root scale quad) (-> arg1 root-override scale quad)) + (set! (-> self root trans y) (+ -5324.8 (-> self root trans y))) + (set! (-> self part) (create-launch-control (-> *part-group-id-table* 440) self)) + (set! (-> self part2) (create-launch-control (-> *part-group-id-table* 107) self)) + (initialize-skeleton self *orbit-plat-bottom-sg* '()) + (ja-channel-set! 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 2)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (go orbit-plat-bottom-idle) + (none) + ) + +;; failed to figure out what this is: +(defstate orbit-plat-idle (orbit-plat) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'bonk) + (dummy-22 self) + ) + ((= v1-0 'go) + (go orbit-plat-rotating) + ) + ((= v1-0 'query-reset) + (if (not (-> self is-reset?)) + (go orbit-plat-reset) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'reset) + (let ((t9-3 send-event-function) + (v1-8 (-> self other)) + ) + (t9-3 + (if v1-8 + (-> v1-8 extra process) + ) + a1-1 + ) + ) + ) + ) + ((= v1-0 'reset) + (go orbit-plat-reset) + ) + ) + ) + ) + ) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 0)) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 0.0) + (set! (-> a0-0 param 1) 1.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim #f) num-func-seek!) + ) + (dotimes (gp-0 2) + (transform-post) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 param 0) 0.0) + (set! (-> a0-2 param 1) 1.0) + (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (while #t + (when (nonzero? (-> self root-override riders num-riders)) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'go) + (let ((t9-4 send-event-function) + (v1-14 (-> self other)) + ) + (t9-4 + (if v1-14 + (-> v1-14 extra process) + ) + a1-2 + ) + ) + ) + (go orbit-plat-riding) + ) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) 0.0) + (set! (-> a0-5 param 1) 1.0) + (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (when (not (-> self is-reset?)) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) self) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'query-reset) + (let ((t9-8 send-event-function) + (v1-26 (-> self other)) + ) + (t9-8 + (if v1-26 + (-> v1-26 extra process) + ) + a1-4 + ) + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +;; definition for method 28 of type orbit-plat +(defmethod dummy-28 orbit-plat ((obj orbit-plat)) + (when (>= (- (-> *display* base-frame-counter) (-> obj state-time)) (the int (* 300.0 (-> obj timeout)))) + (cond + (*target* + (let ((s5-0 (target-pos 0))) + (if (or + (>= (vector-vector-xz-distance s5-0 (-> obj root-override trans)) 102400.0) + (>= (- (-> obj root-override trans y) (-> s5-0 y)) 16384.0) + ) + (return #t) + ) + ) + ) + (else + (return #t) + ) + ) + ) + #f + ) + +;; failed to figure out what this is: +(defstate orbit-plat-still (orbit-plat) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'bonk) + (dummy-22 self) + ) + ((= v1-0 'go) + (go orbit-plat-rotating) + ) + ) + ) + ) + ) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 0)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 0.0) + (set! (-> a0-0 param 1) 1.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim #f) num-func-seek!) + ) + (until (dummy-28 self) + (when (nonzero? (-> self root-override riders num-riders)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'go) + (let ((t9-1 send-event-function) + (v1-10 (-> self other)) + ) + (t9-1 + (if v1-10 + (-> v1-10 extra process) + ) + a1-1 + ) + ) + ) + (go orbit-plat-riding) + ) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) 0.0) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (go orbit-plat-idle) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +;; failed to figure out what this is: +(defstate orbit-plat-riding (orbit-plat) + :event + (the-as (function process int symbol event-message-block object :behavior orbit-plat) plat-event) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 1)) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) (the float (+ (-> a0-0 frame-group data 0 length) -1))) + (set! (-> a0-0 param 1) 1.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim #f) num-func-seek!) + ) + (while #t + (when (zero? (-> self root-override riders num-riders)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'stop) + (let ((t9-1 send-event-function) + (v1-13 (-> self other)) + ) + (t9-1 + (if v1-13 + (-> v1-13 extra process) + ) + a1-1 + ) + ) + ) + (go orbit-plat-still) + ) + (suspend) + (when (not (ja-done? 0)) + (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) 1.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +;; definition for function get-rotate-point! +(defun get-rotate-point! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float) (arg5 float)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector-! s5-0 arg2 arg1) + (when (!= arg4 0.0) + (set! (-> s2-0 x) (* arg4 (-> s5-0 z))) + (set! (-> s2-0 y) 0.0) + (set! (-> s2-0 z) (- (* arg4 (-> s5-0 x)))) + (vector-normalize! s2-0 (* arg5 (-> *display* seconds-per-frame))) + (+! (-> s5-0 x) (-> s2-0 x)) + (+! (-> s5-0 z) (-> s2-0 z)) + ) + ) + (vector-normalize! s5-0 (the-as float arg3)) + (vector+! arg0 arg1 s5-0) + ) + arg0 + ) + +;; definition for function get-nav-point! +;; Used lq/sq +(defun get-nav-point! ((arg0 vector) (arg1 orbit-plat) (arg2 vector) (arg3 float)) + (set! (-> arg1 nav target-pos quad) (-> arg2 quad)) + (logclear! (-> arg1 nav flags) (nav-control-flags bit19)) + (dummy-11 (-> arg1 nav) (-> arg1 nav target-pos)) + (let ((f0-0 (vector-length (-> arg1 nav travel)))) + (if (< arg3 f0-0) + (set! f0-0 arg3) + ) + (vector-normalize! (-> arg1 nav travel) (* f0-0 (-> *display* seconds-per-frame))) + ) + (set! (-> arg0 x) (+ (-> arg1 root-override trans x) (-> arg1 nav travel x))) + (set! (-> arg0 y) (-> arg1 root-override trans x)) + (set! (-> arg0 z) (+ (-> arg1 root-override trans z) (-> arg1 nav travel z))) + arg0 + ) + +;; failed to figure out what this is: +(defstate orbit-plat-rotating (orbit-plat) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'bonk) + (dummy-22 self) + ) + ((= v1-0 'stop) + (go orbit-plat-still) + ) + ) + ) + ) + ) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +;; definition for method 27 of type orbit-plat +;; INFO: Return type mismatch object vs symbol. +;; WARN: disable def twice: 132. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; Used lq/sq +(defmethod dummy-27 orbit-plat ((obj orbit-plat)) + (local-vars (v0-11 object)) + (let* ((v1-0 (-> obj other)) + (s5-0 (if v1-0 + (-> v1-0 extra process) + ) + ) + ) + (the-as + symbol + (cond + ((and + s5-0 + (< (vector-vector-xz-distance (the-as vector (&-> s5-0 stack 96)) (the-as vector (&-> s5-0 stack 128))) + (vector-vector-xz-distance (-> obj basetrans) (-> obj reset-trans)) + ) + ) + (cond + ((-> (the-as orbit-plat s5-0) is-reset?) + (when (!= (-> obj plat-status) 2) + (set! (-> obj plat-status) (the-as uint 2)) + (let ((f30-1 (atan + (- (-> obj basetrans x) (-> (the-as orbit-plat s5-0) basetrans x)) + (- (-> obj basetrans z) (-> (the-as orbit-plat s5-0) basetrans z)) + ) + ) + (f0-9 (atan + (- (-> obj reset-trans x) (-> (the-as orbit-plat s5-0) basetrans x)) + (- (-> obj reset-trans z) (-> (the-as orbit-plat s5-0) basetrans z)) + ) + ) + ) + (if (>= (deg- f0-9 f30-1) 0.0) + (set! (-> obj rot-dir) 1.0) + (set! (-> obj rot-dir) -1.0) + ) + ) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((a0-7 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (let ((v1-9 s4-0) + (a1-5 (-> obj other)) + ) + (set! (-> v1-9 quad) (-> (the-as orbit-plat (if a1-5 + (-> a1-5 extra process) + ) + ) + root-override + trans + quad + ) + ) + ) + (vector-! a0-7 (-> obj basetrans) s4-0) + (let ((f30-2 (vector-length a0-7))) + (get-rotate-point! s5-1 s4-0 (-> obj basetrans) (the-as vector f30-2) (-> obj rot-dir) 40960.0) + (cond + ((dummy-16 (-> obj nav) s5-1) + (set! (-> obj basetrans quad) (-> s5-1 quad)) + ) + (else + (set! (-> obj rot-dir) (- (-> obj rot-dir))) + (get-rotate-point! s5-1 s4-0 (-> obj basetrans) (the-as vector f30-2) (-> obj rot-dir) 40960.0) + (if (dummy-16 (-> obj nav) s5-1) + (set! (-> obj basetrans quad) (-> s5-1 quad)) + ) + ) + ) + ) + ) + ) + (when (>= 614.4 (vector-vector-xz-distance (-> obj basetrans) (-> obj reset-trans))) + (set! v0-11 (logior (nav-control-flags bit19) (-> obj nav flags))) + (set! (-> obj nav flags) (the-as nav-control-flags v0-11)) + v0-11 + ) + ) + (else + (let ((s5-2 (new 'stack-no-clear 'vector))) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (get-nav-point! s5-2 obj (-> obj reset-trans) 40960.0) + (let ((v1-20 s4-1) + (a0-19 (-> obj other)) + ) + (set! (-> v1-20 quad) (-> (the-as orbit-plat (if a0-19 + (-> a0-19 extra process) + ) + ) + root-override + trans + quad + ) + ) + ) + (set! (-> s5-2 y) (-> s4-1 y)) + (vector-! s5-2 s5-2 s4-1) + (vector-normalize! s5-2 (-> obj reset-length)) + (vector+! s5-2 s5-2 s4-1) + (when (not (dummy-16 (-> obj nav) s5-2)) + (logclear! (-> obj nav flags) (nav-control-flags bit19)) + (get-rotate-point! s5-2 s4-1 (-> obj basetrans) (the-as vector (-> obj reset-length)) 0.0 40960.0) + (when (not (dummy-16 (-> obj nav) s5-2)) + (get-rotate-point! + s5-2 + s4-1 + (-> obj basetrans) + (the-as vector (-> obj reset-length)) + (-> obj rot-dir) + 40960.0 + ) + (when (not (dummy-16 (-> obj nav) s5-2)) + (set! (-> obj rot-dir) (- (-> obj rot-dir))) + (get-rotate-point! + s5-2 + s4-1 + (-> obj basetrans) + (the-as vector (-> obj reset-length)) + (-> obj rot-dir) + 40960.0 + ) + ) + ) + ) + ) + (set! (-> s5-2 y) (-> obj basetrans y)) + (set! v0-11 (-> obj basetrans)) + (set! (-> (the-as vector v0-11) quad) (-> s5-2 quad)) + ) + v0-11 + ) + ) + ) + (else + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 quad) (-> obj basetrans quad)) + (get-nav-point! (-> obj basetrans) obj (-> obj reset-trans) 40960.0) + (let ((f0-29 (-> s5-3 y))) + (set! (-> obj basetrans y) f0-29) + f0-29 + ) + ) + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate orbit-plat-reset (orbit-plat) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'bonk) + (dummy-22 self) + ) + ((= v1-0 'go) + (go orbit-plat-rotating) + ) + ) + ) + ) + ) + :trans + (the-as (function none :behavior orbit-plat) plat-trans) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 3)) + (logclear! (-> self nav flags) (nav-control-flags bit19)) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) 0.0) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + (while (zero? (logand (nav-control-flags bit19) (-> self nav flags))) + (dummy-27 self) + (when (nonzero? (-> self root-override riders num-riders)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'go) + (let ((t9-2 send-event-function) + (v1-13 (-> self other)) + ) + (t9-2 + (if v1-13 + (-> v1-13 extra process) + ) + a1-1 + ) + ) + ) + (go orbit-plat-riding) + ) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) 0.0) + (set! (-> a0-7 param 1) 1.0) + (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (set! (-> self is-reset?) #t) + (go orbit-plat-idle) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) plat-post) + ) + +;; failed to figure out what this is: +(defstate orbit-plat-wait-for-other (orbit-plat) + :code + (behavior () + (set! (-> self plat-status) (the-as uint 0)) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 0.0) + (set! (-> a0-0 param 1) 1.0) + (joint-control-channel-group! a0-0 (the-as art-joint-anim #f) num-func-seek!) + ) + (while #t + (let ((v1-3 (-> self other))) + (when (if v1-3 + (-> v1-3 extra process) + ) + (suspend) + (go orbit-plat-idle) + ) + ) + (suspend) + (when (not (ja-done? 0)) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) 0.0) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior orbit-plat) ja-post) + ) + +;; definition for method 11 of type orbit-plat +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defmethod init-from-entity! orbit-plat ((obj orbit-plat) (arg0 entity-actor)) + (set! (-> obj plat-status) (the-as uint 0)) + (set! (-> obj mask) (logior (process-mask platform) (-> obj mask))) + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) + (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 2048)) + (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) 4) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 13926.4) + (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) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton obj *orbit-plat-sg* '()) + (logior! (-> obj skel status) 1) + (ja-channel-set! 1) + (let ((s4-1 (-> obj skel root-channel 0))) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim (-> obj draw art-group data 2)) + num-func-identity + ) + (set! (-> s4-1 frame-num) 0.0) + ) + (ja-post) + (dummy-47 (-> obj root-override)) + (dummy-21 obj) + (set! (-> obj nav) (new 'process 'nav-control (-> obj root-override) 16 40960.0)) + (logior! (-> obj nav flags) (nav-control-flags display-marks bit3 bit5 bit6 bit7)) + (set! (-> obj nav gap-event) 'blocked) + (set! (-> obj other) (entity-actor-lookup arg0 'alt-actor 0)) + (let ((f0-7 (res-lump-float arg0 'scale :default 1.0))) + (set-vector! (-> obj root-override scale) f0-7 f0-7 f0-7 1.0) + ) + (set! (-> obj timeout) (res-lump-float arg0 'timeout :default 10.0)) + (set! (-> obj rot-dir) 1.0) + (set! (-> obj reset-trans quad) (-> obj basetrans quad)) + (set! (-> obj is-reset?) #t) + (let ((s5-1 (get-process *default-dead-pool* orbit-plat-bottom #x4000))) + (when s5-1 + (let ((t9-18 (method-of-type orbit-plat-bottom activate))) + (t9-18 (the-as orbit-plat-bottom s5-1) obj 'orbit-plat-bottom (the-as pointer #x70004000)) + ) + (run-now-in-process s5-1 orbit-plat-bottom-init-by-other (-> obj entity) obj) + (-> s5-1 ppointer) + ) + ) + (go orbit-plat-wait-for-other) + (none) + ) diff --git a/test/offline/config.jsonc b/test/offline/config.jsonc index ce32f4fad2..e12a54b09d 100644 --- a/test/offline/config.jsonc +++ b/test/offline/config.jsonc @@ -186,9 +186,6 @@ // generic-obs "command-get-process", // handle casts - // sage-finalboss - "(method 7 sage-finalboss)", // inline-array stuff - // appears twice "(method 9 drawable-tree-instance-tie)", "(method 11 drawable-tree-instance-tie)", @@ -214,6 +211,9 @@ ], "energydoor-opened": [ "trans" // cfg + ], + "orbit-plat-rotating": [ + "code" ] } }