diff --git a/.vscode/settings.json b/.vscode/settings.json index 1434f5d5df..69a3110e63 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -106,6 +106,15 @@ } ] }, + "(dsll32 v1, s5, 30)": { + "filterFileRegex": ".*ir2\\.asm", + "decorations": [ + { + "overviewRulerColor": "transparent", + "color": "magenta" + } + ] + }, "(jalr)": { "filterFileRegex": ".*ir2\\.asm", "decorations": [ diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index efa876a587..6278afc484 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -954,9 +954,8 @@ (firecanyon-not-enough-cells #x24f) (sidekick-hint-orb-cache-top #x251) - + (daxter-launcher-no-eco #x25c) (jungle-precursorbridge-hint #x25b) - (beach-gimmie #x262) (beach-sentinel #x263) (jungle-canyon-end #x264) @@ -10312,10 +10311,11 @@ ;; - Types +;; NOTE - root can also be a collide-shape (deftype manipy (process-drawable) - ((new-trans-hook function :offset-assert 176) - (cur-trans-hook function :offset-assert 180) - (cur-event-hook function :offset-assert 184) + ((new-trans-hook (function none) :offset-assert 176) ;; TODO - no idea on these types + (cur-trans-hook (function none) :offset-assert 180) ;; TODO - no idea on these types + (cur-event-hook (function none) :offset-assert 184) ;; TODO - no idea on these types (new-joint-anim art-joint-anim :offset-assert 188) (new-joint-anim-blend uint64 :offset-assert 192) (anim-mode symbol :offset-assert 200) @@ -10323,8 +10323,8 @@ (cur-target-handle handle :offset-assert 216) (old-grab-pos vector :inline :offset-assert 224) (joint process-drawable 4 :offset-assert 240) - (new-post-hook function :offset-assert 256) - (cur-post-hook function :offset-assert 260) + (new-post-hook (function none) :offset-assert 256) ;; TODO - no idea on these types + (cur-post-hook (function none) :offset-assert 260) ;; TODO - no idea on these types (clone-copy-trans basic :offset-assert 264) (shadow-backup basic :offset-assert 268) (draw? symbol :offset-assert 272) @@ -10335,9 +10335,10 @@ :flag-assert #x1400b00114 ) +(declare-type sparticle-launch-group structure) (deftype part-spawner (process-drawable) - ((mode uint32 :offset-assert 176) - (enable basic :offset-assert 180) + ((mode (pointer sparticle-launch-group) :offset-assert 176) ;; takes a part-spawner as it's first arg in method 9 + (enable symbol :offset-assert 180) (radius meters :offset-assert 184) (world-sphere sphere :inline :offset-assert 192) ) @@ -10346,19 +10347,19 @@ :size-assert #xd0 :flag-assert #x15006000d0 (:methods - (dummy-20 () none 20) + (dummy-20 (_type_) none 20) ) ) (deftype part-tracker (process) - ((root trsqv :offset-assert 112) - (part sparticle-launch-control :offset-assert 116) - (target uint64 :offset-assert 120) - (callback basic :offset-assert 128) - (linger-callback basic :offset-assert 132) - (duration int64 :offset-assert 136) - (linger-duration int64 :offset-assert 144) - (start-time int64 :offset-assert 152) + ((root trsqv :offset-assert 112) + (part sparticle-launch-control :offset-assert 116) + (target handle :offset-assert 120) + (callback (function part-tracker none) :offset-assert 128) + (linger-callback (function part-tracker none) :offset-assert 132) + (duration int64 :offset-assert 136) + (linger-duration int64 :offset-assert 144) + (start-time int64 :offset-assert 152) (offset vector :inline :offset-assert 160) (userdata uint64 :offset-assert 176) (user-time int64 2 :offset-assert 184) @@ -10372,9 +10373,10 @@ ) (deftype camera-tracker (process) - ((grab-target handle :offset 120) - (grab-event basic :offset-assert 128) - (release-event basic :offset-assert 132) + ((entity-override entity-actor :score 100 :offset 52) + (grab-target handle :offset 120) + (grab-event symbol :offset-assert 128) + (release-event symbol :offset-assert 132) (old-global-mask uint32 :offset-assert 136) (old-self-mask uint32 :offset-assert 140) (old-parent-mask uint32 :offset-assert 144) @@ -10388,27 +10390,28 @@ (message basic :offset-assert 200) (border-value basic :offset-assert 204) (mask-to-clear uint32 :offset-assert 208) - (script basic :offset-assert 212) - (script-line basic :offset-assert 216) - (script-func basic :offset-assert 220) + (script pair :offset-assert 212) + (script-line pair :offset-assert 216) + (script-func (function none) :offset-assert 220) ;; TODO - unconfirmed, see generic-obs::lambda::33 ) :heap-base #x70 :method-count-assert 15 :size-assert #xe0 :flag-assert #xf007000e0 - ;; field ~Tuserdata is a basic loaded with a signed load (:methods - (dummy-14 () none 14) + (dummy-14 (_type_ pair) process 14) ) ) +(declare-type collide-shape-moving basic) (deftype touch-tracker (process-drawable) - ((duration uint64 :offset-assert 176) - (target uint64 :offset-assert 184) - (event basic :offset-assert 192) - (run-function basic :offset-assert 196) - (callback basic :offset-assert 200) - (event-mode basic :offset-assert 204) + ((root-override collide-shape-moving :score 100 :offset 112) + (duration uint64 :offset-assert 176) + (target handle :offset-assert 184) + (event symbol :offset-assert 192) + (run-function (function none) :offset-assert 196) + (callback (function touch-tracker none) :offset-assert 200) + (event-mode basic :offset-assert 204) ;; not a basic! ) :heap-base #x60 :method-count-assert 20 @@ -17991,7 +17994,7 @@ (define-extern load-state-want-force-vis (function symbol symbol int)) (define-extern command-get-param (function object object object)) (define-extern entity-birth-no-kill (function entity none)) -(define-extern part-tracker-init (function sparticle-launch-group int basic basic basic vector none)) ;; TODO - not confirmed +(define-extern part-tracker-init (function sparticle-launch-group int (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker)) (define-extern command-list-get-process (function object process)) (define-extern command-get-quoted-param (function object object object)) (define-extern command-get-int (function object int int)) @@ -18598,10 +18601,6 @@ (define-extern cam-master-active (state camera-master)) (define-extern list-keeper-active (state camera-master)) (define-extern *CAMERA_MASTER-bank* camera-master-bank) - - -;; - Unknowns - (define-extern cam-fixed (state camera-slave)) (define-extern cam-decel (state camera-slave)) (define-extern cam-eye (state camera-slave)) @@ -19456,8 +19455,8 @@ ) (deftype med-res-level (process-drawable) - ((level basic :offset-assert 176) - (part-mode basic :offset-assert 180) + ((level symbol :offset-assert 176) + (part-mode basic :offset-assert 180) ;; sometimes a sound-mode, but too low a sample size to know for sure (index int32 :offset-assert 184) ) :method-count-assert 20 @@ -19467,10 +19466,11 @@ ) (deftype launcher (process-drawable) - ((spring-height meters :offset-assert 176) - (camera basic :offset-assert 180) + ((root-override collide-shape :score 100 :offset 112) + (spring-height meters :offset-assert 176) + (camera state :offset-assert 180) (active-distance float :offset-assert 184) - (seek-time int64 :offset-assert 192) + (seek-time uint64 :offset-assert 192) (dest vector :inline :offset-assert 208) (sound-id sound-id :offset-assert 224) ) @@ -19482,47 +19482,47 @@ ;; - Functions -(define-extern line-in-view-frustum? function) +(define-extern line-in-view-frustum? (function vector vector symbol)) ;; TODO - not confirmed (define-extern process-drawable-random-point! (function process-drawable vector vector)) (define-extern process-drawable-from-entity! (function process-drawable res-lump none)) -(define-extern cam-launcher-long-joystick function) +(define-extern cam-launcher-long-joystick (function vector :behavior camera-slave)) (define-extern hide-hud-quick (function none)) -(define-extern command-get-process (function basic process-drawable process)) -(define-extern camera-change-to (function string int symbol none)) ;; TODO - not confirmed yet -(define-extern camera-look-at (function process int none)) ;; TODO - process is likely a target -(define-extern camera-pov-from function) -(define-extern command-get-trans function) -(define-extern manipy-init (function vector entity skeleton-group vector none :behavior manipy)) -(define-extern part-tracker-notify function) +(define-extern command-get-process (function object process-drawable process :behavior camera-tracker)) +(define-extern camera-change-to (function string int symbol symbol)) +(define-extern camera-look-at (function pair uint process :behavior camera-tracker)) +(define-extern camera-pov-from (function pair uint process :behavior camera-tracker)) +(define-extern command-get-trans (function object vector vector)) ;; object types - null | symbol (null | target) | pair +(define-extern manipy-init (function vector entity skeleton-group vector none :behavior manipy)) ;; TODO - not confirmed yet +(define-extern part-tracker-notify (function object :behavior part-tracker)) (define-extern clone-anim-once (function handle int symbol string none :behavior process-drawable)) -(define-extern merc-eye-anim (function process-drawable none)) -(define-extern clone-anim (function handle int symbol string none :behavior process-drawable)) (define-extern convert-to-hud-object (function process-drawable hud none :behavior hud)) -(define-extern command-get-camera function) -(define-extern ja-anim-done? (function symbol)) ;; TODO - not confirmed -(define-extern camera-anim function) -(define-extern camera-tracker-init (function function none)) ;; TODO - not confirmed, see misty-warehouse::camera-view -(define-extern cam-launcher-joystick function) -(define-extern launcher-init-by-other (function vector float vector float none :behavior launcher)) -(define-extern touch-tracker-init (function object object object none)) +(define-extern clone-anim (function handle int symbol string none :behavior process-drawable)) +(define-extern merc-eye-anim (function process-drawable none)) +(define-extern ja-anim-done? (function pair symbol)) ;; TODO - has a behavior, no idea what it is +(define-extern command-get-camera (function object state object)) ;; ret - (state camera) | string | symbol +(define-extern camera-anim (function symbol basic entity (pointer process) :behavior camera-tracker)) ;; unused +(define-extern camera-tracker-init (function object object :behavior camera-tracker)) ;; TODO - nested SC +(define-extern cam-launcher-joystick (function vector :behavior camera-slave)) +(define-extern launcher-init-by-other (function vector float int float none :behavior launcher)) +(define-extern touch-tracker-init (function vector float uint none :behavior touch-tracker)) ;; last arg is a handle to `target` (define-extern process-drawable-pair-random-point! (function process-drawable process-drawable vector float vector)) -(define-extern birth-func-set-quat function) +(define-extern birth-func-set-quat (function int sparticle-cpuinfo sparticle-launchinfo none)) (define-extern draw-eco-beam (function vector vector none)) ;; - Unknowns (define-extern *particle-quat* quaternion) (define-extern touch-tracker-idle (state touch-tracker)) -(define-extern cam-launcher-longfall (state camera-tracker)) -(define-extern cam-launcher-shortfall (state camera-tracker)) +(define-extern cam-launcher-longfall (state camera-slave)) +(define-extern cam-launcher-shortfall (state camera-slave)) (define-extern launcher-idle (state launcher)) (define-extern launcher-deactivated (state launcher)) (define-extern launcher-active (state launcher)) (define-extern part-spawner-active (state part-spawner)) (define-extern *lev-string* string) (define-extern med-res-level-idle (state med-res-level)) -(define-extern camera-tracker-process camera-tracker) -(define-extern part-tracker-process part-tracker) +(define-extern camera-tracker-process (state camera-tracker)) +(define-extern part-tracker-process (state part-tracker)) (define-extern manipy-idle (state manipy)) (define-extern swingpole-stance (state swingpole)) (define-extern swingpole-active (state swingpole)) @@ -21938,7 +21938,7 @@ (define-extern dm-cam-settings-func (function int int symbol)) (define-extern dm-cam-settings-func-int (function int int debug-menu debug-menu debug-menu)) (define-extern debug-create-cam-restore (function none)) ;; TODO - level-group type isn't complete -(define-extern dm-cam-mode-func (function (state camera-slave) int symbol)) +(define-extern dm-cam-mode-func (function (state camera-slave) int object)) (define-extern dm-instance-pick-func (function string int basic)) (define-extern dm-enable-instance-func (function string int symbol)) (define-extern dm-shader-pick-func (function texture-id int object)) ;; TODO - more texture stuff... diff --git a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc index 4e086aba6e..48fb168ef1 100644 --- a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc @@ -817,5 +817,9 @@ [4, "(function sparticle-launch-control :behavior ogreboss-village2)"] ], + "generic-obs": [ + [5, "(function symbol :behavior touch-tracker)"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc index 02e4489259..5cade8b4f1 100644 --- a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc @@ -282,9 +282,6 @@ // ambient "ambient-inspect", - // generic-obs BUG - "camera-change-to", - // target BUG "target-falling-anim-trans", @@ -401,7 +398,10 @@ "load-boundary-from-template", "command-get-time", "command-get-param", - "command-get-quoted-param" + "command-get-quoted-param", + "command-get-trans", + "command-get-camera", + "(method 14 camera-tracker)" ], // If format is used with the wrong number of arguments, diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index ecef73b2a1..ec34c4ce35 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -486,9 +486,6 @@ ], "projectiles": [["L150", "attack-info"]], - - "generic-obs": [["L455", "quaternion"]], - "blocking-plane": [ ["L18", "vector"], ["L19", "vector"], @@ -1246,6 +1243,11 @@ ["L105", "vector"] ], + "generic-obs": [ + ["L455", "quaternion"], + ["L457", "attack-info"] + ], + // please do not add things after this entry! git is dumb. "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index fecd288df3..f1be018ff9 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -3453,5 +3453,177 @@ [32, "event-message-block"] ], + "(anon-function 54 generic-obs)": [ + [16, "vector"], + [32, "vector"] + ], + + "part-tracker-notify": [ + [16, "event-message-block"] + ], + + "process-grab?": [ + [16, "event-message-block"] + ], + + "process-release?": [ + [16, "event-message-block"] + ], + + "camera-change-to": [ + [16, "event-message-block"] + ], + + "camera-look-at": [ + [16, "event-message-block"] + ], + + "ja-anim-done?": [ + [16, "event-message-block"] + ], + + "draw-eco-beam": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "quaternion"] + ], + + "process-drawable-pair-random-point!": [ + [16, "vector"], + [32, "vector"] + ], + + "(anon-function 7 generic-obs)": [ + [16, "event-message-block"] + ], + + "(anon-function 11 generic-obs)": [ + [16, "event-message-block"] // trans + ], + + "(anon-function 13 generic-obs)": [ + [16, "event-message-block"] // event + ], + + "(anon-function 14 generic-obs)": [ + [16, "event-message-block"] // trans + ], + + "(anon-function 16 generic-obs)": [ // code + [16, "vector"], + [32, "vector"], + [48, "event-message-block"] + ], + + "(anon-function 18 generic-obs)": [ // enter + [16, "vector"] + ], + + "cam-launcher-long-joystick": [ + [16, "matrix"] + ], + + "(anon-function 21 generic-obs)": [ // code + [16, "event-message-block"] + ], + + "(anon-function 23 generic-obs)": [ // enter + [16, "vector"] + ], + + "cam-launcher-joystick": [ + [16, "matrix"], + [80, "vector"] + ], + + "(anon-function 31 generic-obs)": [ + [16, "vector"] // code + ], + + "(code swingpole-stance)": [ + [16, "event-message-block"] + ], + + "camera-anim": [ + [16, "event-message-block"] + ], + + "camera-pov-from": [ + [16, "event-message-block"] + ], + + "(method 14 camera-tracker)": [ + [16, "event-message-block"], + [96, "event-message-block"] + ], + + "(anon-function 33 generic-obs)": [ + [16, "event-message-block"] + ], + + "(trans manipy-idle)": [ + [16, "vector"], + [32, "vector"] + ], + + "(anon-function 34 generic-obs)": [ + [16, "event-message-block"] + ], + + "(exit camera-tracker-process)": [ + [16, "event-message-block"] + ], + + "(code camera-tracker-process)": [ + [16, "event-message-block"] + ], + + "(code cam-launcher-shortfall)": [ + [16, "event-message-block"] + ], + + "(trans launcher-idle)": [ + [16, "event-message-block"] + ], + + "(event launcher-active)": [ + [16, "event-message-block"] + ], + + "(event touch-tracker-idle)": [ + [16, "event-message-block"] + ], + + "(trans launcher-active)": [ + [16, "event-message-block"] + ], + + "(code touch-tracker-idle)": [ + [16, "touching-shapes-entry"] + ], + + "(event manipy-idle)": [ + [16, "matrix"] + ], + + "(code med-res-level-idle)": [ + [16, "vector"] + ], + + "(enter cam-launcher-longfall)": [ + [16, "vector"] + ], + + "(enter cam-launcher-shortfall)": [ + [16, "vector"] + ], + + "(code cam-launcher-longfall)": [ + [16, "vector"], + [32, "vector"], + [48, "event-message-block"] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 0b63b2714e..d3f0dcf23c 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -2338,8 +2338,6 @@ [64, "a0", "process-drawable"] ], - "process-drawable-random-point!": [[[28, 40], "s4", "collide-shape"]], - "(anon-function 0 dark-eco-pool)": [[2, "v1", "state"]], "(method 25 dark-eco-pool)": [ @@ -2408,7 +2406,10 @@ "(method 27 projectile-yellow)": [[70, "v1", "process-mask"]], - "manipy-init": [[143, "a0", "collide-shape"]], + "manipy-init": [ + [143, "a0", "collide-shape"], + [145, "a0", "collide-shape"] + ], "forall-particles-with-key-runner": [ [32, "s3", "(inline-array sparticle-cpuinfo)"], @@ -4218,10 +4219,6 @@ [18, "s6", "camera-tracker"] ], - "command-get-process": [ - [62, "s6", "camera-tracker"] - ], - "joint-control-copy!": [ [8, "a0", "pointer"], [8, "a2", "pointer"] @@ -5008,5 +5005,125 @@ [[8, 16], "a0", "dma-packet"] ], + "(method 11 swingpole)": [ + [27, "s5", "entity-actor"] + ], + + "(anon-function 54 generic-obs)": [ + [57, "v1", "process-drawable"], + [66, "a0", "collide-shape"] + ], + + "(code manipy-idle)": [ + [58, "a1", "process-drawable"], + [73, "gp", "process-drawable"], + [79, "gp", "process-drawable"], + [110, "a0", "process-drawable"] + ], + + "(anon-function 49 generic-obs)": [ + [25, "gp", "process-drawable"], + [30, "gp", "process-drawable"] + ], + + "ja-anim-done?": [ + [27, "gp", "process-drawable"] + ], + + "camera-pov-from": [ + [23, "gp", "process-drawable"], + [26, "gp", "process-drawable"] + ], + + "process-drawable-random-point!": [ + [29, "s4", "collide-shape"], + [33, "s4", "collide-shape"] + ], + + "launcher-init-by-other": [ + [134, "v0", "vector"] + ], + + "(method 11 launcher)": [ + [130, "v0", "vector"] + ], + + "(method 11 part-spawner)": [ + ["_stack_", 16, "res-tag"], + [62, "v0", "(pointer (pointer sparticle-launch-group))"] + ], + + "(method 11 med-res-level)": [ + ["_stack_", 16, "res-tag"], + [21, "v0", "(pointer (pointer sparticle-launch-group))"], + [57, "s4", "(pointer sparticle-launch-group)"] + ], + + "(anon-function 28 generic-obs)": [ + [25, "v1", "quaternion"] // code + ], + + "camera-tracker-init": [ + [69, "v1", "process"] + ], + + "camera-anim": [ + [26, "t9", "(function process function object object object object object)"] + ], + + "(event manipy-idle)": [ + [59, "t9", "(function manipy none)"], + [118, "v1", "float"], + [131, "a0", "process"], + [151, "v1", "process-drawable"], + [160, "a0", "process"], + [177, "a0", "collide-shape"], + [180, "a0", "collide-shape"], + [185, "v1", "vector"], + [313, "a0", "float"] + ], + + "command-get-trans": [ + [29, "s4", "target"] + ], + + "(trans manipy-idle)": [ + [57, "v1", "process-drawable"], + [66, "a0", "collide-shape"] + ], + + "(method 14 camera-tracker)": [ + [196, "s4", "basic"], + [202, "s4", "(function camera-tracker symbol)"], + [270, "v0", "target"] + ], + + "(event touch-tracker-idle)": [ + [105, "a0", "process"], + [129, "t9", "(function touch-tracker none)"] + ], + + "(code touch-tracker-idle)": [ + [25, "a0", "process-drawable"], + [38, "a0", "collide-shape"] + ], + + "(code part-tracker-process)": [ + [25, "gp", "process-drawable"], + [30, "gp", "process-drawable"] + ], + + "(event part-spawner-active)": [ + [25, "v1", "vector"] + ], + + "(exit launcher-active)": [ + [2, "v0", "sound-rpc-set-param"] + ], + + "command-get-camera": [ + [27, "gp", "symbol"] + ], + "placeholder-do-not-add-below": [] } diff --git a/goal_src/engine/debug/default-menu.gc b/goal_src/engine/debug/default-menu.gc index ff38fd9eb6..5d096832d5 100644 --- a/goal_src/engine/debug/default-menu.gc +++ b/goal_src/engine/debug/default-menu.gc @@ -13,6 +13,8 @@ ;; Necessary forward declarations (define-extern cam-robotboss (state camera-slave)) +(define-extern dm-cam-mode-func (function (state camera-slave) int object)) + ;; DECOMP BEGINS ;; this file is debug only diff --git a/goal_src/engine/draw/drawable-h.gc b/goal_src/engine/draw/drawable-h.gc index 744ce70c38..bb64e5a685 100644 --- a/goal_src/engine/draw/drawable-h.gc +++ b/goal_src/engine/draw/drawable-h.gc @@ -55,4 +55,6 @@ (define-extern add-process-drawable (function process-drawable draw-control symbol dma-buffer none)) (define-extern dma-add-process-drawable-hud (function process-drawable draw-control symbol dma-buffer none)) (define-extern dma-add-process-drawable (function process-drawable draw-control symbol dma-buffer none)) -(define-extern vis-cull (function int symbol)) \ No newline at end of file +(define-extern vis-cull (function int symbol)) + +(define-extern line-in-view-frustum? (function vector vector symbol)) ;; TODO - not confirmed diff --git a/goal_src/engine/game/game-info.gc b/goal_src/engine/game/game-info.gc index 4ef5c776b3..91e85a5e30 100644 --- a/goal_src/engine/game/game-info.gc +++ b/goal_src/engine/game/game-info.gc @@ -549,7 +549,6 @@ ) (declare-type vent process-drawable) -(define-extern touch-tracker-init (function object object object none)) (defmethod pickup-collectable! fact-info-target ((obj fact-info-target) (kind pickup-type) (amount float) (source-handle handle)) "Pickup a thing!" diff --git a/goal_src/engine/game/generic-obs-h.gc b/goal_src/engine/game/generic-obs-h.gc index 898f32aae1..cb646f6d32 100644 --- a/goal_src/engine/game/generic-obs-h.gc +++ b/goal_src/engine/game/generic-obs-h.gc @@ -10,8 +10,6 @@ ;; TODO - for babak-with-cannon (define-extern beachcam-spawn (function none)) -(define-extern ja-anim-done? (function symbol)) - (define-extern draw-eco-beam (function vector vector none)) (define-extern process-grab? (function process symbol :behavior process)) @@ -21,24 +19,33 @@ (define-extern birth-pickup-at-point (function vector int float symbol process-drawable fact-info (pointer process))) -;; decomp begins +(declare-type collide-shape-moving basic) +(declare-type sparticle-launch-group basic) +(declare-type part-tracker process) +(declare-type collide-prim-core structure) +(define-extern part-tracker-init (function sparticle-launch-group int (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker)) + +(declare-type touch-tracker process-drawable) +(define-extern touch-tracker-init (function vector float uint none :behavior touch-tracker)) ;; last arg is a handle to `target` + +;; DECOMP BEGINS (deftype manipy (process-drawable) - ((new-trans-hook function :offset-assert 176) - (cur-trans-hook function :offset-assert 180) - (cur-event-hook function :offset-assert 184) - (new-joint-anim art-joint-anim :offset-assert 188) - (new-joint-anim-blend uint64 :offset-assert 192) - (anim-mode symbol :offset-assert 200) - (cur-grab-handle handle :offset-assert 208) - (cur-target-handle handle :offset-assert 216) - (old-grab-pos vector :inline :offset-assert 224) - (joint process-drawable 4 :offset-assert 240) - (new-post-hook function :offset-assert 256) - (cur-post-hook function :offset-assert 260) - (clone-copy-trans basic :offset-assert 264) - (shadow-backup basic :offset-assert 268) - (draw? symbol :offset-assert 272) + ((new-trans-hook (function none) :offset-assert 176) + (cur-trans-hook (function none) :offset-assert 180) + (cur-event-hook (function none) :offset-assert 184) + (new-joint-anim art-joint-anim :offset-assert 188) + (new-joint-anim-blend uint64 :offset-assert 192) + (anim-mode symbol :offset-assert 200) + (cur-grab-handle handle :offset-assert 208) + (cur-target-handle handle :offset-assert 216) + (old-grab-pos vector :inline :offset-assert 224) + (joint process-drawable 4 :offset-assert 240) + (new-post-hook (function none) :offset-assert 256) + (cur-post-hook (function none) :offset-assert 260) + (clone-copy-trans basic :offset-assert 264) + (shadow-backup basic :offset-assert 268) + (draw? symbol :offset-assert 272) ) :heap-base #xb0 :method-count-assert 20 @@ -46,35 +53,37 @@ :flag-assert #x1400b00114 ) + (deftype part-spawner (process-drawable) - ((mode uint32 :offset-assert 176) - (enable basic :offset-assert 180) - (radius meters :offset-assert 184) - (world-sphere sphere :inline :offset-assert 192) + ((mode (pointer sparticle-launch-group) :offset-assert 176) + (enable symbol :offset-assert 180) + (radius meters :offset-assert 184) + (world-sphere sphere :inline :offset-assert 192) ) :heap-base #x60 :method-count-assert 21 :size-assert #xd0 :flag-assert #x15006000d0 (:methods - (dummy-20 () none 20) + (dummy-20 (_type_) none 20) ) ) + (deftype part-tracker (process) - ((root trsqv :offset-assert 112) - (part sparticle-launch-control :offset-assert 116) - (target uint64 :offset-assert 120) - (callback basic :offset-assert 128) - (linger-callback basic :offset-assert 132) - (duration int64 :offset-assert 136) - (linger-duration int64 :offset-assert 144) - (start-time int64 :offset-assert 152) - (offset vector :inline :offset-assert 160) - (userdata uint64 :offset-assert 176) - (user-time int64 2 :offset-assert 184) - (user-vector vector 2 :inline :offset-assert 208) - (user-handle uint32 2 :offset-assert 240) + ((root trsqv :offset-assert 112) + (part sparticle-launch-control :offset-assert 116) + (target handle :offset-assert 120) + (callback (function part-tracker none) :offset-assert 128) + (linger-callback (function part-tracker none) :offset-assert 132) + (duration int64 :offset-assert 136) + (linger-duration int64 :offset-assert 144) + (start-time int64 :offset-assert 152) + (offset vector :inline :offset-assert 160) + (userdata uint64 :offset-assert 176) + (user-time int64 2 :offset-assert 184) + (user-vector vector 2 :inline :offset-assert 208) + (user-handle uint32 2 :offset-assert 240) ) :heap-base #x90 :method-count-assert 14 @@ -82,44 +91,47 @@ :flag-assert #xe009000f8 ) + (deftype camera-tracker (process) - ((grab-target handle :offset 120) - (grab-event basic :offset-assert 128) - (release-event basic :offset-assert 132) - (old-global-mask uint32 :offset-assert 136) - (old-self-mask uint32 :offset-assert 140) - (old-parent-mask uint32 :offset-assert 144) - (look-at-target handle :offset-assert 152) - (pov-target handle :offset-assert 160) - (work-process handle :offset-assert 168) - (anim-process handle :offset-assert 176) - (start-time int64 :offset-assert 184) - (callback basic :offset-assert 192) - (userdata basic :offset-assert 196) - (message basic :offset-assert 200) - (border-value basic :offset-assert 204) - (mask-to-clear uint32 :offset-assert 208) - (script basic :offset-assert 212) - (script-line basic :offset-assert 216) - (script-func basic :offset-assert 220) + ((entity-override entity-actor :offset 52) + (grab-target handle :offset 120) + (grab-event symbol :offset-assert 128) + (release-event symbol :offset-assert 132) + (old-global-mask uint32 :offset-assert 136) + (old-self-mask uint32 :offset-assert 140) + (old-parent-mask uint32 :offset-assert 144) + (look-at-target handle :offset-assert 152) + (pov-target handle :offset-assert 160) + (work-process handle :offset-assert 168) + (anim-process handle :offset-assert 176) + (start-time int64 :offset-assert 184) + (callback basic :offset-assert 192) + (userdata basic :offset-assert 196) + (message basic :offset-assert 200) + (border-value basic :offset-assert 204) + (mask-to-clear uint32 :offset-assert 208) + (script pair :offset-assert 212) + (script-line pair :offset-assert 216) + (script-func (function none) :offset-assert 220) ) :heap-base #x70 :method-count-assert 15 :size-assert #xe0 :flag-assert #xf007000e0 - ;; field ~Tuserdata is a basic loaded with a signed load (:methods - (dummy-14 () none 14) + (dummy-14 (_type_ pair) process 14) ) ) + (deftype touch-tracker (process-drawable) - ((duration uint64 :offset-assert 176) - (target uint64 :offset-assert 184) - (event basic :offset-assert 192) - (run-function basic :offset-assert 196) - (callback basic :offset-assert 200) - (event-mode basic :offset-assert 204) + ((root-override collide-shape-moving :offset 112) + (duration uint64 :offset-assert 176) + (target handle :offset-assert 184) + (event symbol :offset-assert 192) + (run-function (function none) :offset-assert 196) + (callback (function touch-tracker none) :offset-assert 200) + (event-mode basic :offset-assert 204) ) :heap-base #x60 :method-count-assert 20 @@ -127,6 +139,7 @@ :flag-assert #x14006000d0 ) + (deftype swingpole (process) ((root trsq :offset-assert 112) (dir vector :inline :offset-assert 128) @@ -139,14 +152,15 @@ :flag-assert #xe00300098 ) + (deftype gui-query (structure) - ((x-position int32 :offset-assert 0) - (y-position int32 :offset-assert 4) - (message string :offset-assert 8) - (decision symbol :offset-assert 12) - (only-allow-cancel symbol :offset-assert 16) - (no-msg string :offset-assert 20) - (message-space int32 :offset-assert 24) + ((x-position int32 :offset-assert 0) + (y-position int32 :offset-assert 4) + (message string :offset-assert 8) + (decision symbol :offset-assert 12) + (only-allow-cancel symbol :offset-assert 16) + (no-msg string :offset-assert 20) + (message-space int32 :offset-assert 24) ) :pack-me :method-count-assert 11 @@ -158,6 +172,7 @@ ) ) + (deftype othercam (process) ((hand handle :offset-assert 112) (old-global-mask uint32 :offset-assert 120) @@ -167,9 +182,9 @@ (old-mat-z vector :inline :offset-assert 160) (had-valid-frame basic :offset-assert 176) (border-value basic :offset-assert 180) - (die? symbol :offset-assert 184) + (die? symbol :offset-assert 184) (survive-anim-end? symbol :offset-assert 188) - (spooling? symbol :offset-assert 192) + (spooling? symbol :offset-assert 192) ) :heap-base #x60 :method-count-assert 14 @@ -177,6 +192,7 @@ :flag-assert #xe006000c4 ) + (deftype process-hidden (process) () :method-count-assert 15 @@ -187,5 +203,9 @@ ) ) -(declare-type sparticle-launch-group basic) -(define-extern part-tracker-init (function sparticle-launch-group int basic basic basic vector none)) ;; TODO - not confirmed \ No newline at end of file + +0 + + + + diff --git a/goal_src/engine/game/generic-obs.gc b/goal_src/engine/game/generic-obs.gc index 4bb1f2a282..52000fd799 100644 --- a/goal_src/engine/game/generic-obs.gc +++ b/goal_src/engine/game/generic-obs.gc @@ -5,34 +5,29 @@ ;; name in dgo: generic-obs ;; dgos: GAME, ENGINE -;; TODO - temporary, for citadel-obs -(deftype launcher (process-drawable) - ((spring-height meters :offset-assert 176) - (camera basic :offset-assert 180) - (active-distance float :offset-assert 184) - (seek-time int64 :offset-assert 192) - (dest vector :inline :offset-assert 208) - (sound-id sound-id :offset-assert 224) - ) - :method-count-assert 20 - :size-assert #xe4 - :heap-base #x80 - :flag-assert #x14008000e4 - ) -(define-extern launcher-init-by-other (function vector float vector float none :behavior launcher)) +(declare-type swingpole process) +(define-extern swingpole-stance (state swingpole)) +(define-extern swingpole-active (state swingpole)) -;; TODO - for village-obs -(define-extern draw-eco-beam (function vector vector none)) ;; TODO - not confirmed +(define-extern convert-to-hud-object (function process-drawable hud none :behavior hud)) -;; TODO - for jungleb-obs -(define-extern camera-look-at (function process int none)) ;; TODO - process is likely a target +;; TODO - temporary +(define-extern command-get-process (function object process-drawable process :behavior camera-tracker)) -;; decomp begins +(define-extern process-drawable-from-entity! (function process-drawable res-lump none)) +(declare-type beach-part part-spawner) +(define-extern beach-part-grotto-1 (state beach-part)) + +(declare-type launcher process-drawable) +(define-extern launcher-active (state launcher)) +(define-extern launcher-idle (state launcher)) +(define-extern launcher-deactivated (state launcher)) + +(define-extern command-get-camera (function object state object)) ;; ret - (state camera) | string | symbol + +;; DECOMP BEGINS -;; definition for function clone-anim-once -;; INFO: Return type mismatch int vs none. -;; Used lq/sq (defbehavior clone-anim-once process-drawable ((arg0 handle) (arg1 int) (arg2 symbol) (arg3 string)) @@ -121,8 +116,6 @@ (none) ) -;; definition for function clone-anim -;; INFO: Return type mismatch int vs none. (defbehavior clone-anim process-drawable ((arg0 handle) (arg1 int) (arg2 symbol) (arg3 string)) @@ -136,6 +129,100 @@ (none) ) +(defstate swingpole-stance (swingpole) + :code + (behavior () + (while #t + (when + (and + *target* + (< + (vector-vector-distance + (-> self root trans) + (the-as vector (&-> (-> *target* control) unknown-cspace00 bone)) + ) + (-> self range) + ) + (logtest? (-> *target* control root-prim prim-core action) 64) + (< + (the-as float (-> *target* control unknown-cspace00 param0)) + (+ (-> self root trans y) (* 0.5 (-> self range))) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'pole-grab) + (set! (-> a1-1 param 0) (the-as uint self)) + (if (send-event-function *target* a1-1) + (go swingpole-active) + ) + ) + ) + (suspend) + ) + (none) + ) + ) + +(defstate swingpole-active (swingpole) + :code + (behavior () + (suspend) + (while + (and + *target* + (= (handle->process (-> *target* control unknown-handle10)) self) + ) + (suspend) + ) + (let ((gp-0 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-0) 150) + (suspend) + ) + ) + (go swingpole-stance) + (none) + ) + ) + +(defmethod copy-defaults! swingpole ((obj swingpole) (arg0 res-lump)) + "Copy defaults from the entity." + (stack-size-set! (-> obj main-thread) 128) + (logior! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj root) (new 'process 'trsq)) + (set! (-> obj root trans quad) (-> arg0 extra trans quad)) + (quaternion-copy! (-> obj root quat) (-> (the-as entity-actor arg0) quat)) + (vector-identity! (-> obj root scale)) + (vector-y-quaternion! (-> obj dir) (-> obj root quat)) + (set! (-> obj dir y) 0.0) + (vector-normalize! (-> obj dir) 1.0) + (set! (-> obj range) 12288.0) + (set! (-> obj edge-length) 8192.0) + (go swingpole-stance) + (none) + ) + +(defstate die (process-hidden) + :virtual #t + :code + (the-as (function none :behavior process-hidden) nothing) + ) + +(defmethod copy-defaults! process-hidden ((obj process-hidden) (arg0 res-lump)) + "Copy defaults from the entity." + (process-entity-status! obj (entity-perm-status dead) #t) + (go (method-of-object obj die)) + (none) + ) + +(deftype target-start (process-hidden) + () + :method-count-assert 15 + :size-assert #x70 + :flag-assert #xf00000070 + ) + (deftype camera-start (process-hidden) () @@ -144,61 +231,487 @@ :flag-assert #xf00000070 ) -;; TODO - for misty-warehouse -(define-extern camera-tracker-init (function function none)) ;; TODO - not confirmed, see misty-warehouse::camera-view -(define-extern command-get-process (function basic process-drawable process)) -(defbehavior process-grab? process ((arg0 process)) - (let ((gp-0 (command-get-process arg0 *target*))) - (the-as symbol (when gp-0 - (if (type-type? (-> self type) camera-tracker) - (set! - (-> (the-as camera-tracker self) grab-target) - (process->handle gp-0) + +(defstate manipy-idle (manipy) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 none)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'attackable) + (cond + ((-> arg3 param 0) + (set! + v0-0 + (the-as + none + (logior (process-mask attackable) (-> self mask)) + ) + ) + (set! (-> self mask) (the-as process-mask v0-0)) + ) + (else + (set! + v0-0 + (the-as + none + (logclear (-> self mask) (process-mask attackable)) + ) + ) + (set! (-> self mask) (the-as process-mask v0-0)) + ) + ) + v0-0 + ) + ((= v1-0 'blend-shape) + (cond + ((-> arg3 param 0) + (set! + v0-0 + (the-as none (logior (-> self skel status) 264)) + ) + (set! (-> self skel status) (the-as uint v0-0)) + ) + (else + (set! + v0-0 + (the-as none (logand -265 (-> self skel status))) + ) + (set! (-> self skel status) (the-as uint v0-0)) + ) + ) + v0-0 + ) + ((= v1-0 'shadow) + (cond + ((-> arg3 param 0) + (set! v0-0 (the-as none (-> self shadow-backup))) + (set! (-> self draw shadow) (the-as shadow-geo v0-0)) + v0-0 + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ((= v1-0 'trans-hook) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! + (-> self new-trans-hook) + (the-as (function none) v0-0) + ) + v0-0 + ) + ((= v1-0 'post-hook) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! + (-> self new-post-hook) + (the-as (function none) v0-0) + ) + v0-0 + ) + ((= v1-0 'eval) + ((the-as (function manipy none) (-> arg3 param 0)) self) + ) + ((= v1-0 'become-hud-object) + (convert-to-hud-object self (the-as hud (-> arg3 param 0))) + ) + ((= v1-0 'event-hook) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! + (-> self cur-event-hook) + (the-as (function none) v0-0) + ) + v0-0 + ) + ((= v1-0 'art-joint-anim) + (set! + (-> self new-joint-anim) + (the-as + art-joint-anim + (dummy-10 + (-> self draw art-group) + (the-as string (-> arg3 param 0)) + art-joint-anim + ) + ) + ) + (set! v0-0 (the-as none (-> arg3 param 1))) + (set! (-> self new-joint-anim-blend) (the-as uint v0-0)) + v0-0 + ) + ((= v1-0 'anim-mode) + (when (nonzero? (-> self skel)) + (set! + (-> self anim-mode) + (the-as symbol (-> arg3 param 0)) + ) + (if (= (-> self anim-mode) 'clone-anim) + (ja-post) + ) + (-> self anim-mode) + ) + ) + ((or (= v1-0 'origin-joint-index) (= v1-0 'center-joint)) + (set! (-> self draw origin-joint-index) (-> arg3 param 0)) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! (-> self draw shadow-joint-index) (the-as uint v0-0)) + v0-0 + ) + ((= v1-0 'max-vis-dist) + (let ((f0-0 (the-as float (-> arg3 param 0)))) + (set! + (-> + self + draw + lod-set + lod + (-> self draw lod-set max-lod) + dist + ) + f0-0 + ) + f0-0 + ) + ) + ((= v1-0 'grab) + (set! + (-> self cur-grab-handle) + (process->handle (the-as process (-> arg3 param 0))) + ) + (let ((v1-30 (handle->process (-> self cur-grab-handle)))) + (when v1-30 + (set! v0-0 (the-as none (-> self old-grab-pos))) + (set! + (-> (the-as vector v0-0) quad) + (-> (the-as process-drawable v1-30) root trans quad) + ) + v0-0 + ) + ) + ) + ((= v1-0 'target) + (set! + v0-0 + (the-as + none + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (set! (-> self cur-target-handle) (the-as handle v0-0)) + v0-0 + ) + ((= v1-0 'trans) + (cond + ((type-type? (-> self root type) collide-shape) + (TODO-RENAME-30 + (the-as collide-shape (-> self root)) + (the-as vector (-> arg3 param 0)) + ) + ) + (else + (set! v0-0 (the-as none (-> self root trans))) + (set! + (-> (the-as vector v0-0) quad) + (-> (the-as vector (-> arg3 param 0)) quad) + ) + v0-0 + ) + ) + ) + ((= v1-0 'rot) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (matrix-rotate-y! s5-0 (the-as float (-> arg3 param 0))) + (matrix->quaternion (-> self root quat) s5-0) + ) + ) + ((= v1-0 'rot-quat) + (quaternion-copy! + (-> self root quat) + (the-as quaternion (-> arg3 param 0)) + ) + ) + ((= v1-0 'clone-copy-trans) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! (-> self clone-copy-trans) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'release) + (set! (-> self cur-grab-handle) (the-as handle #f)) + #f + ) + ((= v1-0 'draw) + (set! (-> self draw?) (the-as symbol (-> arg3 param 0))) + (cond + ((-> arg3 param 0) + (let ((v1-47 (logtest? (-> self draw status) 2))) + (set! + (-> self draw status) + (logand -3 (-> self draw status)) + ) + (when v1-47 + (cond + ((nonzero? (-> self skel)) + (let ((gp-1 (-> self skel status))) + (logior! (-> self skel status) 1) + (set! v0-0 (ja-post)) + (set! (-> self skel status) gp-1) + ) + v0-0 + ) + (else + (ja-post) + ) + ) + ) + ) + ) + (else + (set! + v0-0 + (the-as none (logior (-> self draw status) 2)) + ) + (set! (-> self draw status) (the-as uint v0-0)) + v0-0 + ) + ) + ) + ((= v1-0 'query) + (case (-> arg3 param 0) + (('grab) + (handle->process (-> self cur-grab-handle)) + ) + (('done) + (case (-> self anim-mode) + (('play1 'play) + (>= + (ja-frame-num 0) + (the + float + (+ (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + data + 0 + length + ) + -2 + ) + ) + ) + ) + ) + ) + ) + ) + ((= v1-0 'set-frame-num) + (let ((v1-73 (-> self skel root-channel 0))) + (set! (-> v1-73 num-func) num-func-identity) + (let ((f0-2 (the-as float (-> arg3 param 0)))) + (set! (-> v1-73 frame-num) f0-2) + f0-2 + ) + ) + ) + (else + (if (-> self cur-event-hook) + ((-> self cur-event-hook)) + ) ) ) - (send-event gp-0 'change-mode 'grab) - ) - ) - ) - ) - -(defbehavior process-release? process ((arg0 process)) - (let ((gp-0 (command-get-process arg0 *target*))) - (the-as - symbol - (if (and gp-0 (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) self) - (set! (-> a1-1 num-params) 1) - (set! (-> a1-1 message) 'query) - (set! (-> a1-1 param 0) (the-as uint 'mode)) - (send-event-function gp-0 a1-1) - ) - 'target-grab - ) - (send-event gp-0 'end-mode) - #t ) ) ) - ) - -(define-extern camera-change-to (function string int symbol none)) ;; TODO - not confirmed yet -;; TODO - for projectiles | dark-eco-pool -(define-extern part-tracker-init (function sparticle-launch-group int basic basic basic vector none)) ;; TODO - not confirmed -;; TODO - for target-part -(define-extern process-drawable-random-point! (function process-drawable vector vector)) - - -;; TODO PLACEHOLDER STATE -(defstate manipy-idle (manipy) - :code (behavior () - (loop - (suspend) - ) + :trans + (behavior () + (if (!= (-> self cur-trans-hook) (-> self new-trans-hook)) + (set! (-> self cur-trans-hook) (-> self new-trans-hook)) ) + (if (!= (-> self cur-post-hook) (-> self new-post-hook)) + (set! (-> self cur-post-hook) (-> self new-post-hook)) + ) + (when + (and + (-> self new-joint-anim) + (nonzero? (-> self skel)) + (and (!= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self new-joint-anim) + ) + (!= (-> self anim-mode) 'clone-anim) + ) + ) + (ja-channel-push! 1 (the-as int (-> self new-joint-anim-blend))) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (-> self new-joint-anim) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + ) + (let ((v1-20 (handle->process (-> self cur-grab-handle)))) + (when v1-20 + (let ((gp-1 (-> (the-as process-drawable v1-20) root trans))) + (cond + ((type-type? (-> self root type) collide-shape) + (let* ((a0-13 (-> self root)) + (t9-3 + (method-of-object (the-as collide-shape a0-13) TODO-RENAME-28) + ) + ) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self old-grab-pos)) + (t9-3 (the-as collide-shape a0-13)) + ) + ) + (else + (vector+! + (-> self root trans) + (-> self root trans) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self old-grab-pos)) + ) + ) + ) + (set! (-> self old-grab-pos quad) (-> gp-1 quad)) + ) + ) + ) + ((-> self cur-trans-hook)) + (none) + ) + :code + (behavior () + ;; TODO - fix me + (loop (suspend)) + ;; (logclear! (-> self mask) (process-mask heap-shrunk)) + ;; (while #t + ;; ((-> self cur-post-hook)) + ;; (if (!= (-> self anim-mode) 'clone-anim) + ;; (ja-post) + ;; ) + ;; (suspend) + ;; (case (-> self anim-mode) + ;; (('loop) + ;; (let ((a0-4 (-> self skel root-channel 0))) + ;; (set! (-> a0-4 param 0) 1.0) + ;; (joint-control-channel-group-eval! + ;; a0-4 + ;; (the-as art-joint-anim #f) + ;; num-func-loop! + ;; ) + ;; ) + ;; ) + ;; (('play) + ;; (let ((a0-7 (-> self skel root-channel 0))) + ;; (set! + ;; (-> a0-7 param 0) + ;; (the float (+ (-> a0-7 frame-group data 0 length) -1)) + ;; ) + ;; (set! (-> a0-7 param 1) 1.0) + ;; (joint-control-channel-group-eval! + ;; a0-7 + ;; (the-as art-joint-anim #f) + ;; num-func-seek! + ;; ) + ;; ) + ;; ) + ;; (('copy-parent) + ;; (let ((v1-18 (-> self skel root-channel 0))) + ;; (set! (-> v1-18 num-func) num-func-identity) + ;; (set! + ;; (-> v1-18 frame-num) + ;; (-> + ;; (the-as process-drawable (ppointer->process (-> self parent))) + ;; skel + ;; root-channel + ;; 0 + ;; frame-num + ;; ) + ;; ) + ;; ) + ;; ) + ;; (('clone-parent) + ;; (let ((gp-0 (ppointer->process (-> self parent)))) + ;; (set! (-> self post-hook) #f) + ;; (joint-control-copy! + ;; (-> self skel) + ;; (-> (the-as process-drawable gp-0) skel) + ;; ) + ;; (joint-control-remap! + ;; (-> self skel) + ;; (-> self draw art-group) + ;; (-> (the-as process-drawable gp-0) draw art-group) + ;; '() + ;; 0 + ;; "" + ;; ) + ;; ) + ;; (dummy-17 self) + ;; ) + ;; (('clone-anim) + ;; (clone-anim-once (the-as handle (cond + ;; ((handle->process + ;; (-> self cur-target-handle) + ;; ) + ;; (the-as int (-> self cur-target-handle)) + ;; ) + ;; (else + ;; (let ((v1-29 (-> self parent))) + ;; (logior + ;; (shl + ;; (-> + ;; (the-as + ;; process-drawable + ;; (-> v1-29 0) + ;; ) + ;; pid + ;; ) + ;; 32 + ;; ) + ;; (.asm.sllv.r0 v1-29) + ;; ) + ;; ) + ;; ) + ;; ) + ;; ) + ;; (the-as + ;; int + ;; (-> self draw origin-joint-index) + ;; ) + ;; (the-as symbol (-> self clone-copy-trans)) "" + ;; ) + ;; ) + ;; (('still) + ;; ) + ;; (('play1) + ;; (let ((a0-33 (-> self skel root-channel 0))) + ;; (set! + ;; (-> a0-33 param 0) + ;; (the float (+ (-> a0-33 frame-group data 0 length) -1)) + ;; ) + ;; (set! (-> a0-33 param 1) 1.0) + ;; (joint-control-channel-group-eval! + ;; a0-33 + ;; (the-as art-joint-anim #f) + ;; num-func-seek! + ;; ) + ;; ) + ;; (if (ja-done? 0) + ;; (deactivate self) + ;; ) + ;; ) + ;; ) + ;; ) + ;; (none) + ) ) -(defbehavior manipy-init manipy ((arg0 vector) (arg1 entity) (arg2 skeleton-group) (arg3 vector)) +(defbehavior + manipy-init manipy + ((arg0 vector) (arg1 entity) (arg2 skeleton-group) (arg3 vector)) (stack-size-set! (-> self main-thread) 128) (logior! (-> self mask) (process-mask heap-shrunk)) (set! (-> self entity) arg1) @@ -261,12 +774,12 @@ (set! (-> self root) (new 'process 'trsqv)) ) ) - ;;(set! (-> self root trans quad) (-> arg0 quad)) - ;;(dummy-14 self arg2 '()) - ;;(if (type-type? (-> self root type) collide-shape) - ;;(dummy-47 (-> self root)) - ;;) - ;;(set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self root trans quad) (-> arg0 quad)) + (initialize-skeleton self arg2 '()) + (if (type-type? (-> self root type) collide-shape) + (dummy-47 (the-as collide-shape (-> self root))) + ) + (set! (-> self shadow-backup) (-> self draw shadow)) (set! (-> self new-trans-hook) nothing) (set! (-> self cur-trans-hook) nothing) (set! (-> self new-post-hook) nothing) @@ -293,4 +806,2448 @@ (none) ) +(defmethod deactivate part-tracker ((obj part-tracker)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +(defbehavior part-tracker-notify part-tracker () + (let ((gp-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> gp-0 from) self) + (set! (-> gp-0 num-params) 1) + (set! (-> gp-0 message) 'notify) + (set! (-> gp-0 param 0) (the-as uint 'die)) + (let ((s5-0 send-event-function) + (s4-0 (ppointer->process (-> self parent))) + ) + (s5-0 (if (and (nonzero? s4-0) (type-type? (-> s4-0 type) process)) + s4-0 + ) + gp-0 + ) + ) + ) + ) + +(defstate part-tracker-process (part-tracker) + :code + (behavior () + (set! (-> self start-time) (-> *display* base-frame-counter)) + (while + (< + (- (-> *display* base-frame-counter) (-> self start-time)) + (-> self duration) + ) + (let ((gp-0 (handle->process (-> self target)))) + (when gp-0 + (if + (and + gp-0 + (type-type? (-> gp-0 type) process-drawable) + (nonzero? (-> (the-as process-drawable gp-0) root)) + ) + (vector+! + (-> self root trans) + (-> (the-as process-drawable gp-0) root trans) + (-> self offset) + ) + ) + ) + ) + (let ((gp-1 (-> self root trans))) + (if (-> self callback) + ((-> self callback) self) + ) + (spawn (-> self part) gp-1) + ) + (suspend) + ) + (let ((gp-2 (-> *display* base-frame-counter))) + (until + (>= (- (-> *display* base-frame-counter) gp-2) (-> self linger-duration)) + (if (-> self linger-callback) + ((-> self linger-callback) self) + ) + (suspend) + ) + ) + (if (-> self linger-callback) + ((-> self linger-callback) self) + ) + (part-tracker-notify) + (suspend) + 0 + (none) + ) + ) + +(defbehavior + part-tracker-init part-tracker + ((arg0 sparticle-launch-group) + (arg1 int) + (arg2 (function part-tracker none)) + (arg3 (pointer process-drawable)) + (arg4 process) + (arg5 collide-prim-core) + ) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg5 world-sphere quad)) + (set! (-> self offset quad) (-> arg5 world-sphere quad)) + (set! (-> self callback) arg2) + (set! (-> self linger-callback) #f) + (set! (-> self userdata) (the-as uint arg3)) + (set! (-> self target) (process->handle arg4)) + (set! arg1 (cond + ((> arg1 0) + (empty) + arg1 + ) + (else + (the-as int (-> arg0 duration)) + ) + ) + ) + (set! (-> self duration) arg1) + (set! (-> self linger-duration) (the-as int (-> arg0 linger-duration))) + (set! (-> self part) (create-launch-control arg0 self)) + (go part-tracker-process) + (none) + ) + +;; WARN: disable def twice: 68. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 82. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 96. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 110. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; (defbehavior +;; command-get-process camera-tracker +;; ((arg0 object) (arg1 process-drawable)) +;; (the-as process (cond +;; ((null? arg0) +;; (empty) +;; arg1 +;; ) +;; ((type-type? (rtype-of arg0) process) +;; (the-as process-drawable arg0) +;; ) +;; ((= arg0 'target) +;; *target* +;; ) +;; ((= arg0 'sidekick) +;; (when *target* +;; (let ((v1-6 (-> *target* sidekick))) +;; (if v1-6 +;; (the-as process-drawable (-> v1-6 0 self)) +;; ) +;; ) +;; ) +;; ) +;; ((= arg0 'parent) +;; (let ((v1-9 (-> self parent))) +;; (if v1-9 +;; (the-as process-drawable (-> v1-9 0 self)) +;; ) +;; ) +;; ) +;; ((= arg0 'camera) +;; (the-as process-drawable *camera*) +;; ) +;; ((type-type? (rtype-of arg0) string) +;; (the-as +;; process-drawable +;; (process-by-ename (the-as string arg0)) +;; ) +;; ) +;; ((type-type? (-> self type) camera-tracker) +;; (let ((v1-13 self)) +;; (cond +;; ((= arg0 'work) +;; (let ((v1-14 (-> v1-13 work-process))) +;; (and +;; (nonzero? (l32-false-check v1-14)) +;; (let ((a0-8 (-> v1-14 process 0))) +;; (if (= (-> v1-14 pid) (-> a0-8 pid)) +;; (the-as process-drawable a0-8) +;; ) +;; ) +;; ) +;; ) +;; ) +;; ((= arg0 'grab) +;; (let ((v1-17 (-> v1-13 grab-target))) +;; (and +;; (nonzero? (l32-false-check v1-17)) +;; (let ((a0-12 (-> v1-17 process 0))) +;; (if (= (-> v1-17 pid) (-> a0-12 pid)) +;; (the-as process-drawable a0-12) +;; ) +;; ) +;; ) +;; ) +;; ) +;; ((= arg0 'look-at) +;; (let ((v1-20 (-> v1-13 look-at-target))) +;; (and +;; (nonzero? (l32-false-check v1-20)) +;; (let ((a0-16 (-> v1-20 process 0))) +;; (if (= (-> v1-20 pid) (-> a0-16 pid)) +;; (the-as process-drawable a0-16) +;; ) +;; ) +;; ) +;; ) +;; ) +;; ((= arg0 'pov) +;; (let ((v1-23 (-> v1-13 pov-target))) +;; (and +;; (nonzero? (l32-false-check v1-23)) +;; (let ((a0-20 (-> v1-23 process 0))) +;; (if (= (-> v1-23 pid) (-> a0-20 pid)) +;; (the-as process-drawable a0-20) +;; ) +;; ) +;; ) +;; ) +;; ) +;; ((= arg0 'anim) +;; (let ((v1-26 (-> v1-13 anim-process))) +;; (and +;; (nonzero? (l32-false-check v1-26)) +;; (let ((a0-24 (-> v1-26 process 0))) +;; (if (= (-> v1-26 pid) (-> a0-24 pid)) +;; (the-as process-drawable a0-24) +;; ) +;; ) +;; ) +;; ) +;; ) +;; (else +;; (empty) +;; arg1 +;; ) +;; ) +;; ) +;; ) +;; (else +;; (empty) +;; arg1 +;; ) +;; ) +;; ) +;; ) + +(defun command-get-camera ((arg0 object) (arg1 state)) + (cond + ((null? arg0) + (empty) + arg1 + ) + ((= arg0 'base) + *camera-base-mode* + ) + ((= arg0 'string) + cam-string + ) + ((= arg0 'fixed) + cam-fixed + ) + ((type-type? (rtype-of arg0) symbol) + (the-as state (-> (the-as symbol arg0) value)) + ) + ((type-type? (rtype-of arg0) string) + (the-as state arg0) + ) + ((type-type? (rtype-of arg0) state) + (the-as state arg0) + ) + (else + (empty) + arg1 + ) + ) + ) + +(defun command-get-trans ((arg0 object) (arg1 vector)) + (cond + ((null? arg0) + (empty) + arg1 + ) + ((= arg0 'null) + *null-vector* + ) + ((= arg0 'target) + (target-pos 0) + ) + ((pair? arg0) + (let ((s4-0 (command-get-process (car arg0) *target*)) + (v1-4 (command-get-int (car (cdr arg0)) 0)) + ) + (cond + (s4-0 + (-> (the-as target s4-0) node-list data v1-4 bone transform vector 3) + ) + (else + (empty) + arg1 + ) + ) + ) + ) + (else + (empty) + arg1 + ) + ) + ) + +(defbehavior process-grab? process ((arg0 process)) + (let ((gp-0 (command-get-process arg0 *target*))) + (the-as symbol (when gp-0 + (if (type-type? (-> self type) camera-tracker) + (set! + (-> (the-as camera-tracker self) grab-target) + (process->handle gp-0) + ) + ) + (send-event gp-0 'change-mode 'grab) + ) + ) + ) + ) + +(defbehavior process-release? process ((arg0 process)) + (let ((gp-0 (command-get-process arg0 *target*))) + (the-as + symbol + (if (and gp-0 (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'mode)) + (send-event-function gp-0 a1-1) + ) + 'target-grab + ) + (send-event gp-0 'end-mode) + #t + ) + ) + ) + ) + +(defun camera-change-to ((arg0 string) (arg1 int) (arg2 symbol)) + (let ((gp-0 (command-get-camera arg0 *camera-base-mode*))) + (cond + ((not gp-0) + #f + ) + ((type-type? (rtype-of gp-0) string) + (send-event *camera* 'change-to-entity-by-name gp-0) + #t + ) + ((type-type? (rtype-of gp-0) state) + (send-event *camera* 'change-state gp-0 arg1) + (if arg2 + (send-event *camera* 'blend-from-as-fixed) + ) + #t + ) + ) + ) + ) + +(defbehavior camera-look-at camera-tracker ((arg0 pair) (arg1 uint)) + (let ((gp-0 (command-get-process arg0 *target*))) + (when gp-0 + (if (type-type? (-> self type) camera-tracker) + (set! (-> self look-at-target) (process->handle gp-0)) + ) + (send-event *camera* 'change-target gp-0 arg1) + ) + gp-0 + ) + ) + +(defun ja-anim-done? ((arg0 pair)) + (with-pp + (let ((gp-0 (command-get-process arg0 *target*))) + (the-as symbol (when gp-0 + (cond + ((type-type? (-> gp-0 type) manipy) + (send-event gp-0 'query 'done) + ) + ((type-type? (-> gp-0 type) process-drawable) + (when + (zero? + (logand + (-> (the-as process-drawable gp-0) skel status) + 4 + ) + ) + (let ((s5-0 pp)) + (let ((s6-1 gp-0)) + ) + (let ((v0-1 (the-as object (ja-done? 0)))) + (let ((s6-2 s5-0)) + ) + v0-1 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + +(defbehavior camera-pov-from camera-tracker ((arg0 pair) (arg1 uint)) + (let ((gp-0 (command-get-process arg0 *target*))) + (when gp-0 + (if (type-type? (-> self type) camera-tracker) + (set! (-> self pov-target) (process->handle gp-0)) + ) + (when (= arg1 -10) + (set! arg1 (the-as uint 0)) + (when (> (-> (the-as process-drawable gp-0) skel active-channels) 0) + (let + ((v1-11 + (dummy-10 + (-> (the-as process-drawable gp-0) draw jgeo) + "camera" + (the-as type #f) + ) + ) + ) + (if v1-11 + (set! arg1 (the-as uint (+ (-> v1-11 number) 1))) + ) + ) + ) + ) + (send-event *camera* 'change-pov gp-0 arg1) + ) + gp-0 + ) + ) + +(defbehavior + camera-anim camera-tracker + ((arg0 symbol) (arg1 basic) (arg2 entity)) + (set! (-> self anim-process) (the-as handle #f)) + (let* ((s2-0 (get-process *default-dead-pool* manipy #x4000)) + (gp-0 (when s2-0 + (let ((t9-1 (method-of-type manipy activate))) + (t9-1 + (the-as manipy s2-0) + self + 'manipy + (the-as pointer #x70004000) + ) + ) + ((the-as + (function process function object object object object object) + run-function-in-process + ) + s2-0 + manipy-init + arg2 + #f + arg0 + #f + ) + (-> s2-0 ppointer) + ) + ) + ) + (when gp-0 + (send-event (-> gp-0 0 self) 'anim-mode 'play1) + (send-event (-> gp-0 0 self) 'art-joint-anim arg1) + (set! (-> self anim-process) (ppointer->handle gp-0)) + ) + gp-0 + ) + ) + +(defmethod dummy-14 camera-tracker ((obj camera-tracker) (arg0 pair)) + (with-pp + (let ((gp-0 (the-as object #f))) + (cond + ((null? arg0) + ) + ((pair? arg0) + (let ((a2-0 (car arg0)) + (s4-0 (cdr arg0)) + ) + (case a2-0 + (('print) + (set! gp-0 (car s4-0)) + (if (pair? gp-0) + (set! gp-0 (dummy-14 obj (the-as pair gp-0))) + ) + (format + #t + "~A MESSAGE (~D): ~A~%" + obj + (-> *display* base-frame-counter) + gp-0 + ) + ) + (('while) + (let ((s3-0 (car s4-0))) + (while (dummy-14 obj (the-as pair s3-0)) + (let* ((s2-0 (cdr s4-0)) + (a1-3 (car s2-0)) + ) + (while (not (null? s2-0)) + (set! gp-0 (dummy-14 obj (the-as pair a1-3))) + (set! s2-0 (cdr s2-0)) + (set! a1-3 (car s2-0)) + ) + ) + ) + ) + ) + (('until) + (let ((s3-1 (car s4-0))) + (while (not (dummy-14 obj (the-as pair s3-1))) + (let* ((s2-1 (cdr s4-0)) + (a1-5 (car s2-1)) + ) + (while (not (null? s2-1)) + (set! gp-0 (dummy-14 obj (the-as pair a1-5))) + (set! s2-1 (cdr s2-1)) + (set! a1-5 (car s2-1)) + ) + ) + ) + ) + ) + (('not) + (set! gp-0 (not (dummy-14 obj (the-as pair (car s4-0))))) + ) + (('wait-for 'wait 'suspend) + (let ((s5-1 (command-get-time (car s4-0) 1)) + (s4-1 (-> *display* base-frame-counter)) + ) + (until (>= (- (-> *display* base-frame-counter) s4-1) s5-1) + (suspend) + ) + ) + ) + (('message?) + (when (= (-> obj message) (car s4-0)) + (set! gp-0 (-> obj message)) + (set! (-> obj message) #f) + ) + ) + (('send-event) + (let ((s5-2 (command-get-process (car s4-0) *target*)) + (s3-2 (car (cdr s4-0))) + (s4-2 (cdr (cdr s4-0))) + ) + (when (and s5-2 (not (null? s3-2))) + (let ((gp-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> gp-1 from) pp) + (let ((a0-22 s4-2)) + (set! + (-> gp-1 num-params) + ((method-of-type (rtype-of a0-22) length) a0-22) + ) + ) + (set! (-> gp-1 message) (the-as symbol s3-2)) + (set! + (-> gp-1 param 0) + (the-as uint (command-get-param (car s4-2) #f)) + ) + (set! + (-> gp-1 param 1) + (the-as uint (command-get-param (car (cdr s4-2)) #f)) + ) + (set! + (-> gp-1 param 2) + (the-as uint (command-get-param (car (cdr (cdr s4-2))) #f)) + ) + (set! gp-0 (send-event-function s5-2 gp-1)) + ) + ) + ) + ) + (('eval) + (let ((s4-3 (car s4-0))) + (if (and s4-3 (type-type? (-> (the-as basic s4-3) type) function)) + (set! gp-0 ((the-as (function camera-tracker symbol) s4-3) obj)) + ) + ) + ) + (('work-set!) + (set! gp-0 (process->handle (dummy-14 obj (the-as pair (car s4-0))))) + (set! (-> obj work-process) (the-as handle gp-0)) + ) + (('grab) + (let ((a0-38 (command-get-process (car s4-0) *target*))) + (set! gp-0 (process-grab? a0-38)) + ) + ) + (('release) + (set! gp-0 (process-release? (handle->process (-> obj grab-target)))) + ) + (('alive?) + (set! gp-0 (command-get-process (car s4-0) *target*)) + ) + (('draw) + (set! gp-0 (command-get-process (car s4-0) *target*)) + (when (the-as target gp-0) + (if (car (cdr s4-0)) + (set! + (-> (the-as target gp-0) skel status) + (logand -3 (-> (the-as target gp-0) skel status)) + ) + (logior! (-> (the-as target gp-0) skel status) 2) + ) + ) + ) + (('camera-change-to 'camera) + (set! + gp-0 + (camera-change-to + (the-as string (car s4-0)) + (command-get-time (car (cdr s4-0)) 0) + #f + ) + ) + ) + (('intro-done?) + (let ((a1-25 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-25 from) pp) + (set! (-> a1-25 num-params) 0) + (set! (-> a1-25 message) 'intro-done?) + (set! gp-0 (send-event-function *camera* a1-25)) + ) + ) + (('camera-look-at 'look-at) + (set! + gp-0 + (camera-look-at + (the-as pair (car s4-0)) + (the-as uint (command-get-int (car (cdr s4-0)) 0)) + ) + ) + ) + (('pov) + (set! + gp-0 + (camera-pov-from + (the-as pair (car s4-0)) + (the-as uint (command-get-int (car (cdr s4-0)) 0)) + ) + ) + ) + (('camera-anim) + (let ((s2-2 (car s4-0)) + (s3-3 (car (cdr s4-0))) + (s4-4 (command-get-trans (car (cdr (cdr s4-0))) *null-vector*)) + (s1-0 string->symbol) + ) + (format (clear *temp-string*) "*~S-sg*" s2-2) + (let ((s2-3 (-> (s1-0 *temp-string*) value))) + (when (type-type? (rtype-of s2-3) skeleton-group) + (set! (-> obj anim-process) (the-as handle #f)) + (let ((s1-1 (get-process *default-dead-pool* manipy #x4000))) + (set! gp-0 (when s1-1 + (let ((t9-35 (method-of-type manipy activate))) + (t9-35 + (the-as manipy s1-1) + obj + 'manipy + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s1-1 manipy-init s4-4 #f s2-3 #f) + (-> s1-1 ppointer) + ) + ) + ) + (send-event + (-> (the-as (pointer process) gp-0) 0 self) + 'anim-mode + 'play1 + ) + (send-event + (-> (the-as (pointer process) gp-0) 0 self) + 'art-joint-anim + s3-3 + ) + (set! + (-> obj anim-process) + (ppointer->handle (the-as (pointer process) gp-0)) + ) + ) + ) + ) + ) + (else + (format + 0 + "ERROR: camera-tracker does not know script line command ~A.~%" + a2-0 + ) + ) + ) + ) + ) + (else + (format + 0 + "ERROR: camera-tracker requires a pair as a script line, not ~A.~%" + arg0 + ) + ) + ) + (the-as process gp-0) + ) + ) + ) + +(defstate camera-tracker-process (camera-tracker) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 uint)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'message) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self message) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'mask) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self mask-to-clear) v0-0) + v0-0 + ) + ((= v1-0 'border) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self border-value) (the-as basic v0-0)) + v0-0 + ) + ) + ) + ) + ) + :enter + (behavior () + (if (-> self entity-override) + (dummy-30 (-> self entity-override) (entity-perm-status bit-3) #t) + ) + (if (not (-> self border-value)) + (push-setting! + *setting-control* + self + 'border-mode + (-> self border-value) + 0.0 + 0 + ) + ) + (push-setting! + *setting-control* + self + 'process-mask + 'set + 0.0 + (-> self mask-to-clear) + ) + (push-setting! *setting-control* self 'movie (process->ppointer self) 0.0 0) + (hide-hud-quick) + (none) + ) + :exit + (behavior () + (if (-> self entity-override) + (dummy-30 (-> self entity-override) (entity-perm-status bit-3) #f) + ) + (send-event *camera* 'clear-entity) + (none) + ) + :code + (behavior () + (cond + ((-> self script-func) + ((-> self script-func)) + ) + (else + (while (not (null? (-> self script-line))) + (dummy-14 self (the-as pair (-> self script-line car))) + (set! (-> self script-line) (the-as pair (-> self script-line cdr))) + ) + ) + ) + (clear-pending-settings-from-process *setting-control* self 'process-mask) + (send-event *camera* 'clear-entity) + (suspend) + (suspend) + (suspend) + 0 + (none) + ) + ) + +(defbehavior camera-tracker-init camera-tracker ((arg0 object)) + (stack-size-set! (-> self main-thread) 512) + (logclear! + (-> self mask) + (process-mask actor-pause movie enemy platform projectile) + ) + (set! (-> self mask-to-clear) (the-as uint #x4a0800)) + (set! (-> self grab-target) (the-as handle #f)) + (set! (-> self grab-event) 'grab) + (set! (-> self release-event) 'end-mode) + (set! (-> self look-at-target) (the-as handle #f)) + (set! (-> self pov-target) (the-as handle #f)) + (set! (-> self callback) #f) + (set! (-> self userdata) #f) + (set! (-> self start-time) (-> *display* base-frame-counter)) + (set! (-> self script) '()) + (set! (-> self script-line) '()) + (set! (-> self script-func) #f) + (set! (-> self message) #f) + (set! (-> self border-value) #f) + (cond + ((pair? arg0) + (set! (-> self script) (the-as pair arg0)) + (set! (-> self script-line) (the-as pair arg0)) + ) + ((type-type? (rtype-of arg0) function) + (set! (-> self script-func) (the-as (function none) arg0)) + ) + (else + (format + 0 + "ERROR: camera-tracker requires a pair as a script, not ~A.~%" + arg0 + ) + ) + ) + (let* ((gp-1 (ppointer->process (-> self parent))) + (v1-17 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) process)) + gp-1 + ) + ) + ) + (if v1-17 + (set! + (-> self entity-override) + (the-as entity-actor (-> (the-as process v1-17) entity)) + ) + ) + ) + (set! (-> self event-hook) (-> camera-tracker-process event)) + (go camera-tracker-process) + ) + +(deftype med-res-level (process-drawable) + ((level symbol :offset-assert 176) + (part-mode basic :offset-assert 180) + (index int32 :offset-assert 184) + ) + :heap-base #x50 + :method-count-assert 20 + :size-assert #xbc + :flag-assert #x14005000bc + ) + + +(defstate med-res-level-idle (med-res-level) + :code + (behavior () + (local-vars (v1-37 float)) + (rlet ((vf0 :class vf) + (vf16 :class vf) + (vf17 :class vf) + ) + (init-vf0-vector) + (while #t + (let ((a0-1 (level-get *level* (-> self level))) + (v1-3 (-> *game-info* current-continue level)) + ) + (cond + ((and + a0-1 + (or + (= (-> a0-1 display?) 'special) + (= (-> a0-1 display?) 'special-vis) + ) + ) + (set! (-> self draw status) (logand -3 (-> self draw status))) + (when (nonzero? (-> self skel)) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) 1.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + ((or (and a0-1 (= (-> a0-1 status) 'active)) (= v1-3 'firecanyon)) + (logior! (-> self draw status) 2) + ) + ((and (= (-> self level) 'firecanyon) (< (-> (camera-pos) y) 327680.0)) + (logior! (-> self draw status) 2) + ) + (else + (set! (-> self draw status) (logand -3 (-> self draw status))) + (if (nonzero? (-> self part)) + (spawn (-> self part) (-> self root trans)) + ) + (when (nonzero? (-> self skel)) + (let ((a0-17 (-> self skel root-channel 0))) + (set! (-> a0-17 param 0) 1.0) + (joint-control-channel-group-eval! + a0-17 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + ) + ) + (when (zero? (logand (-> self draw status) 2)) + (let ((v1-36 (-> self draw)) + (a0-18 (new 'stack-no-clear 'vector)) + ) + (.lvf vf16 (&-> v1-36 origin quad)) + (.lvf vf17 (&-> v1-36 bounds quad)) + (.mul.x.vf vf16 vf16 vf0 :mask #b1000) + (.add.vf vf16 vf16 vf17) + (.svf (&-> a0-18 quad) vf16) + ) + (.mov v1-37 vf16) + ) + (suspend) + ) + (none) + ) + ) + :post + (the-as (function none :behavior med-res-level) ja-post) + ) + +(define *lev-string* (new 'global 'string 64 (the-as string #f))) + +(defmethod copy-defaults! med-res-level ((obj med-res-level) (arg0 res-lump)) + (local-vars (sv-16 res-tag)) + (stack-size-set! (-> obj main-thread) 128) + "#f" + (let ((s4-0 (the-as (pointer sparticle-launch-group) #f))) + (set! sv-16 (new 'static 'res-tag)) + (let* + ((s3-0 + (res-lump-data + arg0 + 'art-name + (pointer (pointer sparticle-launch-group)) + :tag-ptr + (& sv-16) + ) + ) + (s2-0 (-> s3-0 0)) + ) + (cond + ((not s3-0) + ) + ((part-group-pointer? s2-0) + (set! s4-0 (-> s3-0 0)) + ) + ((= (-> s2-0 -1) string) + (set! s4-0 (lookup-part-group-pointer-by-name (the-as string s2-0))) + (if s4-0 + (set! (-> s3-0 0) s4-0) + ) + ) + ((= (-> s2-0 -1) symbol) + (let ((a0-7 (-> (&+ s2-0 #xff38) 0))) + (set! s4-0 (lookup-part-group-pointer-by-name (the-as string a0-7))) + ) + (if s4-0 + (set! (-> s3-0 0) s4-0) + ) + ) + ) + ) + (when s4-0 + (let ((a0-8 (-> s4-0 0))) + (if (and (nonzero? a0-8) (= (-> a0-8 type) sparticle-launch-group)) + (set! (-> obj part) (create-launch-control a0-8 obj)) + ) + ) + ) + ) + (process-entity-status! obj (entity-perm-status bit-7) #t) + (let ((s4-1 (res-lump-struct (-> obj entity) 'level structure)) + (s3-1 (res-lump-value (-> obj entity) 'index uint128)) + ) + (when s4-1 + (set! (-> obj level) (the-as symbol s4-1)) + (set! (-> obj index) (the-as int s3-1)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (format (clear *lev-string*) "med-res-~S~S" s4-1 (if (zero? s3-1) + "" + (* s3-1 8) + ) + ) + (dummy-15 obj *lev-string* '()) + (logior! (-> obj draw status) 64) + (if (nonzero? (-> obj draw)) + (go med-res-level-idle) + ) + ) + ) + (none) + ) + +(defmethod dummy-20 part-spawner ((obj part-spawner)) + (sphere<-vector+r! (-> obj world-sphere) (-> obj root trans) (-> obj radius)) + (sphere-in-view-frustum? (-> obj world-sphere)) + (none) + ) + +(defstate part-spawner-active (part-spawner) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('stop) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> self enable) #f) + #t + ) + (('start) + (process-entity-status! self (entity-perm-status complete) #f) + (set! (-> self enable) #t) + #t + ) + (('trans) + (let ((v0-1 (the-as object (-> (the-as vector (-> arg3 param 0)) quad)))) + (set! (-> self root trans quad) (the-as uint128 v0-1)) + v0-1 + ) + ) + ) + ) + :code + (behavior () + (while #t + (when (-> self enable) + (spawn (-> self part) (-> self root trans)) + (if (nonzero? (-> self sound)) + (update! (-> self sound)) + ) + ) + (suspend) + ) + (none) + ) + ) + +(defmethod copy-defaults! part-spawner ((obj part-spawner) (arg0 res-lump)) + (local-vars (sv-16 res-tag)) + (stack-size-set! (-> obj main-thread) 128) + (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj radius) 12288.0) + (set! + (-> obj enable) + (not + (and + (-> obj entity) + (logtest? (-> obj entity extra perm status) (entity-perm-status complete)) + ) + ) + ) + (set! + (-> obj sound) + (new 'process 'ambient-sound (-> obj entity) (-> obj root trans)) + ) + (let ((s4-0 (the-as object "#f"))) + (let ((s3-0 (the-as (pointer sparticle-launch-group) #f))) + (set! sv-16 (new 'static 'res-tag)) + (let* + ((s5-1 + (res-lump-data + arg0 + 'art-name + (pointer (pointer sparticle-launch-group)) + :tag-ptr + (& sv-16) + ) + ) + (s2-0 (-> s5-1 0)) + ) + (cond + ((part-group-pointer? s2-0) + (set! s3-0 (-> s5-1 0)) + ) + ((= (-> s2-0 -1) string) + (when (string= (the-as string s2-0) "group-beach-grotto-1") + (set! (-> obj radius) 61440.0) + (go beach-part-grotto-1) + ) + (set! s4-0 s2-0) + (set! s3-0 (lookup-part-group-pointer-by-name (the-as string s4-0))) + (if s3-0 + (set! (-> s5-1 0) s3-0) + ) + ) + ((= (-> s2-0 -1) symbol) + (set! s4-0 (-> (&+ s2-0 #xff38) 0)) + (set! s3-0 (lookup-part-group-pointer-by-name (the-as string s4-0))) + (if s3-0 + (set! (-> s5-1 0) s3-0) + ) + ) + (else + (go process-drawable-art-error (the-as string s2-0)) + ) + ) + ) + (set! (-> obj mode) s3-0) + (when s3-0 + (let ((a0-19 (-> s3-0 0))) + (when (and (nonzero? a0-19) (= (-> a0-19 type) sparticle-launch-group)) + (set! (-> obj part) (create-launch-control a0-19 obj)) + (go part-spawner-active) + ) + ) + ) + ) + (go process-drawable-art-error (the-as string s4-0)) + ) + (none) + ) + +(deftype launcher (process-drawable) + ((root-override collide-shape :offset 112) + (spring-height meters :offset-assert 176) + (camera state :offset-assert 180) + (active-distance float :offset-assert 184) + (seek-time uint64 :offset-assert 192) + (dest vector :inline :offset-assert 208) + (sound-id sound-id :offset-assert 224) + ) + :heap-base #x80 + :method-count-assert 20 + :size-assert #xe4 + :flag-assert #x14008000e4 + ) + + +(set! + (-> *part-group-id-table* 37) + (new 'static 'sparticle-launch-group + :length 5 + :duration #xbb8 + :linger-duration #x5dc + :name "group-beach-launcher" + :launcher + (new 'static 'inline-array sparticle-group-item 5 + (sp-item 45 :fade-after (meters 100.0) :falloff-to (meters 100.0)) + (sp-item 46 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 47 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 48 :fade-after (meters 50.0) :falloff-to (meters 80.0)) + (sp-item 49 :fade-after (meters 70.0) :falloff-to (meters 100.0)) + ) + :bounds + (new 'static 'sphere :y 12288.0 :w 20480.0) + ) + ) + +(set! + (-> *part-id-table* 45) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 14 + (sp-flt spt-num 1.5) + (sp-flt spt-x (meters 1.5)) + (sp-flt spt-y (meters -0.5)) + (sp-int spt-rot-x 5) + (sp-flt spt-r 4096.0) + (sp-flt spt-g 2867.2) + (sp-flt spt-b 3276.8) + (sp-flt spt-vel-y (meters 0.026666667)) + (sp-int spt-timer 270) + (sp-cpuinfo-flags aux-list) + (sp-int spt-next-time 180) + (sp-launcher-by-id spt-next-launcher 50) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 50) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-b -4.551111) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 46) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0.0) (meters 1.8) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.5) (meters 2.5) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.24414062) (meters 0.48828125) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags bit3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 47) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 1.8) (meters 1.0) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 1.0) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.048828125) (meters 0.09765625) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags bit3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 48) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x17 :page #x2)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.4) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.1) (meters 0.1) 1.0) + (sp-rnd-flt spt-r 10.0 6.0 1.0) + (sp-rnd-flt spt-g 64.0 128.0 1.0) + (sp-rnd-flt spt-b 10.0 6.0 1.0) + (sp-flt spt-a 80.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a -0.2) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int-plain-rnd spt-timer 180 119 1) + (sp-cpuinfo-flags bit2) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 49) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 1.0) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 10.0 5.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags bit2 bit3) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 51) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 51) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.18) + (sp-end) + ) + ) + ) + +(set! + (-> *part-group-id-table* 38) + (new 'static 'sparticle-launch-group + :length 4 + :duration #xbb8 + :linger-duration #x5dc + :name "group-jungle-launcher" + :launcher + (new 'static 'inline-array sparticle-group-item 4 + (sp-item 45 :fade-after (meters 100.0) :falloff-to (meters 100.0)) + (sp-item 52 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 53 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 54 :fade-after (meters 70.0) :falloff-to (meters 100.0)) + ) + :bounds + (new 'static 'sphere :y 12288.0 :w 20480.0) + ) + ) + +(set! + (-> *part-id-table* 52) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0.0) (meters 1.4) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.5) (meters 2.5) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.24414062) (meters 0.48828125) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags bit3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 53) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 1.4) (meters 0.9) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 1.0) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.048828125) (meters 0.09765625) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags bit3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 54) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 1.0) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 10.0 5.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags bit2 bit3) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 51) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-group-id-table* 39) + (new 'static 'sparticle-launch-group + :length 4 + :duration #xbb8 + :linger-duration #x5dc + :name "group-swamp-launcher" + :launcher + (new 'static 'inline-array sparticle-group-item 4 + (sp-item 45 :fade-after (meters 100.0) :falloff-to (meters 100.0)) + (sp-item 46 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 47 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 55 :fade-after (meters 70.0) :falloff-to (meters 100.0)) + ) + :bounds + (new 'static 'sphere :y 12288.0 :w 20480.0) + ) + ) + +(set! + (-> *part-id-table* 55) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 1.0) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 16.0 16.0 1.0) + (sp-rnd-flt spt-g 16.0 16.0 1.0) + (sp-rnd-flt spt-b 5.0 2.5 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags bit2) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 51) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(defbehavior cam-launcher-joystick camera-slave () + (when *camera-read-analog* + (let ((s5-0 (new-stack-matrix0)) + (gp-0 (vector-reset! (new 'stack-no-clear 'vector))) + ) + (let* + ((f0-0 + (analog-input + (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) + 0.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f1-1 (* -546.13336 f0-0)) + (f0-2 (fmin 546.13336 (fmax -546.13336 f1-1))) + ) + (matrix-axis-angle! s5-0 (-> *camera* local-down) f0-2) + ) + (vector-! gp-0 (-> self trans) (-> *camera* tpos-curr)) + (vector-matrix*! gp-0 gp-0 s5-0) + (vector+! (-> self trans) gp-0 (-> *camera* tpos-curr)) + ) + ) + ) + +(defstate cam-launcher-shortfall (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector--float*! + (-> self trans) + (-> *camera* tpos-curr) + (-> *camera* local-down) + 28672.0 + ) + (vector-flatten! + gp-0 + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! gp-0 1.0) + (set! (-> self pivot-pt quad) (-> gp-0 quad)) + (vector+float*! gp-0 gp-0 (-> *camera* local-down) 1000.0) + (vector-normalize-copy! (-> self tracking inv-mat vector 2) gp-0 1.0) + ) + (vector-cross! + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 (-> *display* base-frame-counter))) + (while #t + (when (not (paused?)) + (vector--float*! + (-> self trans) + (-> *camera* tpos-curr) + (-> *camera* local-down) + 28672.0 + ) + (send-event *camera* 'teleport) + (if + (and + (-> *camera* on-ground) + (>= (- (-> *display* base-frame-counter) gp-0) 300) + ) + (send-event *camera* 'change-state *camera-base-mode* 150) + ) + ) + (suspend) + ) + ) + (none) + ) + ) + +(defbehavior cam-launcher-long-joystick camera-slave () + (when *camera-read-analog* + (let ((gp-0 (new-stack-matrix0))) + (let* + ((f0-0 + (analog-input + (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) + 0.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f1-1 (* -546.13336 f0-0)) + (f0-2 (fmin 546.13336 (fmax -546.13336 f1-1))) + ) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-2) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + (vector-normalize! (-> self view-flat) 4096.0) + ) + ) + +(defstate cam-launcher-longfall (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (new 'stack-no-clear 'vector) + (vector-negate! (-> self view-flat) (-> self tracking inv-mat vector 2)) + (vector-normalize! (-> self view-flat) 4096.0) + (vector--float*! + (-> self trans) + (-> *camera* tpos-curr) + (-> *camera* local-down) + 28672.0 + ) + (vector+! (-> self trans) (-> self trans) (-> self view-flat)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (cam-launcher-long-joystick) + (none) + ) + :code + (behavior () + (let ((gp-0 (-> *display* base-frame-counter))) + (while #t + (when (not (paused?)) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + 0.0 + 0.0 + 0.0 + (send-event *camera* 'teleport) + (let* ((f0-4 (vector-dot (-> self velocity) (-> *camera* local-down))) + (f30-0 (* 0.975 f0-4)) + ) + (vector--float*! + s4-0 + (-> *camera* tpos-curr) + (-> *camera* local-down) + 28672.0 + ) + (vector-! s4-0 s4-0 (-> self trans)) + (let ((f28-0 (vector-dot s4-0 (-> *camera* local-down)))) + (vector--float*! s5-0 s4-0 (-> *camera* local-down) f28-0) + (cond + ((< f28-0 f30-0) + (set! f30-0 f28-0) + ) + ((< 20480.0 f28-0) + (let ((f28-1 (+ -20480.0 f28-0))) + (let ((f0-8 (lerp f30-0 f28-1 0.005))) + (if (< f30-0 f0-8) + (set! f30-0 f0-8) + ) + ) + (if (< (* 0.09 f28-1) f30-0) + (set! f30-0 (* 0.09 f28-1)) + ) + ) + ) + ) + ) + (vector+float*! (-> self velocity) s5-0 (-> *camera* local-down) f30-0) + ) + ) + (vector+! (-> self trans) (-> self trans) (-> self velocity)) + (set! (-> self trans x) (-> *camera* tpos-curr x)) + (set! (-> self trans z) (-> *camera* tpos-curr z)) + (vector+! (-> self trans) (-> self trans) (-> self view-flat)) + (if + (and + (-> *camera* on-ground) + (>= (- (-> *display* base-frame-counter) gp-0) 300) + ) + (send-event *camera* 'change-state *camera-base-mode* 150) + ) + ) + (vector-reset! (-> self tracking follow-off)) + (vector+! + (-> self tracking follow-pt) + (-> *camera* tpos-curr-adj) + (-> self tracking follow-off) + ) + (vector--float*! + (-> self tracking follow-pt) + (-> self tracking follow-pt) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + (suspend) + ) + ) + (none) + ) + ) + +(defstate launcher-idle (launcher) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'instant-death) + (go launcher-deactivated) + ) + ((= v1-0 'trans) + (TODO-RENAME-30 + (-> self root-override) + (the-as vector (-> arg3 param 0)) + ) + (dummy-47 (-> self root-override)) + ) + ) + ) + ) + ) + :trans + (behavior () + (when + (and + *target* + (>= + (-> self active-distance) + (vector-vector-distance + (-> self root-override trans) + (-> *target* control trans) + ) + ) + ) + (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) 'query) + (set! (-> a1-1 param 0) (the-as uint 'powerup)) + (set! (-> a1-1 param 1) (the-as uint 3)) + (cond + ((send-event-function *target* a1-1) + (go launcher-active) + ) + (else + (let ((gp-0 'target-launch) + (a1-2 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 1) + (set! (-> a1-2 message) 'query) + (set! (-> a1-2 param 0) (the-as uint 'mode)) + (if (= (send-event-function *target* a1-2) gp-0) + (send-event *target* 'end-mode) + ) + ) + ) + ) + ) + (if + (and + (and + *target* + (>= + 32768.0 + (vector-vector-distance + (-> self root-override trans) + (-> *target* control trans) + ) + ) + ) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) self) + (set! (-> a1-5 num-params) 2) + (set! (-> a1-5 message) 'query) + (set! (-> a1-5 param 0) (the-as uint 'powerup)) + (set! (-> a1-5 param 1) (the-as uint 3)) + (not (send-event-function *target* a1-5)) + ) + ) + (level-hint-spawn + (game-text-id daxter-launcher-no-eco) + "sksp0035" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + (none) + ) + :code + (the-as (function none :behavior launcher) anim-loop) + ) + +(defstate launcher-active (launcher) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (when (or (= arg2 'touch) (= arg2 'attack)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (send-event + arg0 + 'launch + (-> self spring-height) + (-> self camera) + (-> self dest) + (-> self seek-time) + ) + ) + (the-as object (cond + ((= arg2 'instant-death) + (go launcher-deactivated) + ) + ((= arg2 'trans) + (TODO-RENAME-30 + (-> self root-override) + (the-as vector (-> arg3 param 0)) + ) + (dummy-47 (-> self root-override)) + ) + ) + ) + ) + :exit + (behavior () + (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-0 command) (sound-command set-param)) + (set! (-> v1-0 id) (-> self sound-id)) + (set! (-> v1-0 parms volume) -4) + (set! (-> v1-0 auto-time) 120) + (set! (-> v1-0 auto-from) 2) + (set! (-> v1-0 parms mask) (the-as uint 17)) + (-> v1-0 id) + ) + (none) + ) + :trans + (behavior () + (if + (or + (or + (not *target*) + (< + (-> self active-distance) + (vector-vector-distance + (-> self root-override trans) + (-> *target* control trans) + ) + ) + ) + (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) 'query) + (set! (-> a1-1 param 0) (the-as uint 'powerup)) + (set! (-> a1-1 param 1) (the-as uint 3)) + (not (send-event-function *target* a1-1)) + ) + ) + (go launcher-idle) + ) + (spawn (-> self part) (-> self root-override trans)) + (sound-play-by-name + (static-sound-name "launch-idle") + (-> self sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (if + (and + (and + *target* + (>= + (+ 2867.2 (-> self root-override root-prim prim-core world-sphere w)) + (vector-vector-distance + (-> self root-override trans) + (-> *target* control trans) + ) + ) + ) + (< (- (-> *display* base-frame-counter) (-> self state-time)) 150) + ) + (send-event + *target* + 'launch + (-> self spring-height) + (-> self camera) + (-> self dest) + (-> self seek-time) + ) + ) + (none) + ) + :code + (behavior () + (sound-play-by-name + (static-sound-name "launch-start") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (anim-loop) + (none) + ) + ) + +(defstate launcher-deactivated (launcher) + :code + (the-as (function none :behavior launcher) anim-loop) + ) + +(defmethod copy-defaults! launcher ((obj launcher) (arg0 res-lump)) + (stack-size-set! (-> obj main-thread) 128) + (let + ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> s3-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s3-0 collide-with) (the-as uint 16)) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 12288.0) + ) + (dummy-46 s4-0) + (set! (-> s4-0 nav-radius) 13926.4) + (dummy-50 s4-0) + (set! (-> obj root-override) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (dummy-47 (-> obj root-override)) + (set! (-> obj active-distance) 409600.0) + (set! + (-> obj spring-height) + (res-lump-float arg0 'spring-height :default 163840.0) + ) + (let ((s4-1 (res-lump-value arg0 'mode uint128))) + (let ((v1-18 (-> obj entity extra level name))) + (set! (-> obj part) (create-launch-control (cond + ((= v1-18 'beach) + (-> *part-group-id-table* 37) + ) + ((= v1-18 'swamp) + (-> *part-group-id-table* 39) + ) + (else + (-> *part-group-id-table* 38) + ) + ) + obj + ) + ) + ) + (let ((v1-24 (logand (the-as int s4-1) 255))) + (cond + ((= (the-as uint v1-24) 1) + (set! (-> obj camera) cam-launcher-longfall) + ) + ((= (the-as uint v1-24) 2) + (set! (-> obj camera) #f) + ) + (else + (set! (-> obj camera) cam-launcher-shortfall) + ) + ) + ) + ) + (let ((v1-29 (res-lump-struct arg0 'alt-vector vector))) + (when v1-29 + (set-vector! (-> obj dest) (-> v1-29 x) (-> v1-29 y) (-> v1-29 z) 1.0) + (set! (-> obj seek-time) (the-as uint (the int (* 300.0 (-> v1-29 w))))) + ) + ) + (set! (-> obj sound-id) (new-sound-id)) + (nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f)) + (go launcher-idle) + (none) + ) + +(defbehavior + launcher-init-by-other launcher + ((arg0 vector) (arg1 float) (arg2 int) (arg3 float)) + (stack-size-set! (-> self main-thread) 128) + (let + ((s2-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((s1-0 (new 'process 'collide-shape-prim-sphere s2-0 (the-as uint 0)))) + (set! (-> s1-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-0 collide-with) (the-as uint 16)) + (set-vector! (-> s1-0 local-sphere) 0.0 0.0 0.0 12288.0) + ) + (dummy-46 s2-0) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (dummy-50 s2-0) + (set! (-> self root-override) s2-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-vector! (-> self root-override scale) 1.0 1.0 1.0 1.0) + (set-vector! (-> self root-override quat) 0.0 0.0 0.0 1.0) + (dummy-47 (-> self root-override)) + (set! (-> self spring-height) arg1) + (set! (-> self active-distance) arg3) + (let ((v1-23 (-> self entity extra level name))) + (set! (-> self part) (create-launch-control (cond + ((= v1-23 'beach) + (-> *part-group-id-table* 37) + ) + ((= v1-23 'swamp) + (-> *part-group-id-table* 39) + ) + (else + (-> *part-group-id-table* 38) + ) + ) + self + ) + ) + ) + (case (logand arg2 255) + ((1) + (set! (-> self camera) cam-launcher-longfall) + ) + ((2) + (set! (-> self camera) #f) + ) + (else + (set! (-> self camera) cam-launcher-shortfall) + ) + ) + (let ((v1-34 (res-lump-struct (-> self entity) 'alt-vector vector))) + (when v1-34 + (set-vector! (-> self dest) (-> v1-34 x) (-> v1-34 y) (-> v1-34 z) 1.0) + (set! (-> self seek-time) (the-as uint (the int (* 300.0 (-> v1-34 w))))) + ) + ) + (set! (-> self sound-id) (new-sound-id)) + (go launcher-idle) + (none) + ) + +(defstate touch-tracker-idle (touch-tracker) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 none)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'touched) + (let ((v1-1 (ppointer->process (-> self parent)))) + (when (!= v1-1 arg0) + (cond + ((= (-> self event) 'attack) + (cond + ((= (-> arg0 type) target) + (let + ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (the-as process v1-1)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) (-> self event)) + (set! (-> a1-2 param 0) (the-as uint #f)) + (let ((a2-2 (new 'static 'attack-info :mask #x20))) + (set! + (-> a2-2 mode) + (the-as symbol (-> self event-mode)) + ) + (set! (-> a1-2 param 1) (the-as uint a2-2)) + ) + (send-event-function arg0 a1-2) + ) + ) + ((= (-> v1-1 type) target) + (let + ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (the-as process v1-1)) + (set! (-> a1-4 num-params) 4) + (set! (-> a1-4 message) (-> self event)) + (set! (-> a1-4 param 0) (the-as uint #f)) + (set! + (-> a1-4 param 1) + (the-as uint (-> self event-mode)) + ) + (set! + (-> a1-4 param 2) + (the-as uint (-> *target* control unknown-dword50)) + ) + (set! + (-> a1-4 param 3) + (the-as uint (-> *target* control unknown-dword51)) + ) + (send-event-function arg0 a1-4) + ) + ) + (else + (let + ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (the-as process v1-1)) + (set! (-> a1-5 num-params) 4) + (set! (-> a1-5 message) (-> self event)) + (set! (-> a1-5 param 0) (the-as uint #f)) + (set! + (-> a1-5 param 1) + (the-as uint (-> self event-mode)) + ) + (let ((v1-19 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-19) + (set! (-> a1-5 param 2) (the-as uint v1-19)) + ) + (set! (-> a1-5 param 3) (the-as uint 0)) + (send-event-function arg0 a1-5) + ) + ) + ) + ) + ((-> self event) + (let + ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (the-as process v1-1)) + (set! (-> a1-6 num-params) 0) + (set! (-> a1-6 message) (-> self event)) + (send-event-function arg0 a1-6) + ) + ) + (else + (let + ((t0-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> t0-5 from) arg0) + (set! (-> t0-5 num-params) arg1) + (set! (-> t0-5 message) arg2) + (set! (-> t0-5 param 0) (-> arg3 param 0)) + (set! (-> t0-5 param 1) (-> arg3 param 1)) + (set! (-> t0-5 param 2) (-> arg3 param 2)) + (set! (-> t0-5 param 3) (-> arg3 param 3)) + (set! (-> t0-5 param 4) (-> arg3 param 4)) + (set! (-> t0-5 param 5) (-> arg3 param 5)) + (set! (-> t0-5 param 6) (-> arg3 param 6)) + (send-event-function v1-1 t0-5) + ) + ) + ) + ) + ) + ) + ((= v1-0 'target) + (set! + v0-0 + (the-as + none + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (set! (-> self target) (the-as handle v0-0)) + v0-0 + ) + ((= v1-0 'event) + (set! (-> self event) (the-as symbol (-> arg3 param 0))) + (set! v0-0 (the-as none (-> arg3 param 1))) + (set! (-> self event-mode) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'exit) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! (-> self run-function) (the-as (function none) v0-0)) + v0-0 + ) + ((= v1-0 'eval) + ((the-as (function touch-tracker none) (-> arg3 param 0)) + self + ) + ) + ((= v1-0 'function) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! + (-> self callback) + (the-as (function touch-tracker none) v0-0) + ) + v0-0 + ) + ) + ) + ) + ) + :code + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (while ((-> self run-function)) + (let* ((gp-0 (handle->process (-> self target))) + (a0-4 + (if + (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) + gp-0 + ) + ) + ) + (when a0-4 + (let* ((gp-1 (-> (the-as process-drawable a0-4) root)) + (a0-6 + (if + (and (nonzero? gp-1) (type-type? (-> gp-1 type) collide-shape)) + gp-1 + ) + ) + ) + (if a0-6 + (set! + (-> self root-override trans quad) + (-> (the-as collide-shape a0-6) root-prim prim-core world-sphere quad) + ) + ) + ) + ) + ) + (if (-> self callback) + ((-> self callback) self) + ) + (dummy-47 (-> self root-override)) + (let ((a1-3 (new 'stack-no-clear 'touching-shapes-entry))) + (set! (-> a1-3 cshape1) (the-as collide-shape 2)) + (set! (-> a1-3 cshape2) (the-as collide-shape *touching-list*)) + (dummy-40 (-> self root-override) a1-3) + ) + (suspend) + ) + (dummy-48 (-> self root-override)) + (suspend) + 0 + (none) + ) + ) + +(defbehavior + touch-tracker-init touch-tracker + ((arg0 vector) (arg1 float) (arg2 uint)) + (let + ((s4-0 + (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)) + ) + ) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) default-collision-reaction) + (set! (-> s4-0 no-reaction) nothing) + (let ((s2-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 272)) + (set! (-> s2-0 collide-with) (the-as uint 3022)) + (set! (-> s2-0 prim-core offense) 4) + (set-vector! (-> s2-0 local-sphere) 0.0 0.0 0.0 arg1) + ) + (dummy-46 s4-0) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (dummy-50 s4-0) + (set! (-> s4-0 event-self) 'touched) + (set! (-> self root-override) s4-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set! (-> self duration) arg2) + (set! (-> self target) (the-as handle #f)) + (set! (-> self event) #f) + (set! (-> self callback) #f) + (set! + (-> self run-function) + (the-as + (function none) + (lambda :behavior touch-tracker + () + (< + (- (-> *display* base-frame-counter) (-> self state-time)) + (the-as int (-> self duration)) + ) + ) + ) + ) + (set! (-> self event-hook) (-> touch-tracker-idle event)) + (go touch-tracker-idle) + (none) + ) + +(defun process-drawable-random-point! ((arg0 process-drawable) (arg1 vector)) + (let ((v1-1 (-> arg0 node-list length)) + (s4-0 (-> arg0 root)) + ) + (cond + ((>= v1-1 7) + (let ((v1-2 (rand-vu-int-range 3 (+ v1-1 -1)))) + (vector<-cspace! arg1 (-> arg0 node-list data v1-2)) + ) + ) + ((and (nonzero? s4-0) (type-type? (-> s4-0 type) collide-shape)) + (vector+! + arg1 + (the-as vector (-> (the-as collide-shape s4-0) root-prim prim-core)) + (rand-vu-sphere-point! + arg1 + (-> (the-as collide-shape s4-0) root-prim prim-core world-sphere w) + ) + ) + ) + (else + (vector+! + arg1 + (-> arg0 root trans) + (rand-vu-sphere-point! arg1 (-> arg0 draw bounds w)) + ) + ) + ) + ) + arg1 + ) + +(defun + process-drawable-pair-random-point! + ((arg0 process-drawable) (arg1 process-drawable) (arg2 vector) (arg3 float)) + (let ((s4-0 (new-stack-vector0)) + (s3-0 (new-stack-vector0)) + ) + (process-drawable-random-point! arg0 s4-0) + (process-drawable-random-point! arg1 s3-0) + (vector-lerp! arg2 s4-0 s3-0 arg3) + ) + ) + +(define *particle-quat* (new 'static 'quaternion :w 1.0)) + +(defun + birth-func-set-quat + ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (local-vars (a0-2 float) (a0-3 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((a0-1 arg2) + (v1-0 *particle-quat*) + ) + (cond + ((< (-> v1-0 w) 0.0) + (.lvf vf1 (&-> a0-1 conerot quad)) + (.lvf vf2 (&-> v1-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> a0-1 conerot quad) vf1) + (.mov a0-2 vf1) + ) + (else + (.lvf vf1 (&-> a0-1 conerot quad)) + (.lvf vf2 (&-> v1-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> a0-1 conerot quad) vf1) + (.mov a0-3 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +(set! + (-> *part-id-table* 2528) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 12 + (sp-tex spt-texture (new 'static 'texture-id :index #xc :page #x2)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 0.5) 1.0) + (sp-flt spt-scale-y (meters 5.6)) + (sp-rnd-flt spt-r 0.0 44.0 1.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-rnd-flt spt-b 128.0 32.0 1.0) + (sp-flt spt-a 128.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags bit2 bit3 bit14 left-multiply-quat) + (sp-end) + ) + ) + ) + +(defun draw-eco-beam ((arg0 vector) (arg1 vector)) + (when (line-in-view-frustum? arg0 arg1) + (let ((s2-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (gp-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (vector+*! gp-1 arg0 s2-1 0.5) + (vector-normalize-copy! s4-0 s2-1 1.0) + (set! + (-> *part-id-table* 2528 init-specs 4 initial-valuef) + (vector-length s2-1) + ) + (forward-up->quaternion s5-0 s4-0 *y-vector*) + (dotimes (s4-1 3) + (quaternion-rotate-local-z! s5-0 s5-0 10922.667) + (quaternion-copy! *particle-quat* s5-0) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 2528) + gp-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ) + 0 + (none) + ) + + + diff --git a/goal_src/engine/game/task/process-taskable.gc b/goal_src/engine/game/task/process-taskable.gc index d64948477b..10ac83aa53 100644 --- a/goal_src/engine/game/task/process-taskable.gc +++ b/goal_src/engine/game/task/process-taskable.gc @@ -1817,33 +1817,40 @@ ) ) (suspend) - (-> self hand process 0) - (when - (or (-> self die?) (and (not (-> self survive-anim-end?)) (ja-anim-done?))) - (let ((gp-1 (-> *display* base-frame-counter))) - (while + (let ((a0-25 (-> self hand process 0))) + (when + (or + (-> self die?) (and - (< (- (-> *display* base-frame-counter) gp-1) #x4650) - (or - (and - (-> self entity) - (not - (is-object-visible? - (-> self entity extra level) - (-> self entity extra vis-id) + (not (-> self survive-anim-end?)) + (ja-anim-done? (the-as pair a0-25)) + ) + ) + (let ((gp-1 (-> *display* base-frame-counter))) + (while + (and + (< (- (-> *display* base-frame-counter) gp-1) #x4650) + (or + (and + (-> self entity) + (not + (is-object-visible? + (-> self entity extra level) + (-> self entity extra vis-id) + ) ) ) - ) - (< - 81920.0 - (vector-vector-distance (camera-pos) (-> *math-camera* trans)) + (< + 81920.0 + (vector-vector-distance (camera-pos) (-> *math-camera* trans)) + ) ) ) + (suspend) ) - (suspend) ) + (deactivate self) ) - (deactivate self) ) ) (none) diff --git a/goal_src/engine/ui/text-h.gc b/goal_src/engine/ui/text-h.gc index 4e57aaa4c6..8be0e0f429 100644 --- a/goal_src/engine/ui/text-h.gc +++ b/goal_src/engine/ui/text-h.gc @@ -152,9 +152,8 @@ (firecanyon-not-enough-cells #x24f) (sidekick-hint-orb-cache-top #x251) - + (daxter-launcher-no-eco #x25c) (jungle-precursorbridge-hint #x25b) - (beach-gimmie #x262) (beach-sentinel #x263) (jungle-canyon-end #x264) diff --git a/goal_src/levels/beach/beach-part.gc b/goal_src/levels/beach/beach-part.gc index 3d07d64cd5..0b2983fcdf 100644 --- a/goal_src/levels/beach/beach-part.gc +++ b/goal_src/levels/beach/beach-part.gc @@ -120,8 +120,7 @@ :code (behavior () (while #t - self - (when ((method-of-object self dummy-20)) + (when (dummy-20 self) (let* ((gp-0 (camera-pos)) (f0-0 (vector-vector-distance (-> self root trans) gp-0)) ) diff --git a/goal_src/levels/jungleb/jungleb-obs.gc b/goal_src/levels/jungleb/jungleb-obs.gc index 82d057cfa0..19353c0481 100644 --- a/goal_src/levels/jungleb/jungleb-obs.gc +++ b/goal_src/levels/jungleb/jungleb-obs.gc @@ -425,10 +425,13 @@ ) (camera-look-at (the-as - process + pair "ecovent-171" ) - 0 + (the-as + uint + 0 + ) ) (camera-change-to "camera-223" @@ -489,8 +492,14 @@ ) ) (camera-look-at - *target* - 0 + (the-as + pair + *target* + ) + (the-as + uint + 0 + ) ) (camera-change-to (the-as diff --git a/scripts/update-goal-src.py b/scripts/update-goal-src.py index c095500e8d..9bc4aad14a 100644 --- a/scripts/update-goal-src.py +++ b/scripts/update-goal-src.py @@ -26,6 +26,7 @@ files_with_modifications = [ "viewer", "sunken-obs", "cam-master", + "generic-obs", "default-menu" ] diff --git a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc index 9cbb1ab44f..74c0c83f20 100644 --- a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc +++ b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc @@ -3,9 +3,9 @@ ;; definition of type manipy (deftype manipy (process-drawable) - ((new-trans-hook function :offset-assert 176) - (cur-trans-hook function :offset-assert 180) - (cur-event-hook function :offset-assert 184) + ((new-trans-hook (function none) :offset-assert 176) + (cur-trans-hook (function none) :offset-assert 180) + (cur-event-hook (function none) :offset-assert 184) (new-joint-anim art-joint-anim :offset-assert 188) (new-joint-anim-blend uint64 :offset-assert 192) (anim-mode symbol :offset-assert 200) @@ -13,8 +13,8 @@ (cur-target-handle handle :offset-assert 216) (old-grab-pos vector :inline :offset-assert 224) (joint process-drawable 4 :offset-assert 240) - (new-post-hook function :offset-assert 256) - (cur-post-hook function :offset-assert 260) + (new-post-hook (function none) :offset-assert 256) + (cur-post-hook (function none) :offset-assert 260) (clone-copy-trans basic :offset-assert 264) (shadow-backup basic :offset-assert 268) (draw? symbol :offset-assert 272) @@ -50,17 +50,17 @@ ;; definition of type part-spawner (deftype part-spawner (process-drawable) - ((mode uint32 :offset-assert 176) - (enable basic :offset-assert 180) - (radius meters :offset-assert 184) - (world-sphere sphere :inline :offset-assert 192) + ((mode (pointer sparticle-launch-group) :offset-assert 176) + (enable symbol :offset-assert 180) + (radius meters :offset-assert 184) + (world-sphere sphere :inline :offset-assert 192) ) :heap-base #x60 :method-count-assert 21 :size-assert #xd0 :flag-assert #x15006000d0 (:methods - (dummy-20 () none 20) + (dummy-20 (_type_) none 20) ) ) @@ -78,19 +78,19 @@ ;; definition of type part-tracker (deftype part-tracker (process) - ((root trsqv :offset-assert 112) - (part sparticle-launch-control :offset-assert 116) - (target uint64 :offset-assert 120) - (callback basic :offset-assert 128) - (linger-callback basic :offset-assert 132) - (duration int64 :offset-assert 136) - (linger-duration int64 :offset-assert 144) - (start-time int64 :offset-assert 152) - (offset vector :inline :offset-assert 160) - (userdata uint64 :offset-assert 176) - (user-time int64 2 :offset-assert 184) - (user-vector vector 2 :inline :offset-assert 208) - (user-handle uint32 2 :offset-assert 240) + ((root trsqv :offset-assert 112) + (part sparticle-launch-control :offset-assert 116) + (target handle :offset-assert 120) + (callback (function part-tracker none) :offset-assert 128) + (linger-callback (function part-tracker none) :offset-assert 132) + (duration int64 :offset-assert 136) + (linger-duration int64 :offset-assert 144) + (start-time int64 :offset-assert 152) + (offset vector :inline :offset-assert 160) + (userdata uint64 :offset-assert 176) + (user-time int64 2 :offset-assert 184) + (user-vector vector 2 :inline :offset-assert 208) + (user-handle uint32 2 :offset-assert 240) ) :heap-base #x90 :method-count-assert 14 @@ -121,32 +121,33 @@ ;; definition of type camera-tracker (deftype camera-tracker (process) - ((grab-target handle :offset 120) - (grab-event basic :offset-assert 128) - (release-event basic :offset-assert 132) - (old-global-mask uint32 :offset-assert 136) - (old-self-mask uint32 :offset-assert 140) - (old-parent-mask uint32 :offset-assert 144) - (look-at-target handle :offset-assert 152) - (pov-target handle :offset-assert 160) - (work-process handle :offset-assert 168) - (anim-process handle :offset-assert 176) - (start-time int64 :offset-assert 184) - (callback basic :offset-assert 192) - (userdata basic :offset-assert 196) - (message basic :offset-assert 200) - (border-value basic :offset-assert 204) - (mask-to-clear uint32 :offset-assert 208) - (script basic :offset-assert 212) - (script-line basic :offset-assert 216) - (script-func basic :offset-assert 220) + ((entity-override entity-actor :offset 52) + (grab-target handle :offset 120) + (grab-event symbol :offset-assert 128) + (release-event symbol :offset-assert 132) + (old-global-mask uint32 :offset-assert 136) + (old-self-mask uint32 :offset-assert 140) + (old-parent-mask uint32 :offset-assert 144) + (look-at-target handle :offset-assert 152) + (pov-target handle :offset-assert 160) + (work-process handle :offset-assert 168) + (anim-process handle :offset-assert 176) + (start-time int64 :offset-assert 184) + (callback basic :offset-assert 192) + (userdata basic :offset-assert 196) + (message basic :offset-assert 200) + (border-value basic :offset-assert 204) + (mask-to-clear uint32 :offset-assert 208) + (script pair :offset-assert 212) + (script-line pair :offset-assert 216) + (script-func (function none) :offset-assert 220) ) :heap-base #x70 :method-count-assert 15 :size-assert #xe0 :flag-assert #xf007000e0 (:methods - (dummy-14 () none 14) + (dummy-14 (_type_ pair) process 14) ) ) @@ -180,12 +181,13 @@ ;; definition of type touch-tracker (deftype touch-tracker (process-drawable) - ((duration uint64 :offset-assert 176) - (target uint64 :offset-assert 184) - (event basic :offset-assert 192) - (run-function basic :offset-assert 196) - (callback basic :offset-assert 200) - (event-mode basic :offset-assert 204) + ((root-override collide-shape-moving :offset 112) + (duration uint64 :offset-assert 176) + (target handle :offset-assert 184) + (event symbol :offset-assert 192) + (run-function (function none) :offset-assert 196) + (callback (function touch-tracker none) :offset-assert 200) + (event-mode basic :offset-assert 204) ) :heap-base #x60 :method-count-assert 20 diff --git a/test/decompiler/reference/engine/game/generic-obs_REF.gc b/test/decompiler/reference/engine/game/generic-obs_REF.gc new file mode 100644 index 0000000000..c733a12744 --- /dev/null +++ b/test/decompiler/reference/engine/game/generic-obs_REF.gc @@ -0,0 +1,3279 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function clone-anim-once +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defbehavior + clone-anim-once process-drawable + ((arg0 handle) (arg1 int) (arg2 symbol) (arg3 string)) + (set! (-> self skel status) (logand -33 (-> self skel status))) + (let ((s5-0 (handle->process arg0))) + (if (the-as process-drawable s5-0) + (joint-control-copy! + (-> self skel) + (-> (the-as process-drawable s5-0) skel) + ) + ) + (cond + ((and + (the-as process-drawable s5-0) + (joint-control-remap! + (-> self skel) + (-> self draw art-group) + (-> (the-as process-drawable s5-0) draw art-group) + '() + 0 + arg3 + ) + ) + (when arg2 + (let* ((s4-1 (-> self root)) + (a0-7 + (if + (and (nonzero? s4-1) (type-type? (-> s4-1 type) collide-shape)) + (the-as collide-shape s4-1) + ) + ) + ) + (if a0-7 + (TODO-RENAME-30 a0-7 (-> (the-as process-drawable s5-0) root trans)) + (set! + (-> self root trans quad) + (-> (the-as process-drawable s5-0) root trans quad) + ) + ) + ) + (quaternion-copy! + (-> self root quat) + (-> (the-as process-drawable s5-0) root quat) + ) + ) + (if (logtest? (-> (the-as process-drawable s5-0) skel status) 32) + (logior! (-> self skel status) 32) + ) + (set! (-> self draw status) (logand -7 (-> self draw status))) + (if (not (-> self skel root-channel 0 frame-group)) + (logior! (-> self draw status) 4) + ) + (let* ((s5-1 self) + (v1-37 (if (and (nonzero? s5-1) (type-type? (-> s5-1 type) manipy)) + s5-1 + ) + ) + ) + (if (and manipy (not (-> (the-as manipy v1-37) draw?))) + (logior! (-> self draw status) 4) + ) + ) + (dummy-17 self) + (let ((a0-22 (-> self skel effect))) + (if a0-22 + (TODO-RENAME-9 a0-22) + ) + ) + (if (logtest? (-> self skel status) 72) + (merc-blend-shape self) + ) + (if (logtest? (-> self skel status) 384) + (merc-eye-anim self) + ) + ) + (else + (logior! (-> self draw status) 2) + (ja-post) + ) + ) + ) + (if (>= arg1 0) + (vector<-cspace! (-> self draw origin) (-> self node-list data arg1)) + ) + 0 + (none) + ) + +;; definition for function clone-anim +;; INFO: Return type mismatch int vs none. +(defbehavior + clone-anim process-drawable + ((arg0 handle) (arg1 int) (arg2 symbol) (arg3 string)) + (ja-post) + (while (handle->process arg0) + (clone-anim-once arg0 arg1 #t arg3) + (suspend) + ) + (set! (-> self skel status) (logand -33 (-> self skel status))) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate swingpole-stance (swingpole) + :code + (behavior () + (while #t + (when + (and + *target* + (< + (vector-vector-distance + (-> self root trans) + (the-as vector (&-> (-> *target* control) unknown-cspace00 bone)) + ) + (-> self range) + ) + (logtest? (-> *target* control root-prim prim-core action) 64) + (< + (the-as float (-> *target* control unknown-cspace00 param0)) + (+ (-> self root trans y) (* 0.5 (-> self range))) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'pole-grab) + (set! (-> a1-1 param 0) (the-as uint self)) + (if (send-event-function *target* a1-1) + (go swingpole-active) + ) + ) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate swingpole-active (swingpole) + :code + (behavior () + (suspend) + (while + (and + *target* + (= (handle->process (-> *target* control unknown-handle10)) self) + ) + (suspend) + ) + (let ((gp-0 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-0) 150) + (suspend) + ) + ) + (go swingpole-stance) + (none) + ) + ) + +;; definition for method 11 of type swingpole +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defmethod copy-defaults! swingpole ((obj swingpole) (arg0 res-lump)) + "Copy defaults from the entity." + (stack-size-set! (-> obj main-thread) 128) + (logior! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj root) (new 'process 'trsq)) + (set! (-> obj root trans quad) (-> arg0 extra trans quad)) + (quaternion-copy! (-> obj root quat) (-> (the-as entity-actor arg0) quat)) + (vector-identity! (-> obj root scale)) + (vector-y-quaternion! (-> obj dir) (-> obj root quat)) + (set! (-> obj dir y) 0.0) + (vector-normalize! (-> obj dir) 1.0) + (set! (-> obj range) 12288.0) + (set! (-> obj edge-length) 8192.0) + (go swingpole-stance) + (none) + ) + +;; failed to figure out what this is: +(defstate die (process-hidden) + :virtual #t + :code + (the-as (function none :behavior process-hidden) nothing) + ) + +;; definition for method 11 of type process-hidden +;; INFO: Return type mismatch object vs none. +(defmethod copy-defaults! process-hidden ((obj process-hidden) (arg0 res-lump)) + "Copy defaults from the entity." + (process-entity-status! obj (entity-perm-status dead) #t) + (go (method-of-object obj die)) + (none) + ) + +;; definition of type target-start +(deftype target-start (process-hidden) + () + :method-count-assert 15 + :size-assert #x70 + :flag-assert #xf00000070 + ) + +;; definition for method 3 of type target-start +(defmethod inspect target-start ((obj target-start)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tmask: ~D~%" (-> obj mask)) + (format #t "~Tparent: #x~X~%" (-> obj parent)) + (format #t "~Tbrother: #x~X~%" (-> obj brother)) + (format #t "~Tchild: #x~X~%" (-> obj child)) + (format #t "~Tppointer: #x~X~%" (-> obj ppointer)) + (format #t "~Tself: ~A~%" (-> obj self)) + (format #t "~Tpool: ~A~%" (-> obj pool)) + (format #t "~Tstatus: ~A~%" (-> obj status)) + (format #t "~Tpid: ~D~%" (-> obj pid)) + (format #t "~Tmain-thread: ~A~%" (-> obj main-thread)) + (format #t "~Ttop-thread: ~A~%" (-> obj top-thread)) + (format #t "~Tentity: ~A~%" (-> obj entity)) + (format #t "~Tstate: ~A~%" (-> obj state)) + (format #t "~Ttrans-hook: ~A~%" (-> obj trans-hook)) + (format #t "~Tpost-hook: ~A~%" (-> obj post-hook)) + (format #t "~Tevent-hook: ~A~%" (-> obj event-hook)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tnext-state: ~A~%" (-> obj next-state)) + (format #t "~Theap-base: #x~X~%" (-> obj heap-base)) + (format #t "~Theap-top: #x~X~%" (-> obj heap-top)) + (format #t "~Theap-cur: #x~X~%" (-> obj heap-cur)) + (format #t "~Tstack-frame-top: ~A~%" (-> obj stack-frame-top)) + (format #t "~Theap: #~%" (&-> obj heap-base)) + (format #t "~Tconnection-list: ~`'connectable`P~%" (-> obj connection-list)) + (format #t "~Tstack[0] @ #x~X~%" (-> obj stack)) + obj + ) + +;; definition of type camera-start +(deftype camera-start (process-hidden) + () + :method-count-assert 15 + :size-assert #x70 + :flag-assert #xf00000070 + ) + +;; definition for method 3 of type camera-start +(defmethod inspect camera-start ((obj camera-start)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tname: ~A~%" (-> obj name)) + (format #t "~Tmask: ~D~%" (-> obj mask)) + (format #t "~Tparent: #x~X~%" (-> obj parent)) + (format #t "~Tbrother: #x~X~%" (-> obj brother)) + (format #t "~Tchild: #x~X~%" (-> obj child)) + (format #t "~Tppointer: #x~X~%" (-> obj ppointer)) + (format #t "~Tself: ~A~%" (-> obj self)) + (format #t "~Tpool: ~A~%" (-> obj pool)) + (format #t "~Tstatus: ~A~%" (-> obj status)) + (format #t "~Tpid: ~D~%" (-> obj pid)) + (format #t "~Tmain-thread: ~A~%" (-> obj main-thread)) + (format #t "~Ttop-thread: ~A~%" (-> obj top-thread)) + (format #t "~Tentity: ~A~%" (-> obj entity)) + (format #t "~Tstate: ~A~%" (-> obj state)) + (format #t "~Ttrans-hook: ~A~%" (-> obj trans-hook)) + (format #t "~Tpost-hook: ~A~%" (-> obj post-hook)) + (format #t "~Tevent-hook: ~A~%" (-> obj event-hook)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tnext-state: ~A~%" (-> obj next-state)) + (format #t "~Theap-base: #x~X~%" (-> obj heap-base)) + (format #t "~Theap-top: #x~X~%" (-> obj heap-top)) + (format #t "~Theap-cur: #x~X~%" (-> obj heap-cur)) + (format #t "~Tstack-frame-top: ~A~%" (-> obj stack-frame-top)) + (format #t "~Theap: #~%" (&-> obj heap-base)) + (format #t "~Tconnection-list: ~`'connectable`P~%" (-> obj connection-list)) + (format #t "~Tstack[0] @ #x~X~%" (-> obj stack)) + obj + ) + +;; failed to figure out what this is: +(defstate manipy-idle (manipy) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 none)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'attackable) + (cond + ((-> arg3 param 0) + (set! + v0-0 + (the-as + none + (logior (process-mask attackable) (-> self mask)) + ) + ) + (set! (-> self mask) (the-as process-mask v0-0)) + ) + (else + (set! + v0-0 + (the-as + none + (logclear (-> self mask) (process-mask attackable)) + ) + ) + (set! (-> self mask) (the-as process-mask v0-0)) + ) + ) + v0-0 + ) + ((= v1-0 'blend-shape) + (cond + ((-> arg3 param 0) + (set! + v0-0 + (the-as none (logior (-> self skel status) 264)) + ) + (set! (-> self skel status) (the-as uint v0-0)) + ) + (else + (set! + v0-0 + (the-as none (logand -265 (-> self skel status))) + ) + (set! (-> self skel status) (the-as uint v0-0)) + ) + ) + v0-0 + ) + ((= v1-0 'shadow) + (cond + ((-> arg3 param 0) + (set! v0-0 (the-as none (-> self shadow-backup))) + (set! (-> self draw shadow) (the-as shadow-geo v0-0)) + v0-0 + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ((= v1-0 'trans-hook) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! + (-> self new-trans-hook) + (the-as (function none) v0-0) + ) + v0-0 + ) + ((= v1-0 'post-hook) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! + (-> self new-post-hook) + (the-as (function none) v0-0) + ) + v0-0 + ) + ((= v1-0 'eval) + ((the-as (function manipy none) (-> arg3 param 0)) self) + ) + ((= v1-0 'become-hud-object) + (convert-to-hud-object self (the-as hud (-> arg3 param 0))) + ) + ((= v1-0 'event-hook) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! + (-> self cur-event-hook) + (the-as (function none) v0-0) + ) + v0-0 + ) + ((= v1-0 'art-joint-anim) + (set! + (-> self new-joint-anim) + (the-as + art-joint-anim + (dummy-10 + (-> self draw art-group) + (the-as string (-> arg3 param 0)) + art-joint-anim + ) + ) + ) + (set! v0-0 (the-as none (-> arg3 param 1))) + (set! (-> self new-joint-anim-blend) (the-as uint v0-0)) + v0-0 + ) + ((= v1-0 'anim-mode) + (when (nonzero? (-> self skel)) + (set! + (-> self anim-mode) + (the-as symbol (-> arg3 param 0)) + ) + (if (= (-> self anim-mode) 'clone-anim) + (ja-post) + ) + (-> self anim-mode) + ) + ) + ((or (= v1-0 'origin-joint-index) (= v1-0 'center-joint)) + (set! (-> self draw origin-joint-index) (-> arg3 param 0)) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! (-> self draw shadow-joint-index) (the-as uint v0-0)) + v0-0 + ) + ((= v1-0 'max-vis-dist) + (let ((f0-0 (the-as float (-> arg3 param 0)))) + (set! + (-> + self + draw + lod-set + lod + (-> self draw lod-set max-lod) + dist + ) + f0-0 + ) + f0-0 + ) + ) + ((= v1-0 'grab) + (set! + (-> self cur-grab-handle) + (process->handle (the-as process (-> arg3 param 0))) + ) + (let ((v1-30 (handle->process (-> self cur-grab-handle)))) + (when v1-30 + (set! v0-0 (the-as none (-> self old-grab-pos))) + (set! + (-> (the-as vector v0-0) quad) + (-> (the-as process-drawable v1-30) root trans quad) + ) + v0-0 + ) + ) + ) + ((= v1-0 'target) + (set! + v0-0 + (the-as + none + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (set! (-> self cur-target-handle) (the-as handle v0-0)) + v0-0 + ) + ((= v1-0 'trans) + (cond + ((type-type? (-> self root type) collide-shape) + (TODO-RENAME-30 + (the-as collide-shape (-> self root)) + (the-as vector (-> arg3 param 0)) + ) + ) + (else + (set! v0-0 (the-as none (-> self root trans))) + (set! + (-> (the-as vector v0-0) quad) + (-> (the-as vector (-> arg3 param 0)) quad) + ) + v0-0 + ) + ) + ) + ((= v1-0 'rot) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (matrix-rotate-y! s5-0 (the-as float (-> arg3 param 0))) + (matrix->quaternion (-> self root quat) s5-0) + ) + ) + ((= v1-0 'rot-quat) + (quaternion-copy! + (-> self root quat) + (the-as quaternion (-> arg3 param 0)) + ) + ) + ((= v1-0 'clone-copy-trans) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! (-> self clone-copy-trans) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'release) + (set! (-> self cur-grab-handle) (the-as handle #f)) + #f + ) + ((= v1-0 'draw) + (set! (-> self draw?) (the-as symbol (-> arg3 param 0))) + (cond + ((-> arg3 param 0) + (let ((v1-47 (logtest? (-> self draw status) 2))) + (set! + (-> self draw status) + (logand -3 (-> self draw status)) + ) + (when v1-47 + (cond + ((nonzero? (-> self skel)) + (let ((gp-1 (-> self skel status))) + (logior! (-> self skel status) 1) + (set! v0-0 (ja-post)) + (set! (-> self skel status) gp-1) + ) + v0-0 + ) + (else + (ja-post) + ) + ) + ) + ) + ) + (else + (set! + v0-0 + (the-as none (logior (-> self draw status) 2)) + ) + (set! (-> self draw status) (the-as uint v0-0)) + v0-0 + ) + ) + ) + ((= v1-0 'query) + (case (-> arg3 param 0) + (('grab) + (handle->process (-> self cur-grab-handle)) + ) + (('done) + (case (-> self anim-mode) + (('play1 'play) + (>= + (ja-frame-num 0) + (the + float + (+ (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + data + 0 + length + ) + -2 + ) + ) + ) + ) + ) + ) + ) + ) + ((= v1-0 'set-frame-num) + (let ((v1-73 (-> self skel root-channel 0))) + (set! (-> v1-73 num-func) num-func-identity) + (let ((f0-2 (the-as float (-> arg3 param 0)))) + (set! (-> v1-73 frame-num) f0-2) + f0-2 + ) + ) + ) + (else + (if (-> self cur-event-hook) + ((-> self cur-event-hook)) + ) + ) + ) + ) + ) + ) + :trans + (behavior () + (if (!= (-> self cur-trans-hook) (-> self new-trans-hook)) + (set! (-> self cur-trans-hook) (-> self new-trans-hook)) + ) + (if (!= (-> self cur-post-hook) (-> self new-post-hook)) + (set! (-> self cur-post-hook) (-> self new-post-hook)) + ) + (when + (and + (-> self new-joint-anim) + (nonzero? (-> self skel)) + (and (!= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self new-joint-anim) + ) + (!= (-> self anim-mode) 'clone-anim) + ) + ) + (ja-channel-push! 1 (the-as int (-> self new-joint-anim-blend))) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (-> self new-joint-anim) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + ) + (let ((v1-20 (handle->process (-> self cur-grab-handle)))) + (when v1-20 + (let ((gp-1 (-> (the-as process-drawable v1-20) root trans))) + (cond + ((type-type? (-> self root type) collide-shape) + (let* ((a0-13 (-> self root)) + (t9-3 + (method-of-object (the-as collide-shape a0-13) TODO-RENAME-28) + ) + ) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self old-grab-pos)) + (t9-3 (the-as collide-shape a0-13)) + ) + ) + (else + (vector+! + (-> self root trans) + (-> self root trans) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self old-grab-pos)) + ) + ) + ) + (set! (-> self old-grab-pos quad) (-> gp-1 quad)) + ) + ) + ) + ((-> self cur-trans-hook)) + (none) + ) + ) + +;; definition for function manipy-init +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior + manipy-init manipy + ((arg0 vector) (arg1 entity) (arg2 skeleton-group) (arg3 vector)) + (stack-size-set! (-> self main-thread) 128) + (logior! (-> self mask) (process-mask heap-shrunk)) + (set! (-> self entity) arg1) + (cond + ((= arg3 'collide-shape-moving) + (let + ((s4-1 + (new + 'process + 'collide-shape-moving + self + (collide-list-enum hit-by-player) + ) + ) + ) + (set! (-> s4-1 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-1 reaction) default-collision-reaction) + (set! (-> s4-1 no-reaction) nothing) + (set-vector! + (-> + (new 'process 'collide-shape-prim-sphere s4-1 (the-as uint 0)) + local-sphere + ) + 0.0 + 0.0 + 0.0 + 4096.0 + ) + (dummy-46 s4-1) + (set! (-> s4-1 nav-radius) (* 0.75 (-> s4-1 root-prim local-sphere w))) + (dummy-50 s4-1) + (set! (-> self root) s4-1) + ) + ) + (arg3 + (let + ((s4-2 + (new 'process 'collide-shape self (collide-list-enum hit-by-player)) + ) + ) + (let + ((s2-0 (new 'process 'collide-shape-prim-sphere s4-2 (the-as uint 0)))) + (set! (-> s2-0 prim-core collide-as) (the-as uint #x8040)) + (set! (-> s2-0 collide-with) (the-as uint 16)) + (set-vector! + (-> s2-0 local-sphere) + (-> arg3 x) + (-> arg3 y) + (-> arg3 z) + (-> arg3 w) + ) + ) + (dummy-46 s4-2) + (set! (-> s4-2 nav-radius) (* 0.75 (-> s4-2 root-prim local-sphere w))) + (dummy-50 s4-2) + (set! (-> self root) s4-2) + ) + ) + (else + (set! (-> self root) (new 'process 'trsqv)) + ) + ) + (set! (-> self root trans quad) (-> arg0 quad)) + (initialize-skeleton self arg2 '()) + (if (type-type? (-> self root type) collide-shape) + (dummy-47 (the-as collide-shape (-> self root))) + ) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self new-trans-hook) nothing) + (set! (-> self cur-trans-hook) nothing) + (set! (-> self new-post-hook) nothing) + (set! (-> self cur-post-hook) nothing) + (set! (-> self cur-event-hook) #f) + (set! (-> self cur-grab-handle) (the-as handle #f)) + (set! (-> self cur-target-handle) (the-as handle #f)) + (set! (-> self clone-copy-trans) #t) + (set! (-> self draw?) #t) + (cond + ((nonzero? (-> self skel)) + (set! (-> self new-joint-anim) (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + (set! (-> self anim-mode) 'loop) + ) + (else + (set! (-> self anim-mode) 'still) + ) + ) + (set! (-> self event-hook) (-> manipy-idle event)) + (go manipy-idle) + (none) + ) + +;; definition for method 10 of type part-tracker +(defmethod deactivate part-tracker ((obj part-tracker)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +;; definition for function part-tracker-notify +(defbehavior part-tracker-notify part-tracker () + (let ((gp-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> gp-0 from) self) + (set! (-> gp-0 num-params) 1) + (set! (-> gp-0 message) 'notify) + (set! (-> gp-0 param 0) (the-as uint 'die)) + (let ((s5-0 send-event-function) + (s4-0 (ppointer->process (-> self parent))) + ) + (s5-0 (if (and (nonzero? s4-0) (type-type? (-> s4-0 type) process)) + s4-0 + ) + gp-0 + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate part-tracker-process (part-tracker) + :code + (behavior () + (set! (-> self start-time) (-> *display* base-frame-counter)) + (while + (< + (- (-> *display* base-frame-counter) (-> self start-time)) + (-> self duration) + ) + (let ((gp-0 (handle->process (-> self target)))) + (when gp-0 + (if + (and + gp-0 + (type-type? (-> gp-0 type) process-drawable) + (nonzero? (-> (the-as process-drawable gp-0) root)) + ) + (vector+! + (-> self root trans) + (-> (the-as process-drawable gp-0) root trans) + (-> self offset) + ) + ) + ) + ) + (let ((gp-1 (-> self root trans))) + (if (-> self callback) + ((-> self callback) self) + ) + (spawn (-> self part) gp-1) + ) + (suspend) + ) + (let ((gp-2 (-> *display* base-frame-counter))) + (until + (>= (- (-> *display* base-frame-counter) gp-2) (-> self linger-duration)) + (if (-> self linger-callback) + ((-> self linger-callback) self) + ) + (suspend) + ) + ) + (if (-> self linger-callback) + ((-> self linger-callback) self) + ) + (part-tracker-notify) + (suspend) + 0 + (none) + ) + ) + +;; definition for function part-tracker-init +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior + part-tracker-init part-tracker + ((arg0 sparticle-launch-group) + (arg1 int) + (arg2 (function part-tracker none)) + (arg3 (pointer process-drawable)) + (arg4 process) + (arg5 collide-prim-core) + ) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg5 world-sphere quad)) + (set! (-> self offset quad) (-> arg5 world-sphere quad)) + (set! (-> self callback) arg2) + (set! (-> self linger-callback) #f) + (set! (-> self userdata) (the-as uint arg3)) + (set! (-> self target) (process->handle arg4)) + (set! arg1 (cond + ((> arg1 0) + (empty) + arg1 + ) + (else + (the-as int (-> arg0 duration)) + ) + ) + ) + (set! (-> self duration) arg1) + (set! (-> self linger-duration) (the-as int (-> arg0 linger-duration))) + (set! (-> self part) (create-launch-control arg0 self)) + (go part-tracker-process) + (none) + ) + +;; definition for function command-get-process +;; INFO: Return type mismatch object vs process. +;; WARN: disable def twice: 68. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 82. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 96. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 110. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defbehavior + command-get-process camera-tracker + ((arg0 object) (arg1 process-drawable)) + (the-as process (cond + ((null? arg0) + (empty) + arg1 + ) + ((type-type? (rtype-of arg0) process) + (the-as process-drawable arg0) + ) + ((= arg0 'target) + *target* + ) + ((= arg0 'sidekick) + (when *target* + (let ((v1-6 (-> *target* sidekick))) + (if v1-6 + (the-as process-drawable (-> v1-6 0 self)) + ) + ) + ) + ) + ((= arg0 'parent) + (let ((v1-9 (-> self parent))) + (if v1-9 + (the-as process-drawable (-> v1-9 0 self)) + ) + ) + ) + ((= arg0 'camera) + (the-as process-drawable *camera*) + ) + ((type-type? (rtype-of arg0) string) + (the-as + process-drawable + (process-by-ename (the-as string arg0)) + ) + ) + ((type-type? (-> self type) camera-tracker) + (let ((v1-13 self)) + (cond + ((= arg0 'work) + (let ((v1-14 (-> v1-13 work-process))) + (and + (nonzero? (l32-false-check v1-14)) + (let ((a0-8 (-> v1-14 process 0))) + (if (= (-> v1-14 pid) (-> a0-8 pid)) + (the-as process-drawable a0-8) + ) + ) + ) + ) + ) + ((= arg0 'grab) + (let ((v1-17 (-> v1-13 grab-target))) + (and + (nonzero? (l32-false-check v1-17)) + (let ((a0-12 (-> v1-17 process 0))) + (if (= (-> v1-17 pid) (-> a0-12 pid)) + (the-as process-drawable a0-12) + ) + ) + ) + ) + ) + ((= arg0 'look-at) + (let ((v1-20 (-> v1-13 look-at-target))) + (and + (nonzero? (l32-false-check v1-20)) + (let ((a0-16 (-> v1-20 process 0))) + (if (= (-> v1-20 pid) (-> a0-16 pid)) + (the-as process-drawable a0-16) + ) + ) + ) + ) + ) + ((= arg0 'pov) + (let ((v1-23 (-> v1-13 pov-target))) + (and + (nonzero? (l32-false-check v1-23)) + (let ((a0-20 (-> v1-23 process 0))) + (if (= (-> v1-23 pid) (-> a0-20 pid)) + (the-as process-drawable a0-20) + ) + ) + ) + ) + ) + ((= arg0 'anim) + (let ((v1-26 (-> v1-13 anim-process))) + (and + (nonzero? (l32-false-check v1-26)) + (let ((a0-24 (-> v1-26 process 0))) + (if (= (-> v1-26 pid) (-> a0-24 pid)) + (the-as process-drawable a0-24) + ) + ) + ) + ) + ) + (else + (empty) + arg1 + ) + ) + ) + ) + (else + (empty) + arg1 + ) + ) + ) + ) + +;; definition for function command-get-camera +(defun command-get-camera ((arg0 object) (arg1 state)) + (cond + ((null? arg0) + (empty) + arg1 + ) + ((= arg0 'base) + *camera-base-mode* + ) + ((= arg0 'string) + cam-string + ) + ((= arg0 'fixed) + cam-fixed + ) + ((type-type? (rtype-of arg0) symbol) + (the-as state (-> (the-as symbol arg0) value)) + ) + ((type-type? (rtype-of arg0) string) + (the-as state arg0) + ) + ((type-type? (rtype-of arg0) state) + (the-as state arg0) + ) + (else + (empty) + arg1 + ) + ) + ) + +;; definition for function command-get-trans +(defun command-get-trans ((arg0 object) (arg1 vector)) + (cond + ((null? arg0) + (empty) + arg1 + ) + ((= arg0 'null) + *null-vector* + ) + ((= arg0 'target) + (target-pos 0) + ) + ((pair? arg0) + (let ((s4-0 (command-get-process (car arg0) *target*)) + (v1-4 (command-get-int (car (cdr arg0)) 0)) + ) + (cond + (s4-0 + (-> (the-as target s4-0) node-list data v1-4 bone transform vector 3) + ) + (else + (empty) + arg1 + ) + ) + ) + ) + (else + (empty) + arg1 + ) + ) + ) + +;; definition for function process-grab? +;; INFO: Return type mismatch object vs symbol. +(defbehavior process-grab? process ((arg0 process)) + (let ((gp-0 (command-get-process arg0 *target*))) + (the-as symbol (when gp-0 + (if (type-type? (-> self type) camera-tracker) + (set! + (-> (the-as camera-tracker self) grab-target) + (process->handle gp-0) + ) + ) + (send-event gp-0 'change-mode 'grab) + ) + ) + ) + ) + +;; definition for function process-release? +;; INFO: Return type mismatch object vs symbol. +(defbehavior process-release? process ((arg0 process)) + (let ((gp-0 (command-get-process arg0 *target*))) + (the-as + symbol + (if (and gp-0 (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'mode)) + (send-event-function gp-0 a1-1) + ) + 'target-grab + ) + (send-event gp-0 'end-mode) + #t + ) + ) + ) + ) + +;; definition for function camera-change-to +(defun camera-change-to ((arg0 string) (arg1 int) (arg2 symbol)) + (let ((gp-0 (command-get-camera arg0 *camera-base-mode*))) + (cond + ((not gp-0) + #f + ) + ((type-type? (rtype-of gp-0) string) + (send-event *camera* 'change-to-entity-by-name gp-0) + #t + ) + ((type-type? (rtype-of gp-0) state) + (send-event *camera* 'change-state gp-0 arg1) + (if arg2 + (send-event *camera* 'blend-from-as-fixed) + ) + #t + ) + ) + ) + ) + +;; definition for function camera-look-at +(defbehavior camera-look-at camera-tracker ((arg0 pair) (arg1 uint)) + (let ((gp-0 (command-get-process arg0 *target*))) + (when gp-0 + (if (type-type? (-> self type) camera-tracker) + (set! (-> self look-at-target) (process->handle gp-0)) + ) + (send-event *camera* 'change-target gp-0 arg1) + ) + gp-0 + ) + ) + +;; definition for function ja-anim-done? +;; INFO: Return type mismatch object vs symbol. +(defun ja-anim-done? ((arg0 pair)) + (with-pp + (let ((gp-0 (command-get-process arg0 *target*))) + (the-as symbol (when gp-0 + (cond + ((type-type? (-> gp-0 type) manipy) + (send-event gp-0 'query 'done) + ) + ((type-type? (-> gp-0 type) process-drawable) + (when + (zero? + (logand + (-> (the-as process-drawable gp-0) skel status) + 4 + ) + ) + (let ((s5-0 pp)) + (let ((s6-1 gp-0)) + ) + (let ((v0-1 (the-as object (ja-done? 0)))) + (let ((s6-2 s5-0)) + ) + v0-1 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function camera-pov-from +(defbehavior camera-pov-from camera-tracker ((arg0 pair) (arg1 uint)) + (let ((gp-0 (command-get-process arg0 *target*))) + (when gp-0 + (if (type-type? (-> self type) camera-tracker) + (set! (-> self pov-target) (process->handle gp-0)) + ) + (when (= arg1 -10) + (set! arg1 (the-as uint 0)) + (when (> (-> (the-as process-drawable gp-0) skel active-channels) 0) + (let + ((v1-11 + (dummy-10 + (-> (the-as process-drawable gp-0) draw jgeo) + "camera" + (the-as type #f) + ) + ) + ) + (if v1-11 + (set! arg1 (the-as uint (+ (-> v1-11 number) 1))) + ) + ) + ) + ) + (send-event *camera* 'change-pov gp-0 arg1) + ) + gp-0 + ) + ) + +;; definition for function camera-anim +(defbehavior + camera-anim camera-tracker + ((arg0 symbol) (arg1 basic) (arg2 entity)) + (set! (-> self anim-process) (the-as handle #f)) + (let* ((s2-0 (get-process *default-dead-pool* manipy #x4000)) + (gp-0 (when s2-0 + (let ((t9-1 (method-of-type manipy activate))) + (t9-1 + (the-as manipy s2-0) + self + 'manipy + (the-as pointer #x70004000) + ) + ) + ((the-as + (function process function object object object object object) + run-function-in-process + ) + s2-0 + manipy-init + arg2 + #f + arg0 + #f + ) + (-> s2-0 ppointer) + ) + ) + ) + (when gp-0 + (send-event (-> gp-0 0 self) 'anim-mode 'play1) + (send-event (-> gp-0 0 self) 'art-joint-anim arg1) + (set! (-> self anim-process) (ppointer->handle gp-0)) + ) + gp-0 + ) + ) + +;; definition for method 14 of type camera-tracker +;; INFO: Return type mismatch object vs process. +(defmethod dummy-14 camera-tracker ((obj camera-tracker) (arg0 pair)) + (with-pp + (let ((gp-0 (the-as object #f))) + (cond + ((null? arg0) + ) + ((pair? arg0) + (let ((a2-0 (car arg0)) + (s4-0 (cdr arg0)) + ) + (case a2-0 + (('print) + (set! gp-0 (car s4-0)) + (if (pair? gp-0) + (set! gp-0 (dummy-14 obj (the-as pair gp-0))) + ) + (format + #t + "~A MESSAGE (~D): ~A~%" + obj + (-> *display* base-frame-counter) + gp-0 + ) + ) + (('while) + (let ((s3-0 (car s4-0))) + (while (dummy-14 obj (the-as pair s3-0)) + (let* ((s2-0 (cdr s4-0)) + (a1-3 (car s2-0)) + ) + (while (not (null? s2-0)) + (set! gp-0 (dummy-14 obj (the-as pair a1-3))) + (set! s2-0 (cdr s2-0)) + (set! a1-3 (car s2-0)) + ) + ) + ) + ) + ) + (('until) + (let ((s3-1 (car s4-0))) + (while (not (dummy-14 obj (the-as pair s3-1))) + (let* ((s2-1 (cdr s4-0)) + (a1-5 (car s2-1)) + ) + (while (not (null? s2-1)) + (set! gp-0 (dummy-14 obj (the-as pair a1-5))) + (set! s2-1 (cdr s2-1)) + (set! a1-5 (car s2-1)) + ) + ) + ) + ) + ) + (('not) + (set! gp-0 (not (dummy-14 obj (the-as pair (car s4-0))))) + ) + (('wait-for 'wait 'suspend) + (let ((s5-1 (command-get-time (car s4-0) 1)) + (s4-1 (-> *display* base-frame-counter)) + ) + (until (>= (- (-> *display* base-frame-counter) s4-1) s5-1) + (suspend) + ) + ) + ) + (('message?) + (when (= (-> obj message) (car s4-0)) + (set! gp-0 (-> obj message)) + (set! (-> obj message) #f) + ) + ) + (('send-event) + (let ((s5-2 (command-get-process (car s4-0) *target*)) + (s3-2 (car (cdr s4-0))) + (s4-2 (cdr (cdr s4-0))) + ) + (when (and s5-2 (not (null? s3-2))) + (let ((gp-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> gp-1 from) pp) + (let ((a0-22 s4-2)) + (set! + (-> gp-1 num-params) + ((method-of-type (rtype-of a0-22) length) a0-22) + ) + ) + (set! (-> gp-1 message) (the-as symbol s3-2)) + (set! + (-> gp-1 param 0) + (the-as uint (command-get-param (car s4-2) #f)) + ) + (set! + (-> gp-1 param 1) + (the-as uint (command-get-param (car (cdr s4-2)) #f)) + ) + (set! + (-> gp-1 param 2) + (the-as uint (command-get-param (car (cdr (cdr s4-2))) #f)) + ) + (set! gp-0 (send-event-function s5-2 gp-1)) + ) + ) + ) + ) + (('eval) + (let ((s4-3 (car s4-0))) + (if (and s4-3 (type-type? (-> (the-as basic s4-3) type) function)) + (set! gp-0 ((the-as (function camera-tracker symbol) s4-3) obj)) + ) + ) + ) + (('work-set!) + (set! gp-0 (process->handle (dummy-14 obj (the-as pair (car s4-0))))) + (set! (-> obj work-process) (the-as handle gp-0)) + ) + (('grab) + (let ((a0-38 (command-get-process (car s4-0) *target*))) + (set! gp-0 (process-grab? a0-38)) + ) + ) + (('release) + (set! gp-0 (process-release? (handle->process (-> obj grab-target)))) + ) + (('alive?) + (set! gp-0 (command-get-process (car s4-0) *target*)) + ) + (('draw) + (set! gp-0 (command-get-process (car s4-0) *target*)) + (when (the-as target gp-0) + (if (car (cdr s4-0)) + (set! + (-> (the-as target gp-0) skel status) + (logand -3 (-> (the-as target gp-0) skel status)) + ) + (logior! (-> (the-as target gp-0) skel status) 2) + ) + ) + ) + (('camera-change-to 'camera) + (set! + gp-0 + (camera-change-to + (the-as string (car s4-0)) + (command-get-time (car (cdr s4-0)) 0) + #f + ) + ) + ) + (('intro-done?) + (let ((a1-25 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-25 from) pp) + (set! (-> a1-25 num-params) 0) + (set! (-> a1-25 message) 'intro-done?) + (set! gp-0 (send-event-function *camera* a1-25)) + ) + ) + (('camera-look-at 'look-at) + (set! + gp-0 + (camera-look-at + (the-as pair (car s4-0)) + (the-as uint (command-get-int (car (cdr s4-0)) 0)) + ) + ) + ) + (('pov) + (set! + gp-0 + (camera-pov-from + (the-as pair (car s4-0)) + (the-as uint (command-get-int (car (cdr s4-0)) 0)) + ) + ) + ) + (('camera-anim) + (let ((s2-2 (car s4-0)) + (s3-3 (car (cdr s4-0))) + (s4-4 (command-get-trans (car (cdr (cdr s4-0))) *null-vector*)) + (s1-0 string->symbol) + ) + (format (clear *temp-string*) "*~S-sg*" s2-2) + (let ((s2-3 (-> (s1-0 *temp-string*) value))) + (when (type-type? (rtype-of s2-3) skeleton-group) + (set! (-> obj anim-process) (the-as handle #f)) + (let ((s1-1 (get-process *default-dead-pool* manipy #x4000))) + (set! gp-0 (when s1-1 + (let ((t9-35 (method-of-type manipy activate))) + (t9-35 + (the-as manipy s1-1) + obj + 'manipy + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s1-1 manipy-init s4-4 #f s2-3 #f) + (-> s1-1 ppointer) + ) + ) + ) + (send-event + (-> (the-as (pointer process) gp-0) 0 self) + 'anim-mode + 'play1 + ) + (send-event + (-> (the-as (pointer process) gp-0) 0 self) + 'art-joint-anim + s3-3 + ) + (set! + (-> obj anim-process) + (ppointer->handle (the-as (pointer process) gp-0)) + ) + ) + ) + ) + ) + (else + (format + 0 + "ERROR: camera-tracker does not know script line command ~A.~%" + a2-0 + ) + ) + ) + ) + ) + (else + (format + 0 + "ERROR: camera-tracker requires a pair as a script line, not ~A.~%" + arg0 + ) + ) + ) + (the-as process gp-0) + ) + ) + ) + +;; failed to figure out what this is: +(defstate camera-tracker-process (camera-tracker) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 uint)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'message) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self message) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'mask) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self mask-to-clear) v0-0) + v0-0 + ) + ((= v1-0 'border) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self border-value) (the-as basic v0-0)) + v0-0 + ) + ) + ) + ) + ) + :enter + (behavior () + (if (-> self entity-override) + (dummy-30 (-> self entity-override) (entity-perm-status bit-3) #t) + ) + (if (not (-> self border-value)) + (push-setting! + *setting-control* + self + 'border-mode + (-> self border-value) + 0.0 + 0 + ) + ) + (push-setting! + *setting-control* + self + 'process-mask + 'set + 0.0 + (-> self mask-to-clear) + ) + (push-setting! *setting-control* self 'movie (process->ppointer self) 0.0 0) + (hide-hud-quick) + (none) + ) + :exit + (behavior () + (if (-> self entity-override) + (dummy-30 (-> self entity-override) (entity-perm-status bit-3) #f) + ) + (send-event *camera* 'clear-entity) + (none) + ) + :code + (behavior () + (cond + ((-> self script-func) + ((-> self script-func)) + ) + (else + (while (not (null? (-> self script-line))) + (dummy-14 self (the-as pair (-> self script-line car))) + (set! (-> self script-line) (the-as pair (-> self script-line cdr))) + ) + ) + ) + (clear-pending-settings-from-process *setting-control* self 'process-mask) + (send-event *camera* 'clear-entity) + (suspend) + (suspend) + (suspend) + 0 + (none) + ) + ) + +;; definition for function camera-tracker-init +(defbehavior camera-tracker-init camera-tracker ((arg0 object)) + (stack-size-set! (-> self main-thread) 512) + (logclear! + (-> self mask) + (process-mask actor-pause movie enemy platform projectile) + ) + (set! (-> self mask-to-clear) (the-as uint #x4a0800)) + (set! (-> self grab-target) (the-as handle #f)) + (set! (-> self grab-event) 'grab) + (set! (-> self release-event) 'end-mode) + (set! (-> self look-at-target) (the-as handle #f)) + (set! (-> self pov-target) (the-as handle #f)) + (set! (-> self callback) #f) + (set! (-> self userdata) #f) + (set! (-> self start-time) (-> *display* base-frame-counter)) + (set! (-> self script) '()) + (set! (-> self script-line) '()) + (set! (-> self script-func) #f) + (set! (-> self message) #f) + (set! (-> self border-value) #f) + (cond + ((pair? arg0) + (set! (-> self script) (the-as pair arg0)) + (set! (-> self script-line) (the-as pair arg0)) + ) + ((type-type? (rtype-of arg0) function) + (set! (-> self script-func) (the-as (function none) arg0)) + ) + (else + (format + 0 + "ERROR: camera-tracker requires a pair as a script, not ~A.~%" + arg0 + ) + ) + ) + (let* ((gp-1 (ppointer->process (-> self parent))) + (v1-17 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) process)) + gp-1 + ) + ) + ) + (if v1-17 + (set! + (-> self entity-override) + (the-as entity-actor (-> (the-as process v1-17) entity)) + ) + ) + ) + (set! (-> self event-hook) (-> camera-tracker-process event)) + (go camera-tracker-process) + ) + +;; definition of type med-res-level +(deftype med-res-level (process-drawable) + ((level symbol :offset-assert 176) + (part-mode basic :offset-assert 180) + (index int32 :offset-assert 184) + ) + :heap-base #x50 + :method-count-assert 20 + :size-assert #xbc + :flag-assert #x14005000bc + ) + +;; definition for method 3 of type med-res-level +(defmethod inspect med-res-level ((obj med-res-level)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tlevel: ~A~%" (-> obj level)) + (format #t "~T~Tpart-mode: ~A~%" (-> obj part-mode)) + (format #t "~T~Tindex: ~D~%" (-> obj index)) + obj + ) + +;; failed to figure out what this is: +(defstate med-res-level-idle (med-res-level) + :code + (behavior () + (local-vars (v1-37 float)) + (rlet ((vf0 :class vf) + (vf16 :class vf) + (vf17 :class vf) + ) + (init-vf0-vector) + (while #t + (let ((a0-1 (level-get *level* (-> self level))) + (v1-3 (-> *game-info* current-continue level)) + ) + (cond + ((and + a0-1 + (or + (= (-> a0-1 display?) 'special) + (= (-> a0-1 display?) 'special-vis) + ) + ) + (set! (-> self draw status) (logand -3 (-> self draw status))) + (when (nonzero? (-> self skel)) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) 1.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + ((or (and a0-1 (= (-> a0-1 status) 'active)) (= v1-3 'firecanyon)) + (logior! (-> self draw status) 2) + ) + ((and (= (-> self level) 'firecanyon) (< (-> (camera-pos) y) 327680.0)) + (logior! (-> self draw status) 2) + ) + (else + (set! (-> self draw status) (logand -3 (-> self draw status))) + (if (nonzero? (-> self part)) + (spawn (-> self part) (-> self root trans)) + ) + (when (nonzero? (-> self skel)) + (let ((a0-17 (-> self skel root-channel 0))) + (set! (-> a0-17 param 0) 1.0) + (joint-control-channel-group-eval! + a0-17 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + ) + ) + (when (zero? (logand (-> self draw status) 2)) + (let ((v1-36 (-> self draw)) + (a0-18 (new 'stack-no-clear 'vector)) + ) + (.lvf vf16 (&-> v1-36 origin quad)) + (.lvf vf17 (&-> v1-36 bounds quad)) + (.mul.x.vf vf16 vf16 vf0 :mask #b1000) + (.add.vf vf16 vf16 vf17) + (.svf (&-> a0-18 quad) vf16) + ) + (.mov v1-37 vf16) + ) + (suspend) + ) + (none) + ) + ) + :post + (the-as (function none :behavior med-res-level) ja-post) + ) + +;; definition for symbol *lev-string*, type string +(define *lev-string* (new 'global 'string 64 (the-as string #f))) + +;; definition for method 11 of type med-res-level +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defmethod copy-defaults! med-res-level ((obj med-res-level) (arg0 res-lump)) + (local-vars (sv-16 res-tag)) + (stack-size-set! (-> obj main-thread) 128) + "#f" + (let ((s4-0 (the-as (pointer sparticle-launch-group) #f))) + (set! sv-16 (new 'static 'res-tag)) + (let* + ((s3-0 + (res-lump-data + arg0 + 'art-name + (pointer (pointer sparticle-launch-group)) + :tag-ptr + (& sv-16) + ) + ) + (s2-0 (-> s3-0 0)) + ) + (cond + ((not s3-0) + ) + ((part-group-pointer? s2-0) + (set! s4-0 (-> s3-0 0)) + ) + ((= (-> s2-0 -1) string) + (set! s4-0 (lookup-part-group-pointer-by-name (the-as string s2-0))) + (if s4-0 + (set! (-> s3-0 0) s4-0) + ) + ) + ((= (-> s2-0 -1) symbol) + (let ((a0-7 (-> (&+ s2-0 #xff38) 0))) + (set! s4-0 (lookup-part-group-pointer-by-name (the-as string a0-7))) + ) + (if s4-0 + (set! (-> s3-0 0) s4-0) + ) + ) + ) + ) + (when s4-0 + (let ((a0-8 (-> s4-0 0))) + (if (and (nonzero? a0-8) (= (-> a0-8 type) sparticle-launch-group)) + (set! (-> obj part) (create-launch-control a0-8 obj)) + ) + ) + ) + ) + (process-entity-status! obj (entity-perm-status bit-7) #t) + (let ((s4-1 (res-lump-struct (-> obj entity) 'level structure)) + (s3-1 (res-lump-value (-> obj entity) 'index uint128)) + ) + (when s4-1 + (set! (-> obj level) (the-as symbol s4-1)) + (set! (-> obj index) (the-as int s3-1)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (format (clear *lev-string*) "med-res-~S~S" s4-1 (if (zero? s3-1) + "" + (* s3-1 8) + ) + ) + (dummy-15 obj *lev-string* '()) + (logior! (-> obj draw status) 64) + (if (nonzero? (-> obj draw)) + (go med-res-level-idle) + ) + ) + ) + (none) + ) + +;; definition for method 20 of type part-spawner +;; INFO: Return type mismatch symbol vs none. +(defmethod dummy-20 part-spawner ((obj part-spawner)) + (sphere<-vector+r! (-> obj world-sphere) (-> obj root trans) (-> obj radius)) + (sphere-in-view-frustum? (-> obj world-sphere)) + (none) + ) + +;; failed to figure out what this is: +(defstate part-spawner-active (part-spawner) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('stop) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> self enable) #f) + #t + ) + (('start) + (process-entity-status! self (entity-perm-status complete) #f) + (set! (-> self enable) #t) + #t + ) + (('trans) + (let ((v0-1 (the-as object (-> (the-as vector (-> arg3 param 0)) quad)))) + (set! (-> self root trans quad) (the-as uint128 v0-1)) + v0-1 + ) + ) + ) + ) + :code + (behavior () + (while #t + (when (-> self enable) + (spawn (-> self part) (-> self root trans)) + (if (nonzero? (-> self sound)) + (update! (-> self sound)) + ) + ) + (suspend) + ) + (none) + ) + ) + +;; definition for method 11 of type part-spawner +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defmethod copy-defaults! part-spawner ((obj part-spawner) (arg0 res-lump)) + (local-vars (sv-16 res-tag)) + (stack-size-set! (-> obj main-thread) 128) + (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj radius) 12288.0) + (set! + (-> obj enable) + (not + (and + (-> obj entity) + (logtest? (-> obj entity extra perm status) (entity-perm-status complete)) + ) + ) + ) + (set! + (-> obj sound) + (new 'process 'ambient-sound (-> obj entity) (-> obj root trans)) + ) + (let ((s4-0 (the-as object "#f"))) + (let ((s3-0 (the-as (pointer sparticle-launch-group) #f))) + (set! sv-16 (new 'static 'res-tag)) + (let* + ((s5-1 + (res-lump-data + arg0 + 'art-name + (pointer (pointer sparticle-launch-group)) + :tag-ptr + (& sv-16) + ) + ) + (s2-0 (-> s5-1 0)) + ) + (cond + ((part-group-pointer? s2-0) + (set! s3-0 (-> s5-1 0)) + ) + ((= (-> s2-0 -1) string) + (when (string= (the-as string s2-0) "group-beach-grotto-1") + (set! (-> obj radius) 61440.0) + (go beach-part-grotto-1) + ) + (set! s4-0 s2-0) + (set! s3-0 (lookup-part-group-pointer-by-name (the-as string s4-0))) + (if s3-0 + (set! (-> s5-1 0) s3-0) + ) + ) + ((= (-> s2-0 -1) symbol) + (set! s4-0 (-> (&+ s2-0 #xff38) 0)) + (set! s3-0 (lookup-part-group-pointer-by-name (the-as string s4-0))) + (if s3-0 + (set! (-> s5-1 0) s3-0) + ) + ) + (else + (go process-drawable-art-error (the-as string s2-0)) + ) + ) + ) + (set! (-> obj mode) s3-0) + (when s3-0 + (let ((a0-19 (-> s3-0 0))) + (when (and (nonzero? a0-19) (= (-> a0-19 type) sparticle-launch-group)) + (set! (-> obj part) (create-launch-control a0-19 obj)) + (go part-spawner-active) + ) + ) + ) + ) + (go process-drawable-art-error (the-as string s4-0)) + ) + (none) + ) + +;; definition of type launcher +(deftype launcher (process-drawable) + ((root-override collide-shape :offset 112) + (spring-height meters :offset-assert 176) + (camera state :offset-assert 180) + (active-distance float :offset-assert 184) + (seek-time uint64 :offset-assert 192) + (dest vector :inline :offset-assert 208) + (sound-id sound-id :offset-assert 224) + ) + :heap-base #x80 + :method-count-assert 20 + :size-assert #xe4 + :flag-assert #x14008000e4 + ) + +;; definition for method 3 of type launcher +(defmethod inspect launcher ((obj launcher)) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~T~Tspring-height: (meters ~m)~%" (-> obj spring-height)) + (format #t "~T~Tcamera: ~A~%" (-> obj camera)) + (format #t "~T~Tactive-distance: ~f~%" (-> obj active-distance)) + (format #t "~T~Tseek-time: ~D~%" (-> obj seek-time)) + (format #t "~T~Tdest: ~`vector`P~%" (-> obj dest)) + (format #t "~T~Tsound-id: ~D~%" (-> obj sound-id)) + obj + ) + +;; failed to figure out what this is: +(set! + (-> *part-group-id-table* 37) + (new 'static 'sparticle-launch-group + :length 5 + :duration #xbb8 + :linger-duration #x5dc + :name "group-beach-launcher" + :launcher + (new 'static 'inline-array sparticle-group-item 5 + (sp-item 45 :fade-after (meters 100.0) :falloff-to (meters 100.0)) + (sp-item 46 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 47 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 48 :fade-after (meters 50.0) :falloff-to (meters 80.0)) + (sp-item 49 :fade-after (meters 70.0) :falloff-to (meters 100.0)) + ) + :bounds + (new 'static 'sphere :y 12288.0 :w 20480.0) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 45) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 14 + (sp-flt spt-num 1.5) + (sp-flt spt-x (meters 1.5)) + (sp-flt spt-y (meters -0.5)) + (sp-int spt-rot-x 5) + (sp-flt spt-r 4096.0) + (sp-flt spt-g 2867.2) + (sp-flt spt-b 3276.8) + (sp-flt spt-vel-y (meters 0.026666667)) + (sp-int spt-timer 270) + (sp-cpuinfo-flags aux-list) + (sp-int spt-next-time 180) + (sp-launcher-by-id spt-next-launcher 50) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 50) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-b -4.551111) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 46) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0.0) (meters 1.8) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.5) (meters 2.5) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.24414062) (meters 0.48828125) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags bit3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 47) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 1.8) (meters 1.0) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 1.0) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.048828125) (meters 0.09765625) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags bit3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 48) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x17 :page #x2)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.4) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.1) (meters 0.1) 1.0) + (sp-rnd-flt spt-r 10.0 6.0 1.0) + (sp-rnd-flt spt-g 64.0 128.0 1.0) + (sp-rnd-flt spt-b 10.0 6.0 1.0) + (sp-flt spt-a 80.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a -0.2) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int-plain-rnd spt-timer 180 119 1) + (sp-cpuinfo-flags bit2) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 49) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 1.0) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 10.0 5.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags bit2 bit3) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 51) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 51) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.18) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-group-id-table* 38) + (new 'static 'sparticle-launch-group + :length 4 + :duration #xbb8 + :linger-duration #x5dc + :name "group-jungle-launcher" + :launcher + (new 'static 'inline-array sparticle-group-item 4 + (sp-item 45 :fade-after (meters 100.0) :falloff-to (meters 100.0)) + (sp-item 52 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 53 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 54 :fade-after (meters 70.0) :falloff-to (meters 100.0)) + ) + :bounds + (new 'static 'sphere :y 12288.0 :w 20480.0) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 52) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0.0) (meters 1.4) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.5) (meters 2.5) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.24414062) (meters 0.48828125) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags bit3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 53) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 1.4) (meters 0.9) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 1.0) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.048828125) (meters 0.09765625) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags bit3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 54) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 1.0) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 10.0 5.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags bit2 bit3) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 51) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-group-id-table* 39) + (new 'static 'sparticle-launch-group + :length 4 + :duration #xbb8 + :linger-duration #x5dc + :name "group-swamp-launcher" + :launcher + (new 'static 'inline-array sparticle-group-item 4 + (sp-item 45 :fade-after (meters 100.0) :falloff-to (meters 100.0)) + (sp-item 46 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 47 :fade-after (meters 70.0) :falloff-to (meters 100.0) :flags (is-3d)) + (sp-item 55 :fade-after (meters 70.0) :falloff-to (meters 100.0)) + ) + :bounds + (new 'static 'sphere :y 12288.0 :w 20480.0) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 55) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :page #x2)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 1.0) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 16.0 16.0 1.0) + (sp-rnd-flt spt-g 16.0 16.0 1.0) + (sp-rnd-flt spt-b 5.0 2.5 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0.0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags bit2) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 51) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; definition for function cam-launcher-joystick +;; Used lq/sq +(defbehavior cam-launcher-joystick camera-slave () + (when *camera-read-analog* + (let ((s5-0 (new-stack-matrix0)) + (gp-0 (vector-reset! (new 'stack-no-clear 'vector))) + ) + (let* + ((f0-0 + (analog-input + (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) + 0.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f1-1 (* -546.13336 f0-0)) + (f0-2 (fmin 546.13336 (fmax -546.13336 f1-1))) + ) + (matrix-axis-angle! s5-0 (-> *camera* local-down) f0-2) + ) + (vector-! gp-0 (-> self trans) (-> *camera* tpos-curr)) + (vector-matrix*! gp-0 gp-0 s5-0) + (vector+! (-> self trans) gp-0 (-> *camera* tpos-curr)) + ) + ) + ) + +;; failed to figure out what this is: +(defstate cam-launcher-shortfall (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector--float*! + (-> self trans) + (-> *camera* tpos-curr) + (-> *camera* local-down) + 28672.0 + ) + (vector-flatten! + gp-0 + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! gp-0 1.0) + (set! (-> self pivot-pt quad) (-> gp-0 quad)) + (vector+float*! gp-0 gp-0 (-> *camera* local-down) 1000.0) + (vector-normalize-copy! (-> self tracking inv-mat vector 2) gp-0 1.0) + ) + (vector-cross! + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 (-> *display* base-frame-counter))) + (while #t + (when (not (paused?)) + (vector--float*! + (-> self trans) + (-> *camera* tpos-curr) + (-> *camera* local-down) + 28672.0 + ) + (send-event *camera* 'teleport) + (if + (and + (-> *camera* on-ground) + (>= (- (-> *display* base-frame-counter) gp-0) 300) + ) + (send-event *camera* 'change-state *camera-base-mode* 150) + ) + ) + (suspend) + ) + ) + (none) + ) + ) + +;; definition for function cam-launcher-long-joystick +;; Used lq/sq +(defbehavior cam-launcher-long-joystick camera-slave () + (when *camera-read-analog* + (let ((gp-0 (new-stack-matrix0))) + (let* + ((f0-0 + (analog-input + (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) + 0.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f1-1 (* -546.13336 f0-0)) + (f0-2 (fmin 546.13336 (fmax -546.13336 f1-1))) + ) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-2) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + (vector-normalize! (-> self view-flat) 4096.0) + ) + ) + +;; failed to figure out what this is: +(defstate cam-launcher-longfall (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (new 'stack-no-clear 'vector) + (vector-negate! (-> self view-flat) (-> self tracking inv-mat vector 2)) + (vector-normalize! (-> self view-flat) 4096.0) + (vector--float*! + (-> self trans) + (-> *camera* tpos-curr) + (-> *camera* local-down) + 28672.0 + ) + (vector+! (-> self trans) (-> self trans) (-> self view-flat)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (cam-launcher-long-joystick) + (none) + ) + :code + (behavior () + (let ((gp-0 (-> *display* base-frame-counter))) + (while #t + (when (not (paused?)) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + 0.0 + 0.0 + 0.0 + (send-event *camera* 'teleport) + (let* ((f0-4 (vector-dot (-> self velocity) (-> *camera* local-down))) + (f30-0 (* 0.975 f0-4)) + ) + (vector--float*! + s4-0 + (-> *camera* tpos-curr) + (-> *camera* local-down) + 28672.0 + ) + (vector-! s4-0 s4-0 (-> self trans)) + (let ((f28-0 (vector-dot s4-0 (-> *camera* local-down)))) + (vector--float*! s5-0 s4-0 (-> *camera* local-down) f28-0) + (cond + ((< f28-0 f30-0) + (set! f30-0 f28-0) + ) + ((< 20480.0 f28-0) + (let ((f28-1 (+ -20480.0 f28-0))) + (let ((f0-8 (lerp f30-0 f28-1 0.005))) + (if (< f30-0 f0-8) + (set! f30-0 f0-8) + ) + ) + (if (< (* 0.09 f28-1) f30-0) + (set! f30-0 (* 0.09 f28-1)) + ) + ) + ) + ) + ) + (vector+float*! (-> self velocity) s5-0 (-> *camera* local-down) f30-0) + ) + ) + (vector+! (-> self trans) (-> self trans) (-> self velocity)) + (set! (-> self trans x) (-> *camera* tpos-curr x)) + (set! (-> self trans z) (-> *camera* tpos-curr z)) + (vector+! (-> self trans) (-> self trans) (-> self view-flat)) + (if + (and + (-> *camera* on-ground) + (>= (- (-> *display* base-frame-counter) gp-0) 300) + ) + (send-event *camera* 'change-state *camera-base-mode* 150) + ) + ) + (vector-reset! (-> self tracking follow-off)) + (vector+! + (-> self tracking follow-pt) + (-> *camera* tpos-curr-adj) + (-> self tracking follow-off) + ) + (vector--float*! + (-> self tracking follow-pt) + (-> self tracking follow-pt) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + (suspend) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate launcher-idle (launcher) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'instant-death) + (go launcher-deactivated) + ) + ((= v1-0 'trans) + (TODO-RENAME-30 + (-> self root-override) + (the-as vector (-> arg3 param 0)) + ) + (dummy-47 (-> self root-override)) + ) + ) + ) + ) + ) + :trans + (behavior () + (when + (and + *target* + (>= + (-> self active-distance) + (vector-vector-distance + (-> self root-override trans) + (-> *target* control trans) + ) + ) + ) + (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) 'query) + (set! (-> a1-1 param 0) (the-as uint 'powerup)) + (set! (-> a1-1 param 1) (the-as uint 3)) + (cond + ((send-event-function *target* a1-1) + (go launcher-active) + ) + (else + (let ((gp-0 'target-launch) + (a1-2 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 1) + (set! (-> a1-2 message) 'query) + (set! (-> a1-2 param 0) (the-as uint 'mode)) + (if (= (send-event-function *target* a1-2) gp-0) + (send-event *target* 'end-mode) + ) + ) + ) + ) + ) + (if + (and + (and + *target* + (>= + 32768.0 + (vector-vector-distance + (-> self root-override trans) + (-> *target* control trans) + ) + ) + ) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) self) + (set! (-> a1-5 num-params) 2) + (set! (-> a1-5 message) 'query) + (set! (-> a1-5 param 0) (the-as uint 'powerup)) + (set! (-> a1-5 param 1) (the-as uint 3)) + (not (send-event-function *target* a1-5)) + ) + ) + (level-hint-spawn + (game-text-id daxter-launcher-no-eco) + "sksp0035" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + (none) + ) + :code + (the-as (function none :behavior launcher) anim-loop) + ) + +;; failed to figure out what this is: +(defstate launcher-active (launcher) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (when (or (= arg2 'touch) (= arg2 'attack)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (send-event + arg0 + 'launch + (-> self spring-height) + (-> self camera) + (-> self dest) + (-> self seek-time) + ) + ) + (the-as object (cond + ((= arg2 'instant-death) + (go launcher-deactivated) + ) + ((= arg2 'trans) + (TODO-RENAME-30 + (-> self root-override) + (the-as vector (-> arg3 param 0)) + ) + (dummy-47 (-> self root-override)) + ) + ) + ) + ) + :exit + (behavior () + (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-0 command) (sound-command set-param)) + (set! (-> v1-0 id) (-> self sound-id)) + (set! (-> v1-0 parms volume) -4) + (set! (-> v1-0 auto-time) 120) + (set! (-> v1-0 auto-from) 2) + (set! (-> v1-0 parms mask) (the-as uint 17)) + (-> v1-0 id) + ) + (none) + ) + :trans + (behavior () + (if + (or + (or + (not *target*) + (< + (-> self active-distance) + (vector-vector-distance + (-> self root-override trans) + (-> *target* control trans) + ) + ) + ) + (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) 'query) + (set! (-> a1-1 param 0) (the-as uint 'powerup)) + (set! (-> a1-1 param 1) (the-as uint 3)) + (not (send-event-function *target* a1-1)) + ) + ) + (go launcher-idle) + ) + (spawn (-> self part) (-> self root-override trans)) + (sound-play-by-name + (static-sound-name "launch-idle") + (-> self sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (if + (and + (and + *target* + (>= + (+ 2867.2 (-> self root-override root-prim prim-core world-sphere w)) + (vector-vector-distance + (-> self root-override trans) + (-> *target* control trans) + ) + ) + ) + (< (- (-> *display* base-frame-counter) (-> self state-time)) 150) + ) + (send-event + *target* + 'launch + (-> self spring-height) + (-> self camera) + (-> self dest) + (-> self seek-time) + ) + ) + (none) + ) + :code + (behavior () + (sound-play-by-name + (static-sound-name "launch-start") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (anim-loop) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate launcher-deactivated (launcher) + :code + (the-as (function none :behavior launcher) anim-loop) + ) + +;; definition for method 11 of type launcher +;; INFO: Return type mismatch object vs none. +(defmethod copy-defaults! launcher ((obj launcher) (arg0 res-lump)) + (stack-size-set! (-> obj main-thread) 128) + (let + ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> s3-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s3-0 collide-with) (the-as uint 16)) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 12288.0) + ) + (dummy-46 s4-0) + (set! (-> s4-0 nav-radius) 13926.4) + (dummy-50 s4-0) + (set! (-> obj root-override) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (dummy-47 (-> obj root-override)) + (set! (-> obj active-distance) 409600.0) + (set! + (-> obj spring-height) + (res-lump-float arg0 'spring-height :default 163840.0) + ) + (let ((s4-1 (res-lump-value arg0 'mode uint128))) + (let ((v1-18 (-> obj entity extra level name))) + (set! (-> obj part) (create-launch-control (cond + ((= v1-18 'beach) + (-> *part-group-id-table* 37) + ) + ((= v1-18 'swamp) + (-> *part-group-id-table* 39) + ) + (else + (-> *part-group-id-table* 38) + ) + ) + obj + ) + ) + ) + (let ((v1-24 (logand (the-as int s4-1) 255))) + (cond + ((= (the-as uint v1-24) 1) + (set! (-> obj camera) cam-launcher-longfall) + ) + ((= (the-as uint v1-24) 2) + (set! (-> obj camera) #f) + ) + (else + (set! (-> obj camera) cam-launcher-shortfall) + ) + ) + ) + ) + (let ((v1-29 (res-lump-struct arg0 'alt-vector vector))) + (when v1-29 + (set-vector! (-> obj dest) (-> v1-29 x) (-> v1-29 y) (-> v1-29 z) 1.0) + (set! (-> obj seek-time) (the-as uint (the int (* 300.0 (-> v1-29 w))))) + ) + ) + (set! (-> obj sound-id) (new-sound-id)) + (nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f)) + (go launcher-idle) + (none) + ) + +;; definition for function launcher-init-by-other +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior + launcher-init-by-other launcher + ((arg0 vector) (arg1 float) (arg2 int) (arg3 float)) + (stack-size-set! (-> self main-thread) 128) + (let + ((s2-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((s1-0 (new 'process 'collide-shape-prim-sphere s2-0 (the-as uint 0)))) + (set! (-> s1-0 prim-core collide-as) (the-as uint 256)) + (set! (-> s1-0 collide-with) (the-as uint 16)) + (set-vector! (-> s1-0 local-sphere) 0.0 0.0 0.0 12288.0) + ) + (dummy-46 s2-0) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (dummy-50 s2-0) + (set! (-> self root-override) s2-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-vector! (-> self root-override scale) 1.0 1.0 1.0 1.0) + (set-vector! (-> self root-override quat) 0.0 0.0 0.0 1.0) + (dummy-47 (-> self root-override)) + (set! (-> self spring-height) arg1) + (set! (-> self active-distance) arg3) + (let ((v1-23 (-> self entity extra level name))) + (set! (-> self part) (create-launch-control (cond + ((= v1-23 'beach) + (-> *part-group-id-table* 37) + ) + ((= v1-23 'swamp) + (-> *part-group-id-table* 39) + ) + (else + (-> *part-group-id-table* 38) + ) + ) + self + ) + ) + ) + (case (logand arg2 255) + ((1) + (set! (-> self camera) cam-launcher-longfall) + ) + ((2) + (set! (-> self camera) #f) + ) + (else + (set! (-> self camera) cam-launcher-shortfall) + ) + ) + (let ((v1-34 (res-lump-struct (-> self entity) 'alt-vector vector))) + (when v1-34 + (set-vector! (-> self dest) (-> v1-34 x) (-> v1-34 y) (-> v1-34 z) 1.0) + (set! (-> self seek-time) (the-as uint (the int (* 300.0 (-> v1-34 w))))) + ) + ) + (set! (-> self sound-id) (new-sound-id)) + (go launcher-idle) + (none) + ) + +;; failed to figure out what this is: +(defstate touch-tracker-idle (touch-tracker) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 none)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'touched) + (let ((v1-1 (ppointer->process (-> self parent)))) + (when (!= v1-1 arg0) + (cond + ((= (-> self event) 'attack) + (cond + ((= (-> arg0 type) target) + (let + ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (the-as process v1-1)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) (-> self event)) + (set! (-> a1-2 param 0) (the-as uint #f)) + (let ((a2-2 (new 'static 'attack-info :mask #x20))) + (set! + (-> a2-2 mode) + (the-as symbol (-> self event-mode)) + ) + (set! (-> a1-2 param 1) (the-as uint a2-2)) + ) + (send-event-function arg0 a1-2) + ) + ) + ((= (-> v1-1 type) target) + (let + ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (the-as process v1-1)) + (set! (-> a1-4 num-params) 4) + (set! (-> a1-4 message) (-> self event)) + (set! (-> a1-4 param 0) (the-as uint #f)) + (set! + (-> a1-4 param 1) + (the-as uint (-> self event-mode)) + ) + (set! + (-> a1-4 param 2) + (the-as uint (-> *target* control unknown-dword50)) + ) + (set! + (-> a1-4 param 3) + (the-as uint (-> *target* control unknown-dword51)) + ) + (send-event-function arg0 a1-4) + ) + ) + (else + (let + ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (the-as process v1-1)) + (set! (-> a1-5 num-params) 4) + (set! (-> a1-5 message) (-> self event)) + (set! (-> a1-5 param 0) (the-as uint #f)) + (set! + (-> a1-5 param 1) + (the-as uint (-> self event-mode)) + ) + (let ((v1-19 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-19) + (set! (-> a1-5 param 2) (the-as uint v1-19)) + ) + (set! (-> a1-5 param 3) (the-as uint 0)) + (send-event-function arg0 a1-5) + ) + ) + ) + ) + ((-> self event) + (let + ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (the-as process v1-1)) + (set! (-> a1-6 num-params) 0) + (set! (-> a1-6 message) (-> self event)) + (send-event-function arg0 a1-6) + ) + ) + (else + (let + ((t0-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> t0-5 from) arg0) + (set! (-> t0-5 num-params) arg1) + (set! (-> t0-5 message) arg2) + (set! (-> t0-5 param 0) (-> arg3 param 0)) + (set! (-> t0-5 param 1) (-> arg3 param 1)) + (set! (-> t0-5 param 2) (-> arg3 param 2)) + (set! (-> t0-5 param 3) (-> arg3 param 3)) + (set! (-> t0-5 param 4) (-> arg3 param 4)) + (set! (-> t0-5 param 5) (-> arg3 param 5)) + (set! (-> t0-5 param 6) (-> arg3 param 6)) + (send-event-function v1-1 t0-5) + ) + ) + ) + ) + ) + ) + ((= v1-0 'target) + (set! + v0-0 + (the-as + none + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (set! (-> self target) (the-as handle v0-0)) + v0-0 + ) + ((= v1-0 'event) + (set! (-> self event) (the-as symbol (-> arg3 param 0))) + (set! v0-0 (the-as none (-> arg3 param 1))) + (set! (-> self event-mode) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'exit) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! (-> self run-function) (the-as (function none) v0-0)) + v0-0 + ) + ((= v1-0 'eval) + ((the-as (function touch-tracker none) (-> arg3 param 0)) + self + ) + ) + ((= v1-0 'function) + (set! v0-0 (the-as none (-> arg3 param 0))) + (set! + (-> self callback) + (the-as (function touch-tracker none) v0-0) + ) + v0-0 + ) + ) + ) + ) + ) + :code + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (while ((-> self run-function)) + (let* ((gp-0 (handle->process (-> self target))) + (a0-4 + (if + (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) + gp-0 + ) + ) + ) + (when a0-4 + (let* ((gp-1 (-> (the-as process-drawable a0-4) root)) + (a0-6 + (if + (and (nonzero? gp-1) (type-type? (-> gp-1 type) collide-shape)) + gp-1 + ) + ) + ) + (if a0-6 + (set! + (-> self root-override trans quad) + (-> (the-as collide-shape a0-6) root-prim prim-core world-sphere quad) + ) + ) + ) + ) + ) + (if (-> self callback) + ((-> self callback) self) + ) + (dummy-47 (-> self root-override)) + (let ((a1-3 (new 'stack-no-clear 'touching-shapes-entry))) + (set! (-> a1-3 cshape1) (the-as collide-shape 2)) + (set! (-> a1-3 cshape2) (the-as collide-shape *touching-list*)) + (dummy-40 (-> self root-override) a1-3) + ) + (suspend) + ) + (dummy-48 (-> self root-override)) + (suspend) + 0 + (none) + ) + ) + +;; definition for function touch-tracker-init +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior + touch-tracker-init touch-tracker + ((arg0 vector) (arg1 float) (arg2 uint)) + (let + ((s4-0 + (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)) + ) + ) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) default-collision-reaction) + (set! (-> s4-0 no-reaction) nothing) + (let ((s2-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> s2-0 prim-core collide-as) (the-as uint 272)) + (set! (-> s2-0 collide-with) (the-as uint 3022)) + (set! (-> s2-0 prim-core offense) 4) + (set-vector! (-> s2-0 local-sphere) 0.0 0.0 0.0 arg1) + ) + (dummy-46 s4-0) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (dummy-50 s4-0) + (set! (-> s4-0 event-self) 'touched) + (set! (-> self root-override) s4-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set! (-> self duration) arg2) + (set! (-> self target) (the-as handle #f)) + (set! (-> self event) #f) + (set! (-> self callback) #f) + (set! + (-> self run-function) + (the-as + (function none) + (lambda :behavior touch-tracker + () + (< + (- (-> *display* base-frame-counter) (-> self state-time)) + (the-as int (-> self duration)) + ) + ) + ) + ) + (set! (-> self event-hook) (-> touch-tracker-idle event)) + (go touch-tracker-idle) + (none) + ) + +;; definition for function process-drawable-random-point! +(defun process-drawable-random-point! ((arg0 process-drawable) (arg1 vector)) + (let ((v1-1 (-> arg0 node-list length)) + (s4-0 (-> arg0 root)) + ) + (cond + ((>= v1-1 7) + (let ((v1-2 (rand-vu-int-range 3 (+ v1-1 -1)))) + (vector<-cspace! arg1 (-> arg0 node-list data v1-2)) + ) + ) + ((and (nonzero? s4-0) (type-type? (-> s4-0 type) collide-shape)) + (vector+! + arg1 + (the-as vector (-> (the-as collide-shape s4-0) root-prim prim-core)) + (rand-vu-sphere-point! + arg1 + (-> (the-as collide-shape s4-0) root-prim prim-core world-sphere w) + ) + ) + ) + (else + (vector+! + arg1 + (-> arg0 root trans) + (rand-vu-sphere-point! arg1 (-> arg0 draw bounds w)) + ) + ) + ) + ) + arg1 + ) + +;; definition for function process-drawable-pair-random-point! +;; Used lq/sq +(defun + process-drawable-pair-random-point! + ((arg0 process-drawable) (arg1 process-drawable) (arg2 vector) (arg3 float)) + (let ((s4-0 (new-stack-vector0)) + (s3-0 (new-stack-vector0)) + ) + (process-drawable-random-point! arg0 s4-0) + (process-drawable-random-point! arg1 s3-0) + (vector-lerp! arg2 s4-0 s3-0 arg3) + ) + ) + +;; definition for symbol *particle-quat*, type quaternion +(define *particle-quat* (new 'static 'quaternion :w 1.0)) + +;; definition for function birth-func-set-quat +;; INFO: Return type mismatch int vs none. +(defun + birth-func-set-quat + ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (local-vars (a0-2 float) (a0-3 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((a0-1 arg2) + (v1-0 *particle-quat*) + ) + (cond + ((< (-> v1-0 w) 0.0) + (.lvf vf1 (&-> a0-1 conerot quad)) + (.lvf vf2 (&-> v1-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> a0-1 conerot quad) vf1) + (.mov a0-2 vf1) + ) + (else + (.lvf vf1 (&-> a0-1 conerot quad)) + (.lvf vf2 (&-> v1-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> a0-1 conerot quad) vf1) + (.mov a0-3 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 2528) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 12 + (sp-tex spt-texture (new 'static 'texture-id :index #xc :page #x2)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 2.0) (meters 0.5) 1.0) + (sp-flt spt-scale-y (meters 5.6)) + (sp-rnd-flt spt-r 0.0 44.0 1.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-rnd-flt spt-b 128.0 32.0 1.0) + (sp-flt spt-a 128.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags bit2 bit3 bit14 left-multiply-quat) + (sp-end) + ) + ) + ) + +;; definition for function draw-eco-beam +;; INFO: Return type mismatch int vs none. +(defun draw-eco-beam ((arg0 vector) (arg1 vector)) + (when (line-in-view-frustum? arg0 arg1) + (let ((s2-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (gp-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (vector+*! gp-1 arg0 s2-1 0.5) + (vector-normalize-copy! s4-0 s2-1 1.0) + (set! + (-> *part-id-table* 2528 init-specs 4 initial-valuef) + (vector-length s2-1) + ) + (forward-up->quaternion s5-0 s4-0 *y-vector*) + (dotimes (s4-1 3) + (quaternion-rotate-local-z! s5-0 s5-0 10922.667) + (quaternion-copy! *particle-quat* s5-0) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 2528) + gp-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/engine/game/task/process-taskable_REF.gc b/test/decompiler/reference/engine/game/task/process-taskable_REF.gc index 4585f1ac6c..9ff4afeaae 100644 --- a/test/decompiler/reference/engine/game/task/process-taskable_REF.gc +++ b/test/decompiler/reference/engine/game/task/process-taskable_REF.gc @@ -1879,33 +1879,40 @@ ) ) (suspend) - (-> self hand process 0) - (when - (or (-> self die?) (and (not (-> self survive-anim-end?)) (ja-anim-done?))) - (let ((gp-1 (-> *display* base-frame-counter))) - (while + (let ((a0-25 (-> self hand process 0))) + (when + (or + (-> self die?) (and - (< (- (-> *display* base-frame-counter) gp-1) #x4650) - (or - (and - (-> self entity) - (not - (is-object-visible? - (-> self entity extra level) - (-> self entity extra vis-id) + (not (-> self survive-anim-end?)) + (ja-anim-done? (the-as pair a0-25)) + ) + ) + (let ((gp-1 (-> *display* base-frame-counter))) + (while + (and + (< (- (-> *display* base-frame-counter) gp-1) #x4650) + (or + (and + (-> self entity) + (not + (is-object-visible? + (-> self entity extra level) + (-> self entity extra vis-id) + ) ) ) - ) - (< - 81920.0 - (vector-vector-distance (camera-pos) (-> *math-camera* trans)) + (< + 81920.0 + (vector-vector-distance (camera-pos) (-> *math-camera* trans)) + ) ) ) + (suspend) ) - (suspend) ) + (deactivate self) ) - (deactivate self) ) ) (none) diff --git a/test/decompiler/reference/levels/beach/beach-part_REF.gc b/test/decompiler/reference/levels/beach/beach-part_REF.gc index bbc49c4e34..9e00a169de 100644 --- a/test/decompiler/reference/levels/beach/beach-part_REF.gc +++ b/test/decompiler/reference/levels/beach/beach-part_REF.gc @@ -128,8 +128,7 @@ :code (behavior () (while #t - self - (when ((method-of-object self dummy-20)) + (when (dummy-20 self) (let* ((gp-0 (camera-pos)) (f0-0 (vector-vector-distance (-> self root trans) gp-0)) ) diff --git a/test/decompiler/reference/levels/jungleb/jungleb-obs_REF.gc b/test/decompiler/reference/levels/jungleb/jungleb-obs_REF.gc index 49853dcfce..ad5c1622aa 100644 --- a/test/decompiler/reference/levels/jungleb/jungleb-obs_REF.gc +++ b/test/decompiler/reference/levels/jungleb/jungleb-obs_REF.gc @@ -435,10 +435,13 @@ ) (camera-look-at (the-as - process + pair "ecovent-171" ) - 0 + (the-as + uint + 0 + ) ) (camera-change-to "camera-223" @@ -499,8 +502,14 @@ ) ) (camera-look-at - *target* - 0 + (the-as + pair + *target* + ) + (the-as + uint + 0 + ) ) (camera-change-to (the-as diff --git a/test/offline/config.jsonc b/test/offline/config.jsonc index c55d53fc35..a5a81f3ee3 100644 --- a/test/offline/config.jsonc +++ b/test/offline/config.jsonc @@ -1,161 +1,200 @@ { - "dgos": ["CGO/KERNEL.CGO", "CGO/ENGINE.CGO", "CGO/GAME.CGO", "DGO/BEA.DGO", - "DGO/INT.DGO", "DGO/VI1.DGO", "DGO/VI2.DGO", "DGO/VI3.DGO", - "DGO/CIT.DGO", "DGO/MIS.DGO", "DGO/JUB.DGO", "DGO/SUN.DGO", - "DGO/DEM.DGO", "DGO/FIN.DGO", "DGO/JUN.DGO", "DGO/FIC.DGO", - "DGO/SNO.DGO", "DGO/SWA.DGO", "DGO/MAI.DGO", "DGO/ROB.DGO", - "DGO/LAV.DGO", "DGO/OGR.DGO", "DGO/TRA.DGO", "DGO/ROL.DGO", "DGO/DAR.DGO"], + "dgos": [ + "CGO/KERNEL.CGO", + "CGO/ENGINE.CGO", + "CGO/GAME.CGO", + "DGO/BEA.DGO", + "DGO/INT.DGO", + "DGO/VI1.DGO", + "DGO/VI2.DGO", + "DGO/VI3.DGO", + "DGO/CIT.DGO", + "DGO/MIS.DGO", + "DGO/JUB.DGO", + "DGO/SUN.DGO", + "DGO/DEM.DGO", + "DGO/FIN.DGO", + "DGO/JUN.DGO", + "DGO/FIC.DGO", + "DGO/SNO.DGO", + "DGO/SWA.DGO", + "DGO/MAI.DGO", + "DGO/ROB.DGO", + "DGO/LAV.DGO", + "DGO/OGR.DGO", + "DGO/TRA.DGO", + "DGO/ROL.DGO", + "DGO/DAR.DGO" + ], - "skip_compile_files": [ - "timer", // accessing timer regs - "display", // interrupt handlers - "target-snowball" // screwed up labels, likely cut content + "skip_compile_files": [ + "timer", // accessing timer regs + "display", // interrupt handlers + "target-snowball" // screwed up labels, likely cut content + ], + + "skip_compile_functions": [ + /// GCOMMON + // these functions are not implemented by the compiler in OpenGOAL, but are in GOAL. + "abs", + "ash", + "min", + "max", + "lognor", + // weird PS2 specific debug registers: + "breakpoint-range-set!", + // inline assembly + "valid?", + + /// GKERNEL + // asm + "(method 10 process)", + "(method 14 dead-pool)", + + /// GSTATE + "enter-state", // stack pointer asm + + /// MATH + "rand-vu-init", + "rand-vu", + "rand-vu-nostep", // random hardware + + // trig + "sin-rad", // fpu acc + "cos-rad", // fpu acc + "atan-series-rad", // fpu acc + + /// VECTOR-H + "(method 3 vector)", // this function appears twice, which confuses the compiler. + "vector4-dot", // fpu acc + + "(method 3 profile-frame)", // double definition. + + // dma-disasm + "disasm-dma-list", // missing a single cast :( + + // math camera + "transform-point-vector!", + "transform-point-qword!", + "transform-point-vector-scale!", + + // display-h + "put-draw-env", + + // geometry + "calculate-basis-functions-vector!", // asm requiring manual rewrite + "curve-evaluate!", // asm requiring manual rewrite + "point-in-triangle-cross", // logior on floats manual fixup + + // texture + "(method 9 texture-page-dir)", // multiplication on pointers + "adgif-shader<-texture-with-update!", // misrecognized bitfield stuff. + + // asm + "invalidate-cache-line", + + // stats-h + "(method 11 perf-stat)", + "(method 12 perf-stat)", + + // sprite-distorter + "sprite-draw-distorters", // uses clipping flag. + + // sync-info + "(method 15 sync-info)", // needs display stuff first + "(method 15 sync-info-eased)", // needs display stuff first + "(method 15 sync-info-paused)", // needs display stuff first + + // sparticle + "lookup-part-group-pointer-by-name", // address of element in array issue + + // ripple - calls an asm function + "ripple-execute", + + "get-task-status", + + "print-game-text-scaled", // float/int, looks like a bug in original code? + + // aligner - return-from-thread, currently not supported + "(method 9 align-control)", + + // stat collection + "start-perf-stat-collection", + "end-perf-stat-collection", + + // double definition + "(method 3 game-save)", + + // new stack boxed array + "update-time-of-day", + + // weird asm, was rewritten + "close-sky-buffer", + + // float to int + "(method 10 bsp-header)", + + // multiply defined. + "(method 3 sprite-aux-list)", + + // camera + "slave-set-rotation!", + "v-slrp2!", + "v-slrp3!", // vector-dot involving the stack + + // function returning float with a weird cast. + "debug-menu-item-var-make-float", + + // decompiler BUG + "level-hint-task-process", + "(method 26 level)", + "(method 9 level)", + "(method 10 level)", // asm + + // cam-states + "cam-los-collide", // vector-dot involving the stack + + // cam-layout + "cam-layout-save-cam-trans", // temporary, im sure this can be fixed + + // anim-tester + "(method 3 anim-tester)", + "anim-tester-save-object-seqs", // anim-tester -- new basic on the stack + + // default-menu + "all-texture-tweak-adjust", // dynamic-field access placeholder case TODO + "debug-menu-make-instance-menu", // also disabled + + // joint + "(method 9 art-mesh-geo)", // PLACEHOLDER array access + "flatten-joint-control-to-spr", + "make-joint-jump-tables", + "(method 5 art-joint-anim)", // defined identically twice in the same file...probably a bug? + + // process-drawable + "fill-skeleton-cache", // cache dxwbin + "execute-math-engine", // handle casts -- was fixed manually + + // ambient + "ambient-type-music", // IR_StoreConstOffset::do_codegen can't handle this (c {} sz {}) + + // main + "display-loop", + "on", + + // generic-obs + "command-get-process", // handle casts + + // sage-finalboss + "(method 7 sage-finalboss)" // inline-array stuff + ], + + "skip_compile_states": { + "cam-master-active": [ + "event" ], - - "skip_compile_functions": [ - /// GCOMMON - // these functions are not implemented by the compiler in OpenGOAL, but are in GOAL. - "abs", "ash", "min", "max", "lognor", - // weird PS2 specific debug registers: - "breakpoint-range-set!", - // inline assembly - "valid?", - - /// GKERNEL - // asm - "(method 10 process)", "(method 14 dead-pool)", - - /// GSTATE - "enter-state", // stack pointer asm - - /// MATH - "rand-vu-init", "rand-vu", - "rand-vu-nostep", // random hardware - - // trig - "sin-rad", // fpu acc - "cos-rad", // fpu acc - "atan-series-rad", // fpu acc - - /// VECTOR-H - "(method 3 vector)", // this function appears twice, which confuses the compiler. - "vector4-dot", // fpu acc - - "(method 3 profile-frame)", // double definition. - - // dma-disasm - "disasm-dma-list", // missing a single cast :( - - // math camera - "transform-point-vector!", "transform-point-qword!", "transform-point-vector-scale!", - - // display-h - "put-draw-env", - - // geometry - "calculate-basis-functions-vector!", // asm requiring manual rewrite - "curve-evaluate!", // asm requiring manual rewrite - "point-in-triangle-cross", // logior on floats manual fixup - - // texture - "(method 9 texture-page-dir)", // multiplication on pointers - "adgif-shader<-texture-with-update!", // misrecognized bitfield stuff. - - // asm - "invalidate-cache-line", - - // stats-h - "(method 11 perf-stat)", "(method 12 perf-stat)", - - // sprite-distorter - "sprite-draw-distorters", // uses clipping flag. - - // sync-info - "(method 15 sync-info)", // needs display stuff first - "(method 15 sync-info-eased)", // needs display stuff first - "(method 15 sync-info-paused)", // needs display stuff first - - // sparticle - "lookup-part-group-pointer-by-name", // address of element in array issue - - // ripple - calls an asm function - "ripple-execute", - - "get-task-status", - - "print-game-text-scaled", // float/int, looks like a bug in original code? - - // aligner - return-from-thread, currently not supported - "(method 9 align-control)", - - // stat collection - "start-perf-stat-collection", "end-perf-stat-collection", - - // double definition - "(method 3 game-save)", - - // new stack boxed array - "update-time-of-day", - - // weird asm, was rewritten - "close-sky-buffer", - - // float to int - "(method 10 bsp-header)", - - // multiply defined. - "(method 3 sprite-aux-list)", - - // camera - "slave-set-rotation!", "v-slrp2!", "v-slrp3!", // vector-dot involving the stack - - // function returning float with a weird cast. - "debug-menu-item-var-make-float", - - // decompiler BUG - "level-hint-task-process", - "(method 26 level)", - "(method 9 level)", - "(method 10 level)", // asm - - // cam-states - "cam-los-collide", // vector-dot involving the stack - - // cam-layout - "cam-layout-save-cam-trans", // temporary, im sure this can be fixed - - // anim-tester - "(method 3 anim-tester)", - "anim-tester-save-object-seqs", // anim-tester -- new basic on the stack - - // default-menu - "all-texture-tweak-adjust", // dynamic-field access placeholder case TODO - "debug-menu-make-instance-menu", // also disabled - - // joint - "(method 9 art-mesh-geo)", // PLACEHOLDER array access - "flatten-joint-control-to-spr", - "make-joint-jump-tables", - "(method 5 art-joint-anim)", // defined identically twice in the same file...probably a bug? - - // process-drawable - "fill-skeleton-cache", // cache dxwbin - "execute-math-engine", // handle casts -- was fixed manually - - // ambient - "ambient-type-music", // IR_StoreConstOffset::do_codegen can't handle this (c {} sz {}) - - // main - "display-loop", - "on", - - // sage-finalboss - "(method 7 sage-finalboss)" // inline-array stuff - ], - - "skip_compile_states": { - "cam-master-active": [ - "event" - ] - } + "manipy-idle": [ + "code" // handle casts + ] + } } diff --git a/third-party/googletest b/third-party/googletest index 955c7f837e..7153098229 160000 --- a/third-party/googletest +++ b/third-party/googletest @@ -1 +1 @@ -Subproject commit 955c7f837efad184ec63e771c42542d37545eaef +Subproject commit 7153098229e88295f9655ff1d3b0e2fa9eada5f8