diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index fb5e114095..2f234cb6ce 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -6923,39 +6923,39 @@ (progress-locations-dig #x221) (progress-locations-underport #x222) (progress-locations-nest #x223) - (text-x224 #x0224) - (text-x225 #x0225) - (text-x226 #x0226) - (text-x227 #x0227) - (text-x228 #x0228) - (text-x229 #x0229) - (text-x22a #x022a) - (text-x22b #x022b) - (text-x22c #x022c) - (text-x22d #x022d) - (gungame-red-prompt #x022e) - (gungame-red-or-blue-prompt #x022f) - (text-x230 #x0230) - (gungame-yellow-prompt #x0231) - (gungame-yellow-or-purple-prompt #x0232) - (text-x233 #x0233) - (text-x234 #x0234) - (text-x235 #x0235) - (text-x236 #x0236) - (text-x237 #x0237) - (text-x238 #x0238) - (text-x239 #x0239) - (text-x23a #x023a) - (text-x23b #x023b) - (text-x23c #x023c) - (text-x23d #x023d) - (text-x23e #x023e) - (text-x23f #x023f) - (text-x240 #x0240) - (text-x241 #x0241) - (text-x242 #x0242) - (text-x243 #x0243) - (text-x244 #x0244) + (tutorial-jump #x0224) + (tutorial-roll #x0225) + (tutorial-double-jump #x0226) + (tutorial-basic-attack #x0227) + (tutorial-rolljump #x0228) + (tutorial-ground-pound #x0229) + (tutorial-high-jump #x022a) + (gungame-tutorial-fire-button #x022b) + (gungame-tutorial-put-red-away #x022c) + (gungame-tutorial-take-red-out #x022d) + (gungame-prompt-red #x022e) + (gungame-prompt-red-or-blue #x022f) + (gungame-tutorial-switch-to-yellow #x0230) + (gungame-prompt-yellow #x0231) + (gungame-prompt-yellow-or-purple #x0232) + (gungame-tutorial-kick-combo #x0233) + (gungame-tutorial-shoot-the-crates #x0234) + (highscore-text-goal #x0235) + (highscore-text-gold #x0236) + (highscore-text-silver #x0237) + (highscore-text-bronze #x0238) + (board-tutorial-get-on-board #x0239) + (board-tutorial-jump #x023a) + (board-tutorial-duck-jump #x023b) + (board-tutorial-boost-jump #x023c) + (board-tutorial-grind #x023d) + (board-tutorial-spin #x023e) + (board-tutorial-flip #x023f) + (board-tutorial-trick #x0240) + (board-score-grind-and-trick #x0241) + (board-score-activate-judge #x0242) + (board-score-try-again #x0243) ;; TODO only for board? + (board-score-return-to-garage #x0244) (text-x245 #x0245) (text-x246 #x0246) (text-x247 #x0247) @@ -9747,7 +9747,7 @@ ) ) - +(declare-type actor-group inline-array-class) (deftype task-manager (process) ((node-info game-task-node-info) (info task-manager-info) @@ -9772,8 +9772,8 @@ (data-int8 int8 32) (data-int32 int32 32) (data-float float 32) - (data-vector vector 32 :inline :offset-assert 800) - (actor-group uint32 4 :offset-assert 1312) + (data-vector vector 32 :inline :offset-assert 800 :score 100) + (actor-group (pointer entity-actor) 4 :offset-assert 1312) (minimap uint32 8 :offset-assert 1328) (hud handle 4 :offset-assert 1360) (hud-timer handle :offset 1360) @@ -14920,9 +14920,9 @@ (initialize-skeleton (_type_ skeleton-group pair) draw-control 14) (initialize-skeleton-by-name (_type_ string) draw-control 15) (apply-alignment (_type_ align-opts transformq vector) trsqv 16) - (cleanup-for-death (_type_) none 17) ;; (do-joint-math! (_type_) none 17) - (relocate-nav (_type_ int) none 18) ;; ( (_type_) none 18) - (evaluate-joint-control (_type_) none 19) ;; (evaluate-joint-control (_type_) none 19) + (cleanup-for-death (_type_) none 17) + (relocate-nav (_type_ int) none 18) + (evaluate-joint-control (_type_) none 19) ) ) @@ -18654,7 +18654,16 @@ (deftype collide-query-with-vec (structure) "A custom type added because of weirdness discovered in task-arrow::23" ((cquery collide-query :inline) - (vec vector :inline)) + (vec vector :inline) + ) + ) + +(deftype collide-query-with-2vec (structure) + "A custom type added because of weirdness discovered in krew-collection-item::22" + ((cquery collide-query :inline) + (vec vector :inline) + (vec2 vector :inline) + ) ) (deftype do-push-aways-work (structure) @@ -27970,7 +27979,7 @@ (deftype pilot-info (basic) ((entity basic :offset-assert 4) - (vehicle uint64 :offset-assert 8) + (vehicle handle :offset-assert 8) (left-right-interp float :offset-assert 16) (front-back-interp float :offset-assert 20) (up-down-interp float :offset-assert 24) @@ -32380,7 +32389,7 @@ (jump-debug-draw symbol :offset-assert 24) (move-to-ground symbol :offset-assert 28) (hover-if-no-ground symbol :offset-assert 32) - (idle-anim-script (pointer uint32) :offset-assert 36) ;; TODO very likely WRONG, possible `script-form`s? + (idle-anim-script (pointer uint32) :offset-assert 36) ;; TODO very likely WRONG, possible `script-form`s? (idle-anim int32 :offset-assert 40) (notice-anim int32 :offset-assert 44) (hostile-anim int32 :offset-assert 48) @@ -35849,9 +35858,10 @@ (deftype pegasus-path-info (structure) ((num-data int32 :offset-assert 0) - (path-data basic :offset-assert 4) - (control-data uint32 :offset-assert 8) + (path-data curve-control :offset-assert 4) + (control-data (pointer float) :offset-assert 8) ) + :allow-misaligned :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c @@ -35864,7 +35874,7 @@ (tangent vector :inline :offset-assert 560) (run-blend-interp float :offset-assert 576) (near-timer int32 :offset-assert 580) - (far-time time-frame :offset-assert 584) + (far-time time-frame :offset-assert 584) (y-offset float :offset-assert 592) (y-offset-desired float :offset-assert 596) (y-vel float :offset-assert 600) @@ -35872,11 +35882,11 @@ (timeout uint64 :offset-assert 608) (ambient-possible uint64 :offset-assert 616) (ambient-expire uint64 :offset-assert 624) - (can-run basic :offset-assert 632) - (on-ground basic :offset-assert 636) - (over-ground basic :offset-assert 640) - (allow-idle basic :offset-assert 644) - (path-info pegasus-path-info 20 :offset-assert 648) + (can-run symbol :offset-assert 632) + (on-ground symbol :offset-assert 636) + (over-ground symbol :offset-assert 640) + (allow-idle symbol :offset-assert 644) + (path-info pegasus-path-info 20 :inline :offset-assert 648) (previous-path int32 :offset 968) (current-path int32 :offset 972) (num-paths int32 :offset 976) @@ -35887,22 +35897,23 @@ :size-assert #x3e0 :flag-assert #x8a036003e0 (:methods - (pegasus-method-137 () none 137) + (pegasus-method-137 (_type_) none 137) ) + (:states + pegasus-debug + pegasus-tired) ) -;; (define-extern *pegasus-enemy-info* enemy-info) -;; (define-extern pegasus-draw-section function) -;; (define-extern pegasus-show-runs function) -;; (define-extern pegasus-rotate function) -;; (define-extern pegasus-loop-on-same-path function) -;; (define-extern pegasus-choose-path function) -;; (define-extern pegasus-move function) -;; (define-extern pegasus-calc-speed function) -;; (define-extern pegasus-calc-anim-speed function) -;; (define-extern pegasus-debug state) -;; (define-extern pegasus-fly-code function) -;; (define-extern pegasus-tired state) +(define-extern *pegasus-enemy-info* enemy-info) +(define-extern pegasus-draw-section (function float float rgba none :behavior pegasus)) +(define-extern pegasus-show-runs (function symbol :behavior pegasus)) +(define-extern pegasus-rotate (function symbol float none :behavior pegasus)) +(define-extern pegasus-loop-on-same-path (function none :behavior pegasus)) +(define-extern pegasus-choose-path (function symbol :behavior pegasus)) +(define-extern pegasus-move (function float symbol symbol none :behavior pegasus)) +(define-extern pegasus-calc-speed (function float float float float symbol :behavior pegasus)) +(define-extern pegasus-calc-anim-speed (function float :behavior pegasus)) +(define-extern pegasus-fly-code (function int none :behavior pegasus)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; wren ;; @@ -45210,19 +45221,39 @@ ;; skatea-obs ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype hoverboard-training-manager (process) - () + ( + (actor-group (pointer actor-group) :offset-assert 128) + (actor-group-count int32 :offset-assert 132) + (trick-type board-tricks :offset-assert 136) + (board-picked-up symbol :offset-assert 140) + (boost symbol :offset-assert 144) + (grind symbol :offset-assert 148) + (text symbol :offset-assert 152) + (score float :offset-assert 156) + (challenge-done symbol :offset-assert 160) + (arrow handle :offset-assert 168) ;; task-arrow + (minimap connection-minimap :offset-assert 176) + (hud-score handle :offset-assert 184) ;; hud-score + (hud-goal handle :offset-assert 192) ;; hud-goal + (voicebox handle :offset-assert 200) ;; voice-box + (last-sound-id sound-id :offset-assert 208) + (combo-done? symbol :offset-assert 212) + (task-gold uint16 :offset-assert 216) + (task-silver uint16 :offset-assert 218) + (task-bronze uint16 :offset-assert 220) + (game-score uint8 :offset-assert 222) + (training? symbol :offset-assert 224) + (training-goal float :offset-assert 228) + (egg-count int32 :offset-assert 232) + (medal int32 :offset-assert 236) + (gui-id sound-id :offset-assert 240) + (hint-time time-frame :offset-assert 248) + ) :method-count-assert 31 :size-assert #x100 :flag-assert #x1f00800100 - ;; Failed to read fields. (:methods - (hoverboard-training-manager-method-9 () none 9) - (hoverboard-training-manager-method-10 () none 10) - (hoverboard-training-manager-method-11 () none 11) - (hoverboard-training-manager-method-12 () none 12) - (hoverboard-training-manager-method-13 () none 13) (wait-for-pickup () _type_ :state 14) (wait-for-pickup-training () _type_ :state 15) (wait-for-board () _type_ :state 16) @@ -45237,30 +45268,26 @@ (game () _type_ :state 25) (idle () _type_ :state 26) (idle-training () _type_ :state 27) - (hoverboard-training-manager-method-28 () none 28) - (hoverboard-training-manager-method-29 () none 29) - (hoverboard-training-manager-method-30 () none 30) + (render-text (_type_ game-text-id) float 28) + (hoverboard-training-manager-method-29 (_type_) none 29) + (hoverboard-training-manager-method-30 (_type_) none 30) ) ) -|# -#| (deftype skate-training-ramp (process-focusable) - ((onoff basic :offset-assert 200) + ((onoff symbol :offset-assert 204) ) :method-count-assert 29 :size-assert #xd0 :flag-assert #x1d005000d0 (:methods (idle () _type_ :state 27) - (skate-training-ramp-method-28 () none 28) + (skate-training-ramp-method-28 (_type_) collide-shape-moving 28) ) ) -|# -#| (deftype skate-gate (process-focusable) - ((onoff basic :offset-assert 200) + ((onoff symbol :offset-assert 204) ) :method-count-assert 30 :size-assert #xd0 @@ -45268,39 +45295,32 @@ (:methods (idle () _type_ :state 27) (open () _type_ :state 28) - (open () _type_ :state 29) + (skate-gate-method-29 (_type_) collide-shape-moving 29) ) ) -|# -#| (deftype skatea-jump-pad (bouncer) () :method-count-assert 25 :size-assert #xd4 :flag-assert #x19006000d4 - (:methods - ) ) -|# -#| (deftype skatea-floating-ring (process-focusable) - ((pos-y float :offset-assert 200) - (offset float :offset-assert 204) + ((pos-y float :offset-assert 204) + (offset float :offset-assert 208) ) :method-count-assert 29 :size-assert #xd4 :flag-assert #x1d006000d4 (:methods (idle () _type_ :state 27) - (skatea-floating-ring-method-28 () none 28) + (skatea-floating-ring-method-28 (_type_) none 28) ) ) -|# -;; (define-extern trick-type-trick? function) -;; (define-extern hoverboard-training-manager-event-handler function) +(define-extern trick-type-trick? (function board-tricks symbol)) +(define-extern hoverboard-training-manager-event-handler (function process int symbol event-message-block hoverboard-training-manager :behavior hoverboard-training-manager)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ctyinda-part ;; @@ -46773,7 +46793,7 @@ (training-manager-method-27 (_type_ (array tpath-info)) symbol 27) (training-manager-method-28 (_type_) none 28) (training-manager-method-29 (_type_ vector) vector 29) - (training-manager-method-30 (_type_ game-text-id) float 30) + (render-text (_type_ game-text-id) float 30) (training-manager-method-31 (_type_) none 31) (training-manager-method-32 (_type_) none 32) ) @@ -51936,7 +51956,6 @@ ;; collection-task ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype krew-collection-item (process-drawable) () :method-count-assert 23 @@ -51945,13 +51964,12 @@ (:methods (idle () _type_ :state 20) (die () _type_ :state 21) - (krew-collection-item-method-22 () none 22) + (find-ground (_type_) symbol 22) ) ) -|# -;; (define-extern krew-collection-item-init-by-other function) -;; (define-extern krew-collection-item-spawn function) +(define-extern krew-collection-item-init-by-other (function vector krew-collection-item :behavior krew-collection-item)) +(define-extern krew-collection-item-spawn (function process vector krew-collection-item)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ctyasha-obs ;; diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index ebd76f0d73..defe88e99e 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -658,5 +658,18 @@ [9, "(function none :behavior target)"], [18, "(function surface object surface int none :behavior target)"], [19, "(function surface object surface int none :behavior target)"] + ], + "collection-task": [ + [0, "(function object :behavior task-manager)"], + [1, "(function object :behavior task-manager)"], + [2, "(function object :behavior task-manager)"], + [3, "(function object :behavior task-manager)"], + [4, "(function object :behavior task-manager)"], + [5, "(function object :behavior task-manager)"] + ], + "pegasus": [ + [0, "(function none)"], + [1, "(function none :behavior task-manager)"], + [2, "(function symbol :behavior task-manager)"] ] } diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index ce9a6f77cd..d6668f4676 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -511,23 +511,40 @@ "auto-save-post": [[158, 1]], "(method 30 training-manager)": [[53, 0]], "(trans course training-manager)": [ - [54, 1], - [89, 1], - [124, 1], - [155, 1], - [195, 1], - [230, 1], - [261, 1], - [307, 1], - [338, 1], - [374, 1], - [409, 1], - [444, 1], - [479, 1], - [510, 1] + [54, 0], + [89, 0], + [124, 0], + [155, 0], + [195, 0], + [230, 0], + [261, 0], + [307, 0], + [338, 0], + [374, 0], + [409, 0], + [444, 0], + [479, 0], + [510, 0] ], "(method 17 hud-goal)": [[71, 0]], - "(method 15 hud-miss)": [[44, 0]] + "(method 15 hud-miss)": [[44, 0]], + "(method 28 hoverboard-training-manager)": [[53, 0]], + "(method 29 hoverboard-training-manager)": [ + [48, 0], + [83, 0], + [118, 0], + [153, 0], + [184, 0], + [224, 0], + [259, 0], + [294, 0], + [325, 0], + [365, 0], + [400, 0], + [431, 0], + [477, 0], + [508, 0] + ] }, "mips2c_functions_by_name": [ diff --git a/decompiler/config/jak2/inputs.jsonc b/decompiler/config/jak2/inputs.jsonc index f92b11b4ce..104b1efc31 100644 --- a/decompiler/config/jak2/inputs.jsonc +++ b/decompiler/config/jak2/inputs.jsonc @@ -55,7 +55,7 @@ // "DGO/LPRSNCST.DGO", // "DGO/SWB.DGO", // "DGO/LPOWER.DGO", - // "DGO/FOB.DGO", + "DGO/FOB.DGO", "DGO/CIB.DGO", // "DGO/LSHUTTLE.DGO", // "DGO/LJAKDAX.DGO", @@ -151,7 +151,7 @@ "DGO/CWI.DGO", // "DGO/CTYKORA.DGO", "DGO/RUI.DGO", - // "DGO/LSACK.DGO", + "DGO/LSACK.DGO", // "DGO/CTYASHA.DGO", // "DGO/LPRTRACE.DGO", "DGO/LWIDEA.DGO", @@ -185,23 +185,28 @@ "streamed_audio_file_names": [], "levels_to_extract": [ - "PRI.DGO", + "CIB.DGO", "CTA.DGO", "CTB.DGO", "CWI.DGO", + "DMI.DGO", + "FOB.DGO", + "FOR.DGO", + "FEA.DGO", + "FEB.DGO", "GGA.DGO", + "HIDEOUT.DGO", + "KIOSK.DGO", + "LDJAKBRN.DGO", "LWIDEA.DGO", "LWIDEB.DGO", "LWIDEC.DGO", - "FEA.DGO", - "FEB.DGO", - - "LDJAKBRN.DGO", - "HIDEOUT.DGO", - "KIOSK.DGO", - "DMI.DGO", + "LSACK.DGO", + "MTN.DGO", + "PRI.DGO", "RUI.DGO", - "VI1.DGO", - "CIB.DGO" + "SKA.DGO", + "STA.DGO", + "VI1.DGO" ] } diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 450a57e084..2fdf5c4d2c 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -829,5 +829,30 @@ ["L578", "attack-info"] ], "mech": [["L106", "attack-info"]], - "target-mech": [["L210", "attack-info"]] + "target-mech": [["L210", "attack-info"]], + "skatea-obs": [ + ["L556", "vector"], + ["L542", "vector"], + ["L538", "vector"], + ["L525", "vector"], + ["L518", "vector"], + ["L516", "vector"] + ], + "collection-task": [ + ["L70", "vector"], + ["L69", "vector"], + ["L68", "vector"], + ["L67", "vector"], + ["L66", "vector"], + ["L65", "vector"], + ["L64", "vector"], + ["L63", "vector"], + ["L62", "vector"], + ["L61", "vector"], + ["L60", "vector"], + ["L59", "vector"], + ["L58", "vector"], + ["L57", "vector"], + ["L56", "vector"] + ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 3bb64ef679..b9d7098560 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -1302,5 +1302,8 @@ [672, "sphere"] ], "(code target-mech-carry-pickup)": [[16, "event-message-block"]], - "(trans target-mech-carry-drag)": [[560, "sphere"]] + "(trans target-mech-carry-drag)": [[560, "sphere"]], + "(method 22 krew-collection-item)": [[16, "collide-query-with-2vec"]], + "(code idle krew-collection-item)": [[64, "vector"]], + "pegasus-fly-code": [[96, "vector"]] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 5b1968f553..318f009fd2 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -5716,5 +5716,45 @@ [28, "v0", "sound-rpc-set-param"] ], "(trans target-mech-carry-drag)": [[73, "v1", "sphere"]], - "target-mech-carry-update": [[50, "v1", "sphere"]] + "target-mech-carry-update": [[50, "v1", "sphere"]], + "(code idle hoverboard-training-manager)": [ + [[162, 169], "v1", "handle"], + [337, "s5", "process-drawable"], + [[68, 248], "gp", "handle"], + [[266, 384], "gp", "handle"] + ], + "(code idle-training hoverboard-training-manager)": [ + [56, "gp", "handle"], + [175, "s5", "process-drawable"], + [[104, 219], "gp", "handle"] + ], + "(method 10 hoverboard-training-manager)": [ + [19, "t9", "(function process none)"] + ], + "(code fire skatea-jump-pad)": [[59, "t9", "(function none)"]], + "(method 29 hoverboard-training-manager)": [[[18, 491], "gp", "hud-goal"]], + "hoverboard-training-manager-event-handler": [ + [[32, 72], "gp", "(pointer board-tricks)"], + [12, "v1", "float"], + [25, "v1", "float"] + ], + "(method 11 hoverboard-training-manager)": [["_stack_", 16, "res-tag"]], + "(trans idle krew-collection-item)": [ + [28, "a1", "process-drawable"], + [29, "a0", "collide-shape"] + ], + "(method 56 pegasus)": [[[5, 10], "v1", "attack-info"]], + "(post idle pegasus)": [[11, "t9", "(function none)"]], + "(code notice pegasus)": [ + [53, "v1", "art-joint-anim"], + [121, "v1", "art-joint-anim"] + ], + "(code active pegasus)": [[28, "v1", "art-joint-anim"]], + "pegasus-fly-code": [ + [386, "v1", "float"], + [413, "v1", "float"] + ], + "(code die pegasus)": [[45, "v1", "art-joint-anim"]], + "pegasus-choose-path": [[114, "v1", "float"]], + "(method 115 pegasus)": [["_stack_", 16, "res-tag"]] } diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index ecca476c0b..3018835e16 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -7,7 +7,7 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. - "allowed_objects": [], + "allowed_objects": ["pegasus"], "banned_objects": ["texture-anim-tables", "traffic-engine"], //////////////////////////// diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 0a834fd60f..7dde3448d8 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -748,6 +748,11 @@ const std::unordered_map< {{"data", ArrayFieldDecompMeta(TypeSpec("int8"), 1, ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, + {"enemy-info", + {{"idle-anim-script", + ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, {"nav-enemy-info", {{"idle-anim-script", ArrayFieldDecompMeta(TypeSpec("uint32"), diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index 3c81097134..1a48a7d7d8 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -122,6 +122,11 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { init_bucket_renderer("tie-l3-tfrag", BucketCategory::TIE, BucketId::TIE_L3_TFRAG, 3); init_bucket_renderer("merc-l3-tfrag", BucketCategory::MERC, BucketId::MERC_L3_TFRAG); // 50 + init_bucket_renderer("tex-l4-tfrag", BucketCategory::TEX, + BucketId::TEX_L4_TFRAG); + init_bucket_renderer("tfrag-l4-tfrag", BucketCategory::TFRAG, BucketId::TFRAG_L4_TFRAG, + std::vector{tfrag3::TFragmentTreeKind::NORMAL}, false, 3); + init_bucket_renderer("tie-l4-tfrag", BucketCategory::TIE, BucketId::TIE_L4_TFRAG, 3); // 60 // 70 init_bucket_renderer("tex-l0-shrub", BucketCategory::TEX, @@ -139,7 +144,10 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { init_bucket_renderer("tex-l3-shrub", BucketCategory::TEX, BucketId::TEX_L3_SHRUB); init_bucket_renderer("shrub-l3-shrub", BucketCategory::SHRUB, BucketId::SHRUB_L3_SHRUB); + init_bucket_renderer("tex-l4-shrub", BucketCategory::TEX, + BucketId::TEX_L4_SHRUB); // 110 + init_bucket_renderer("shrub-l4-shrub", BucketCategory::SHRUB, BucketId::SHRUB_L4_SHRUB); // 120 init_bucket_renderer("tex-l0-alpha", BucketCategory::TEX, BucketId::TEX_L0_ALPHA); @@ -174,10 +182,15 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { init_bucket_renderer("tex-l3-pris", BucketCategory::TEX, BucketId::TEX_L3_PRIS); // 210 + init_bucket_renderer("tex-l4-pris", BucketCategory::TEX, + BucketId::TEX_L4_PRIS); + init_bucket_renderer("merc-l4-pris", BucketCategory::MERC, BucketId::MERC_L4_PRIS); // 220 init_bucket_renderer("tex-lcom-pris", BucketCategory::TEX, BucketId::TEX_LCOM_PRIS); init_bucket_renderer("merc-lcom-pris", BucketCategory::MERC, BucketId::MERC_LCOM_PRIS); + init_bucket_renderer("tex-l1-pris2", BucketCategory::TEX, + BucketId::TEX_L1_PRIS2); // 230 // 240 // 250 @@ -191,6 +204,9 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { init_bucket_renderer("tex-l1-water", BucketCategory::TEX, BucketId::TEX_L1_WATER); init_bucket_renderer("merc-l1-water", BucketCategory::MERC, BucketId::MERC_L1_WATER); + init_bucket_renderer("tfrag-w-l1-alpha", BucketCategory::TFRAG, + BucketId::TFRAG_W_L1_WATER, + std::vector{tfrag3::TFragmentTreeKind::WATER}, false, 0); // 270 init_bucket_renderer("tex-l2-water", BucketCategory::TEX, @@ -199,6 +215,9 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { init_bucket_renderer("tex-l3-water", BucketCategory::TEX, BucketId::TEX_L3_WATER); // 280 + init_bucket_renderer("tex-l4-water", BucketCategory::TEX, + BucketId::TEX_L4_WATER); + init_bucket_renderer("merc-l4-water", BucketCategory::MERC, BucketId::MERC_L4_WATER); // 290 // 300 init_bucket_renderer("tex-lcom-water", BucketCategory::TEX, diff --git a/game/graphics/opengl_renderer/buckets.h b/game/graphics/opengl_renderer/buckets.h index 366a380ff8..15823fbad4 100644 --- a/game/graphics/opengl_renderer/buckets.h +++ b/game/graphics/opengl_renderer/buckets.h @@ -100,6 +100,9 @@ enum class BucketId { TFRAG_L3_TFRAG = 41, TIE_L3_TFRAG = 42, MERC_L3_TFRAG = 47, + TEX_L4_TFRAG = 51, + TFRAG_L4_TFRAG = 52, + TIE_L4_TFRAG = 53, TEX_L0_SHRUB = 73, SHRUB_L0_SHRUB = 74, TEX_L1_SHRUB = 82, @@ -108,6 +111,8 @@ enum class BucketId { SHRUB_L2_SHRUB = 92, TEX_L3_SHRUB = 100, SHRUB_L3_SHRUB = 101, + TEX_L4_SHRUB = 109, + SHRUB_L4_SHRUB = 110, TEX_L0_ALPHA = 127, TFRAG_T_L0_ALPHA = 128, TEX_L1_ALPHA = 137, @@ -122,16 +127,22 @@ enum class BucketId { TEX_L2_PRIS = 204, MERC_L2_PRIS = 205, TEX_L3_PRIS = 208, + TEX_L4_PRIS = 212, + MERC_L4_PRIS = 213, TEX_LCOM_PRIS = 220, MERC_LCOM_PRIS = 221, + TEX_L1_PRIS2 = 228, TEX_L0_WATER = 252, MERC_L0_WATER = 253, TFRAG_W_L0_WATER = 255, TEX_L1_WATER = 261, MERC_L1_WATER = 262, + TFRAG_W_L1_WATER = 264, TEX_L2_WATER = 270, MERC_L2_WATER = 271, TEX_L3_WATER = 279, + TEX_L4_WATER = 288, + MERC_L4_WATER = 289, TEX_LCOM_WATER = 306, MERC_LCOM_WATER = 307, TEX_LCOM_SKY_POST = 309, diff --git a/game/sound/989snd/sfxgrain.cpp b/game/sound/989snd/sfxgrain.cpp index c3d12c256c..43b79cae9b 100644 --- a/game/sound/989snd/sfxgrain.cpp +++ b/game/sound/989snd/sfxgrain.cpp @@ -106,8 +106,8 @@ s32 SFXGrain_LfoSettings::execute(blocksound_handler& handler) { lfo.m_next_step = m_lfop.start_offset << 16; } - lg::info("starting LFO type {} for {}", magic_enum::enum_name(lfo.m_type), - magic_enum::enum_name(lfo.m_target)); + // lg::info("starting LFO type {} for {}", magic_enum::enum_name(lfo.m_type), + // magic_enum::enum_name(lfo.m_target)); lfo.init(); } else { lfo.m_type = lfo_type::OFF; diff --git a/goal_src/jak2/engine/collide/collide.gc b/goal_src/jak2/engine/collide/collide.gc index ff66f2c230..efb57e5fb8 100644 --- a/goal_src/jak2/engine/collide/collide.gc +++ b/goal_src/jak2/engine/collide/collide.gc @@ -11,6 +11,14 @@ (vec vector :inline)) ) +(deftype collide-query-with-2vec (structure) + "A custom type added because of weirdness discovered in krew-collection-item::22" + ((cquery collide-query :inline) + (vec vector :inline) + (vec2 vector :inline) + ) + ) + ;; this is some vif setup stuff that was in jak 1 as well - some code in collide-cache ;; uses VIF's unpack/upload to modify collision data. This gets ported to c++, just ;; keeping it here for reference. diff --git a/goal_src/jak2/engine/game/pilot-h.gc b/goal_src/jak2/engine/game/pilot-h.gc index f6727c2e51..5507f41814 100644 --- a/goal_src/jak2/engine/game/pilot-h.gc +++ b/goal_src/jak2/engine/game/pilot-h.gc @@ -19,9 +19,10 @@ :flag-assert #x900000010 ) + (deftype pilot-info (basic) ((entity basic :offset-assert 4) - (vehicle uint64 :offset-assert 8) + (vehicle handle :offset-assert 8) (left-right-interp float :offset-assert 16) (front-back-interp float :offset-assert 20) (up-down-interp float :offset-assert 24) @@ -47,4 +48,4 @@ :method-count-assert 9 :size-assert #x120 :flag-assert #x900000120 - ) \ No newline at end of file + ) diff --git a/goal_src/jak2/engine/game/task/game-task.gc b/goal_src/jak2/engine/game/task/game-task.gc index 8dc7520cae..e062c11ee0 100644 --- a/goal_src/jak2/engine/game/task/game-task.gc +++ b/goal_src/jak2/engine/game/task/game-task.gc @@ -3425,7 +3425,7 @@ :borrow '() :open? #f :on-close #f - :description (game-text-id text-x244) + :description (game-text-id board-score-return-to-garage) ) (new 'static 'game-task-node-info :level 'stadium diff --git a/goal_src/jak2/engine/game/task/task-control-h.gc b/goal_src/jak2/engine/game/task/task-control-h.gc index 2b195a92ab..b29bb347a6 100644 --- a/goal_src/jak2/engine/game/task/task-control-h.gc +++ b/goal_src/jak2/engine/game/task/task-control-h.gc @@ -254,6 +254,10 @@ ;; NOTE - for progress (define-extern restart-mission (function int)) +(declare-type game-task-node-info basic) +(declare-type task-manager process) +(define-extern task-manager-init-by-other (function game-task-node-info symbol object :behavior task-manager)) + ;; DECOMP BEGINS (defun-debug game-task->string ((arg0 game-task)) @@ -1442,37 +1446,37 @@ (deftype task-manager (process) - ((node-info game-task-node-info :offset-assert 128) - (info task-manager-info :offset-assert 132) - (lev-name symbol :offset-assert 136) - (fail-on-death? symbol :offset-assert 140) - (fail-now symbol :offset-assert 144) - (retry-now symbol :offset-assert 148) - (allow-fail symbol :offset-assert 152) - (state-time time-frame :offset-assert 160) - (count int16 :offset-assert 168) - (max-count int16 :offset-assert 170) - (sub-state uint32 :offset-assert 172) - (slave handle 32 :offset-assert 176) - (arrow handle :offset-assert 432) - (link uint32 :offset-assert 440) - (start-time time-frame :offset-assert 448) - (total-time time-frame :offset-assert 456) - (beep-time time-frame :offset-assert 464) - (time-limit time-frame :offset-assert 472) - (begin-pos vector :inline :offset-assert 480) - (end-pos vector :inline :offset-assert 496) - (data-int8 int8 32 :offset-assert 512) - (data-int32 int32 32 :offset-assert 544) - (data-float float 32 :offset-assert 672) - (data-vector vector 32 :inline :offset-assert 800) - (actor-group uint32 4 :offset-assert 1312) - (minimap uint32 8 :offset-assert 1328) - (hud handle 4 :offset-assert 1360) - (hud-timer handle :offset 1360) - (hud-counter handle :offset 1368) - (sound-id sound-id 4 :offset-assert 1392) - (intro-time time-frame :offset-assert 1408) + ((node-info game-task-node-info :offset-assert 128) + (info task-manager-info :offset-assert 132) + (lev-name symbol :offset-assert 136) + (fail-on-death? symbol :offset-assert 140) + (fail-now symbol :offset-assert 144) + (retry-now symbol :offset-assert 148) + (allow-fail symbol :offset-assert 152) + (state-time time-frame :offset-assert 160) + (count int16 :offset-assert 168) + (max-count int16 :offset-assert 170) + (sub-state uint32 :offset-assert 172) + (slave handle 32 :offset-assert 176) + (arrow handle :offset-assert 432) + (link uint32 :offset-assert 440) + (start-time time-frame :offset-assert 448) + (total-time time-frame :offset-assert 456) + (beep-time time-frame :offset-assert 464) + (time-limit time-frame :offset-assert 472) + (begin-pos vector :inline :offset-assert 480) + (end-pos vector :inline :offset-assert 496) + (data-int8 int8 32 :offset-assert 512) + (data-int32 int32 32 :offset-assert 544) + (data-float float 32 :offset-assert 672) + (data-vector vector 32 :inline :offset-assert 800) + (actor-group (pointer entity-actor) 4 :offset-assert 1312) + (minimap uint32 8 :offset-assert 1328) + (hud handle 4 :offset-assert 1360) + (hud-timer handle :offset 1360) + (hud-counter handle :offset 1368) + (sound-id sound-id 4 :offset-assert 1392) + (intro-time time-frame :offset-assert 1408) ) :heap-base #x510 :method-count-assert 23 @@ -1510,6 +1514,3 @@ (define *traffic-engine* (the-as object #f)) - -(define-extern task-manager-init-by-other (function game-task-node-info symbol object :behavior task-manager)) - diff --git a/goal_src/jak2/engine/game/task/task-control.gc b/goal_src/jak2/engine/game/task/task-control.gc index 4feea34a96..c36d5fb7fd 100644 --- a/goal_src/jak2/engine/game/task/task-control.gc +++ b/goal_src/jak2/engine/game/task/task-control.gc @@ -1904,7 +1904,7 @@ (set! (-> obj minimap v1-8) (the-as uint #f)) ) (countdown (v1-11 4) - (set! (-> obj actor-group v1-11) (the-as uint #f)) + (set! (-> obj actor-group v1-11) (the-as (pointer entity-actor) #f)) ) (set! (-> obj fail-now) #f) (set! (-> obj retry-now) #f) diff --git a/goal_src/jak2/engine/ui/hud-classes.gc b/goal_src/jak2/engine/ui/hud-classes.gc index d52c020d0d..1f322b1334 100644 --- a/goal_src/jak2/engine/ui/hud-classes.gc +++ b/goal_src/jak2/engine/ui/hud-classes.gc @@ -742,7 +742,7 @@ (gp-1 (clear (-> obj strings 1 text))) (s4-0 "~S") ) - (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id text-x235) #f)) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-goal) #f)) (s5-0 gp-1 s4-0 *temp-string*) ) 0 diff --git a/goal_src/jak2/engine/ui/text-id-h.gc b/goal_src/jak2/engine/ui/text-id-h.gc index 96d9f52bc7..de69d080a6 100644 --- a/goal_src/jak2/engine/ui/text-id-h.gc +++ b/goal_src/jak2/engine/ui/text-id-h.gc @@ -328,39 +328,39 @@ (progress-locations-dig #x221) (progress-locations-underport #x222) (progress-locations-nest #x223) - (text-x224 #x0224) - (text-x225 #x0225) - (text-x226 #x0226) - (text-x227 #x0227) - (text-x228 #x0228) - (text-x229 #x0229) - (text-x22a #x022a) - (text-x22b #x022b) - (text-x22c #x022c) - (text-x22d #x022d) - (gungame-red-prompt #x022e) - (gungame-red-or-blue-prompt #x022f) - (text-x230 #x0230) - (gungame-yellow-prompt #x0231) - (gungame-yellow-or-purple-prompt #x0232) - (text-x233 #x0233) - (text-x234 #x0234) - (text-x235 #x0235) - (text-x236 #x0236) - (text-x237 #x0237) - (text-x238 #x0238) - (text-x239 #x0239) - (text-x23a #x023a) - (text-x23b #x023b) - (text-x23c #x023c) - (text-x23d #x023d) - (text-x23e #x023e) - (text-x23f #x023f) - (text-x240 #x0240) - (text-x241 #x0241) - (text-x242 #x0242) - (text-x243 #x0243) - (text-x244 #x0244) + (tutorial-jump #x0224) + (tutorial-roll #x0225) + (tutorial-double-jump #x0226) + (tutorial-basic-attack #x0227) + (tutorial-rolljump #x0228) + (tutorial-ground-pound #x0229) + (tutorial-high-jump #x022a) + (gungame-tutorial-fire-button #x022b) + (gungame-tutorial-put-red-away #x022c) + (gungame-tutorial-take-red-out #x022d) + (gungame-prompt-red #x022e) + (gungame-prompt-red-or-blue #x022f) + (gungame-tutorial-switch-to-yellow #x0230) + (gungame-prompt-yellow #x0231) + (gungame-prompt-yellow-or-purple #x0232) + (gungame-tutorial-kick-combo #x0233) + (gungame-tutorial-shoot-the-crates #x0234) + (highscore-text-goal #x0235) + (highscore-text-gold #x0236) + (highscore-text-silver #x0237) + (highscore-text-bronze #x0238) + (board-tutorial-get-on-board #x0239) + (board-tutorial-jump #x023a) + (board-tutorial-duck-jump #x023b) + (board-tutorial-boost-jump #x023c) + (board-tutorial-grind #x023d) + (board-tutorial-spin #x023e) + (board-tutorial-flip #x023f) + (board-tutorial-trick #x0240) + (board-score-grind-and-trick #x0241) + (board-score-activate-judge #x0242) + (board-score-try-again #x0243) ;; TODO only for board? + (board-score-return-to-garage #x0244) (text-x245 #x0245) (text-x246 #x0246) (text-x247 #x0247) diff --git a/goal_src/jak2/game.gp b/goal_src/jak2/game.gp index 0948119048..aa0254b6bd 100644 --- a/goal_src/jak2/game.gp +++ b/goal_src/jak2/game.gp @@ -2090,20 +2090,15 @@ ;; ;; FOB ;; ;;;;;;;;;;;;;;;;;;;;; -;; (cgo "FOB.DGO" "fob.gd") +(cgo "FOB.DGO" "fob.gd") -;; (copy-textures 2280 2574 2281 3262 3417) +(copy-textures 2280 2574 2281 3262 3417) -;; (copy-gos -;; "youngsamos-forestb+0-ag" -;; "daxter-highres-ag" -;; "youngsamos-highres-ag" -;; "jak-highres-ag" -;; "crimson-guard-hover-ag" -;; "transport-ag" -;; "life-seed-ag" -;; "forestb-vis" -;; ) +(copy-gos + "youngsamos-forestb+0-ag" + "youngsamos-highres-ag" + "forestb-vis" + ) ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; FOR @@ -3066,20 +3061,20 @@ ;; ;; LSACK ;; ;;;;;;;;;;;;;;;;;;;;; -;; (cgo "LSACK.DGO" "lsack.gd") +(cgo "LSACK.DGO" "lsack.gd") -;; (goal-src-sequence -;; "" -;; :deps ("$OUT/obj/los-control.o") -;; "levels/city/misc/collection_task/collection-task.gc" -;; ) +(goal-src-sequence + "" + :deps ("$OUT/obj/los-control.o") + "levels/city/misc/collection_task/collection-task.gc" + ) -;; (copy-textures 2605) +(copy-textures 2605) -;; (copy-gos -;; "krew-moneybag-ag" -;; "lsack" -;; ) +(copy-gos + "krew-moneybag-ag" + "lsack" + ) ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; LSAMERGD diff --git a/goal_src/jak2/levels/city/misc/collection_task/collection-task.gc b/goal_src/jak2/levels/city/misc/collection_task/collection-task.gc index 2d24afd208..8e0d4f9340 100644 --- a/goal_src/jak2/levels/city/misc/collection_task/collection-task.gc +++ b/goal_src/jak2/levels/city/misc/collection_task/collection-task.gc @@ -7,3 +7,373 @@ ;; DECOMP BEGINS +(defmethod draw hud-moneybag ((obj hud-moneybag)) + (set-hud-piece-position! + (the-as hud-sprite (-> obj sprites)) + (the int (+ 462.0 (* 130.0 (-> obj offset)))) + 210 + ) + (format (clear (-> obj strings 0 text)) "~D" (-> obj values 0 current)) + (set-as-offset-from! (the-as hud-sprite (-> obj strings 0 pos)) (the-as vector4w (-> obj sprites)) -25 25) + ((method-of-type hud draw) obj) + 0 + (none) + ) + +(defmethod update-values hud-moneybag ((obj hud-moneybag)) + (set! (-> obj values 0 target) (the int (-> *game-info* counter))) + ((method-of-type hud update-values) obj) + 0 + (none) + ) + +(defmethod init-callback hud-moneybag ((obj hud-moneybag)) + (set! (-> obj level) (level-get *level* 'ctywide)) + (set! (-> obj gui-id) + (add-process *gui-control* obj (gui-channel hud-middle-right) (gui-action hidden) (-> obj name) 81920.0 0) + ) + (logior! (-> obj flags) (hud-flags show)) + (set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x7 :page #x679))) + (set! (-> obj sprites 0 flags) (the-as uint 4)) + (set! (-> obj sprites 0 scale-x) 1.2) + (set! (-> obj sprites 0 scale-y) 1.2) + (alloc-string-if-needed obj 0) + (set! (-> obj strings 0 scale) 0.6) + (set! (-> obj strings 0 flags) (font-flags kerning middle large)) + 0 + (none) + ) + +(defskelgroup skel-krew-collection-item krew-moneybag 0 3 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :shadow 2 + ) + +(deftype krew-collection-item (process-drawable) + () + :heap-base #x50 + :method-count-assert 23 + :size-assert #xc8 + :flag-assert #x17005000c8 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + (find-ground (_type_) symbol 22) + ) + ) + + +(defmethod find-ground krew-collection-item ((obj krew-collection-item)) + (let ((s4-0 #f)) + (let ((gp-0 (new 'stack-no-clear 'collide-query-with-2vec))) + (set! (-> gp-0 vec quad) (-> obj root trans quad)) + (set! (-> gp-0 cquery start-pos quad) (-> gp-0 vec quad)) + (vector-reset! (-> gp-0 vec2)) + (set! (-> gp-0 vec2 y) 1.0) + (set-vector! (-> gp-0 cquery move-dist) 0.0 -40960.0 0.0 1.0) + (let ((v1-5 (-> gp-0 cquery))) + (set! (-> v1-5 radius) 1024.0) + (set! (-> v1-5 collide-with) (collide-spec backgnd)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (let ((f0-6 (fill-and-probe-using-line-sphere *collide-cache* (-> gp-0 cquery)))) + (when (>= f0-6 0.0) + (vector+float*! (-> gp-0 vec) (-> gp-0 cquery start-pos) (-> gp-0 cquery move-dist) f0-6) + (set! (-> gp-0 vec2 quad) (-> gp-0 cquery best-other-tri normal quad)) + (set! (-> gp-0 vec y) (+ 4915.2 (-> gp-0 vec y))) + (set! s4-0 #t) + (format #t "krew-collection-item::find-ground: ground y ~M~%" (-> gp-0 vec y)) + ) + ) + (set! (-> obj root trans quad) (-> gp-0 vec quad)) + (forward-up-nopitch->quaternion (-> obj root quat) (new 'static 'vector :z 1.0 :w 1.0) (-> gp-0 vec2)) + ) + s4-0 + ) + ) + +(defstate idle (krew-collection-item) + :virtual #t + :trans (behavior () + (let ((v1-0 *target*) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (when v1-0 + (set! (-> gp-0 quad) (-> v1-0 control trans quad)) + (set! (-> gp-0 w) 4096.0) + (when (logtest? (focus-status pilot) (-> v1-0 focus-status)) + (let ((a1-4 (handle->process (-> v1-0 pilot vehicle)))) + (set! (-> gp-0 quad) + (-> (the-as collide-shape (-> (the-as process-drawable a1-4) root)) root-prim prim-core world-sphere quad) + ) + ) + ) + (let ((f0-1 (vector-vector-distance-squared (-> self root trans) gp-0)) + (f1-1 (+ 12288.0 (-> gp-0 w))) + ) + (when (>= (* f1-1 f1-1) f0-1) + (sound-play "skill-pickup") + (set! (-> *game-info* counter) (+ -1.0 (-> *game-info* counter))) + (go-virtual die) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'task-arrow-params))) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 quad) (-> self root trans quad)) + (set! (-> v1-0 y) (+ -6144.0 (-> v1-0 y))) + (set! (-> gp-0 pos quad) (-> v1-0 quad)) + ) + (quaternion-identity! (-> gp-0 quat)) + (set! (-> gp-0 flags) (task-arrow-flags)) + (set! (-> gp-0 map-icon) (the-as uint 15)) + (task-arrow-spawn gp-0 (the-as task-arrow self)) + ) + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior krew-collection-item) ja-post) + ) + +(defstate die (krew-collection-item) + :virtual #t + :code (behavior () + (cleanup-for-death self) + (none) + ) + ) + +;; WARN: Return type mismatch object vs krew-collection-item. +(defbehavior krew-collection-item-init-by-other krew-collection-item ((arg0 vector)) + (set! (-> self level) (level-get *level* 'lsack)) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg0 quad)) + (quaternion-identity! (-> self root quat)) + (set-vector! (-> self root scale) 3.0 3.0 3.0 1.0) + (initialize-skeleton + self + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-krew-collection-item" (the-as (pointer uint32) #f)) + ) + (the-as pair 0) + ) + (if (-> self draw shadow) + (set! (-> self draw shadow-ctrl) + (new 'process 'shadow-control -12288.0 12288.0 614400.0 (shadow-flags shdf00 shdf04) 245760.0) + ) + ) + (the-as krew-collection-item (go-virtual idle)) + ) + +;; WARN: Return type mismatch process vs krew-collection-item. +(defun krew-collection-item-spawn ((arg0 process) (arg1 vector)) + (let ((gp-0 (the-as process #f))) + (let ((v1-1 (process-spawn krew-collection-item arg1 :to arg0))) + (if v1-1 + (set! gp-0 (-> v1-1 0)) + ) + ) + (the-as krew-collection-item gp-0) + ) + ) + +(set-subtask-hook! + *game-info* + 73 + 0 + (lambda :behavior task-manager + () + (set! (-> self begin-pos quad) (-> (new 'static 'vector :x -245760.0 :y 45056.0 :z 5468160.0 :w 1.0) quad)) + (set-setting! 'exclusive-task #f 0 (-> self node-info task)) + (let ((gp-0 *traffic-manager*) + (s5-0 (new 'stack 'traffic-object-spawn-params)) + ) + (set! (-> s5-0 position quad) (-> self begin-pos quad)) + (quaternion-axis-angle! (-> s5-0 rotation) 0.0 1.0 0.0 16384.0) + (set! (-> s5-0 object-type) (the-as uint 13)) + (set! (-> s5-0 behavior) (the-as uint 0)) + (set! (-> s5-0 id) (the-as uint 0)) + (set! (-> s5-0 proc) #f) + (send-event gp-0 'spawn-object s5-0) + ) + (set! (-> self start-time) 0) + (set! (-> self count) -1) + (set! (-> self max-count) 14) + (set! (-> self data-vector 0 quad) + (-> (new 'static 'vector :x 1282048.0 :y 37925.273 :z 5492736.0 :w 1.0) quad) + ) + (set! (-> self data-vector 1 quad) + (-> (new 'static 'vector :x 2392064.0 :y 23235.379 :z 5980160.0 :w 1.0) quad) + ) + (set! (-> self data-vector 2 quad) + (-> (new 'static 'vector :x 3231744.0 :y 38680.984 :z 4788224.0 :w 1.0) quad) + ) + (set! (-> self data-vector 3 quad) + (-> (new 'static 'vector :x 3829760.0 :y 38680.984 :z 3682304.0 :w 1.0) quad) + ) + (set! (-> self data-vector 4 quad) + (-> (new 'static 'vector :x 4325376.0 :y 38680.984 :z 2564096.0 :w 1.0) quad) + ) + (set! (-> self data-vector 5 quad) + (-> (new 'static 'vector :x 4014080.0 :y 38680.984 :z 1822720.0 :w 1.0) quad) + ) + (set! (-> self data-vector 6 quad) + (-> (new 'static 'vector :x 3698688.0 :y 38680.984 :z 1728512.0 :w 1.0) quad) + ) + (set! (-> self data-vector 7 quad) + (-> (new 'static 'vector :x 3792896.0 :y 38680.984 :z 2387968.0 :w 1.0) quad) + ) + (set! (-> self data-vector 8 quad) + (-> (new 'static 'vector :x 4616192.0 :y 38680.984 :z 2863104.0 :w 1.0) quad) + ) + (set! (-> self data-vector 9 quad) + (-> (new 'static 'vector :x 3633152.0 :y 38680.984 :z 3477504.0 :w 1.0) quad) + ) + (set! (-> self data-vector 10 quad) + (-> (new 'static 'vector :x 3993600.0 :y 38680.984 :z 4378624.0 :w 1.0) quad) + ) + (set! (-> self data-vector 11 quad) + (-> (new 'static 'vector :x 3112960.0 :y 23472.947 :z 5390336.0 :w 1.0) quad) + ) + (set! (-> self data-vector 12 quad) + (-> (new 'static 'vector :x 1789952.0 :y 37616.027 :z 5455872.0 :w 1.0) quad) + ) + (set! (-> self data-vector 13 quad) + (-> (new 'static 'vector :x 237568.0 :y 37541.477 :z 5439488.0 :w 1.0) quad) + ) + (set! (-> self data-int32 0) #x2904) + (set! (-> self data-int32 1) 9000) + (set! (-> self data-int32 2) 9000) + (set! (-> self data-int32 3) 9000) + (set! (-> self data-int32 4) 9000) + (set! (-> self data-int32 5) 9000) + (set! (-> self data-int32 6) 3000) + (set! (-> self data-int32 7) 6000) + (set! (-> self data-int32 8) 9000) + (set! (-> self data-int32 9) 9000) + (set! (-> self data-int32 10) 9000) + (set! (-> self data-int32 11) 9000) + (set! (-> self data-int32 12) 7500) + (set! (-> self data-int32 13) 7500) + (let ((f0-1 (the float (-> self max-count)))) + (set! (-> *game-info* counter) f0-1) + (the-as object f0-1) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 73 + 1 + (lambda :behavior task-manager () (send-event *traffic-manager* 'restore-default-settings)) + ) + +(set-subtask-hook! + *game-info* + 73 + 2 + (lambda :behavior task-manager + () + (check-time self) + (when (>= (-> self count) 0) + (cond + ((handle->process (-> self slave 0)) + #f + ) + (else + (let ((gp-0 (-> self count))) + (cond + ((< gp-0 (-> self max-count)) + (let ((a0-6 (krew-collection-item-spawn self (-> self data-vector gp-0)))) + (when a0-6 + (set! (-> self slave 0) (process->handle a0-6)) + (set! (-> self time-limit) (the-as time-frame (-> self data-int32 gp-0))) + (set! (-> self start-time) (-> self clock frame-counter)) + (let ((v0-1 (the-as object (+ (-> self count) 1)))) + (set! (-> self count) (the-as int v0-1)) + v0-1 + ) + ) + ) + ) + (else + (go-virtual complete) + ) + ) + ) + ) + ) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 73 + 3 + (lambda :behavior task-manager + () + (local-vars (v1-2 symbol)) + (until (or v1-2 (and *target* (logtest? (focus-status pilot) (-> *target* focus-status)))) + (suspend) + (let ((f0-0 122880.0)) + (set! v1-2 (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)))) + ) + ) + (set-setting! 'airlock #f 0 0) + (set! (-> self count) 0) + (set! (-> self hud-counter) + (ppointer->handle (process-spawn hud-moneybag :init hud-init-by-other :to *target*)) + ) + (send-event *traffic-manager* 'set-target-level #x3f800000) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (suspend) + ) + (send-event *traffic-manager* 'set-alert-level 2) + (send-event *traffic-manager* 'set-alert-duration #xa4cb80) + ) + ) + +(set-subtask-hook! + *game-info* + 73 + 5 + (lambda :behavior task-manager () (the-as object (kill-all-children self))) + ) + +(set-subtask-hook! + *game-info* + 73 + 4 + (lambda :behavior task-manager + () + (send-event *traffic-manager* 'decrease-alert-level 0) + (send-event *traffic-manager* 'set-alert-duration 9000) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (suspend) + ) + (the-as object (talker-spawn-func (-> *talker-speech* 88) *entity-pool* (target-pos 0) (the-as region #f))) + ) + ) diff --git a/goal_src/jak2/levels/forest/pegasus.gc b/goal_src/jak2/levels/forest/pegasus.gc index e898c4aa8e..500743cb58 100644 --- a/goal_src/jak2/levels/forest/pegasus.gc +++ b/goal_src/jak2/levels/forest/pegasus.gc @@ -7,3 +7,1508 @@ ;; DECOMP BEGINS +(deftype pegasus-path-info (structure) + ((num-data int32 :offset-assert 0) + (path-data curve-control :offset-assert 4) + (control-data (pointer float) :offset-assert 8) + ) + :allow-misaligned + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(deftype pegasus (enemy) + ((curve-position float :offset-assert 532) + (speed float :offset-assert 536) + (facing vector :inline :offset-assert 544) + (tangent vector :inline :offset-assert 560) + (run-blend-interp float :offset-assert 576) + (near-timer int32 :offset-assert 580) + (far-time time-frame :offset-assert 584) + (y-offset float :offset-assert 592) + (y-offset-desired float :offset-assert 596) + (y-vel float :offset-assert 600) + (water-height float :offset-assert 604) + (timeout uint64 :offset-assert 608) + (ambient-possible uint64 :offset-assert 616) + (ambient-expire uint64 :offset-assert 624) + (can-run symbol :offset-assert 632) + (on-ground symbol :offset-assert 636) + (over-ground symbol :offset-assert 640) + (allow-idle symbol :offset-assert 644) + (path-info pegasus-path-info 20 :inline :offset-assert 648) + (previous-path int32 :offset 968) + (current-path int32 :offset 972) + (num-paths int32 :offset 976) + (display-path int32 :offset 980) + (targetted-timer uint64 :offset 984) + ) + :heap-base #x360 + :method-count-assert 138 + :size-assert #x3e0 + :flag-assert #x8a036003e0 + (:methods + (pegasus-method-137 (_type_) none 137) + ) + (:states + pegasus-debug + pegasus-tired + ) + ) + + +(defskelgroup skel-pegasus pegasus 0 5 + ((1 (meters 20)) (2 (meters 40)) (3 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :shadow 4 + ) + +(define *pegasus-enemy-info* (new 'static 'enemy-info + :use-die-falling #f + :use-victory #f + :use-jump-blocked #f + :debug-draw-neck #f + :jump-debug-draw #f + :move-to-ground #f + :hover-if-no-ground #f + :idle-anim-script (new 'static 'array uint32 4 #x1010501 #x0 #x0 #x0) + :idle-anim 5 + :notice-anim 6 + :hostile-anim 8 + :hit-anim 5 + :knocked-anim -1 + :knocked-land-anim -1 + :die-anim 15 + :die-falling-anim -1 + :victory-anim -1 + :jump-wind-up-anim -1 + :jump-in-air-anim -1 + :jump-land-anim -1 + :neck-joint -1 + :sound-die (static-sound-name "pegasus-die") + :notice-distance (meters 45) + :notice-distance-delta (meters 30) + :proximity-notice-distance (meters 55) + :default-hit-points 6 + :gnd-collide-with (collide-spec backgnd) + :overlaps-others-collide-with-filter (collide-spec jak bot player-list) + :movement-gravity (meters -100) + :friction 0.8 + :attack-shove-back (meters 3) + :attack-shove-up (meters 2) + :attack-mode 'generic + :attack-damage 2 + :jump-height-min (meters 3) + :jump-height-factor 0.5 + :knocked-seek-ry-clamp 2730.6667 + :knocked-soft-vxz-lo 72089.6 + :knocked-soft-vxz-hi 108134.4 + :knocked-soft-vy-lo 81920.0 + :knocked-soft-vy-hi 122880.0 + :knocked-medium-vxz-lo 147456.0 + :knocked-medium-vxz-hi 196608.0 + :knocked-medium-vy-lo 135168.0 + :knocked-medium-vy-hi 151552.0 + :knocked-hard-vxz-lo 78643.2 + :knocked-hard-vxz-hi 117964.8 + :knocked-hard-vy-lo 183500.8 + :knocked-hard-vy-hi 209715.2 + :knocked-huge-vxz-lo 164659.2 + :knocked-huge-vxz-hi 249036.8 + :knocked-huge-vy-lo 183500.8 + :knocked-huge-vy-hi 217907.2 + :knocked-yellow-vxz-lo 40960.0 + :knocked-yellow-vxz-hi 49152.0 + :knocked-yellow-vy-lo 57344.0 + :knocked-yellow-vy-hi 81920.0 + :knocked-red-vxz-lo 24576.0 + :knocked-red-vxz-hi 196608.0 + :knocked-red-vy-lo 94208.0 + :knocked-red-vy-hi 151552.0 + :knocked-blue-vxz-lo 40960.0 + :knocked-blue-vxz-hi 49152.0 + :knocked-blue-vy-lo 24576.0 + :knocked-blue-vy-hi 81920.0 + :shadow-size (meters 1) + :shadow-max-y (meters 1) + :shadow-min-y (meters -1) + :shadow-locus-dist (meters 150) + :gem-joint 9 + :gem-seg #x2 + :gem-no-seg #x4 + :gem-offset (new 'static 'sphere :y 942.08 :z 40.96 :r 163840.0) + ) + ) + +(set! (-> *pegasus-enemy-info* fact-defaults) *fact-info-enemy-defaults*) + +(defmethod run-logic? pegasus ((obj pegasus)) + (let ((f0-0 491520.0)) + (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> obj root-override2 trans) (camera-pos))) + ((method-of-type enemy run-logic?) obj) + #t + ) + ) + ) + +(defmethod pegasus-method-137 pegasus ((obj pegasus)) + (with-pp + (let ((v1-0 *target*)) + (when (and v1-0 (-> v1-0 gun active?)) + (let ((a1-0 (new 'stack-no-clear 'vector)) + (a0-4 (new 'stack-no-clear 'vector)) + ) + (vector-! a1-0 (-> obj root-override2 trans) (-> v1-0 gun fire-point)) + (vector+float*! a0-4 (-> v1-0 gun fire-point) (-> v1-0 gun fire-dir-out) (vector-length a1-0)) + (let ((f0-1 (vector-vector-distance-squared a0-4 (-> obj root-override2 trans))) + (f1-0 20480.0) + ) + (if (< f0-1 (* f1-0 f1-0)) + (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch int vs enemy-aware. +(defmethod enemy-method-57 pegasus ((obj pegasus) (arg0 process-focusable) (arg1 enemy-best-focus)) + (with-pp + (the-as + enemy-aware + (if (>= (- (-> pp clock frame-counter) (the-as int (-> obj targetted-timer))) (seconds 5)) + (the-as int ((method-of-type enemy enemy-method-57) obj arg0 arg1)) + 4 + ) + ) + ) + ) + +(defmethod enemy-method-74 pegasus ((obj pegasus) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) + (with-pp + (case arg2 + (('track) + ) + (('hit 'hit-knocked) + (cond + ((zero? (-> obj hit-points)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (enemy-method-73 obj) + ) + (else + (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) + ) + ) + ) + (else + ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ) + ) + (none) + ) + ) + +(defmethod enemy-method-56 pegasus ((obj pegasus) (arg0 process) (arg1 event-message-block)) + (with-pp + (let ((v0-0 1)) + (let ((v1-0 (the-as object (-> arg1 param 1)))) + (case (-> arg1 message) + (('attack) + (if (and (logtest? (-> (the-as attack-info v1-0) mask) (attack-info-mask mode)) + (= (-> (the-as attack-info v1-0) mode) 'board) + ) + (set! v0-0 (-> obj hit-points)) + ) + ) + ) + ) + (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) + v0-0 + ) + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defbehavior pegasus-draw-section pegasus ((arg0 float) (arg1 float) (arg2 rgba)) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (get-point-at-percent-along-path! (-> self path-info (-> self current-path) path-data) gp-0 arg0 'interp) + (get-point-at-percent-along-path! (-> self path-info (-> self current-path) path-data) s5-0 arg1 'interp) + (add-debug-line #t (bucket-id debug-no-zbuf1) gp-0 s5-0 arg2 #f (the-as rgba -1)) + ) + (none) + ) + +;; WARN: Return type mismatch none vs symbol. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 43] +(defbehavior pegasus-show-runs pegasus () + (the-as symbol (when *display-path-marks* + (when (cpad-pressed? 0 up) + (+! (-> self display-path) 1) + (if (>= (-> self display-path) (-> self num-paths)) + (set! (-> self display-path) -1) + ) + ) + (when (cpad-pressed? 0 down) + (+! (-> self display-path) -1) + (if (< (-> self display-path) -1) + (set! (-> self display-path) (+ (-> self num-paths) -1)) + ) + ) + (cond + ((< (-> self display-path) 0) + (countdown (gp-0 20) + (let ((a0-1 (-> self path-info gp-0 path-data))) + (if a0-1 + (debug-draw a0-1) + ) + ) + ) + #f + ) + (else + (format + *stdcon* + "~A old-path ~D can run ~A at ~D ~F~%" + (-> self name) + (-> self previous-path) + (-> self can-run) + (-> self current-path) + (-> self curve-position) + ) + (format *stdcon* "~A showing path ~D~%" (-> self name) (-> self display-path)) + (let ((a0-4 (-> self path-info (-> self display-path) path-data))) + (if a0-4 + (debug-draw a0-4) + ) + ) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch vector vs none. +(defbehavior pegasus-rotate pegasus ((arg0 symbol) (arg1 float)) + (let ((s5-0 (new 'stack-no-clear 'matrix)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (displacement-between-points-at-percent-normalized! + (-> self path-info (-> self current-path) path-data) + (-> self tangent) + (-> self curve-position) + ) + (cond + ((and arg0 *target*) + (vector-! gp-0 (-> self root-override2 trans) (target-pos 0)) + (vector-normalize! gp-0 1.0) + ) + ((= (-> self speed) 0.0) + (set! (-> gp-0 quad) (-> self facing quad)) + ) + ((< (-> self speed) 0.0) + (vector-negate! gp-0 (-> self tangent)) + ) + (else + (set! (-> gp-0 quad) (-> self tangent quad)) + ) + ) + (matrix-from-two-vectors-max-angle-partial! s5-0 (-> self facing) gp-0 arg1 0.25) + (vector-matrix*! gp-0 (-> self facing) s5-0) + (vector-normalize! gp-0 1.0) + (forward-down->inv-matrix s5-0 gp-0 (new 'static 'vector :y -1.0)) + (matrix->quaternion (-> self root-override2 quat) s5-0) + (set! (-> self run-blend-interp) (acos (vector-dot gp-0 (-> self facing)))) + (set! (-> self run-blend-interp) (* 0.0002746582 (-> self run-blend-interp))) + (if (< (vector-dot (-> self facing) (the-as vector (-> s5-0 vector))) 0.0) + (set! (-> self run-blend-interp) (- (-> self run-blend-interp))) + ) + (set! (-> self facing quad) (-> gp-0 quad)) + ) + (none) + ) + +;; WARN: Return type mismatch float vs none. +(defbehavior pegasus-loop-on-same-path pegasus () + (cond + ((< 100.0 (-> self curve-position)) + (set! (-> self curve-position) 1.0) + ) + ((< (-> self curve-position) -100.0) + (set! (-> self curve-position) 0.0) + ) + ((< 1.0 (-> self curve-position)) + (set! (-> self curve-position) (+ -1.0 (-> self curve-position))) + ) + ((< (-> self curve-position) 0.0) + (set! (-> self curve-position) (+ 1.0 (-> self curve-position))) + ) + ) + (none) + ) + +(defbehavior pegasus-choose-path pegasus () + (local-vars (f0-15 float) (f30-0 float)) + (while (begin (label cfg-61) (or (< 1.0 (-> self curve-position)) (< (-> self curve-position) 0.0))) + (let ((s5-0 (-> self path-info (-> self current-path))) + (gp-0 3) + ) + 0.0 + (set! f30-0 + (cond + ((or (>= (-> self current-path) (-> self num-paths)) + (< (-> self current-path) 0) + (<= (-> s5-0 num-data) 0) + ) + (format + 0 + ": ~A has path out of range cur ~D num ~D num-data ~D~%" + (-> self name) + (-> self current-path) + (-> self num-paths) + (-> s5-0 num-data) + ) + (pegasus-loop-on-same-path) + (goto cfg-61) + f30-0 + ) + ((< (-> self curve-position) 0.0) + (while (and (< gp-0 (-> s5-0 num-data)) (>= (-> s5-0 control-data gp-0) 0.0)) + (+! gp-0 3) + ) + (+! gp-0 1) + (* (total-distance (-> s5-0 path-data)) (- (-> self curve-position))) + ) + (else + (* (total-distance (-> s5-0 path-data)) (+ -1.0 (-> self curve-position))) + ) + ) + ) + (when (or (< (- (-> s5-0 num-data) gp-0) 3) (< (-> s5-0 control-data gp-0) 0.0)) + (format + 0 + ": ~A has bad path connect data format num-data ~D ctrl-data ~F~%" + (-> self name) + (- (-> s5-0 num-data) gp-0) + (-> s5-0 control-data gp-0) + ) + (pegasus-loop-on-same-path) + (goto cfg-61) + ) + (let* ((v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-34 (the-as number (logior #x3f800000 v1-33))) + (f0-9 (+ -1.0 (the-as float v1-34))) + ) + (while (and (>= (- (-> s5-0 num-data) gp-0) 6) + (>= (-> s5-0 control-data gp-0) 0.0) + (< (-> s5-0 control-data (+ gp-0 2)) f0-9) + (!= (-> s5-0 control-data (+ gp-0 3)) -1.0) + (!= (-> s5-0 control-data (+ gp-0 5)) 0.0) + ) + (set! f0-9 (- f0-9 (-> s5-0 control-data (+ gp-0 2)))) + (+! gp-0 3) + ) + ) + (let ((t1-1 (the int (-> s5-0 control-data gp-0))) + (f28-0 (fmin 1.0 (fmax 0.0 (-> s5-0 control-data (+ gp-0 1))))) + ) + (when (or (>= t1-1 (-> self num-paths)) (< t1-1 0)) + (format + 0 + ": ~A has bad path connect data prev ~D current ~D desired ~D num ~D~%" + (-> self name) + (-> self previous-path) + (-> self current-path) + t1-1 + (-> self num-paths) + ) + (pegasus-loop-on-same-path) + (goto cfg-61) + ) + (set! (-> self previous-path) (-> self current-path)) + (set! (-> self current-path) t1-1) + (let ((gp-1 (-> self path-info (-> self current-path)))) + (let ((f0-14 (/ f30-0 (total-distance (-> gp-1 path-data))))) + (cond + ((< 0.5 f28-0) + (set! f0-15 (- f28-0 f0-14)) + (if (< 0.0 (-> self speed)) + (set! (-> self speed) (- (-> self speed))) + ) + ) + (else + (set! f0-15 (+ f28-0 f0-14)) + (if (< (-> self speed) 0.0) + (set! (-> self speed) (- (-> self speed))) + ) + ) + ) + ) + (set! (-> self curve-position) f0-15) + (set! (-> self can-run) #f) + (if (> (-> gp-1 num-data) 0) + (set! (-> self can-run) (!= (-> gp-1 control-data 0) 0.0)) + ) + ) + ) + ) + ) + #f + ) + +(defbehavior pegasus-move pegasus ((arg0 float) (arg1 symbol) (arg2 symbol)) + (+! (-> self curve-position) + (/ (the float (* (- (-> self clock frame-counter) (-> self clock old-frame-counter)) (the int (-> self speed)))) + (total-distance (-> self path-info (-> self current-path) path-data)) + ) + ) + (pegasus-choose-path) + (get-point-at-percent-along-path! + (-> self path-info (-> self current-path) path-data) + (-> self root-override2 trans) + (-> self curve-position) + 'interp + ) + (let ((f30-1 (+ -81920.0 (-> self root-override2 trans y))) + (gp-0 #f) + ) + (let ((s2-0 (new 'stack 'collide-query)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-0 quad) (-> self root-override2 trans quad)) + (set! (-> self over-ground) #f) + (when (enemy-method-126 self s2-0 s3-0 (collide-spec backgnd) 12288.0 81920.0 1024.0) + (set! f30-1 (-> s2-0 best-other-tri intersect y)) + (set! gp-0 #t) + (set! (-> self over-ground) (< 204.8 (fabs (- f30-1 (-> self water-height))))) + (set! arg1 (and (-> self over-ground) arg1)) + (if arg1 + (set! (-> self y-offset-desired) (- f30-1 (-> s3-0 y))) + ) + ) + ) + (cond + ((< (-> self y-offset-desired) (-> self y-offset)) + (set! (-> self y-vel) (* 0.25 (- (-> self y-offset-desired) (-> self y-offset)))) + (set! (-> self y-vel) (fmax -68.26667 (-> self y-vel))) + (if (!= arg0 0.0) + (set! (-> self y-vel) (- arg0)) + ) + (+! (-> self y-offset) (-> self y-vel)) + (when (>= (-> self y-offset-desired) (-> self y-offset)) + (set! (-> self y-offset) (-> self y-offset-desired)) + (set! (-> self y-vel) 0.0) + ) + ) + ((< (-> self y-offset) (-> self y-offset-desired)) + (set! (-> self y-vel) (* 0.5 (- (-> self y-offset-desired) (-> self y-offset)))) + (set! (-> self y-vel) (fmin 13.653334 (-> self y-vel))) + (if (!= arg0 0.0) + (set! (-> self y-vel) arg0) + ) + (+! (-> self y-offset) (-> self y-vel)) + (when (>= (-> self y-offset) (-> self y-offset-desired)) + (set! (-> self y-offset) (-> self y-offset-desired)) + (set! (-> self y-vel) 0.0) + ) + ) + ) + (+! (-> self root-override2 trans y) (-> self y-offset)) + (when (< (-> self root-override2 trans y) f30-1) + (set! (-> self y-offset) (- f30-1 (- (-> self root-override2 trans y) (-> self y-offset)))) + (set! (-> self root-override2 trans y) f30-1) + (set! (-> self y-vel) (fmax 0.0 (-> self y-vel))) + ) + (set! (-> self on-ground) (< (fabs (- (-> self root-override2 trans y) f30-1)) 409.6)) + (cond + (gp-0 + (let ((v1-54 (-> self draw shadow-ctrl))) + (logclear! (-> v1-54 settings flags) (shadow-flags disable-draw)) + ) + 0 + (let ((v1-57 (-> self draw shadow-ctrl))) + (set! (-> v1-57 settings bot-plane w) (- (+ (- -6144.0 (-> self root-override2 trans y)) f30-1))) + ) + 0 + ) + (else + (let ((v1-59 (-> self draw shadow-ctrl))) + (logior! (-> v1-59 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + ) + (none) + ) + +(defbehavior pegasus-calc-speed pegasus ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self root-override2 trans) (target-pos 0))) + (gp-1 #f) + ) + (set! (-> s5-1 y) 0.0) + (let* ((f1-3 (/ (- (vector-length s5-1) arg0) (- arg1 arg0))) + (f0-4 (- 1.0 (fmax 0.0 (fmin 1.0 f1-3)))) + (f0-5 (lerp arg3 arg2 f0-4)) + ) + (if (< (- (-> self clock frame-counter) (the-as int (-> self targetted-timer))) (seconds 5)) + (set! f0-5 (fmax 163840.0 f0-5)) + ) + (let ((f0-6 (* 0.0033333334 f0-5))) + (cond + ((< (vector-dot s5-1 (-> self tangent)) 0.0) + (if (< 0.0 (-> self speed)) + (set! gp-1 #t) + ) + ) + ((< (-> self speed) 0.0) + (set! gp-1 #t) + ) + ) + (let ((v1-22 (ja-group))) + (cond + ((and v1-22 (= v1-22 (-> self draw art-group data 13))) + (if (< 1.0 (fabs (-> self speed))) + (set! (-> self speed) (* 0.92 (-> self speed))) + ) + ) + (else + (let ((v1-31 (ja-group))) + (cond + ((and v1-31 (= v1-31 (-> self draw art-group data 14))) + (if (< (-> self speed) 0.0) + (seek! (-> self speed) (- f0-6) 13.653334) + (seek! (-> self speed) f0-6 13.653334) + ) + ) + ((< (-> self speed) 0.0) + (set! (-> self speed) (- f0-6)) + ) + (else + (set! (-> self speed) f0-6) + ) + ) + ) + ) + ) + ) + ) + ) + gp-1 + ) + ) + +(defbehavior pegasus-calc-anim-speed pegasus () + (let* ((f0-1 (fabs (-> self speed))) + (f0-2 (* 0.07324219 f0-1)) + (f0-3 (+ -15.0 f0-2)) + (f0-4 (* 0.13333334 f0-3)) + ) + (fmin 1.5 (fmax 0.9 f0-4)) + ) + ) + +(defmethod enemy-method-55 pegasus ((obj pegasus)) + (pegasus-method-137 obj) + (pegasus-show-runs) + ((method-of-type enemy enemy-method-55) obj) + (none) + ) + +(defmethod enemy-method-99 pegasus ((obj pegasus) (arg0 process-focusable)) + #t + ) + +(defstate pegasus-debug (pegasus) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (clmf-input gp-0 a1-1 1) + ) + (vector-float*! gp-0 gp-0 4096.0) + (+! (-> self curve-position) + (/ (-> gp-0 y) (total-distance (-> self path-info (-> self current-path) path-data))) + ) + ) + (cond + ((< 1.0 (-> self curve-position)) + (set! (-> self curve-position) (+ -1.0 (-> self curve-position))) + ) + ((< (-> self curve-position) 0.0) + (set! (-> self curve-position) (+ 1.0 (-> self curve-position))) + ) + ) + (get-point-at-percent-along-path! + (-> self path-info (-> self current-path) path-data) + (-> self root-override2 trans) + (-> self curve-position) + 'interp + ) + (pegasus-rotate #f 1820.4445) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior pegasus) ja-post) + ) + +(defstate die (pegasus) + :virtual #t + :code (behavior () + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'change-mode) + (set! (-> a1-1 param 0) (the-as uint 'pegasus)) + (let ((gp-0 (send-event-function (handle->process (-> self incoming attacker-handle)) a1-1))) + (-> self speed) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 frame-group) (the-as art-joint-anim (-> self draw art-group data 20))) + (set! (-> a0-7 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 20)) frames num-frames) -1)) + ) + (set! (-> a0-7 param 1) 1.5) + (set! (-> a0-7 frame-num) 0.0) + (let ((t9-3 joint-control-channel-group!) + (a1-3 (-> self draw art-group data 20)) + (a2-2 (the-as object num-func-seek!)) + ) + (t9-3 + a0-7 + (the-as art-joint-anim a1-3) + (the-as (function joint-control-channel float float float float :behavior process) a2-2) + ) + (until (ja-done? 0) + (let ((f0-5 (ja-aframe-num 0)) + (f1-0 (-> self speed)) + ) + (when (>= f0-5 60.0) + (let ((t9-5 lerp-scale) + (a0-9 f1-0) + (a1-4 0.0) + ) + (set! a2-2 f0-5) + (set! (-> self speed) (t9-5 a0-9 a1-4 (the-as float a2-2) 60.0 100.0)) + ) + (set! (-> self y-offset-desired) 0.0) + ) + ) + (pegasus-move 0.0 #t (the-as symbol a2-2)) + (pegasus-rotate #f 1820.4445) + (suspend) + (let ((a0-12 (-> self skel root-channel 0))) + (set! (-> a0-12 param 0) (the float (+ (-> a0-12 frame-group frames num-frames) -1))) + (set! (-> a0-12 param 1) 1.5) + (let ((t9-8 joint-control-channel-group-eval!) + (a1-7 #f) + ) + (set! a2-2 num-func-seek!) + (t9-8 + a0-12 + (the-as art-joint-anim a1-7) + (the-as (function joint-control-channel float float float float :behavior process) a2-2) + ) + ) + ) + ) + ) + ) + (if gp-0 + (send-event (handle->process (-> self incoming attacker-handle)) 'end-mode) + ) + ) + ) + (send-event self 'death-end) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + (none) + ) + ) + +(defstate stare (pegasus) + :virtual #t + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (let ((gp-0 (-> self focus aware))) + (cond + ((and (>= 1 (the-as int gp-0)) + (-> self over-ground) + (< (fabs (- (-> self y-offset) (-> self y-offset-desired))) 409.6) + ) + (go-virtual active) + ) + ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + (go-hostile self) + ) + ((= gp-0 (enemy-aware enemy-aware-4)) + (go-flee self) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 (-> self draw art-group data 8)))) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! (-> self draw art-group data 8)) + ) + ) + (until #f + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 param 0) (pegasus-calc-anim-speed)) + (let ((t9-2 joint-control-channel-group-eval!) + (a1-1 #f) + (a2-0 num-func-loop!) + ) + (t9-2 gp-0 (the-as art-joint-anim a1-1) a2-0) + (if (< 27.306667 (fabs (-> self speed))) + (set! (-> self speed) (* 0.95 (-> self speed))) + ) + (set! (-> self y-offset-desired) 0.0) + (pegasus-move 409.6 #t (the-as symbol a2-0)) + ) + ) + (pegasus-rotate #f 1820.4445) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior pegasus) enemy-simple-post) + ) + +(defbehavior pegasus-fly-code pegasus ((arg0 int)) + (local-vars (a2-3 object)) + (let ((f30-0 (pegasus-calc-anim-speed))) + (let ((gp-0 + (and (-> self can-run) (< (the-as time-frame (-> self ambient-possible)) (-> self clock frame-counter))) + ) + ) + (let* ((f28-0 (lerp-scale 61440.0 32768.0 (the float arg0) 0.0 3000.0)) + (f0-4 (lerp-scale 122880.0 81920.0 (the float arg0) 0.0 3000.0)) + (s4-0 (pegasus-calc-speed f28-0 122880.0 f0-4 49152.0)) + ) + (case (ja-group) + (('pegasus-fly-doublespeed-ja) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group frames num-frames) -1))) + (set! (-> a0-7 param 1) (fmax 1.0 (* 0.8 f30-0))) + (let ((t9-4 joint-control-channel-group-eval!) + (a1-3 #f) + ) + (set! a2-3 num-func-seek!) + (t9-4 + a0-7 + (the-as art-joint-anim a1-3) + (the-as (function joint-control-channel float float float float :behavior process) a2-3) + ) + ) + ) + ) + (('pegasus-fly-ja) + (let ((a0-9 (-> self skel root-channel 0))) + (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) + (set! (-> a0-9 param 1) (* 1.5 f30-0)) + (let ((t9-5 joint-control-channel-group-eval!) + (a1-4 #f) + ) + (set! a2-3 num-func-seek!) + (t9-5 + a0-9 + (the-as art-joint-anim a1-4) + (the-as (function joint-control-channel float float float float :behavior process) a2-3) + ) + ) + ) + ) + (else + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group frames num-frames) -1))) + (set! (-> a0-10 param 1) 1.0) + (let ((t9-6 joint-control-channel-group-eval!) + (a1-5 #f) + ) + (set! a2-3 num-func-seek!) + (t9-6 + a0-10 + (the-as art-joint-anim a1-5) + (the-as (function joint-control-channel float float float float :behavior process) a2-3) + ) + ) + ) + ) + ) + (let ((v1-34 #f) + (s5-1 12) + ) + (let ((a0-13 (ja-group))) + (when (not (and a0-13 (begin + (set! a2-3 (= a0-13 (-> self draw art-group data 10))) + (or (the-as symbol a2-3) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 9))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 8))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 13))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 14))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 16))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 17))) (the-as symbol a2-3)) + (= a0-13 (-> self draw art-group data 18)) + ) + ) + ) + ) + (set! s5-1 37) + (set! v1-34 #t) + ) + ) + (cond + ((and s4-0 (let ((a0-21 (ja-group))) + (not (and a0-21 (begin + (set! a2-3 (= a0-21 (-> self draw art-group data 13))) + (or (the-as symbol a2-3) (= a0-21 (-> self draw art-group data 14))) + ) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.125)) + (ja :group! (-> self draw art-group data 13)) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ((and (not v1-34) (not (ja-done? 0))) + ) + (else + (let ((v1-46 (ja-group))) + (cond + ((and v1-46 (= v1-46 (-> self draw art-group data 16))) + (ja :group! (-> self draw art-group data 17)) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ((let ((v1-58 (ja-group))) + (and v1-58 (= v1-58 (-> self draw art-group data 13))) + ) + (ja :group! (-> self draw art-group data 14) :num! min) + (set! (-> self speed) (- (-> self speed))) + (let ((s5-3 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'matrix)) + ) + (new 'stack-no-clear 'vector) + (vector-cross! s5-3 (-> self tangent) (new 'static 'vector :y 1.0)) + (vector-cross! s5-3 s5-3 (-> self tangent)) + (vector-normalize! s5-3 1.0) + (matrix-axis-angle! s4-1 s5-3 32768.0) + (set! a2-3 s4-1) + ) + (vector-matrix*! (-> self facing) (-> self facing) (the-as matrix a2-3)) + ) + ((let ((v1-72 (ja-group))) + (and v1-72 (= v1-72 (-> self draw art-group data 17))) + ) + (if (or (not (-> self can-run)) (< (the-as time-frame (-> self ambient-expire)) (-> self clock frame-counter))) + (ja :group! (-> self draw art-group data 18)) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ((and gp-0 (-> self on-ground)) + (ja-channel-push! 1 (seconds 0.125)) + (ja :group! (-> self draw art-group data 16)) + (ja :num-func num-func-identity :frame-num 0.0) + (let* ((s5-4 (-> self clock frame-counter)) + (f30-1 300.0) + (f28-1 2.0) + (f26-0 3.0) + (v1-99 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-100 (the-as number (logior #x3f800000 v1-99))) + ) + (set! (-> self ambient-expire) + (the-as uint (+ s5-4 (the int (* f30-1 (+ f28-1 (* f26-0 (+ -1.0 (the-as float v1-100)))))))) + ) + ) + (let* ((s5-5 (-> self ambient-expire)) + (f30-2 300.0) + (f28-2 2.0) + (f26-1 3.0) + (v1-108 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-109 (the-as number (logior #x3f800000 v1-108))) + ) + (set! (-> self ambient-possible) + (+ s5-5 (the int (* f30-2 (+ f28-2 (* f26-1 (+ -1.0 (the-as float v1-109))))))) + ) + ) + ) + ((or (and (< (-> self speed) 0.0) (< 0.125 (-> self tangent y))) + (and (< 0.0 (-> self speed)) (< (-> self tangent y) -0.125)) + ) + (let ((v1-121 (ja-group))) + (when (not (and v1-121 (= v1-121 (-> self draw art-group data 10)))) + (ja-channel-push! 1 (the-as time-frame s5-1)) + (ja :group! (-> self draw art-group data 10)) + ) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ((< 1.25 f30-0) + (let ((v1-135 (ja-group))) + (when (not (and v1-135 (= v1-135 (-> self draw art-group data 9)))) + (ja-channel-push! 1 (the-as time-frame s5-1)) + (ja :group! (-> self draw art-group data 9)) + ) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + (else + (let ((v1-148 (ja-group))) + (when (not (and v1-148 (= v1-148 (-> self draw art-group data 8)))) + (ja-channel-push! 1 (the-as time-frame s5-1)) + (ja :group! (-> self draw art-group data 8)) + ) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ) + ) + ) + ) + ) + ) + (pegasus-move + 0.0 + (the-as + symbol + (or gp-0 (let ((v1-161 (ja-group))) + (and v1-161 (begin + (set! a2-3 (= v1-161 (-> self draw art-group data 16))) + (or (the-as symbol a2-3) (= v1-161 (-> self draw art-group data 17))) + ) + ) + ) + ) + ) + (the-as symbol a2-3) + ) + ) + ) + (pegasus-rotate #f 1820.4445) + (none) + ) + +(defstate pegasus-tired (pegasus) + :event (the-as (function process int symbol event-message-block object :behavior pegasus) enemy-event-handler) + :enter (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self far-time) (-> self clock frame-counter)) + (set-setting! 'sound-mode #f 0 1) + (none) + ) + :exit (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) exit))) + (if t9-0 + (t9-0) + ) + ) + (remove-setting! 'sound-mode) + (none) + ) + :trans (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) trans))) + (if t9-0 + (t9-0) + ) + ) + (cond + ((and *target* + (and (>= 102400.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (set! (-> self state-time) + (the-as time-frame (max (+ (-> self clock frame-counter) (seconds -10)) (-> self state-time))) + ) + ) + (else + (+! (-> self state-time) (* 10 (- (-> self clock frame-counter) (-> self far-time)))) + (if (>= (-> self state-time) (-> self clock frame-counter)) + (go-virtual flee) + ) + ) + ) + (set! (-> self far-time) (-> self clock frame-counter)) + (none) + ) + :code (behavior () + (until #f + (set! (-> self y-offset-desired) 0.0) + (pegasus-fly-code (the-as int (- (-> self clock frame-counter) (-> self state-time)))) + (suspend) + ) + #f + (none) + ) + :post (-> (method-of-type enemy flee) post) + ) + +(defstate flee (pegasus) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self near-timer) 3000) + (set! (-> self far-time) (-> self clock frame-counter)) + (set-setting! 'sound-mode #f 0 1) + (none) + ) + :exit (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) exit))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self y-offset-desired) 0.0) + (remove-setting! 'sound-mode) + (none) + ) + :trans (behavior () + (when (-> self can-run) + (let ((t9-0 (-> (method-of-type enemy flee) trans))) + (if t9-0 + (t9-0) + ) + ) + ) + (when (and *target* + (and (>= 102400.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (set! (-> self near-timer) (- (the-as time-frame (-> self near-timer)) + (- (-> self clock frame-counter) (-> self clock old-frame-counter)) + ) + ) + (if (<= (-> self near-timer) 0) + (go pegasus-tired) + ) + (set! (-> self far-time) (-> self clock frame-counter)) + ) + (if (>= (- (-> self clock frame-counter) (-> self far-time)) (seconds 3)) + (set! (-> self near-timer) (the-as int (-> self timeout))) + ) + (none) + ) + :code (behavior () + (until #f + (set! (-> self y-offset-desired) 2.0) + (pegasus-fly-code 0) + (suspend) + ) + #f + (none) + ) + ) + +(defstate active (pegasus) + :virtual #t + :code (behavior () + (set! (-> self allow-idle) #f) + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 (-> self draw art-group data 5)))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 19) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 19)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (set! (-> self allow-idle) #t) + (ja-channel-push! 1 (seconds 0.1)) + (sleep-code) + (none) + ) + :post (behavior () + (if (-> self allow-idle) + (idle-control-method-10 (-> self idle-anim-player) self) + ) + (enemy-simple-post) + (none) + ) + ) + +(defstate notice (pegasus) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type enemy notice) enter))) + (if t9-0 + (t9-0) + ) + ) + (set-setting! 'sound-mode #f 0 1) + (none) + ) + :exit (behavior () + (let ((t9-0 (-> (method-of-type enemy notice) exit))) + (if t9-0 + (t9-0) + ) + ) + (remove-setting! 'sound-mode) + (none) + ) + :code (behavior () + (displacement-between-points-at-percent-normalized! + (-> self path-info (-> self current-path) path-data) + (-> self tangent) + (-> self curve-position) + ) + (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) + (enemy-method-72 self) + ) + (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) + :num! (seek! + (the float + (+ (-> (the-as art-joint-anim (-> self draw art-group data (-> self enemy-info notice-anim))) frames num-frames) + -1 + ) + ) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) + (enemy-method-72 self) + ) + (pegasus-rotate #f 1820.4445) + (suspend) + (ja :num! (seek! max f30-0)) + ) + (ja-no-eval :group! (-> self draw art-group data 7) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1)) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (let ((t9-12 pegasus-calc-speed) + (a0-12 61440.0) + (a1-15 122880.0) + (a2-7 204800.0) + ) + (if (t9-12 a0-12 a1-15 a2-7 49152.0) + (enemy-method-72 self) + ) + (pegasus-rotate #f 1820.4445) + (set! (-> self y-offset-desired) 0.0) + (pegasus-move 0.0 #f (the-as symbol a2-7)) + ) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (enemy-method-72 self) + (none) + ) + ) + +(defstate idle (pegasus) + :virtual #t + :post (behavior () + (pegasus-show-runs) + (pegasus-method-137 self) + (let ((t9-2 (-> (method-of-type enemy idle) post))) + (if t9-2 + ((the-as (function none) t9-2)) + ) + ) + (none) + ) + ) + +(defmethod enemy-method-114 pegasus ((obj pegasus)) + "@abstract" + (stack-size-set! (-> obj main-thread) 512) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0))) + (set! (-> s5-0 total-prims) (the-as uint 2)) + (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 9216.0 4096.0 18432.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-14 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-14 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-14 prim-core action) (collide-action solid no-standon)) + (set! (-> v1-14 transform-index) 3) + (set-vector! (-> v1-14 local-sphere) 0.0 6144.0 0.0 11264.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-17 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + ) + (set! (-> obj root-override2) s5-0) + ) + 0 + (none) + ) + +(defmethod coin-flip? pegasus ((obj pegasus)) + "@returns The result of a 50/50 RNG roll" + #f + ) + +(defmethod enemy-method-108 pegasus ((obj pegasus) (arg0 enemy) (arg1 event-message-block)) + 0 + ) + +;; WARN: Return type mismatch enemy vs pegasus. +(defmethod relocate pegasus ((obj pegasus) (arg0 int)) + (countdown (v1-0 20) + (if (-> obj path-info v1-0 path-data) + (&+! (-> obj path-info v1-0 path-data) arg0) + ) + ) + (the-as pegasus ((method-of-type enemy relocate) obj arg0)) + ) + +(defmethod enemy-method-115 pegasus ((obj pegasus)) + "@abstract" + (local-vars (sv-16 res-tag)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-pegasus" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (enemy-method-113 obj *pegasus-enemy-info*) + (logclear! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf00)) + (set! (-> obj link) (new 'process 'actor-link-info obj #f)) + (dotimes (v1-8 20) + (set! (-> obj path-info v1-8 path-data) #f) + ) + (set! (-> obj num-paths) 0) + (set! (-> obj path-info 0 path-data) (new 'process 'curve-control obj 'path -1000000000.0)) + (when (-> obj path-info 0 path-data) + (logior! (-> obj path-info 0 path-data flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> obj num-paths) 1) + ) + (dotimes (s5-1 20) + (let ((v1-19 (new 'process 'curve-control obj 'path (the float s5-1)))) + (if (logtest? (-> v1-19 flags) (path-control-flag not-found)) + (goto cfg-15) + ) + (set! (-> obj num-paths) (+ s5-1 1)) + (set! (-> obj path-info s5-1 path-data) v1-19) + (logior! (-> v1-19 flags) (path-control-flag display draw-line draw-point)) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-22 (res-lump-data (-> obj entity) 'path-connection pointer :tag-ptr (& sv-16) :time (the float s5-1)))) + (cond + (v1-22 + (set! (-> obj path-info s5-1 num-data) (the-as int (-> sv-16 elt-count))) + (set! (-> obj path-info s5-1 control-data) (the-as (pointer float) v1-22)) + ) + (else + (set! (-> obj path-info s5-1 num-data) 0) + 0 + ) + ) + ) + ) + (label cfg-15) + (set! (-> obj current-path) 0) + (set! (-> obj previous-path) 0) + (set! (-> obj display-path) -1) + (set! (-> obj curve-position) (res-lump-float (-> obj entity) 'initial-spline-pos)) + (get-point-at-percent-along-path! + (-> obj path-info (-> obj current-path) path-data) + (-> obj root-override2 trans) + (-> obj curve-position) + 'interp + ) + (displacement-between-points-at-percent-normalized! + (-> obj path-info (-> obj current-path) path-data) + (-> obj tangent) + (-> obj curve-position) + ) + (set! (-> obj facing quad) (-> obj tangent quad)) + (let ((s5-2 (new 'stack-no-clear 'matrix))) + (forward-down->inv-matrix s5-2 (-> obj facing) (new 'static 'vector :y -1.0)) + (matrix->quaternion (-> obj root-override2 quat) s5-2) + ) + (set! (-> obj y-vel) 0.0) + (let ((t9-12 (method-of-type res-lump get-property-value-float)) + (a0-37 (-> obj entity)) + (a1-14 'water-height) + (a2-10 'interp) + ) + (set! (-> obj water-height) + (t9-12 a0-37 a1-14 a2-10 -1000000000.0 0.0 (the-as (pointer res-tag) #f) *res-static-buf*) + ) + (set! (-> obj timeout) (the-as uint 3000)) + (when (-> obj entity) + (let ((t9-13 (method-of-type res-lump get-property-value-float)) + (a0-38 (-> obj entity)) + (a1-15 'timeout) + ) + (set! a2-10 'interp) + (let ((f0-9 (t9-13 a0-38 a1-15 a2-10 -1000000000.0 10.0 (the-as (pointer res-tag) #f) *res-static-buf*))) + (set! (-> obj timeout) (the-as uint (the int (* 300.0 f0-9)))) + ) + ) + ) + (set! (-> obj ambient-possible) (the-as uint 0)) + (set! (-> obj speed) 0.0) + (set! (-> obj y-offset-desired) 0.0) + (pegasus-move 409600.0 #t a2-10) + ) + (pegasus-calc-speed 61440.0 122880.0 2048.0 2048.0) + (set! (-> obj can-run) #f) + 0 + (none) + ) + +(set-subtask-hook! + *game-info* + 107 + 0 + (lambda :behavior task-manager + () + (set! (-> *game-info* controller 0) (process->handle self)) + (set! (-> self entity) (entity-by-type pegasus)) + (set! (-> self actor-group 0) (res-lump-struct (-> self entity) 'actor-groups (pointer entity-actor))) + (when (-> self actor-group 0) + (let ((v1-6 (-> self actor-group 0 0))) + (set! (-> self data-int32 0) (the-as int v1-6)) + (set! (-> self data-int32 1) (the-as int v1-6)) + ) + (dotimes (gp-0 (the-as int (-> self actor-group 0 0))) + (let ((t0-1 (-> (&+ (-> self actor-group 0) (* gp-0 8)) 3))) + (if t0-1 + (minimap-method-12 *minimap* self (the-as uint 16) (the-as int #f) (the-as vector t0-1) 0) + ) + ) + ) + #f + ) + ) + ) + +(set-subtask-hook! + *game-info* + 107 + 3 + (the-as + (function object) + (lambda :behavior task-manager + () + (local-vars (sv-16 int)) + (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-pegasus :init hud-init-by-other :to self))) + (while (> (-> self data-int32 0) 0) + (set! sv-16 (-> self data-int32 1)) + (when (-> self actor-group 0) + (dotimes (v1-12 (the-as int (-> self actor-group 0 0))) + (let ((a1-4 (-> (&+ (-> self actor-group 0) (* v1-12 8)) 3))) + (if (and a1-4 (logtest? (-> a1-4 extra perm status) (entity-perm-status subtask-complete))) + (set! sv-16 (+ sv-16 -1)) + ) + ) + ) + ) + (let ((v1-15 sv-16)) + (set! (-> self data-int32 0) v1-15) + (set! (-> *game-info* counter) (the float v1-15)) + ) + (suspend) + ) + (go-virtual complete) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 107 + 4 + (the-as + (function object) + (lambda () + (task-node-close! (game-task-node forest-scouts-resolution)) + (talker-spawn-func (-> *talker-speech* 90) *entity-pool* (target-pos 0) (the-as region #f)) + (none) + ) + ) + ) diff --git a/goal_src/jak2/levels/gungame/gungame-obs.gc b/goal_src/jak2/levels/gungame/gungame-obs.gc index 4fbfce1b0b..72bf5bc7e7 100644 --- a/goal_src/jak2/levels/gungame/gungame-obs.gc +++ b/goal_src/jak2/levels/gungame/gungame-obs.gc @@ -75,7 +75,7 @@ (training-manager-method-27 (_type_ (array tpath-info)) symbol 27) (training-manager-method-28 (_type_) none 28) (training-manager-method-29 (_type_ vector) vector 29) - (training-manager-method-30 (_type_ game-text-id) float 30) + (render-text (_type_ game-text-id) float 30) (training-manager-method-31 (_type_) none 31) (training-manager-method-32 (_type_) none 32) ) @@ -214,7 +214,7 @@ (none) ) -(defmethod training-manager-method-30 training-manager ((obj training-manager) (arg0 game-text-id)) +(defmethod render-text training-manager ((obj training-manager) (arg0 game-text-id)) (when (= (get-status *gui-control* (-> obj gui-id)) (gui-status active)) (let ((s5-1 (new 'stack @@ -282,7 +282,7 @@ (suspend) ) (until (cpad-pressed? 0 r1) - (training-manager-method-30 self (game-text-id text-x22b)) + (render-text self (game-text-id gungame-tutorial-fire-button)) (suspend) ) (set! (-> self last-sound-id) @@ -302,7 +302,7 @@ ) (when *target* (while (logtest? (focus-status gun) (-> *target* focus-status)) - (training-manager-method-30 self (game-text-id text-x22c)) + (render-text self (game-text-id gungame-tutorial-put-red-away)) (suspend) ) ) @@ -316,7 +316,7 @@ (suspend) ) (while (or (not *target*) (zero? (logand (focus-status gun) (-> *target* focus-status)))) - (training-manager-method-30 self (game-text-id text-x22d)) + (render-text self (game-text-id gungame-tutorial-take-red-out)) (suspend) ) (set! (-> self last-sound-id) @@ -334,7 +334,7 @@ ) (let ((gp-2 (training-manager-method-26 self))) (while (= (training-manager-method-26 self) gp-2) - (training-manager-method-30 self (game-text-id text-x234)) + (render-text self (game-text-id gungame-tutorial-shoot-the-crates)) (suspend) ) ) @@ -492,7 +492,7 @@ ) a1-1 ) - (training-manager-method-30 self (game-text-id gungame-red-prompt)) + (render-text self (game-text-id gungame-prompt-red)) ) ) ) @@ -613,7 +613,7 @@ ) a1-2 ) - (training-manager-method-30 self (game-text-id gungame-yellow-prompt)) + (render-text self (game-text-id gungame-prompt-yellow)) ) ) ) @@ -876,8 +876,8 @@ ) ) (if (logtest? (-> *game-info* secrets) (game-secrets gungame-blue)) - (training-manager-method-30 self (game-text-id gungame-red-or-blue-prompt)) - (training-manager-method-30 self (game-text-id gungame-red-prompt)) + (render-text self (game-text-id gungame-prompt-red-or-blue)) + (render-text self (game-text-id gungame-prompt-red)) ) (b! #t cfg-30 :delay (nop!)) (label cfg-19) @@ -896,8 +896,8 @@ (task-node-closed? (game-task-node city-yellow-gun-training-resolution)) ) (if (logtest? (-> *game-info* secrets) (game-secrets gungame-dark)) - (training-manager-method-30 self (game-text-id gungame-yellow-or-purple-prompt)) - (training-manager-method-30 self (game-text-id gungame-yellow-prompt)) + (render-text self (game-text-id gungame-prompt-yellow-or-purple)) + (render-text self (game-text-id gungame-prompt-yellow)) ) ) ) @@ -1019,7 +1019,7 @@ ) (let ((gp-2 (-> *game-info* gun-type))) (until (!= gp-2 (-> *game-info* gun-type)) - (training-manager-method-30 self (game-text-id text-x230)) + (render-text self (game-text-id gungame-tutorial-switch-to-yellow)) (suspend) ) ) @@ -1042,7 +1042,7 @@ ) ) (until #f - (training-manager-method-30 self (game-text-id text-x233)) + (render-text self (game-text-id gungame-tutorial-kick-combo)) (suspend) (when (and (not (handle->process (-> self dummies 0))) (not (handle->process (-> self dummies 1)))) #t @@ -1274,15 +1274,7 @@ (gp-1 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-0 "~S") ) - (let* ((s3-0 format) - (s2-0 (clear *temp-string*)) - (a0-7 *common-text*) - (t9-4 (method-of-object a0-7 lookup-text!)) - (a1-2 566) - (a2-0 #f) - ) - (s3-0 s2-0 (t9-4 a0-7 (the-as game-text-id a1-2) a2-0) (the-as none a2-0)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-1 gp-1 s4-0 *temp-string*) ) ) @@ -1292,15 +1284,7 @@ (gp-2 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-1 "~S") ) - (let* ((s3-1 format) - (s2-1 (clear *temp-string*)) - (a0-12 *common-text*) - (t9-9 (method-of-object a0-12 lookup-text!)) - (a1-5 566) - (a2-2 #f) - ) - (s3-1 s2-1 (t9-9 a0-12 (the-as game-text-id a1-5) a2-2) (the-as none a2-2)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-2 gp-2 s4-1 *temp-string*) ) ) @@ -1310,15 +1294,7 @@ (gp-3 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-2 "~S") ) - (let* ((s3-2 format) - (s2-2 (clear *temp-string*)) - (a0-17 *common-text*) - (t9-14 (method-of-object a0-17 lookup-text!)) - (a1-8 567) - (a2-4 #f) - ) - (s3-2 s2-2 (t9-14 a0-17 (the-as game-text-id a1-8) a2-4) (the-as none a2-4)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) (s5-3 gp-3 s4-2 *temp-string*) ) ) @@ -1328,15 +1304,7 @@ (gp-4 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-3 "~S") ) - (let* ((s3-3 format) - (s2-3 (clear *temp-string*)) - (a0-22 *common-text*) - (t9-19 (method-of-object a0-22 lookup-text!)) - (a1-11 568) - (a2-6 #f) - ) - (s3-3 s2-3 (t9-19 a0-22 (the-as game-text-id a1-11) a2-6) (the-as none a2-6)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-bronze) #f)) (s5-4 gp-4 s4-3 *temp-string*) ) ) @@ -1350,15 +1318,7 @@ (gp-5 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-4 "~S") ) - (let* ((s3-4 format) - (s2-4 (clear *temp-string*)) - (a0-28 *common-text*) - (t9-25 (method-of-object a0-28 lookup-text!)) - (a1-14 566) - (a2-8 #f) - ) - (s3-4 s2-4 (t9-25 a0-28 (the-as game-text-id a1-14) a2-8) (the-as none a2-8)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-5 gp-5 s4-4 *temp-string*) ) ) @@ -1368,15 +1328,7 @@ (gp-6 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-5 "~S") ) - (let* ((s3-5 format) - (s2-5 (clear *temp-string*)) - (a0-33 *common-text*) - (t9-30 (method-of-object a0-33 lookup-text!)) - (a1-17 567) - (a2-10 #f) - ) - (s3-5 s2-5 (t9-30 a0-33 (the-as game-text-id a1-17) a2-10) (the-as none a2-10)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) (s5-6 gp-6 s4-5 *temp-string*) ) ) @@ -1386,15 +1338,7 @@ (gp-7 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-6 "~S") ) - (let* ((s3-6 format) - (s2-6 (clear *temp-string*)) - (a0-38 *common-text*) - (t9-35 (method-of-object a0-38 lookup-text!)) - (a1-20 567) - (a2-12 #f) - ) - (s3-6 s2-6 (t9-35 a0-38 (the-as game-text-id a1-20) a2-12) (the-as none a2-12)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) (s5-7 gp-7 s4-6 *temp-string*) ) ) @@ -1410,15 +1354,7 @@ (gp-8 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-7 "~S") ) - (let* ((s3-7 format) - (s2-7 (clear *temp-string*)) - (a0-45 *common-text*) - (t9-42 (method-of-object a0-45 lookup-text!)) - (a1-23 566) - (a2-14 #f) - ) - (s3-7 s2-7 (t9-42 a0-45 (the-as game-text-id a1-23) a2-14) (the-as none a2-14)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-8 gp-8 s4-7 *temp-string*) ) ) @@ -1428,15 +1364,7 @@ (gp-9 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-8 "~S") ) - (let* ((s3-8 format) - (s2-8 (clear *temp-string*)) - (a0-50 *common-text*) - (t9-47 (method-of-object a0-50 lookup-text!)) - (a1-26 566) - (a2-16 #f) - ) - (s3-8 s2-8 (t9-47 a0-50 (the-as game-text-id a1-26) a2-16) (the-as none a2-16)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-9 gp-9 s4-8 *temp-string*) ) ) @@ -1448,15 +1376,7 @@ (gp-10 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-9 "~S") ) - (let* ((s3-9 format) - (s2-9 (clear *temp-string*)) - (a0-55 *common-text*) - (t9-52 (method-of-object a0-55 lookup-text!)) - (a1-29 566) - (a2-18 #f) - ) - (s3-9 s2-9 (t9-52 a0-55 (the-as game-text-id a1-29) a2-18) (the-as none a2-18)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-10 gp-10 s4-9 *temp-string*) ) ) @@ -1466,15 +1386,7 @@ (gp-11 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-10 "~S") ) - (let* ((s3-10 format) - (s2-10 (clear *temp-string*)) - (a0-60 *common-text*) - (t9-57 (method-of-object a0-60 lookup-text!)) - (a1-32 566) - (a2-20 #f) - ) - (s3-10 s2-10 (t9-57 a0-60 (the-as game-text-id a1-32) a2-20) (the-as none a2-20)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-11 gp-11 s4-10 *temp-string*) ) ) @@ -1484,15 +1396,7 @@ (gp-12 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-11 "~S") ) - (let* ((s3-11 format) - (s2-11 (clear *temp-string*)) - (a0-65 *common-text*) - (t9-62 (method-of-object a0-65 lookup-text!)) - (a1-35 567) - (a2-22 #f) - ) - (s3-11 s2-11 (t9-62 a0-65 (the-as game-text-id a1-35) a2-22) (the-as none a2-22)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) (s5-12 gp-12 s4-11 *temp-string*) ) ) @@ -1502,15 +1406,7 @@ (gp-13 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-12 "~S") ) - (let* ((s3-12 format) - (s2-12 (clear *temp-string*)) - (a0-70 *common-text*) - (t9-67 (method-of-object a0-70 lookup-text!)) - (a1-38 568) - (a2-24 #f) - ) - (s3-12 s2-12 (t9-67 a0-70 (the-as game-text-id a1-38) a2-24) (the-as none a2-24)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-bronze) #f)) (s5-13 gp-13 s4-12 *temp-string*) ) ) @@ -1520,15 +1416,7 @@ (gp-14 (clear (-> (the-as hud gp-0) strings 1 text))) (s4-13 "~S") ) - (let* ((s3-13 format) - (s2-13 (clear *temp-string*)) - (a0-75 *common-text*) - (t9-72 (method-of-object a0-75 lookup-text!)) - (a1-41 565) - (a2-26 #f) - ) - (s3-13 s2-13 (t9-72 a0-75 (the-as game-text-id a1-41) a2-26) (the-as none a2-26)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-goal) #f)) (s5-14 gp-14 s4-13 *temp-string*) ) ) @@ -2547,7 +2435,7 @@ ) (suspend) (when (>= 0.0 (ja-frame-num 0)) - (ja-no-eval :num! min) + (ja-no-eval :num! zero) (goto cfg-12) ) ) diff --git a/goal_src/jak2/levels/stadium/jetboard/skatea-obs.gc b/goal_src/jak2/levels/stadium/jetboard/skatea-obs.gc index 95bc0c7528..e2bdeffb3b 100644 --- a/goal_src/jak2/levels/stadium/jetboard/skatea-obs.gc +++ b/goal_src/jak2/levels/stadium/jetboard/skatea-obs.gc @@ -7,3 +7,1907 @@ ;; DECOMP BEGINS +(deftype hoverboard-training-manager (process) + ((actor-group (pointer actor-group) :offset-assert 128) + (actor-group-count int32 :offset-assert 132) + (trick-type board-tricks :offset-assert 136) + (board-picked-up symbol :offset-assert 140) + (boost symbol :offset-assert 144) + (grind symbol :offset-assert 148) + (text symbol :offset-assert 152) + (score float :offset-assert 156) + (challenge-done symbol :offset-assert 160) + (arrow handle :offset-assert 168) + (minimap connection-minimap :offset-assert 176) + (hud-score handle :offset-assert 184) + (hud-goal handle :offset-assert 192) + (voicebox handle :offset-assert 200) + (last-sound-id sound-id :offset-assert 208) + (combo-done? symbol :offset-assert 212) + (task-gold uint16 :offset-assert 216) + (task-silver uint16 :offset-assert 218) + (task-bronze uint16 :offset-assert 220) + (game-score uint8 :offset-assert 222) + (training? symbol :offset-assert 224) + (training-goal float :offset-assert 228) + (egg-count int32 :offset-assert 232) + (medal int32 :offset-assert 236) + (gui-id sound-id :offset-assert 240) + (hint-time time-frame :offset-assert 248) + ) + :heap-base #x80 + :method-count-assert 31 + :size-assert #x100 + :flag-assert #x1f00800100 + (:methods + (wait-for-pickup () _type_ :state 14) + (wait-for-pickup-training () _type_ :state 15) + (wait-for-board () _type_ :state 16) + (wait () _type_ :state 17) + (jump () _type_ :state 18) + (duck-jump () _type_ :state 19) + (boost-jump () _type_ :state 20) + (grind () _type_ :state 21) + (spin () _type_ :state 22) + (flip () _type_ :state 23) + (trick () _type_ :state 24) + (game () _type_ :state 25) + (idle () _type_ :state 26) + (idle-training () _type_ :state 27) + (render-text (_type_ game-text-id) float 28) + (hoverboard-training-manager-method-29 (_type_) none 29) + (hoverboard-training-manager-method-30 (_type_) none 30) + ) + ) + + +(defmethod render-text hoverboard-training-manager ((obj hoverboard-training-manager) (arg0 game-text-id)) + (when #t ;; TODO - no streaming audio yet (= (get-status *gui-control* (the-as sound-id (-> obj gui-id))) (gui-status active)) + (let ((s5-1 (new + 'stack + 'font-context + *font-default-matrix* + 32 + 280 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (set! (-> s5-1 flags) (font-flags shadow kerning large)) + (let ((v1-4 s5-1)) + (set! (-> v1-4 width) (the float 440)) + ) + (let ((v1-5 s5-1)) + (set! (-> v1-5 height) (the float 80)) + ) + (let ((v1-6 s5-1)) + (set! (-> v1-6 scale) 0.75) + ) + (let ((s4-0 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* arg0 #f)) + (s4-0 *temp-string* s5-1 #f 44 (bucket-id progress)) + ) + ) + ) + ) + +(defun trick-type-trick? ((arg0 board-tricks)) + (or (= arg0 (board-tricks board-spin)) + (= arg0 (board-tricks board-flip)) + (= arg0 (board-tricks board-nosegrab)) + (= arg0 (board-tricks board-method)) + (= arg0 (board-tricks board-board-spin)) + (= arg0 (board-tricks board-board-flip)) + (= arg0 (board-tricks board-noseflip)) + (= arg0 (board-tricks board-kickflip)) + ) + ) + +;; WARN: Return type mismatch object vs hoverboard-training-manager. +(defbehavior hoverboard-training-manager-event-handler hoverboard-training-manager ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (the-as + hoverboard-training-manager + (case arg2 + (('notify) + (case (-> arg3 param 0) + (('trick-point) + (set! v0-0 (-> arg3 param 1)) + (set! (-> self trick-type) (the-as board-tricks v0-0)) + v0-0 + ) + (('trick-judge) + (set! (-> self score) (the-as float (-> arg3 param 1))) + (set! v0-0 #t) + (set! (-> self challenge-done) (the-as symbol v0-0)) + v0-0 + ) + (('pickup) + (set! v0-0 #t) + (set! (-> self board-picked-up) (the-as symbol v0-0)) + v0-0 + ) + (('trick-flush) + (the-as float (-> arg3 param 1)) + (let ((gp-0 (the-as object (-> arg3 param 2))) + (s5-0 (-> arg3 param 3)) + ) + (dotimes (s4-0 (the-as int (+ s5-0 -2))) + (cond + ((= (-> (the-as (pointer board-tricks) gp-0) s4-0) (board-tricks board-rail-jump)) + (if (and (trick-type-trick? (-> (the-as (pointer board-tricks) gp-0) (+ s4-0 1))) + (= (-> (the-as (pointer board-tricks) gp-0) (+ s4-0 2)) (board-tricks board-rail-jump)) + ) + (set! (-> self combo-done?) #t) + ) + ) + ((trick-type-trick? (-> (the-as (pointer board-tricks) gp-0) s4-0)) + (if (and (= (-> (the-as (pointer board-tricks) gp-0) (+ s4-0 1)) (board-tricks board-rail-jump)) + (trick-type-trick? (-> (the-as (pointer board-tricks) gp-0) (+ s4-0 2))) + ) + (set! (-> self combo-done?) #t) + ) + ) + ) + ) + ) + #f + ) + ) + ) + (('boost) + (set! v0-0 #t) + (set! (-> self boost) (the-as symbol v0-0)) + v0-0 + ) + (('grind) + (set! v0-0 #t) + (set! (-> self grind) (the-as symbol v0-0)) + v0-0 + ) + (('text-on) + (set! v0-0 #t) + (set! (-> self text) (the-as symbol v0-0)) + v0-0 + ) + (('text-off) + (set! (-> self text) #f) + #f + ) + ) + ) + ) + +(defstate wait-for-pickup (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :enter (behavior () + (set! (-> self board-picked-up) #f) + (cond + ((task-node-closed? (game-task-node forest-scouts-get-board)) + (set! (-> self board-picked-up) #t) + ) + (else + (let ((v1-0 (birth-pickup-at-point + (new 'static 'vector :x 505282.56 :y -38912.0 :z -2533785.5 :w 1.0) + (pickup-type board) + 1.0 + #t + self + (the-as fact-info #f) + ) + ) + ) + (send-event (ppointer->process v1-0) 'get-notify #t) + ) + (let ((gp-0 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> gp-0 pos quad) (-> (new 'static 'vector :x 505282.56 :y -38912.0 :z -2533785.5 :w 1.0) quad)) + (quaternion-identity! (-> gp-0 quat)) + (set! (-> gp-0 flags) (task-arrow-flags)) + (set! (-> gp-0 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-0 (the-as task-arrow self)))) + ) + ) + ) + (none) + ) + :exit (behavior () + (set-continue! *game-info* "skatea-training" #f) + (none) + ) + :trans (behavior () + (when (-> self board-picked-up) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'complete) + (let ((t9-0 send-event-function) + (v1-5 (-> *game-info* sub-task-list 64)) + ) + (t9-0 + (handle->process (if (-> v1-5 info) + (-> v1-5 info manager) + (the-as handle #f) + ) + ) + a1-0 + ) + ) + ) + (send-event (handle->process (-> self arrow)) 'leave) + (go-virtual jump) + ) + (none) + ) + :code (the-as (function none :behavior hoverboard-training-manager) sleep-code) + ) + +(defstate wait-for-pickup-training (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :enter (behavior () + (set! (-> self board-picked-up) #f) + (cond + ((task-node-closed? (game-task-node forest-scouts-get-board)) + (set! (-> self board-picked-up) #t) + ) + (else + (let ((v1-0 (birth-pickup-at-point + (new 'static 'vector :x 505282.56 :y -38912.0 :z -2533785.5 :w 1.0) + (pickup-type board) + 1.0 + #t + self + (the-as fact-info #f) + ) + ) + ) + (send-event (ppointer->process v1-0) 'get-notify #t) + ) + ) + ) + (none) + ) + :exit (behavior () + (set-continue! *game-info* "skatea-training" #f) + (none) + ) + :trans (behavior () + (if (-> self board-picked-up) + (go-virtual idle-training) + ) + (none) + ) + :code (the-as (function none :behavior hoverboard-training-manager) sleep-code) + ) + +(defstate wait-for-board (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :trans (behavior () + (if (task-node-open? (game-task-node stadium-board1-board)) + (go-virtual wait-for-pickup) + ) + (none) + ) + :code (the-as (function none :behavior hoverboard-training-manager) sleep-code) + ) + +(defstate wait (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :trans (behavior () + (if (task-node-open? (game-task-node stadium-board1-training-judge)) + (go-virtual jump) + ) + (none) + ) + :code (the-as (function none :behavior hoverboard-training-manager) sleep-code) + ) + +(defstate jump (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + (if (= (-> self voicebox) #f) + (set! (-> self voicebox) (ppointer->handle (voicebox-spawn *target* (target-pos 0)))) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei001" -99.0 0) + ) + (while (or (not *target*) (zero? (logand (focus-status board) (-> *target* focus-status)))) + (if (= (get-status *gui-control* (the-as sound-id (-> self last-sound-id))) (gui-status unknown)) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + ) + (render-text self (game-text-id board-tutorial-get-on-board)) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei002" -99.0 0) + ) + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-jump)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-jump)) + (goto cfg-51) + ) + ) + #f + (label cfg-51) + (send-event *target* 'get-notify #f) + (go-virtual duck-jump) + (none) + ) + ) + +(defstate duck-jump (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei006" -99.0 0) + ) + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-duck-jump)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-duck-jump)) + (goto cfg-36) + ) + ) + #f + (label cfg-36) + (send-event *target* 'get-notify #f) + (go-virtual boost-jump) + (none) + ) + ) + +(defstate boost-jump (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :exit (behavior () + (send-event (handle->process (-> self arrow)) 'leave) + (none) + ) + :code (behavior () + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei008" -99.0 0) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei009" -99.0 0) + ) + (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> gp-1 pos quad) (-> (new 'static 'vector :x 592158.75 :y -18391.04 :z -2367201.2 :w 1.0) quad)) + (quaternion-identity! (-> gp-1 quat)) + (set! (-> gp-1 flags) (task-arrow-flags)) + (set! (-> gp-1 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-1 (the-as task-arrow self)))) + ) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (let ((gp-2 #f) + (s5-0 (+ (-> self clock frame-counter) (seconds 15))) + ) + (until #f + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer self)) + (set! (-> a1-7 num-params) 0) + (set! (-> a1-7 message) 'off) + (let ((t9-8 send-event-function) + (v1-43 (-> self actor-group 0 data 0 actor)) + ) + (t9-8 + (if v1-43 + (-> v1-43 extra process) + ) + a1-7 + ) + ) + ) + (render-text self (game-text-id board-tutorial-boost-jump)) + (when (< s5-0 (-> self clock frame-counter)) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei009" -99.0 0) + ) + (set! s5-0 (+ (-> self clock frame-counter) (seconds 15))) + ) + (suspend) + (if (= (-> self trick-type) (board-tricks board-quick-jump)) + (set! gp-2 #t) + ) + (if (and gp-2 (-> self boost)) + (goto cfg-42) + ) + ) + ) + #f + (label cfg-42) + (send-event *target* 'get-notify #f) + (go-virtual grind) + (none) + ) + ) + +(defstate grind (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :exit (behavior () + (send-event (handle->process (-> self arrow)) 'leave) + (none) + ) + :code (behavior () + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei013" -99.0 0) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei014" -99.0 0) + ) + (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> gp-1 pos quad) (-> (new 'static 'vector :x 520232.97 :y -18391.04 :z -1988730.9 :w 1.0) quad)) + (quaternion-identity! (-> gp-1 quat)) + (set! (-> gp-1 flags) (task-arrow-flags)) + (set! (-> gp-1 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-1 (the-as task-arrow self)))) + ) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (let ((gp-2 #f)) + (until #f + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (process->ppointer self)) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'off) + (let ((t9-6 send-event-function) + (v1-26 (-> self actor-group 0 data 1 actor)) + ) + (t9-6 + (if v1-26 + (-> v1-26 extra process) + ) + a1-5 + ) + ) + ) + (render-text self (game-text-id board-tutorial-grind)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-rail-jump)) + (set! gp-2 #t) + ) + (if (= (get-status *gui-control* (the-as sound-id (-> self last-sound-id))) (gui-status unknown)) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + ) + (if (and gp-2 (-> self grind)) + (goto cfg-35) + ) + ) + ) + #f + (label cfg-35) + (send-event *target* 'get-notify #f) + (go-virtual spin) + (none) + ) + ) + +(defstate spin (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei010" -99.0 0) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei011" -99.0 0) + ) + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-spin)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-spin)) + (goto cfg-36) + ) + ) + #f + (label cfg-36) + (send-event *target* 'get-notify #f) + (go-virtual flip) + (none) + ) + ) + +(defstate flip (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei016" -99.0 0) + ) + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-flip)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-flip)) + (goto cfg-36) + ) + ) + #f + (label cfg-36) + (send-event *target* 'get-notify #f) + (go-virtual trick) + (none) + ) + ) + +(defstate trick (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei017" -99.0 0) + ) + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-trick)) + (suspend) + (case (-> self trick-type) + (((board-tricks board-nosegrab) + (board-tricks board-method) + (board-tricks board-board-spin) + (board-tricks board-board-flip) + (board-tricks board-noseflip) + (board-tricks board-kickflip) + ) + (goto cfg-47) + ) + ) + ) + #f + (label cfg-47) + (send-event *target* 'get-notify #f) + (go-virtual game) + (none) + ) + ) + +(defstate game (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei018" -99.0 0) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei019" -99.0 0) + ) + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id (-> self last-sound-id)))) + ;; (suspend) + ;; ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (when (!= (-> self voicebox) #f) + (send-event (handle->process (-> self voicebox)) 'die) + (set! (-> self voicebox) (the-as handle #f)) + ) + (task-node-close! (game-task-node stadium-board1-training)) + (go-virtual idle) + (none) + ) + ) + +(defmethod hoverboard-training-manager-method-29 hoverboard-training-manager ((obj hoverboard-training-manager)) + (let ((s5-0 (get-game-score-ref *game-info* (the-as int (-> obj game-score)))) + (gp-0 (handle->process (-> obj hud-goal))) + ) + (cond + ((-> obj training?) + (cond + ((>= (-> *game-info* score) (-> s5-0 0)) + (set! (-> *game-info* goal) (-> *game-info* score)) + (let ((s5-1 format) + (gp-1 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-1 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-1 gp-1 s4-1 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 1)) + (set! (-> *game-info* goal) (-> s5-0 0)) + (let ((s5-2 format) + (gp-2 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-2 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-2 gp-2 s4-2 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 2)) + (set! (-> *game-info* goal) (-> s5-0 1)) + (let ((s5-3 format) + (gp-3 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-3 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) + (s5-3 gp-3 s4-3 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> obj training-goal)) + (set! (-> *game-info* goal) (-> s5-0 2)) + (let ((s5-4 format) + (gp-4 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-4 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-bronze) #f)) + (s5-4 gp-4 s4-4 *temp-string*) + ) + ) + (else + (set! (-> *game-info* goal) (-> obj training-goal)) + (let ((s5-5 format) + (gp-5 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-5 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-goal) #f)) + (s5-5 gp-5 s4-5 *temp-string*) + ) + ) + ) + ) + ((task-node-open? (the-as game-task-node (-> obj task-bronze))) + (cond + ((>= (-> *game-info* score) (-> s5-0 0)) + (set! (-> *game-info* goal) (-> *game-info* score)) + (let ((s5-6 format) + (gp-6 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-6 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-6 gp-6 s4-6 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 1)) + (set! (-> *game-info* goal) (-> s5-0 0)) + (let ((s5-7 format) + (gp-7 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-7 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-7 gp-7 s4-7 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 2)) + (set! (-> *game-info* goal) (-> s5-0 1)) + (let ((s5-8 format) + (gp-8 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-8 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) + (s5-8 gp-8 s4-8 *temp-string*) + ) + ) + (else + (set! (-> *game-info* goal) (-> s5-0 2)) + (let ((s5-9 format) + (gp-9 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-9 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-bronze) #f)) + (s5-9 gp-9 s4-9 *temp-string*) + ) + ) + ) + ) + ((task-node-open? (the-as game-task-node (-> obj task-silver))) + (cond + ((>= (-> *game-info* score) (-> s5-0 0)) + (set! (-> *game-info* goal) (-> *game-info* score)) + (let ((s5-10 format) + (gp-10 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-10 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-10 gp-10 s4-10 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 1)) + (set! (-> *game-info* goal) (-> s5-0 0)) + (let ((s5-11 format) + (gp-11 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-11 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) + (s5-11 gp-11 s4-11 *temp-string*) + ) + ) + (else + (set! (-> *game-info* goal) (-> s5-0 1)) + (let ((s5-12 format) + (gp-12 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-12 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) + (s5-12 gp-12 s4-12 *temp-string*) + ) + ) + ) + ) + ((or (task-node-open? (the-as game-task-node (-> obj task-gold))) + (task-node-closed? (the-as game-task-node (-> obj task-gold))) + ) + (cond + ((>= (-> *game-info* score) (-> s5-0 0)) + (set! (-> *game-info* goal) (-> *game-info* score)) + (let ((s5-13 format) + (gp-13 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-13 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-13 gp-13 s4-13 *temp-string*) + ) + ) + (else + (set! (-> *game-info* goal) (-> s5-0 0)) + (let ((s5-14 format) + (gp-14 (clear (-> (the-as hud-goal gp-0) strings 1 text))) + (s4-14 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-14 gp-14 s4-14 *temp-string*) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod hoverboard-training-manager-method-30 hoverboard-training-manager ((obj hoverboard-training-manager)) + (set! (-> obj egg-count) 0) + (set! (-> obj medal) 0) + (let ((s5-0 (get-game-score-ref *game-info* (the-as int (-> obj game-score))))) + (when (or (-> obj training?) (task-node-open? (the-as game-task-node (-> obj task-bronze)))) + (when (>= (-> *game-info* score) (-> s5-0 2)) + (task-node-close! (the-as game-task-node (-> obj task-bronze))) + (logior! (-> *game-info* features) (game-feature board)) + (+! (-> obj egg-count) 1) + (set! (-> obj medal) 2) + ) + ) + (when (task-node-open? (the-as game-task-node (-> obj task-silver))) + (when (>= (-> *game-info* score) (-> s5-0 1)) + (task-node-close! (the-as game-task-node (-> obj task-silver))) + (logior! (-> *game-info* features) (game-feature board)) + (+! (-> obj egg-count) 1) + (set! (-> obj medal) 1) + ) + ) + (when (task-node-open? (the-as game-task-node (-> obj task-gold))) + (when (>= (-> *game-info* score) (-> s5-0 0)) + (task-node-close! (the-as game-task-node (-> obj task-gold))) + (logior! (-> *game-info* features) (game-feature board)) + (+! (-> obj egg-count) 1) + (set! (-> obj medal) 0) + 0 + ) + ) + ) + (game-info-method-28 *game-info* (the-as game-score (-> obj game-score)) (-> obj score)) + 0 + (none) + ) + +(defstate idle (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :enter (behavior () + (if (= (-> self hud-score) #f) + (set! (-> self hud-score) (ppointer->handle (process-spawn hud-score :init hud-init-by-other :to self))) + ) + (if (= (-> self hud-goal) #f) + (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) + ) + (set! (-> self training-goal) 15000.0) + (set! (-> self training?) #t) + (set! (-> self game-score) (the-as uint 10)) + (set! (-> self task-gold) (the-as uint 71)) + (set! (-> self task-silver) (the-as uint 70)) + (set! (-> self task-bronze) (the-as uint 69)) + (set! (-> self challenge-done) #t) + (if (task-node-closed? (game-task-node stadium-board1-training-judge)) + (set! (-> self training?) #f) + ) + (none) + ) + :exit (behavior () + (send-event *target* 'get-notify #f) + (none) + ) + :trans (behavior () + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'off) + (let ((t9-0 send-event-function) + (v1-5 (-> self actor-group 0 data 0 actor)) + ) + (t9-0 + (if v1-5 + (-> v1-5 extra process) + ) + a1-0 + ) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'off) + (let ((t9-1 send-event-function) + (v1-13 (-> self actor-group 0 data 1 actor)) + ) + (t9-1 + (if v1-13 + (-> v1-13 extra process) + ) + a1-1 + ) + ) + ) + (cond + ((not (logtest? (-> *game-info* features) (game-feature board))) + (if (!= (-> self hud-score) #f) + (send-event (handle->process (-> self hud-score)) 'force-hide) + ) + (if (!= (-> self hud-goal) #f) + (send-event (handle->process (-> self hud-goal)) 'force-hide) + ) + ) + (else + (if (!= (-> self hud-score) #f) + (send-event (handle->process (-> self hud-score)) 'force-show) + ) + (if (!= (-> self hud-goal) #f) + (send-event (handle->process (-> self hud-goal)) 'force-show) + ) + ) + ) + (send-event *target* 'get-notify self) + (hoverboard-training-manager-method-29 self) + (when (not (-> self challenge-done)) + (when (and (not (-> self combo-done?)) + (>= (- (-> self clock frame-counter) (-> self hint-time)) (seconds 30)) + (not (task-node-closed? (game-task-node stadium-board1-resolution))) + ) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei018" -99.0 0) + (set! (-> self hint-time) (-> self clock frame-counter)) + ) + ) + (none) + ) + :code (behavior () + (suspend) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'open) + (let ((t9-0 send-event-function) + (v1-5 (-> self actor-group 1 data 0 actor)) + ) + (t9-0 + (if v1-5 + (-> v1-5 extra process) + ) + a1-0 + ) + ) + ) + (until #f + (when (not (task-node-closed? (game-task-node stadium-board1-training-judge))) + (let ((gp-0 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> gp-0 pos quad) (-> (new 'static 'vector :x 191037.44 :y -53780.48 :z -2148638.8 :w 1.0) quad)) + (quaternion-identity! (-> gp-0 quat)) + (set! (-> gp-0 flags) (task-arrow-flags)) + (set! (-> gp-0 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-0 (the-as task-arrow self)))) + ) + (set! (-> self score) -1.0) + ) + (let ((gp-1 + (ppointer->handle + (judge-spawn self (new 'static 'vector :x 190382.08 :y -47063.04 :z -2148475.0 :w 1.0) (the-as uint 10)) + ) + ) + ) + (suspend) + (while (send-event (handle->process gp-1) 'waiting) + (when (-> self text) + (cond + ((not (task-node-closed? (game-task-node stadium-board1-resolution))) + (cond + ((task-node-open? (game-task-node stadium-board1-training-judge)) + (cond + ((< (-> self score) 0.0) + (render-text self (game-text-id board-score-activate-judge)) + ) + ((< (-> self score) 15000.0) + (render-text self (game-text-id board-score-try-again)) + ) + ) + ) + ((not (task-node-closed? (game-task-node stadium-board1-done))) + (if (not (movie?)) + (render-text self (game-text-id board-score-return-to-garage)) + ) + ) + ((task-node-closed? (game-task-node stadium-board1-done)) + (when (!= (-> self arrow) #f) + (send-event (handle->process (-> self arrow)) 'leave) + (set! (-> self arrow) (the-as handle #f)) + ) + ) + ) + ) + (else + (go-virtual wait-for-pickup-training) + ) + ) + ) + (suspend) + ) + (if (!= (-> self arrow) #f) + (send-event (handle->process (-> self arrow)) 'leave) + ) + (set! (-> self score) 0.0) + (set! (-> self challenge-done) #f) + (set! (-> self combo-done?) #f) + (set! (-> self hint-time) (-> self clock frame-counter)) + (while (and (not (-> self challenge-done)) (logtest? (-> *game-info* features) (game-feature board))) + (suspend) + ) + (send-event (handle->process gp-1) 'die) + ) + (when (-> self challenge-done) + (hoverboard-training-manager-method-30 self) + (when (> (-> self egg-count) 0) + (let ((s5-0 0)) + (let ((gp-3 (ppointer->handle (voicebox-spawn *target* (target-pos 0))))) + (let ((v1-83 (-> self medal))) + (cond + ((zero? v1-83) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv179" -99.0 0)) + ) + ) + ((= v1-83 1) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv180" -99.0 0)) + ) + ) + ((= v1-83 2) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv181" -99.0 0)) + ) + ) + ) + ) + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id s5-0))) + ;; (suspend) + ;; ) + (let* ((s5-1 (handle->process gp-3)) + (v1-97 (if (type? s5-1 process-drawable) + (the-as process-drawable s5-1) + ) + ) + (t1-3 (new 'static 'fact-info)) + ) + (set! (-> t1-3 options) (actor-option)) + (logior! (-> t1-3 options) (actor-option suck-in)) + (birth-pickup-at-point + (-> v1-97 root trans) + (pickup-type skill) + (* (the float (-> self egg-count)) (-> *FACT-bank* super-skill-inc)) + #t + *entity-pool* + t1-3 + ) + ) + (let ((s5-2 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s5-2) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process gp-3) 'die) + ) + ) + (auto-save-user) + ) + ) + (set! (-> self challenge-done) #t) + (let ((gp-4 (new 'stack-no-clear 'task-arrow-params))) + (cond + ((not (task-node-closed? (game-task-node stadium-board1-training-judge))) + (cond + ((>= (-> self score) 15000.0) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei021" -99.0 0) + (task-node-close! (game-task-node stadium-board1-training-judge)) + (set! (-> self training?) #f) + (set! (-> gp-4 pos quad) (-> (new 'static 'vector :x 426885.12 :y -38461.44 :z -2598625.2 :w 1.0) quad)) + (quaternion-identity! (-> gp-4 quat)) + (set! (-> gp-4 flags) (task-arrow-flags)) + (set! (-> gp-4 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-4 (the-as task-arrow self)))) + ) + (else + (set! (-> *game-info* sub-task-list 66 death-count) + (the-as uint (seekl (the-as int (-> *game-info* sub-task-list 66 death-count)) #xffff 1)) + ) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei020" -99.0 0) + ) + ) + ) + (else + (set! (-> self training?) #f) + (set! (-> gp-4 pos quad) (-> (new 'static 'vector :x 426885.12 :y -38461.44 :z -2598625.2 :w 1.0) quad)) + (quaternion-identity! (-> gp-4 quat)) + (set! (-> gp-4 flags) (task-arrow-flags)) + (set! (-> gp-4 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-4 (the-as task-arrow self)))) + ) + ) + ) + ) + #f + (none) + ) + ) + +(defstate idle-training (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :enter (behavior () + (if (= (-> self hud-score) #f) + (set! (-> self hud-score) (ppointer->handle (process-spawn hud-score :init hud-init-by-other :to self))) + ) + (if (= (-> self hud-goal) #f) + (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) + ) + (set! (-> self training-goal) 15000.0) + (set! (-> self training?) #f) + (set! (-> self game-score) (the-as uint 10)) + (set! (-> self task-gold) (the-as uint 71)) + (set! (-> self task-silver) (the-as uint 70)) + (set! (-> self task-bronze) (the-as uint 69)) + (none) + ) + :exit (behavior () + (send-event *target* 'get-notify #f) + (none) + ) + :trans (behavior () + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'off) + (let ((t9-0 send-event-function) + (v1-5 (-> self actor-group 0 data 0 actor)) + ) + (t9-0 + (if v1-5 + (-> v1-5 extra process) + ) + a1-0 + ) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'off) + (let ((t9-1 send-event-function) + (v1-13 (-> self actor-group 0 data 1 actor)) + ) + (t9-1 + (if v1-13 + (-> v1-13 extra process) + ) + a1-1 + ) + ) + ) + (cond + ((not (logtest? (-> *game-info* features) (game-feature board))) + (if (!= (-> self hud-score) #f) + (send-event (handle->process (-> self hud-score)) 'force-hide) + ) + (if (!= (-> self hud-goal) #f) + (send-event (handle->process (-> self hud-goal)) 'force-hide) + ) + ) + (else + (if (!= (-> self hud-score) #f) + (send-event (handle->process (-> self hud-score)) 'force-show) + ) + (if (!= (-> self hud-goal) #f) + (send-event (handle->process (-> self hud-goal)) 'force-show) + ) + ) + ) + (hoverboard-training-manager-method-29 self) + (none) + ) + :code (behavior () + (send-event *target* 'get-notify self) + (until #f + (let ((gp-0 + (ppointer->handle + (judge-spawn self (new 'static 'vector :x 190382.08 :y -47063.04 :z -2148475.0 :w 1.0) (the-as uint 10)) + ) + ) + ) + (suspend) + (while (send-event (handle->process (the-as handle gp-0)) 'waiting) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'open) + (let ((t9-2 send-event-function) + (v1-11 (-> self actor-group 1 data 0 actor)) + ) + (t9-2 + (if v1-11 + (-> v1-11 extra process) + ) + a1-2 + ) + ) + ) + (suspend) + ) + ) + (set! (-> self score) 0.0) + (set! (-> self challenge-done) #f) + (until (-> self challenge-done) + (suspend) + ) + (hoverboard-training-manager-method-30 self) + (when (> (-> self egg-count) 0) + (let ((s5-0 0)) + (let ((gp-2 (ppointer->handle (voicebox-spawn *target* (target-pos 0))))) + (let ((v1-30 (-> self medal))) + (cond + ((zero? v1-30) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv179" -99.0 0)) + ) + ) + ((= v1-30 1) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv180" -99.0 0)) + ) + ) + ((= v1-30 2) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv181" -99.0 0)) + ) + ) + ) + ) + ;; TODO - no streaming audio + ;; (while (nonzero? (get-status *gui-control* (the-as sound-id s5-0))) + ;; (suspend) + ;; ) + (let* ((s5-1 (handle->process gp-2)) + (v1-44 (if (type? s5-1 process-drawable) + (the-as process-drawable s5-1) + ) + ) + (t1-3 (new 'static 'fact-info)) + ) + (set! (-> t1-3 options) (actor-option)) + (logior! (-> t1-3 options) (actor-option suck-in)) + (birth-pickup-at-point + (-> v1-44 root trans) + (pickup-type skill) + (* (the float (-> self egg-count)) (-> *FACT-bank* super-skill-inc)) + #t + *entity-pool* + t1-3 + ) + ) + (let ((s5-2 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s5-2) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process gp-2) 'die) + ) + ) + (auto-save-user) + ) + ) + #f + (none) + ) + :post (behavior () + (if (not (logtest? (-> *game-info* features) (game-feature board))) + (go-virtual wait-for-pickup-training) + ) + (none) + ) + ) + +(defmethod deactivate hoverboard-training-manager ((obj hoverboard-training-manager)) + (send-event *traffic-manager* 'restore-default-settings) + ((the-as (function process none) (find-parent-method hoverboard-training-manager 10)) obj) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! hoverboard-training-manager ((obj hoverboard-training-manager) (arg0 entity-actor)) + (stack-size-set! (-> obj main-thread) 1024) ;; added + (local-vars (sv-16 res-tag)) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-1 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (cond + ((and v1-1 (nonzero? (-> sv-16 elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) + ) + (else + (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) + (set! (-> obj actor-group-count) 0) + (go process-drawable-art-error "actor-group training-manager") + ) + ) + ) + (set! (-> obj boost) #f) + (set! (-> obj grind) #f) + (set! (-> obj text) #t) + (set! (-> obj combo-done?) #f) + (set! (-> obj hud-score) (the-as handle #f)) + (set! (-> obj hud-goal) (the-as handle #f)) + (set! (-> obj voicebox) (the-as handle #f)) + (set! (-> obj arrow) (the-as handle #f)) + (set! (-> obj gui-id) (the-as sound-id 0)) + (set! (-> obj gui-id) + (add-process *gui-control* obj (gui-channel message) (gui-action play) (-> obj name) 81920.0 0) + ) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'set-object-target-count 11 0) + (send-event s5-0 'set-object-target-count 12 0) + (send-event s5-0 'set-object-target-count 13 0) + (send-event s5-0 'set-object-target-count 14 0) + (send-event s5-0 'set-object-target-count 15 0) + (send-event s5-0 'set-object-target-count 16 0) + (send-event s5-0 'set-object-target-count 0 0) + (send-event s5-0 'set-object-target-count 1 0) + (send-event s5-0 'set-object-target-count 2 0) + (send-event s5-0 'set-object-target-count 6 0) + (send-event s5-0 'set-object-target-count 7 0) + (send-event s5-0 'set-object-target-count 8 0) + (send-event s5-0 'set-object-target-count 9 0) + (send-event s5-0 'set-object-target-count 10 0) + (send-event s5-0 'set-object-target-count 18 0) + (send-event s5-0 'set-object-target-count 19 0) + (send-event s5-0 'set-guard-target-level 0) + ) + (set-setting! 'allow-continue #f 0 0) + (cond + ((task-node-closed? (game-task-node forest-scouts-get-board)) + (go (method-of-object obj idle)) + ) + ((task-node-closed? (game-task-node stadium-board1-resolution)) + (go (method-of-object obj wait-for-pickup-training)) + ) + ((task-node-open? (game-task-node stadium-board1-training)) + (go (method-of-object obj jump)) + ) + ((task-node-open? (game-task-node stadium-board1-training-judge)) + (go (method-of-object obj idle)) + ) + ((task-node-closed? (game-task-node stadium-board1-training-judge)) + (go (method-of-object obj idle)) + ) + (else + (go (method-of-object obj wait-for-board)) + ) + ) + (none) + ) + +(deftype skate-training-ramp (process-focusable) + ((onoff symbol :offset-assert 204) + ) + :heap-base #x50 + :method-count-assert 29 + :size-assert #xd0 + :flag-assert #x1d005000d0 + (:methods + (idle () _type_ :state 27) + (skate-training-ramp-method-28 (_type_) collide-shape-moving 28) + ) + ) + + +(defskelgroup skel-skate-training-ramp skate-training-ramp 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 4 -4 8 12) + ) + +(defstate idle (skate-training-ramp) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('open) + (let ((v0-0 #t)) + (set! (-> self onoff) v0-0) + v0-0 + ) + ) + (('close) + (set! (-> self onoff) #f) + #f + ) + ) + ) + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (none) + ) + :code (behavior () + (until #f + (if (-> self onoff) + (ja :num! (seek! max 0.05)) + (ja :num! (seek! 0.0 0.05)) + ) + (suspend) + ) + #f + (none) + ) + :post (behavior () + (transform-post) + (none) + ) + ) + +(defmethod skate-training-ramp-method-28 skate-training-ramp ((obj skate-training-ramp)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 61440.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-12 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-12 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-12 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-12 prim-core action) (collide-action solid)) + (set! (-> v1-12 transform-index) 4) + (set-vector! (-> v1-12 local-sphere) 16384.0 -16384.0 32768.0 49152.0) + ) + (let ((v1-14 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-14 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-14 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-14 prim-core action) (collide-action solid)) + (set! (-> v1-14 transform-index) 3) + (set-vector! (-> v1-14 local-sphere) 16384.0 -16384.0 32768.0 49152.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-17 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + s5-0 + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! skate-training-ramp ((obj skate-training-ramp) (arg0 entity-actor)) + (skate-training-ramp-method-28 obj) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton + obj + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-skate-training-ramp" (the-as (pointer uint32) #f)) + ) + (the-as pair 0) + ) + (set! (-> obj onoff) #f) + (ja-channel-push! 1 0) + (let ((a0-7 (-> obj skel root-channel 0))) + (set! (-> a0-7 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-7 frame-num) 0.0) + (joint-control-channel-group! a0-7 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (transform-post) + (go (method-of-object obj idle)) + (none) + ) + +(deftype skate-gate (process-focusable) + ((onoff symbol :offset-assert 204) + ) + :heap-base #x50 + :method-count-assert 30 + :size-assert #xd0 + :flag-assert #x1e005000d0 + (:methods + (idle () _type_ :state 27) + (open () _type_ :state 28) + (skate-gate-method-29 (_type_) collide-shape-moving 29) + ) + ) + + +(defskelgroup skel-skate-gate skate-gate 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 8 0 30)) + +(defstate idle (skate-gate) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('open) + (remove-setting! 'minimap) + (let ((v0-1 #t)) + (set! (-> self onoff) v0-1) + v0-1 + ) + ) + (('close) + (set-setting! 'minimap 'clear 0 128) + (set! (-> self onoff) #f) + #f + ) + ) + ) + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (none) + ) + :code (behavior () + (until #f + (if (-> self onoff) + (ja :num! (seek! max 0.05)) + (ja :num! (seek! 0.0 0.05)) + ) + (suspend) + ) + #f + (none) + ) + :post (behavior () + (if (logtest? (-> *game-info* features) (game-feature board)) + (send-event self 'close) + (send-event self 'open) + ) + (transform-post) + (none) + ) + ) + +(defstate open (skate-gate) + :virtual #t + :code (the-as (function none :behavior skate-gate) sleep-code) + ) + +(defmethod skate-gate-method-29 skate-gate ((obj skate-gate)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((v1-6 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-6 prim-core action) (collide-action solid)) + (set! (-> v1-6 transform-index) 3) + (set-vector! (-> v1-6 local-sphere) 32768.0 32768.0 0.0 49152.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + s5-0 + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! skate-gate ((obj skate-gate) (arg0 entity-actor)) + (skate-gate-method-29 obj) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-skate-gate" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj onoff) #f) + (send-event *target* 'reset-pickup 'trick-judge) + (send-event *target* 'reset-pickup 'trick-point) + (ja-channel-push! 1 0) + (cond + ((and (not (task-node-open? (game-task-node stadium-board1-training-judge))) + (logtest? (-> *game-info* features) (game-feature board)) + ) + (let ((a0-15 (-> obj skel root-channel 0))) + (set! (-> a0-15 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-15 frame-num) 1.0) + (joint-control-channel-group! a0-15 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (transform-post) + (go (method-of-object obj open)) + ) + (else + (let ((a0-16 (-> obj skel root-channel 0))) + (set! (-> a0-16 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-16 frame-num) 0.0) + (joint-control-channel-group! a0-16 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (transform-post) + (go (method-of-object obj idle)) + ) + ) + (none) + ) + +(defskelgroup skel-skatea-jump-pad skatea-jump-pad 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 15) + ) + +(deftype skatea-jump-pad (bouncer) + () + :heap-base #x60 + :method-count-assert 25 + :size-assert #xd4 + :flag-assert #x19006000d4 + ) + + +(defmethod init-skeleton! skatea-jump-pad ((obj skatea-jump-pad)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-skatea-jump-pad" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + 0 + (none) + ) + +(defmethod bouncer-method-24 skatea-jump-pad ((obj skatea-jump-pad)) + "TODO - collision stuff" + (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec crate)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 61440.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 2)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec crate)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 0) + (set-vector! (-> v1-8 local-sphere) 0.0 0.0 0.0 12288.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 8)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec crate)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-10 prim-core action) (collide-action)) + (set-vector! (-> v1-10 local-sphere) 0.0 4096.0 0.0 6144.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> obj root) s5-0) + ) + 0 + (none) + ) + +(defstate fire (skatea-jump-pad) + :virtual #t + :code (behavior () + (sound-play "dig-air-lifter") + (let ((s5-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3))) + (gp-1 (get-process *default-dead-pool* part-tracker #x4000)) + ) + (when gp-1 + (let ((t9-4 (method-of-type part-tracker activate))) + (t9-4 + (the-as part-tracker gp-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-5 run-function-in-process) + (a0-5 gp-1) + (a1-4 part-tracker-init) + (a2-5 (-> *part-group-id-table* 12)) + (a3-2 0) + (t0-1 #f) + (t1-1 #f) + (t2-1 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> s5-1 quad)) + ((the-as (function object object object object object object object object none) t9-5) + a0-5 + a1-4 + a2-5 + a3-2 + t0-1 + t1-1 + t2-1 + t3-0 + ) + ) + (-> gp-1 ppointer) + ) + ) + (let ((t9-6 (-> (method-of-type bouncer fire) code))) + (if t9-6 + ((the-as (function none) t9-6)) + ) + ) + (none) + ) + ) + +(defskelgroup skel-skatea-floating-ring skatea-floating-ring 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 4 0 8) + ) + +(deftype skatea-floating-ring (process-focusable) + ((pos-y float :offset-assert 204) + (offset float :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 29 + :size-assert #xd4 + :flag-assert #x1d006000d4 + (:methods + (idle () _type_ :state 27) + (skatea-floating-ring-method-28 (_type_) none 28) + ) + ) + + +(defstate idle (skatea-floating-ring) + :virtual #t + :exit (behavior () + '() + (none) + ) + :code (the-as (function none :behavior skatea-floating-ring) sleep-code) + :post (behavior () + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (if (nonzero? (-> self sound)) + (update! (-> self sound)) + ) + (let* ((a0-1 (-> self part)) + (t9-1 (method-of-object a0-1 spawn)) + (a1-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-6 (-> self root-override trans))) + (let ((a2-0 *up-vector*)) + (let ((a3-1 16384.0)) + (.mov vf7 a3-1) + ) + (.lvf vf5 (&-> a2-0 quad)) + ) + (.lvf vf4 (&-> v1-6 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a1-0 quad) vf6) + (t9-1 a0-1 a1-0) + ) + (set! (-> self root-override trans y) + (+ (-> self pos-y) + (* 2048.0 (cos (* 18204.445 (+ (-> self offset) (* 0.0033333334 (the float (-> self clock frame-counter))))))) + ) + ) + (transform-post) + (none) + ) + ) + ) + +(defmethod skatea-floating-ring-method-28 skatea-floating-ring ((obj skatea-floating-ring)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec crate camera-blocker)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list tobot)) + (set! (-> v1-6 prim-core action) (collide-action solid deadly)) + (set! (-> v1-6 transform-index) 3) + (set-vector! (-> v1-6 local-sphere) 0.0 16384.0 0.0 32768.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! skatea-floating-ring ((obj skatea-floating-ring) (arg0 entity-actor)) + (skatea-floating-ring-method-28 obj) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-skatea-floating-ring" (the-as (pointer uint32) #f)) + ) + (the-as pair 0) + ) + (set! (-> obj mask) (logior (process-mask crate) (-> obj mask))) + (set! (-> obj pos-y) (-> obj root-override trans y)) + (set! (-> obj offset) (rand-vu)) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 539) obj)) + (set! (-> obj sound) (new + 'process + 'ambient-sound + (static-sound-spec "fire-ring" :fo-min 10 :fo-max 30) + (-> obj root-override trans) + ) + ) + (go (method-of-object obj idle)) + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/game/pilot-h_REF.gc b/test/decompiler/reference/jak2/engine/game/pilot-h_REF.gc index 3eb6f2d498..79ff477dfe 100644 --- a/test/decompiler/reference/jak2/engine/game/pilot-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/pilot-h_REF.gc @@ -32,7 +32,7 @@ ;; definition of type pilot-info (deftype pilot-info (basic) ((entity basic :offset-assert 4) - (vehicle uint64 :offset-assert 8) + (vehicle handle :offset-assert 8) (left-right-interp float :offset-assert 16) (front-back-interp float :offset-assert 20) (up-down-interp float :offset-assert 24) diff --git a/test/decompiler/reference/jak2/engine/game/task/game-task_REF.gc b/test/decompiler/reference/jak2/engine/game/task/game-task_REF.gc index 7b5cc1a72b..5ca9bf7ae5 100644 --- a/test/decompiler/reference/jak2/engine/game/task/game-task_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/task/game-task_REF.gc @@ -3421,7 +3421,7 @@ :borrow '() :open? #f :on-close #f - :description (game-text-id text-x244) + :description (game-text-id board-score-return-to-garage) ) (new 'static 'game-task-node-info :level 'stadium diff --git a/test/decompiler/reference/jak2/engine/game/task/task-control-h_REF.gc b/test/decompiler/reference/jak2/engine/game/task/task-control-h_REF.gc index 49d55aa6d6..87e9883530 100644 --- a/test/decompiler/reference/jak2/engine/game/task/task-control-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/task/task-control-h_REF.gc @@ -1399,37 +1399,37 @@ ;; definition of type task-manager (deftype task-manager (process) - ((node-info game-task-node-info :offset-assert 128) - (info task-manager-info :offset-assert 132) - (lev-name symbol :offset-assert 136) - (fail-on-death? symbol :offset-assert 140) - (fail-now symbol :offset-assert 144) - (retry-now symbol :offset-assert 148) - (allow-fail symbol :offset-assert 152) - (state-time time-frame :offset-assert 160) - (count int16 :offset-assert 168) - (max-count int16 :offset-assert 170) - (sub-state uint32 :offset-assert 172) - (slave handle 32 :offset-assert 176) - (arrow handle :offset-assert 432) - (link uint32 :offset-assert 440) - (start-time time-frame :offset-assert 448) - (total-time time-frame :offset-assert 456) - (beep-time time-frame :offset-assert 464) - (time-limit time-frame :offset-assert 472) - (begin-pos vector :inline :offset-assert 480) - (end-pos vector :inline :offset-assert 496) - (data-int8 int8 32 :offset-assert 512) - (data-int32 int32 32 :offset-assert 544) - (data-float float 32 :offset-assert 672) - (data-vector vector 32 :inline :offset-assert 800) - (actor-group uint32 4 :offset-assert 1312) - (minimap uint32 8 :offset-assert 1328) - (hud handle 4 :offset-assert 1360) - (hud-timer handle :offset 1360) - (hud-counter handle :offset 1368) - (sound-id sound-id 4 :offset-assert 1392) - (intro-time time-frame :offset-assert 1408) + ((node-info game-task-node-info :offset-assert 128) + (info task-manager-info :offset-assert 132) + (lev-name symbol :offset-assert 136) + (fail-on-death? symbol :offset-assert 140) + (fail-now symbol :offset-assert 144) + (retry-now symbol :offset-assert 148) + (allow-fail symbol :offset-assert 152) + (state-time time-frame :offset-assert 160) + (count int16 :offset-assert 168) + (max-count int16 :offset-assert 170) + (sub-state uint32 :offset-assert 172) + (slave handle 32 :offset-assert 176) + (arrow handle :offset-assert 432) + (link uint32 :offset-assert 440) + (start-time time-frame :offset-assert 448) + (total-time time-frame :offset-assert 456) + (beep-time time-frame :offset-assert 464) + (time-limit time-frame :offset-assert 472) + (begin-pos vector :inline :offset-assert 480) + (end-pos vector :inline :offset-assert 496) + (data-int8 int8 32 :offset-assert 512) + (data-int32 int32 32 :offset-assert 544) + (data-float float 32 :offset-assert 672) + (data-vector vector 32 :inline :offset-assert 800) + (actor-group (pointer entity-actor) 4 :offset-assert 1312) + (minimap uint32 8 :offset-assert 1328) + (hud handle 4 :offset-assert 1360) + (hud-timer handle :offset 1360) + (hud-counter handle :offset 1368) + (sound-id sound-id 4 :offset-assert 1392) + (intro-time time-frame :offset-assert 1408) ) :heap-base #x510 :method-count-assert 23 diff --git a/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc b/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc index cc061f4dec..a3411b99a0 100644 --- a/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc @@ -1969,7 +1969,7 @@ (set! (-> obj minimap v1-8) (the-as uint #f)) ) (countdown (v1-11 4) - (set! (-> obj actor-group v1-11) (the-as uint #f)) + (set! (-> obj actor-group v1-11) (the-as (pointer entity-actor) #f)) ) (set! (-> obj fail-now) #f) (set! (-> obj retry-now) #f) diff --git a/test/decompiler/reference/jak2/levels/city/misc/collection_task/collection-task_REF.gc b/test/decompiler/reference/jak2/levels/city/misc/collection_task/collection-task_REF.gc new file mode 100644 index 0000000000..7837755719 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/misc/collection_task/collection-task_REF.gc @@ -0,0 +1,410 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 15 of type hud-moneybag +;; WARN: Return type mismatch int vs none. +(defmethod draw hud-moneybag ((obj hud-moneybag)) + (set-hud-piece-position! + (the-as hud-sprite (-> obj sprites)) + (the int (+ 462.0 (* 130.0 (-> obj offset)))) + 210 + ) + (format (clear (-> obj strings 0 text)) "~D" (-> obj values 0 current)) + (set-as-offset-from! (the-as hud-sprite (-> obj strings 0 pos)) (the-as vector4w (-> obj sprites)) -25 25) + ((method-of-type hud draw) obj) + 0 + (none) + ) + +;; definition for method 16 of type hud-moneybag +;; WARN: Return type mismatch int vs none. +(defmethod update-values hud-moneybag ((obj hud-moneybag)) + (set! (-> obj values 0 target) (the int (-> *game-info* counter))) + ((method-of-type hud update-values) obj) + 0 + (none) + ) + +;; definition for method 17 of type hud-moneybag +;; WARN: Return type mismatch int vs none. +(defmethod init-callback hud-moneybag ((obj hud-moneybag)) + (set! (-> obj level) (level-get *level* 'ctywide)) + (set! (-> obj gui-id) + (add-process *gui-control* obj (gui-channel hud-middle-right) (gui-action hidden) (-> obj name) 81920.0 0) + ) + (logior! (-> obj flags) (hud-flags show)) + (set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x7 :page #x679))) + (set! (-> obj sprites 0 flags) (the-as uint 4)) + (set! (-> obj sprites 0 scale-x) 1.2) + (set! (-> obj sprites 0 scale-y) 1.2) + (alloc-string-if-needed obj 0) + (set! (-> obj strings 0 scale) 0.6) + (set! (-> obj strings 0 flags) (font-flags kerning middle large)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defskelgroup skel-krew-collection-item krew-moneybag 0 3 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :shadow 2 + ) + +;; definition of type krew-collection-item +(deftype krew-collection-item (process-drawable) + () + :heap-base #x50 + :method-count-assert 23 + :size-assert #xc8 + :flag-assert #x17005000c8 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + (find-ground (_type_) symbol 22) + ) + ) + +;; definition for method 3 of type krew-collection-item +(defmethod inspect krew-collection-item ((obj krew-collection-item)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; definition for method 22 of type krew-collection-item +;; INFO: Used lq/sq +(defmethod find-ground krew-collection-item ((obj krew-collection-item)) + (let ((s4-0 #f)) + (let ((gp-0 (new 'stack-no-clear 'collide-query-with-2vec))) + (set! (-> gp-0 vec quad) (-> obj root trans quad)) + (set! (-> gp-0 cquery start-pos quad) (-> gp-0 vec quad)) + (vector-reset! (-> gp-0 vec2)) + (set! (-> gp-0 vec2 y) 1.0) + (set-vector! (-> gp-0 cquery move-dist) 0.0 -40960.0 0.0 1.0) + (let ((v1-5 (-> gp-0 cquery))) + (set! (-> v1-5 radius) 1024.0) + (set! (-> v1-5 collide-with) (collide-spec backgnd)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (let ((f0-6 (fill-and-probe-using-line-sphere *collide-cache* (-> gp-0 cquery)))) + (when (>= f0-6 0.0) + (vector+float*! (-> gp-0 vec) (-> gp-0 cquery start-pos) (-> gp-0 cquery move-dist) f0-6) + (set! (-> gp-0 vec2 quad) (-> gp-0 cquery best-other-tri normal quad)) + (set! (-> gp-0 vec y) (+ 4915.2 (-> gp-0 vec y))) + (set! s4-0 #t) + (format #t "krew-collection-item::find-ground: ground y ~M~%" (-> gp-0 vec y)) + ) + ) + (set! (-> obj root trans quad) (-> gp-0 vec quad)) + (forward-up-nopitch->quaternion (-> obj root quat) (new 'static 'vector :z 1.0 :w 1.0) (-> gp-0 vec2)) + ) + s4-0 + ) + ) + +;; failed to figure out what this is: +(defstate idle (krew-collection-item) + :virtual #t + :trans (behavior () + (let ((v1-0 *target*) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (when v1-0 + (set! (-> gp-0 quad) (-> v1-0 control trans quad)) + (set! (-> gp-0 w) 4096.0) + (when (logtest? (focus-status pilot) (-> v1-0 focus-status)) + (let ((a1-4 (handle->process (-> v1-0 pilot vehicle)))) + (set! (-> gp-0 quad) + (-> (the-as collide-shape (-> (the-as process-drawable a1-4) root)) root-prim prim-core world-sphere quad) + ) + ) + ) + (let ((f0-1 (vector-vector-distance-squared (-> self root trans) gp-0)) + (f1-1 (+ 12288.0 (-> gp-0 w))) + ) + (when (>= (* f1-1 f1-1) f0-1) + (sound-play "skill-pickup") + (set! (-> *game-info* counter) (+ -1.0 (-> *game-info* counter))) + (go-virtual die) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'task-arrow-params))) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 quad) (-> self root trans quad)) + (set! (-> v1-0 y) (+ -6144.0 (-> v1-0 y))) + (set! (-> gp-0 pos quad) (-> v1-0 quad)) + ) + (quaternion-identity! (-> gp-0 quat)) + (set! (-> gp-0 flags) (task-arrow-flags)) + (set! (-> gp-0 map-icon) (the-as uint 15)) + (task-arrow-spawn gp-0 (the-as task-arrow self)) + ) + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior krew-collection-item) ja-post) + ) + +;; failed to figure out what this is: +(defstate die (krew-collection-item) + :virtual #t + :code (behavior () + (cleanup-for-death self) + (none) + ) + ) + +;; definition for function krew-collection-item-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs krew-collection-item. +(defbehavior krew-collection-item-init-by-other krew-collection-item ((arg0 vector)) + (set! (-> self level) (level-get *level* 'lsack)) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg0 quad)) + (quaternion-identity! (-> self root quat)) + (set-vector! (-> self root scale) 3.0 3.0 3.0 1.0) + (initialize-skeleton + self + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-krew-collection-item" (the-as (pointer uint32) #f)) + ) + (the-as pair 0) + ) + (if (-> self draw shadow) + (set! (-> self draw shadow-ctrl) + (new 'process 'shadow-control -12288.0 12288.0 614400.0 (shadow-flags shdf00 shdf04) 245760.0) + ) + ) + (the-as krew-collection-item (go-virtual idle)) + ) + +;; definition for function krew-collection-item-spawn +;; WARN: Return type mismatch process vs krew-collection-item. +(defun krew-collection-item-spawn ((arg0 process) (arg1 vector)) + (let ((gp-0 (the-as process #f))) + (let ((v1-1 (process-spawn krew-collection-item arg1 :to arg0))) + (if v1-1 + (set! gp-0 (-> v1-1 0)) + ) + ) + (the-as krew-collection-item gp-0) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 73 + 0 + (lambda :behavior task-manager + () + (set! (-> self begin-pos quad) (-> (new 'static 'vector :x -245760.0 :y 45056.0 :z 5468160.0 :w 1.0) quad)) + (set-setting! 'exclusive-task #f 0 (-> self node-info task)) + (let ((gp-0 *traffic-manager*) + (s5-0 (new 'stack 'traffic-object-spawn-params)) + ) + (set! (-> s5-0 position quad) (-> self begin-pos quad)) + (quaternion-axis-angle! (-> s5-0 rotation) 0.0 1.0 0.0 16384.0) + (set! (-> s5-0 object-type) (the-as uint 13)) + (set! (-> s5-0 behavior) (the-as uint 0)) + (set! (-> s5-0 id) (the-as uint 0)) + (set! (-> s5-0 proc) #f) + (send-event gp-0 'spawn-object s5-0) + ) + (set! (-> self start-time) 0) + (set! (-> self count) -1) + (set! (-> self max-count) 14) + (set! (-> self data-vector 0 quad) + (-> (new 'static 'vector :x 1282048.0 :y 37925.273 :z 5492736.0 :w 1.0) quad) + ) + (set! (-> self data-vector 1 quad) + (-> (new 'static 'vector :x 2392064.0 :y 23235.379 :z 5980160.0 :w 1.0) quad) + ) + (set! (-> self data-vector 2 quad) + (-> (new 'static 'vector :x 3231744.0 :y 38680.984 :z 4788224.0 :w 1.0) quad) + ) + (set! (-> self data-vector 3 quad) + (-> (new 'static 'vector :x 3829760.0 :y 38680.984 :z 3682304.0 :w 1.0) quad) + ) + (set! (-> self data-vector 4 quad) + (-> (new 'static 'vector :x 4325376.0 :y 38680.984 :z 2564096.0 :w 1.0) quad) + ) + (set! (-> self data-vector 5 quad) + (-> (new 'static 'vector :x 4014080.0 :y 38680.984 :z 1822720.0 :w 1.0) quad) + ) + (set! (-> self data-vector 6 quad) + (-> (new 'static 'vector :x 3698688.0 :y 38680.984 :z 1728512.0 :w 1.0) quad) + ) + (set! (-> self data-vector 7 quad) + (-> (new 'static 'vector :x 3792896.0 :y 38680.984 :z 2387968.0 :w 1.0) quad) + ) + (set! (-> self data-vector 8 quad) + (-> (new 'static 'vector :x 4616192.0 :y 38680.984 :z 2863104.0 :w 1.0) quad) + ) + (set! (-> self data-vector 9 quad) + (-> (new 'static 'vector :x 3633152.0 :y 38680.984 :z 3477504.0 :w 1.0) quad) + ) + (set! (-> self data-vector 10 quad) + (-> (new 'static 'vector :x 3993600.0 :y 38680.984 :z 4378624.0 :w 1.0) quad) + ) + (set! (-> self data-vector 11 quad) + (-> (new 'static 'vector :x 3112960.0 :y 23472.947 :z 5390336.0 :w 1.0) quad) + ) + (set! (-> self data-vector 12 quad) + (-> (new 'static 'vector :x 1789952.0 :y 37616.027 :z 5455872.0 :w 1.0) quad) + ) + (set! (-> self data-vector 13 quad) + (-> (new 'static 'vector :x 237568.0 :y 37541.477 :z 5439488.0 :w 1.0) quad) + ) + (set! (-> self data-int32 0) #x2904) + (set! (-> self data-int32 1) 9000) + (set! (-> self data-int32 2) 9000) + (set! (-> self data-int32 3) 9000) + (set! (-> self data-int32 4) 9000) + (set! (-> self data-int32 5) 9000) + (set! (-> self data-int32 6) 3000) + (set! (-> self data-int32 7) 6000) + (set! (-> self data-int32 8) 9000) + (set! (-> self data-int32 9) 9000) + (set! (-> self data-int32 10) 9000) + (set! (-> self data-int32 11) 9000) + (set! (-> self data-int32 12) 7500) + (set! (-> self data-int32 13) 7500) + (let ((f0-1 (the float (-> self max-count)))) + (set! (-> *game-info* counter) f0-1) + (the-as object f0-1) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 73 + 1 + (lambda :behavior task-manager () (send-event *traffic-manager* 'restore-default-settings)) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 73 + 2 + (lambda :behavior task-manager + () + (check-time self) + (when (>= (-> self count) 0) + (cond + ((handle->process (-> self slave 0)) + #f + ) + (else + (let ((gp-0 (-> self count))) + (cond + ((< gp-0 (-> self max-count)) + (let ((a0-6 (krew-collection-item-spawn self (-> self data-vector gp-0)))) + (when a0-6 + (set! (-> self slave 0) (process->handle a0-6)) + (set! (-> self time-limit) (the-as time-frame (-> self data-int32 gp-0))) + (set! (-> self start-time) (-> self clock frame-counter)) + (let ((v0-1 (the-as object (+ (-> self count) 1)))) + (set! (-> self count) (the-as int v0-1)) + v0-1 + ) + ) + ) + ) + (else + (go-virtual complete) + ) + ) + ) + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 73 + 3 + (lambda :behavior task-manager + () + (local-vars (v1-2 symbol)) + (until (or v1-2 (and *target* (logtest? (focus-status pilot) (-> *target* focus-status)))) + (suspend) + (let ((f0-0 122880.0)) + (set! v1-2 (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)))) + ) + ) + (set-setting! 'airlock #f 0 0) + (set! (-> self count) 0) + (set! (-> self hud-counter) + (ppointer->handle (process-spawn hud-moneybag :init hud-init-by-other :to *target*)) + ) + (send-event *traffic-manager* 'set-target-level #x3f800000) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (suspend) + ) + (send-event *traffic-manager* 'set-alert-level 2) + (send-event *traffic-manager* 'set-alert-duration #xa4cb80) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 73 + 5 + (lambda :behavior task-manager () (the-as object (kill-all-children self))) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 73 + 4 + (lambda :behavior task-manager + () + (send-event *traffic-manager* 'decrease-alert-level 0) + (send-event *traffic-manager* 'set-alert-duration 9000) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (suspend) + ) + (the-as object (talker-spawn-func (-> *talker-speech* 88) *entity-pool* (target-pos 0) (the-as region #f))) + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc new file mode 100644 index 0000000000..4e4bef4acb --- /dev/null +++ b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc @@ -0,0 +1,1597 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type pegasus-path-info +(deftype pegasus-path-info (structure) + ((num-data int32 :offset-assert 0) + (path-data curve-control :offset-assert 4) + (control-data (pointer float) :offset-assert 8) + ) + :allow-misaligned + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type pegasus-path-info +(defmethod inspect pegasus-path-info ((obj pegasus-path-info)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'pegasus-path-info) + (format #t "~1Tnum-data: ~D~%" (-> obj num-data)) + (format #t "~1Tpath-data: ~A~%" (-> obj path-data)) + (format #t "~1Tcontrol-data: #x~X~%" (-> obj control-data)) + (label cfg-4) + obj + ) + +;; definition of type pegasus +(deftype pegasus (enemy) + ((curve-position float :offset-assert 532) + (speed float :offset-assert 536) + (facing vector :inline :offset-assert 544) + (tangent vector :inline :offset-assert 560) + (run-blend-interp float :offset-assert 576) + (near-timer int32 :offset-assert 580) + (far-time time-frame :offset-assert 584) + (y-offset float :offset-assert 592) + (y-offset-desired float :offset-assert 596) + (y-vel float :offset-assert 600) + (water-height float :offset-assert 604) + (timeout uint64 :offset-assert 608) + (ambient-possible uint64 :offset-assert 616) + (ambient-expire uint64 :offset-assert 624) + (can-run symbol :offset-assert 632) + (on-ground symbol :offset-assert 636) + (over-ground symbol :offset-assert 640) + (allow-idle symbol :offset-assert 644) + (path-info pegasus-path-info 20 :inline :offset-assert 648) + (previous-path int32 :offset 968) + (current-path int32 :offset 972) + (num-paths int32 :offset 976) + (display-path int32 :offset 980) + (targetted-timer uint64 :offset 984) + ) + :heap-base #x360 + :method-count-assert 138 + :size-assert #x3e0 + :flag-assert #x8a036003e0 + (:methods + (pegasus-method-137 (_type_) none 137) + ) + (:states + pegasus-debug + pegasus-tired + ) + ) + +;; definition for method 3 of type pegasus +(defmethod inspect pegasus ((obj pegasus)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type enemy inspect))) + (t9-0 obj) + ) + (format #t "~2Tcurve-position: ~f~%" (-> obj curve-position)) + (format #t "~2Tspeed: ~f~%" (-> obj speed)) + (format #t "~2Tfacing: #~%" (-> obj facing)) + (format #t "~2Ttangent: #~%" (-> obj tangent)) + (format #t "~2Trun-blend-interp: ~f~%" (-> obj run-blend-interp)) + (format #t "~2Tnear-timer: ~D~%" (-> obj near-timer)) + (format #t "~2Tfar-time: ~D~%" (-> obj far-time)) + (format #t "~2Ty-offset: ~f~%" (-> obj y-offset)) + (format #t "~2Ty-offset-desired: ~f~%" (-> obj y-offset-desired)) + (format #t "~2Ty-vel: ~f~%" (-> obj y-vel)) + (format #t "~2Twater-height: ~f~%" (-> obj water-height)) + (format #t "~2Ttimeout: ~D~%" (-> obj timeout)) + (format #t "~2Tambient-possible: ~D~%" (-> obj ambient-possible)) + (format #t "~2Tambient-expire: ~D~%" (-> obj ambient-expire)) + (format #t "~2Tcan-run: ~A~%" (-> obj can-run)) + (format #t "~2Ton-ground: ~A~%" (-> obj on-ground)) + (format #t "~2Tover-ground: ~A~%" (-> obj over-ground)) + (format #t "~2Tallow-idle: ~A~%" (-> obj allow-idle)) + (format #t "~2Tpath-info[20] @ #x~X~%" (-> obj path-info)) + (format #t "~2Tprevious-path: ~D~%" (-> obj previous-path)) + (format #t "~2Tcurrent-path: ~D~%" (-> obj current-path)) + (format #t "~2Tnum-paths: ~D~%" (-> obj num-paths)) + (format #t "~2Tdisplay-path: ~D~%" (-> obj display-path)) + (format #t "~2Ttargetted-timer: ~D~%" (-> obj targetted-timer)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-pegasus pegasus 0 5 + ((1 (meters 20)) (2 (meters 40)) (3 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :shadow 4 + ) + +;; definition for symbol *pegasus-enemy-info*, type enemy-info +(define *pegasus-enemy-info* (new 'static 'enemy-info + :use-die-falling #f + :use-victory #f + :use-jump-blocked #f + :debug-draw-neck #f + :jump-debug-draw #f + :move-to-ground #f + :hover-if-no-ground #f + :idle-anim-script (new 'static 'array uint32 4 #x1010501 #x0 #x0 #x0) + :idle-anim 5 + :notice-anim 6 + :hostile-anim 8 + :hit-anim 5 + :knocked-anim -1 + :knocked-land-anim -1 + :die-anim 15 + :die-falling-anim -1 + :victory-anim -1 + :jump-wind-up-anim -1 + :jump-in-air-anim -1 + :jump-land-anim -1 + :neck-joint -1 + :sound-die (static-sound-name "pegasus-die") + :notice-distance (meters 45) + :notice-distance-delta (meters 30) + :proximity-notice-distance (meters 55) + :default-hit-points 6 + :gnd-collide-with (collide-spec backgnd) + :overlaps-others-collide-with-filter (collide-spec jak bot player-list) + :movement-gravity (meters -100) + :friction 0.8 + :attack-shove-back (meters 3) + :attack-shove-up (meters 2) + :attack-mode 'generic + :attack-damage 2 + :jump-height-min (meters 3) + :jump-height-factor 0.5 + :knocked-seek-ry-clamp 2730.6667 + :knocked-soft-vxz-lo 72089.6 + :knocked-soft-vxz-hi 108134.4 + :knocked-soft-vy-lo 81920.0 + :knocked-soft-vy-hi 122880.0 + :knocked-medium-vxz-lo 147456.0 + :knocked-medium-vxz-hi 196608.0 + :knocked-medium-vy-lo 135168.0 + :knocked-medium-vy-hi 151552.0 + :knocked-hard-vxz-lo 78643.2 + :knocked-hard-vxz-hi 117964.8 + :knocked-hard-vy-lo 183500.8 + :knocked-hard-vy-hi 209715.2 + :knocked-huge-vxz-lo 164659.2 + :knocked-huge-vxz-hi 249036.8 + :knocked-huge-vy-lo 183500.8 + :knocked-huge-vy-hi 217907.2 + :knocked-yellow-vxz-lo 40960.0 + :knocked-yellow-vxz-hi 49152.0 + :knocked-yellow-vy-lo 57344.0 + :knocked-yellow-vy-hi 81920.0 + :knocked-red-vxz-lo 24576.0 + :knocked-red-vxz-hi 196608.0 + :knocked-red-vy-lo 94208.0 + :knocked-red-vy-hi 151552.0 + :knocked-blue-vxz-lo 40960.0 + :knocked-blue-vxz-hi 49152.0 + :knocked-blue-vy-lo 24576.0 + :knocked-blue-vy-hi 81920.0 + :shadow-size (meters 1) + :shadow-max-y (meters 1) + :shadow-min-y (meters -1) + :shadow-locus-dist (meters 150) + :gem-joint 9 + :gem-seg #x2 + :gem-no-seg #x4 + :gem-offset (new 'static 'sphere :y 942.08 :z 40.96 :r 163840.0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *pegasus-enemy-info* fact-defaults) *fact-info-enemy-defaults*) + +;; definition for method 12 of type pegasus +(defmethod run-logic? pegasus ((obj pegasus)) + (let ((f0-0 491520.0)) + (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> obj root-override2 trans) (camera-pos))) + ((method-of-type enemy run-logic?) obj) + #t + ) + ) + ) + +;; definition for method 137 of type pegasus +;; WARN: Return type mismatch int vs none. +(defmethod pegasus-method-137 pegasus ((obj pegasus)) + (with-pp + (let ((v1-0 *target*)) + (when (and v1-0 (-> v1-0 gun active?)) + (let ((a1-0 (new 'stack-no-clear 'vector)) + (a0-4 (new 'stack-no-clear 'vector)) + ) + (vector-! a1-0 (-> obj root-override2 trans) (-> v1-0 gun fire-point)) + (vector+float*! a0-4 (-> v1-0 gun fire-point) (-> v1-0 gun fire-dir-out) (vector-length a1-0)) + (let ((f0-1 (vector-vector-distance-squared a0-4 (-> obj root-override2 trans))) + (f1-0 20480.0) + ) + (if (< f0-1 (* f1-0 f1-0)) + (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 57 of type pegasus +;; WARN: Return type mismatch int vs enemy-aware. +(defmethod enemy-method-57 pegasus ((obj pegasus) (arg0 process-focusable) (arg1 enemy-best-focus)) + (with-pp + (the-as + enemy-aware + (if (>= (- (-> pp clock frame-counter) (the-as int (-> obj targetted-timer))) (seconds 5)) + (the-as int ((method-of-type enemy enemy-method-57) obj arg0 arg1)) + 4 + ) + ) + ) + ) + +;; definition for method 74 of type pegasus +(defmethod enemy-method-74 pegasus ((obj pegasus) (arg0 process) (arg1 object) (arg2 symbol) (arg3 event-message-block)) + (with-pp + (case arg2 + (('track) + ) + (('hit 'hit-knocked) + (cond + ((zero? (-> obj hit-points)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> obj enemy-flags) (enemy-flag chase-startup)) + (logior! (-> obj focus-status) (focus-status hit)) + (if (zero? (-> obj hit-points)) + (logior! (-> obj focus-status) (focus-status dead)) + ) + (logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup)) + (enemy-method-62 obj) + (set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags))) + (process-contact-action arg0) + (send-event arg0 'get-attack-count 1) + (enemy-method-73 obj) + ) + (else + (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) + ) + ) + ) + (else + ((method-of-type enemy enemy-method-74) obj arg0 arg1 arg2 arg3) + ) + ) + (none) + ) + ) + +;; definition for method 56 of type pegasus +(defmethod enemy-method-56 pegasus ((obj pegasus) (arg0 process) (arg1 event-message-block)) + (with-pp + (let ((v0-0 1)) + (let ((v1-0 (the-as object (-> arg1 param 1)))) + (case (-> arg1 message) + (('attack) + (if (and (logtest? (-> (the-as attack-info v1-0) mask) (attack-info-mask mode)) + (= (-> (the-as attack-info v1-0) mode) 'board) + ) + (set! v0-0 (-> obj hit-points)) + ) + ) + ) + ) + (set! (-> obj targetted-timer) (the-as uint (-> pp clock frame-counter))) + v0-0 + ) + ) + ) + +;; definition for function pegasus-draw-section +;; WARN: Return type mismatch symbol vs none. +(defbehavior pegasus-draw-section pegasus ((arg0 float) (arg1 float) (arg2 rgba)) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (get-point-at-percent-along-path! (-> self path-info (-> self current-path) path-data) gp-0 arg0 'interp) + (get-point-at-percent-along-path! (-> self path-info (-> self current-path) path-data) s5-0 arg1 'interp) + (add-debug-line #t (bucket-id debug-no-zbuf1) gp-0 s5-0 arg2 #f (the-as rgba -1)) + ) + (none) + ) + +;; definition for function pegasus-show-runs +;; WARN: Return type mismatch none vs symbol. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 43] +(defbehavior pegasus-show-runs pegasus () + (the-as symbol (when *display-path-marks* + (when (cpad-pressed? 0 up) + (+! (-> self display-path) 1) + (if (>= (-> self display-path) (-> self num-paths)) + (set! (-> self display-path) -1) + ) + ) + (when (cpad-pressed? 0 down) + (+! (-> self display-path) -1) + (if (< (-> self display-path) -1) + (set! (-> self display-path) (+ (-> self num-paths) -1)) + ) + ) + (cond + ((< (-> self display-path) 0) + (countdown (gp-0 20) + (let ((a0-1 (-> self path-info gp-0 path-data))) + (if a0-1 + (debug-draw a0-1) + ) + ) + ) + #f + ) + (else + (format + *stdcon* + "~A old-path ~D can run ~A at ~D ~F~%" + (-> self name) + (-> self previous-path) + (-> self can-run) + (-> self current-path) + (-> self curve-position) + ) + (format *stdcon* "~A showing path ~D~%" (-> self name) (-> self display-path)) + (let ((a0-4 (-> self path-info (-> self display-path) path-data))) + (if a0-4 + (debug-draw a0-4) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function pegasus-rotate +;; INFO: Used lq/sq +;; WARN: Return type mismatch vector vs none. +(defbehavior pegasus-rotate pegasus ((arg0 symbol) (arg1 float)) + (let ((s5-0 (new 'stack-no-clear 'matrix)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (displacement-between-points-at-percent-normalized! + (-> self path-info (-> self current-path) path-data) + (-> self tangent) + (-> self curve-position) + ) + (cond + ((and arg0 *target*) + (vector-! gp-0 (-> self root-override2 trans) (target-pos 0)) + (vector-normalize! gp-0 1.0) + ) + ((= (-> self speed) 0.0) + (set! (-> gp-0 quad) (-> self facing quad)) + ) + ((< (-> self speed) 0.0) + (vector-negate! gp-0 (-> self tangent)) + ) + (else + (set! (-> gp-0 quad) (-> self tangent quad)) + ) + ) + (matrix-from-two-vectors-max-angle-partial! s5-0 (-> self facing) gp-0 arg1 0.25) + (vector-matrix*! gp-0 (-> self facing) s5-0) + (vector-normalize! gp-0 1.0) + (forward-down->inv-matrix s5-0 gp-0 (new 'static 'vector :y -1.0)) + (matrix->quaternion (-> self root-override2 quat) s5-0) + (set! (-> self run-blend-interp) (acos (vector-dot gp-0 (-> self facing)))) + (set! (-> self run-blend-interp) (* 0.0002746582 (-> self run-blend-interp))) + (if (< (vector-dot (-> self facing) (the-as vector (-> s5-0 vector))) 0.0) + (set! (-> self run-blend-interp) (- (-> self run-blend-interp))) + ) + (set! (-> self facing quad) (-> gp-0 quad)) + ) + (none) + ) + +;; definition for function pegasus-loop-on-same-path +;; WARN: Return type mismatch float vs none. +(defbehavior pegasus-loop-on-same-path pegasus () + (cond + ((< 100.0 (-> self curve-position)) + (set! (-> self curve-position) 1.0) + ) + ((< (-> self curve-position) -100.0) + (set! (-> self curve-position) 0.0) + ) + ((< 1.0 (-> self curve-position)) + (set! (-> self curve-position) (+ -1.0 (-> self curve-position))) + ) + ((< (-> self curve-position) 0.0) + (set! (-> self curve-position) (+ 1.0 (-> self curve-position))) + ) + ) + (none) + ) + +;; definition for function pegasus-choose-path +(defbehavior pegasus-choose-path pegasus () + (local-vars (f0-15 float) (f30-0 float)) + (while (begin (label cfg-61) (or (< 1.0 (-> self curve-position)) (< (-> self curve-position) 0.0))) + (let ((s5-0 (-> self path-info (-> self current-path))) + (gp-0 3) + ) + 0.0 + (set! f30-0 + (cond + ((or (>= (-> self current-path) (-> self num-paths)) (< (-> self current-path) 0) (<= (-> s5-0 num-data) 0)) + (format + 0 + ": ~A has path out of range cur ~D num ~D num-data ~D~%" + (-> self name) + (-> self current-path) + (-> self num-paths) + (-> s5-0 num-data) + ) + (pegasus-loop-on-same-path) + (goto cfg-61) + f30-0 + ) + ((< (-> self curve-position) 0.0) + (while (and (< gp-0 (-> s5-0 num-data)) (>= (-> s5-0 control-data gp-0) 0.0)) + (+! gp-0 3) + ) + (+! gp-0 1) + (* (total-distance (-> s5-0 path-data)) (- (-> self curve-position))) + ) + (else + (* (total-distance (-> s5-0 path-data)) (+ -1.0 (-> self curve-position))) + ) + ) + ) + (when (or (< (- (-> s5-0 num-data) gp-0) 3) (< (-> s5-0 control-data gp-0) 0.0)) + (format + 0 + ": ~A has bad path connect data format num-data ~D ctrl-data ~F~%" + (-> self name) + (- (-> s5-0 num-data) gp-0) + (-> s5-0 control-data gp-0) + ) + (pegasus-loop-on-same-path) + (goto cfg-61) + ) + (let* ((v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-34 (the-as number (logior #x3f800000 v1-33))) + (f0-9 (+ -1.0 (the-as float v1-34))) + ) + (while (and (>= (- (-> s5-0 num-data) gp-0) 6) + (>= (-> s5-0 control-data gp-0) 0.0) + (< (-> s5-0 control-data (+ gp-0 2)) f0-9) + (!= (-> s5-0 control-data (+ gp-0 3)) -1.0) + (!= (-> s5-0 control-data (+ gp-0 5)) 0.0) + ) + (set! f0-9 (- f0-9 (-> s5-0 control-data (+ gp-0 2)))) + (+! gp-0 3) + ) + ) + (let ((t1-1 (the int (-> s5-0 control-data gp-0))) + (f28-0 (fmin 1.0 (fmax 0.0 (-> s5-0 control-data (+ gp-0 1))))) + ) + (when (or (>= t1-1 (-> self num-paths)) (< t1-1 0)) + (format + 0 + ": ~A has bad path connect data prev ~D current ~D desired ~D num ~D~%" + (-> self name) + (-> self previous-path) + (-> self current-path) + t1-1 + (-> self num-paths) + ) + (pegasus-loop-on-same-path) + (goto cfg-61) + ) + (set! (-> self previous-path) (-> self current-path)) + (set! (-> self current-path) t1-1) + (let ((gp-1 (-> self path-info (-> self current-path)))) + (let ((f0-14 (/ f30-0 (total-distance (-> gp-1 path-data))))) + (cond + ((< 0.5 f28-0) + (set! f0-15 (- f28-0 f0-14)) + (if (< 0.0 (-> self speed)) + (set! (-> self speed) (- (-> self speed))) + ) + ) + (else + (set! f0-15 (+ f28-0 f0-14)) + (if (< (-> self speed) 0.0) + (set! (-> self speed) (- (-> self speed))) + ) + ) + ) + ) + (set! (-> self curve-position) f0-15) + (set! (-> self can-run) #f) + (if (> (-> gp-1 num-data) 0) + (set! (-> self can-run) (!= (-> gp-1 control-data 0) 0.0)) + ) + ) + ) + ) + ) + #f + ) + +;; definition for function pegasus-move +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior pegasus-move pegasus ((arg0 float) (arg1 symbol) (arg2 symbol)) + (+! (-> self curve-position) + (/ (the float (* (- (-> self clock frame-counter) (-> self clock old-frame-counter)) (the int (-> self speed)))) + (total-distance (-> self path-info (-> self current-path) path-data)) + ) + ) + (pegasus-choose-path) + (get-point-at-percent-along-path! + (-> self path-info (-> self current-path) path-data) + (-> self root-override2 trans) + (-> self curve-position) + 'interp + ) + (let ((f30-1 (+ -81920.0 (-> self root-override2 trans y))) + (gp-0 #f) + ) + (let ((s2-0 (new 'stack 'collide-query)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-0 quad) (-> self root-override2 trans quad)) + (set! (-> self over-ground) #f) + (when (enemy-method-126 self s2-0 s3-0 (collide-spec backgnd) 12288.0 81920.0 1024.0) + (set! f30-1 (-> s2-0 best-other-tri intersect y)) + (set! gp-0 #t) + (set! (-> self over-ground) (< 204.8 (fabs (- f30-1 (-> self water-height))))) + (set! arg1 (and (-> self over-ground) arg1)) + (if arg1 + (set! (-> self y-offset-desired) (- f30-1 (-> s3-0 y))) + ) + ) + ) + (cond + ((< (-> self y-offset-desired) (-> self y-offset)) + (set! (-> self y-vel) (* 0.25 (- (-> self y-offset-desired) (-> self y-offset)))) + (set! (-> self y-vel) (fmax -68.26667 (-> self y-vel))) + (if (!= arg0 0.0) + (set! (-> self y-vel) (- arg0)) + ) + (+! (-> self y-offset) (-> self y-vel)) + (when (>= (-> self y-offset-desired) (-> self y-offset)) + (set! (-> self y-offset) (-> self y-offset-desired)) + (set! (-> self y-vel) 0.0) + ) + ) + ((< (-> self y-offset) (-> self y-offset-desired)) + (set! (-> self y-vel) (* 0.5 (- (-> self y-offset-desired) (-> self y-offset)))) + (set! (-> self y-vel) (fmin 13.653334 (-> self y-vel))) + (if (!= arg0 0.0) + (set! (-> self y-vel) arg0) + ) + (+! (-> self y-offset) (-> self y-vel)) + (when (>= (-> self y-offset) (-> self y-offset-desired)) + (set! (-> self y-offset) (-> self y-offset-desired)) + (set! (-> self y-vel) 0.0) + ) + ) + ) + (+! (-> self root-override2 trans y) (-> self y-offset)) + (when (< (-> self root-override2 trans y) f30-1) + (set! (-> self y-offset) (- f30-1 (- (-> self root-override2 trans y) (-> self y-offset)))) + (set! (-> self root-override2 trans y) f30-1) + (set! (-> self y-vel) (fmax 0.0 (-> self y-vel))) + ) + (set! (-> self on-ground) (< (fabs (- (-> self root-override2 trans y) f30-1)) 409.6)) + (cond + (gp-0 + (let ((v1-54 (-> self draw shadow-ctrl))) + (logclear! (-> v1-54 settings flags) (shadow-flags disable-draw)) + ) + 0 + (let ((v1-57 (-> self draw shadow-ctrl))) + (set! (-> v1-57 settings bot-plane w) (- (+ (- -6144.0 (-> self root-override2 trans y)) f30-1))) + ) + 0 + ) + (else + (let ((v1-59 (-> self draw shadow-ctrl))) + (logior! (-> v1-59 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + ) + (none) + ) + +;; definition for function pegasus-calc-speed +(defbehavior pegasus-calc-speed pegasus ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self root-override2 trans) (target-pos 0))) + (gp-1 #f) + ) + (set! (-> s5-1 y) 0.0) + (let* ((f1-3 (/ (- (vector-length s5-1) arg0) (- arg1 arg0))) + (f0-4 (- 1.0 (fmax 0.0 (fmin 1.0 f1-3)))) + (f0-5 (lerp arg3 arg2 f0-4)) + ) + (if (< (- (-> self clock frame-counter) (the-as int (-> self targetted-timer))) (seconds 5)) + (set! f0-5 (fmax 163840.0 f0-5)) + ) + (let ((f0-6 (* 0.0033333334 f0-5))) + (cond + ((< (vector-dot s5-1 (-> self tangent)) 0.0) + (if (< 0.0 (-> self speed)) + (set! gp-1 #t) + ) + ) + ((< (-> self speed) 0.0) + (set! gp-1 #t) + ) + ) + (let ((v1-22 (ja-group))) + (cond + ((and v1-22 (= v1-22 (-> self draw art-group data 13))) + (if (< 1.0 (fabs (-> self speed))) + (set! (-> self speed) (* 0.92 (-> self speed))) + ) + ) + (else + (let ((v1-31 (ja-group))) + (cond + ((and v1-31 (= v1-31 (-> self draw art-group data 14))) + (if (< (-> self speed) 0.0) + (seek! (-> self speed) (- f0-6) 13.653334) + (seek! (-> self speed) f0-6 13.653334) + ) + ) + ((< (-> self speed) 0.0) + (set! (-> self speed) (- f0-6)) + ) + (else + (set! (-> self speed) f0-6) + ) + ) + ) + ) + ) + ) + ) + ) + gp-1 + ) + ) + +;; definition for function pegasus-calc-anim-speed +(defbehavior pegasus-calc-anim-speed pegasus () + (let* ((f0-1 (fabs (-> self speed))) + (f0-2 (* 0.07324219 f0-1)) + (f0-3 (+ -15.0 f0-2)) + (f0-4 (* 0.13333334 f0-3)) + ) + (fmin 1.5 (fmax 0.9 f0-4)) + ) + ) + +;; definition for method 55 of type pegasus +(defmethod enemy-method-55 pegasus ((obj pegasus)) + (pegasus-method-137 obj) + (pegasus-show-runs) + ((method-of-type enemy enemy-method-55) obj) + (none) + ) + +;; definition for method 99 of type pegasus +(defmethod enemy-method-99 pegasus ((obj pegasus) (arg0 process-focusable)) + #t + ) + +;; failed to figure out what this is: +(defstate pegasus-debug (pegasus) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (clmf-input gp-0 a1-1 1) + ) + (vector-float*! gp-0 gp-0 4096.0) + (+! (-> self curve-position) + (/ (-> gp-0 y) (total-distance (-> self path-info (-> self current-path) path-data))) + ) + ) + (cond + ((< 1.0 (-> self curve-position)) + (set! (-> self curve-position) (+ -1.0 (-> self curve-position))) + ) + ((< (-> self curve-position) 0.0) + (set! (-> self curve-position) (+ 1.0 (-> self curve-position))) + ) + ) + (get-point-at-percent-along-path! + (-> self path-info (-> self current-path) path-data) + (-> self root-override2 trans) + (-> self curve-position) + 'interp + ) + (pegasus-rotate #f 1820.4445) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior pegasus) ja-post) + ) + +;; failed to figure out what this is: +(defstate die (pegasus) + :virtual #t + :code (behavior () + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'change-mode) + (set! (-> a1-1 param 0) (the-as uint 'pegasus)) + (let ((gp-0 (send-event-function (handle->process (-> self incoming attacker-handle)) a1-1))) + (-> self speed) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 frame-group) (the-as art-joint-anim (-> self draw art-group data 20))) + (set! (-> a0-7 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 20)) frames num-frames) -1)) + ) + (set! (-> a0-7 param 1) 1.5) + (set! (-> a0-7 frame-num) 0.0) + (let ((t9-3 joint-control-channel-group!) + (a1-3 (-> self draw art-group data 20)) + (a2-2 (the-as object num-func-seek!)) + ) + (t9-3 + a0-7 + (the-as art-joint-anim a1-3) + (the-as (function joint-control-channel float float float float :behavior process) a2-2) + ) + (until (ja-done? 0) + (let ((f0-5 (ja-aframe-num 0)) + (f1-0 (-> self speed)) + ) + (when (>= f0-5 60.0) + (let ((t9-5 lerp-scale) + (a0-9 f1-0) + (a1-4 0.0) + ) + (set! a2-2 f0-5) + (set! (-> self speed) (t9-5 a0-9 a1-4 (the-as float a2-2) 60.0 100.0)) + ) + (set! (-> self y-offset-desired) 0.0) + ) + ) + (pegasus-move 0.0 #t (the-as symbol a2-2)) + (pegasus-rotate #f 1820.4445) + (suspend) + (let ((a0-12 (-> self skel root-channel 0))) + (set! (-> a0-12 param 0) (the float (+ (-> a0-12 frame-group frames num-frames) -1))) + (set! (-> a0-12 param 1) 1.5) + (let ((t9-8 joint-control-channel-group-eval!) + (a1-7 #f) + ) + (set! a2-2 num-func-seek!) + (t9-8 + a0-12 + (the-as art-joint-anim a1-7) + (the-as (function joint-control-channel float float float float :behavior process) a2-2) + ) + ) + ) + ) + ) + ) + (if gp-0 + (send-event (handle->process (-> self incoming attacker-handle)) 'end-mode) + ) + ) + ) + (send-event self 'death-end) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate stare (pegasus) + :virtual #t + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (let ((gp-0 (-> self focus aware))) + (cond + ((and (>= 1 (the-as int gp-0)) + (-> self over-ground) + (< (fabs (- (-> self y-offset) (-> self y-offset-desired))) 409.6) + ) + (go-virtual active) + ) + ((and (= gp-0 (enemy-aware enemy-aware-3)) (enemy-method-107 self)) + (go-hostile self) + ) + ((= gp-0 (enemy-aware enemy-aware-4)) + (go-flee self) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 (-> self draw art-group data 8)))) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! (-> self draw art-group data 8)) + ) + ) + (until #f + (let ((gp-0 (-> self skel root-channel 0))) + (set! (-> gp-0 param 0) (pegasus-calc-anim-speed)) + (let ((t9-2 joint-control-channel-group-eval!) + (a1-1 #f) + (a2-0 num-func-loop!) + ) + (t9-2 gp-0 (the-as art-joint-anim a1-1) a2-0) + (if (< 27.306667 (fabs (-> self speed))) + (set! (-> self speed) (* 0.95 (-> self speed))) + ) + (set! (-> self y-offset-desired) 0.0) + (pegasus-move 409.6 #t (the-as symbol a2-0)) + ) + ) + (pegasus-rotate #f 1820.4445) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior pegasus) enemy-simple-post) + ) + +;; definition for function pegasus-fly-code +(defbehavior pegasus-fly-code pegasus ((arg0 int)) + (local-vars (a2-3 object)) + (let ((f30-0 (pegasus-calc-anim-speed))) + (let ((gp-0 + (and (-> self can-run) (< (the-as time-frame (-> self ambient-possible)) (-> self clock frame-counter))) + ) + ) + (let* ((f28-0 (lerp-scale 61440.0 32768.0 (the float arg0) 0.0 3000.0)) + (f0-4 (lerp-scale 122880.0 81920.0 (the float arg0) 0.0 3000.0)) + (s4-0 (pegasus-calc-speed f28-0 122880.0 f0-4 49152.0)) + ) + (case (ja-group) + (('pegasus-fly-doublespeed-ja) + (let ((a0-7 (-> self skel root-channel 0))) + (set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group frames num-frames) -1))) + (set! (-> a0-7 param 1) (fmax 1.0 (* 0.8 f30-0))) + (let ((t9-4 joint-control-channel-group-eval!) + (a1-3 #f) + ) + (set! a2-3 num-func-seek!) + (t9-4 + a0-7 + (the-as art-joint-anim a1-3) + (the-as (function joint-control-channel float float float float :behavior process) a2-3) + ) + ) + ) + ) + (('pegasus-fly-ja) + (let ((a0-9 (-> self skel root-channel 0))) + (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) + (set! (-> a0-9 param 1) (* 1.5 f30-0)) + (let ((t9-5 joint-control-channel-group-eval!) + (a1-4 #f) + ) + (set! a2-3 num-func-seek!) + (t9-5 + a0-9 + (the-as art-joint-anim a1-4) + (the-as (function joint-control-channel float float float float :behavior process) a2-3) + ) + ) + ) + ) + (else + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (the float (+ (-> a0-10 frame-group frames num-frames) -1))) + (set! (-> a0-10 param 1) 1.0) + (let ((t9-6 joint-control-channel-group-eval!) + (a1-5 #f) + ) + (set! a2-3 num-func-seek!) + (t9-6 + a0-10 + (the-as art-joint-anim a1-5) + (the-as (function joint-control-channel float float float float :behavior process) a2-3) + ) + ) + ) + ) + ) + (let ((v1-34 #f) + (s5-1 12) + ) + (let ((a0-13 (ja-group))) + (when (not (and a0-13 (begin + (set! a2-3 (= a0-13 (-> self draw art-group data 10))) + (or (the-as symbol a2-3) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 9))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 8))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 13))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 14))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 16))) (the-as symbol a2-3)) + (begin (set! a2-3 (= a0-13 (-> self draw art-group data 17))) (the-as symbol a2-3)) + (= a0-13 (-> self draw art-group data 18)) + ) + ) + ) + ) + (set! s5-1 37) + (set! v1-34 #t) + ) + ) + (cond + ((and s4-0 (let ((a0-21 (ja-group))) + (not (and a0-21 (begin + (set! a2-3 (= a0-21 (-> self draw art-group data 13))) + (or (the-as symbol a2-3) (= a0-21 (-> self draw art-group data 14))) + ) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.125)) + (ja :group! (-> self draw art-group data 13)) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ((and (not v1-34) (not (ja-done? 0))) + ) + (else + (let ((v1-46 (ja-group))) + (cond + ((and v1-46 (= v1-46 (-> self draw art-group data 16))) + (ja :group! (-> self draw art-group data 17)) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ((let ((v1-58 (ja-group))) + (and v1-58 (= v1-58 (-> self draw art-group data 13))) + ) + (ja :group! (-> self draw art-group data 14) :num! min) + (set! (-> self speed) (- (-> self speed))) + (let ((s5-3 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'matrix)) + ) + (new 'stack-no-clear 'vector) + (vector-cross! s5-3 (-> self tangent) (new 'static 'vector :y 1.0)) + (vector-cross! s5-3 s5-3 (-> self tangent)) + (vector-normalize! s5-3 1.0) + (matrix-axis-angle! s4-1 s5-3 32768.0) + (set! a2-3 s4-1) + ) + (vector-matrix*! (-> self facing) (-> self facing) (the-as matrix a2-3)) + ) + ((let ((v1-72 (ja-group))) + (and v1-72 (= v1-72 (-> self draw art-group data 17))) + ) + (if (or (not (-> self can-run)) (< (the-as time-frame (-> self ambient-expire)) (-> self clock frame-counter))) + (ja :group! (-> self draw art-group data 18)) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ((and gp-0 (-> self on-ground)) + (ja-channel-push! 1 (seconds 0.125)) + (ja :group! (-> self draw art-group data 16)) + (ja :num-func num-func-identity :frame-num 0.0) + (let* ((s5-4 (-> self clock frame-counter)) + (f30-1 300.0) + (f28-1 2.0) + (f26-0 3.0) + (v1-99 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-100 (the-as number (logior #x3f800000 v1-99))) + ) + (set! (-> self ambient-expire) + (the-as uint (+ s5-4 (the int (* f30-1 (+ f28-1 (* f26-0 (+ -1.0 (the-as float v1-100)))))))) + ) + ) + (let* ((s5-5 (-> self ambient-expire)) + (f30-2 300.0) + (f28-2 2.0) + (f26-1 3.0) + (v1-108 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-109 (the-as number (logior #x3f800000 v1-108))) + ) + (set! (-> self ambient-possible) + (+ s5-5 (the int (* f30-2 (+ f28-2 (* f26-1 (+ -1.0 (the-as float v1-109))))))) + ) + ) + ) + ((or (and (< (-> self speed) 0.0) (< 0.125 (-> self tangent y))) + (and (< 0.0 (-> self speed)) (< (-> self tangent y) -0.125)) + ) + (let ((v1-121 (ja-group))) + (when (not (and v1-121 (= v1-121 (-> self draw art-group data 10)))) + (ja-channel-push! 1 (the-as time-frame s5-1)) + (ja :group! (-> self draw art-group data 10)) + ) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ((< 1.25 f30-0) + (let ((v1-135 (ja-group))) + (when (not (and v1-135 (= v1-135 (-> self draw art-group data 9)))) + (ja-channel-push! 1 (the-as time-frame s5-1)) + (ja :group! (-> self draw art-group data 9)) + ) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + (else + (let ((v1-148 (ja-group))) + (when (not (and v1-148 (= v1-148 (-> self draw art-group data 8)))) + (ja-channel-push! 1 (the-as time-frame s5-1)) + (ja :group! (-> self draw art-group data 8)) + ) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + ) + ) + ) + ) + ) + ) + (pegasus-move + 0.0 + (the-as + symbol + (or gp-0 (let ((v1-161 (ja-group))) + (and v1-161 (begin + (set! a2-3 (= v1-161 (-> self draw art-group data 16))) + (or (the-as symbol a2-3) (= v1-161 (-> self draw art-group data 17))) + ) + ) + ) + ) + ) + (the-as symbol a2-3) + ) + ) + ) + (pegasus-rotate #f 1820.4445) + (none) + ) + +;; failed to figure out what this is: +(defstate pegasus-tired (pegasus) + :event (the-as (function process int symbol event-message-block object :behavior pegasus) enemy-event-handler) + :enter (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self far-time) (-> self clock frame-counter)) + (set-setting! 'sound-mode #f 0 1) + (none) + ) + :exit (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) exit))) + (if t9-0 + (t9-0) + ) + ) + (remove-setting! 'sound-mode) + (none) + ) + :trans (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) trans))) + (if t9-0 + (t9-0) + ) + ) + (cond + ((and *target* + (and (>= 102400.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (set! (-> self state-time) + (the-as time-frame (max (+ (-> self clock frame-counter) (seconds -10)) (-> self state-time))) + ) + ) + (else + (+! (-> self state-time) (* 10 (- (-> self clock frame-counter) (-> self far-time)))) + (if (>= (-> self state-time) (-> self clock frame-counter)) + (go-virtual flee) + ) + ) + ) + (set! (-> self far-time) (-> self clock frame-counter)) + (none) + ) + :code (behavior () + (until #f + (set! (-> self y-offset-desired) 0.0) + (pegasus-fly-code (the-as int (- (-> self clock frame-counter) (-> self state-time)))) + (suspend) + ) + #f + (none) + ) + :post (-> (method-of-type enemy flee) post) + ) + +;; failed to figure out what this is: +(defstate flee (pegasus) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self near-timer) 3000) + (set! (-> self far-time) (-> self clock frame-counter)) + (set-setting! 'sound-mode #f 0 1) + (none) + ) + :exit (behavior () + (let ((t9-0 (-> (method-of-type enemy flee) exit))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self y-offset-desired) 0.0) + (remove-setting! 'sound-mode) + (none) + ) + :trans (behavior () + (when (-> self can-run) + (let ((t9-0 (-> (method-of-type enemy flee) trans))) + (if t9-0 + (t9-0) + ) + ) + ) + (when (and *target* + (and (>= 102400.0 (vector-vector-xz-distance (-> self root-override2 trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (set! (-> self near-timer) (- (the-as time-frame (-> self near-timer)) + (- (-> self clock frame-counter) (-> self clock old-frame-counter)) + ) + ) + (if (<= (-> self near-timer) 0) + (go pegasus-tired) + ) + (set! (-> self far-time) (-> self clock frame-counter)) + ) + (if (>= (- (-> self clock frame-counter) (-> self far-time)) (seconds 3)) + (set! (-> self near-timer) (the-as int (-> self timeout))) + ) + (none) + ) + :code (behavior () + (until #f + (set! (-> self y-offset-desired) 2.0) + (pegasus-fly-code 0) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate active (pegasus) + :virtual #t + :code (behavior () + (set! (-> self allow-idle) #f) + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 (-> self draw art-group data 5)))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 19) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 19)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (set! (-> self allow-idle) #t) + (ja-channel-push! 1 (seconds 0.1)) + (sleep-code) + (none) + ) + :post (behavior () + (if (-> self allow-idle) + (idle-control-method-10 (-> self idle-anim-player) self) + ) + (enemy-simple-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate notice (pegasus) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type enemy notice) enter))) + (if t9-0 + (t9-0) + ) + ) + (set-setting! 'sound-mode #f 0 1) + (none) + ) + :exit (behavior () + (let ((t9-0 (-> (method-of-type enemy notice) exit))) + (if t9-0 + (t9-0) + ) + ) + (remove-setting! 'sound-mode) + (none) + ) + :code (behavior () + (displacement-between-points-at-percent-normalized! + (-> self path-info (-> self current-path) path-data) + (-> self tangent) + (-> self curve-position) + ) + (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) + (enemy-method-72 self) + ) + (let ((f30-0 (get-rand-float-range self 0.8 1.2))) + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) + :num! (seek! + (the float + (+ (-> (the-as art-joint-anim (-> self draw art-group data (-> self enemy-info notice-anim))) frames num-frames) + -1 + ) + ) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (if (pegasus-calc-speed 61440.0 122880.0 204800.0 49152.0) + (enemy-method-72 self) + ) + (pegasus-rotate #f 1820.4445) + (suspend) + (ja :num! (seek! max f30-0)) + ) + (ja-no-eval :group! (-> self draw art-group data 7) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1)) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (let ((t9-12 pegasus-calc-speed) + (a0-12 61440.0) + (a1-15 122880.0) + (a2-7 204800.0) + ) + (if (t9-12 a0-12 a1-15 a2-7 49152.0) + (enemy-method-72 self) + ) + (pegasus-rotate #f 1820.4445) + (set! (-> self y-offset-desired) 0.0) + (pegasus-move 0.0 #f (the-as symbol a2-7)) + ) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (enemy-method-72 self) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (pegasus) + :virtual #t + :post (behavior () + (pegasus-show-runs) + (pegasus-method-137 self) + (let ((t9-2 (-> (method-of-type enemy idle) post))) + (if t9-2 + ((the-as (function none) t9-2)) + ) + ) + (none) + ) + ) + +;; definition for method 114 of type pegasus +;; WARN: Return type mismatch int vs none. +(defmethod enemy-method-114 pegasus ((obj pegasus)) + "@abstract" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech-punch + dark-punch + dark-giant + ) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0))) + (set! (-> s5-0 total-prims) (the-as uint 2)) + (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 9216.0 4096.0 18432.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-14 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-14 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-14 prim-core action) (collide-action solid no-standon)) + (set! (-> v1-14 transform-index) 3) + (set-vector! (-> v1-14 local-sphere) 0.0 6144.0 0.0 11264.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-17 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + ) + (set! (-> obj root-override2) s5-0) + ) + 0 + (none) + ) + +;; definition for method 60 of type pegasus +(defmethod coin-flip? pegasus ((obj pegasus)) + "@returns The result of a 50/50 RNG roll" + #f + ) + +;; definition for method 108 of type pegasus +(defmethod enemy-method-108 pegasus ((obj pegasus) (arg0 enemy) (arg1 event-message-block)) + 0 + ) + +;; definition for method 7 of type pegasus +;; WARN: Return type mismatch enemy vs pegasus. +(defmethod relocate pegasus ((obj pegasus) (arg0 int)) + (countdown (v1-0 20) + (if (-> obj path-info v1-0 path-data) + (&+! (-> obj path-info v1-0 path-data) arg0) + ) + ) + (the-as pegasus ((method-of-type enemy relocate) obj arg0)) + ) + +;; definition for method 115 of type pegasus +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod enemy-method-115 pegasus ((obj pegasus)) + "@abstract" + (local-vars (sv-16 res-tag)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-pegasus" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (enemy-method-113 obj *pegasus-enemy-info*) + (logclear! (-> obj draw shadow-ctrl settings flags) (shadow-flags shdf00)) + (set! (-> obj link) (new 'process 'actor-link-info obj #f)) + (dotimes (v1-8 20) + (set! (-> obj path-info v1-8 path-data) #f) + ) + (set! (-> obj num-paths) 0) + (set! (-> obj path-info 0 path-data) (new 'process 'curve-control obj 'path -1000000000.0)) + (when (-> obj path-info 0 path-data) + (logior! (-> obj path-info 0 path-data flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> obj num-paths) 1) + ) + (dotimes (s5-1 20) + (let ((v1-19 (new 'process 'curve-control obj 'path (the float s5-1)))) + (if (logtest? (-> v1-19 flags) (path-control-flag not-found)) + (goto cfg-15) + ) + (set! (-> obj num-paths) (+ s5-1 1)) + (set! (-> obj path-info s5-1 path-data) v1-19) + (logior! (-> v1-19 flags) (path-control-flag display draw-line draw-point)) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-22 (res-lump-data (-> obj entity) 'path-connection pointer :tag-ptr (& sv-16) :time (the float s5-1)))) + (cond + (v1-22 + (set! (-> obj path-info s5-1 num-data) (the-as int (-> sv-16 elt-count))) + (set! (-> obj path-info s5-1 control-data) (the-as (pointer float) v1-22)) + ) + (else + (set! (-> obj path-info s5-1 num-data) 0) + 0 + ) + ) + ) + ) + (label cfg-15) + (set! (-> obj current-path) 0) + (set! (-> obj previous-path) 0) + (set! (-> obj display-path) -1) + (set! (-> obj curve-position) (res-lump-float (-> obj entity) 'initial-spline-pos)) + (get-point-at-percent-along-path! + (-> obj path-info (-> obj current-path) path-data) + (-> obj root-override2 trans) + (-> obj curve-position) + 'interp + ) + (displacement-between-points-at-percent-normalized! + (-> obj path-info (-> obj current-path) path-data) + (-> obj tangent) + (-> obj curve-position) + ) + (set! (-> obj facing quad) (-> obj tangent quad)) + (let ((s5-2 (new 'stack-no-clear 'matrix))) + (forward-down->inv-matrix s5-2 (-> obj facing) (new 'static 'vector :y -1.0)) + (matrix->quaternion (-> obj root-override2 quat) s5-2) + ) + (set! (-> obj y-vel) 0.0) + (let ((t9-12 (method-of-type res-lump get-property-value-float)) + (a0-37 (-> obj entity)) + (a1-14 'water-height) + (a2-10 'interp) + ) + (set! (-> obj water-height) + (t9-12 a0-37 a1-14 a2-10 -1000000000.0 0.0 (the-as (pointer res-tag) #f) *res-static-buf*) + ) + (set! (-> obj timeout) (the-as uint 3000)) + (when (-> obj entity) + (let ((t9-13 (method-of-type res-lump get-property-value-float)) + (a0-38 (-> obj entity)) + (a1-15 'timeout) + ) + (set! a2-10 'interp) + (let ((f0-9 (t9-13 a0-38 a1-15 a2-10 -1000000000.0 10.0 (the-as (pointer res-tag) #f) *res-static-buf*))) + (set! (-> obj timeout) (the-as uint (the int (* 300.0 f0-9)))) + ) + ) + ) + (set! (-> obj ambient-possible) (the-as uint 0)) + (set! (-> obj speed) 0.0) + (set! (-> obj y-offset-desired) 0.0) + (pegasus-move 409600.0 #t a2-10) + ) + (pegasus-calc-speed 61440.0 122880.0 2048.0 2048.0) + (set! (-> obj can-run) #f) + 0 + (none) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 107 + 0 + (lambda :behavior task-manager + () + (set! (-> *game-info* controller 0) (process->handle self)) + (set! (-> self entity) (entity-by-type pegasus)) + (set! (-> self actor-group 0) (res-lump-struct (-> self entity) 'actor-groups (pointer entity-actor))) + (when (-> self actor-group 0) + (let ((v1-6 (-> self actor-group 0 0))) + (set! (-> self data-int32 0) (the-as int v1-6)) + (set! (-> self data-int32 1) (the-as int v1-6)) + ) + (dotimes (gp-0 (the-as int (-> self actor-group 0 0))) + (let ((t0-1 (-> (&+ (-> self actor-group 0) (* gp-0 8)) 3))) + (if t0-1 + (minimap-method-12 *minimap* self (the-as uint 16) (the-as int #f) (the-as vector t0-1) 0) + ) + ) + ) + #f + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 107 + 3 + (the-as + (function object) + (lambda :behavior task-manager + () + (local-vars (sv-16 int)) + (set! (-> self start-time) (-> self clock frame-counter)) + (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-pegasus :init hud-init-by-other :to self))) + (while (> (-> self data-int32 0) 0) + (set! sv-16 (-> self data-int32 1)) + (when (-> self actor-group 0) + (dotimes (v1-12 (the-as int (-> self actor-group 0 0))) + (let ((a1-4 (-> (&+ (-> self actor-group 0) (* v1-12 8)) 3))) + (if (and a1-4 (logtest? (-> a1-4 extra perm status) (entity-perm-status subtask-complete))) + (set! sv-16 (+ sv-16 -1)) + ) + ) + ) + ) + (let ((v1-15 sv-16)) + (set! (-> self data-int32 0) v1-15) + (set! (-> *game-info* counter) (the float v1-15)) + ) + (suspend) + ) + (go-virtual complete) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 107 + 4 + (the-as + (function object) + (lambda () + (task-node-close! (game-task-node forest-scouts-resolution)) + (talker-spawn-func (-> *talker-speech* 90) *entity-pool* (target-pos 0) (the-as region #f)) + (none) + ) + ) + ) diff --git a/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc b/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc index 4ff4b36f53..bbe2bfda05 100644 --- a/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc @@ -84,7 +84,7 @@ (training-manager-method-27 (_type_ (array tpath-info)) symbol 27) (training-manager-method-28 (_type_) none 28) (training-manager-method-29 (_type_ vector) vector 29) - (training-manager-method-30 (_type_ game-text-id) float 30) + (render-text (_type_ game-text-id) float 30) (training-manager-method-31 (_type_) none 31) (training-manager-method-32 (_type_) none 32) ) @@ -278,7 +278,7 @@ ) ;; definition for method 30 of type training-manager -(defmethod training-manager-method-30 training-manager ((obj training-manager) (arg0 game-text-id)) +(defmethod render-text training-manager ((obj training-manager) (arg0 game-text-id)) (when (= (get-status *gui-control* (-> obj gui-id)) (gui-status active)) (let ((s5-1 (new 'stack @@ -347,7 +347,7 @@ (suspend) ) (until (cpad-pressed? 0 r1) - (training-manager-method-30 self (game-text-id text-x22b)) + (render-text self (game-text-id gungame-tutorial-fire-button)) (suspend) ) (set! (-> self last-sound-id) @@ -367,7 +367,7 @@ ) (when *target* (while (logtest? (focus-status gun) (-> *target* focus-status)) - (training-manager-method-30 self (game-text-id text-x22c)) + (render-text self (game-text-id gungame-tutorial-put-red-away)) (suspend) ) ) @@ -381,7 +381,7 @@ (suspend) ) (while (or (not *target*) (zero? (logand (focus-status gun) (-> *target* focus-status)))) - (training-manager-method-30 self (game-text-id text-x22d)) + (render-text self (game-text-id gungame-tutorial-take-red-out)) (suspend) ) (set! (-> self last-sound-id) @@ -399,7 +399,7 @@ ) (let ((gp-2 (training-manager-method-26 self))) (while (= (training-manager-method-26 self) gp-2) - (training-manager-method-30 self (game-text-id text-x234)) + (render-text self (game-text-id gungame-tutorial-shoot-the-crates)) (suspend) ) ) @@ -558,7 +558,7 @@ ) a1-1 ) - (training-manager-method-30 self (game-text-id gungame-red-prompt)) + (render-text self (game-text-id gungame-prompt-red)) ) ) ) @@ -680,7 +680,7 @@ ) a1-2 ) - (training-manager-method-30 self (game-text-id gungame-yellow-prompt)) + (render-text self (game-text-id gungame-prompt-yellow)) ) ) ) @@ -944,8 +944,8 @@ ) ) (if (logtest? (-> *game-info* secrets) (game-secrets gungame-blue)) - (training-manager-method-30 self (game-text-id gungame-red-or-blue-prompt)) - (training-manager-method-30 self (game-text-id gungame-red-prompt)) + (render-text self (game-text-id gungame-prompt-red-or-blue)) + (render-text self (game-text-id gungame-prompt-red)) ) (b! #t cfg-30 :delay (nop!)) (label cfg-19) @@ -964,8 +964,8 @@ (task-node-closed? (game-task-node city-yellow-gun-training-resolution)) ) (if (logtest? (-> *game-info* secrets) (game-secrets gungame-dark)) - (training-manager-method-30 self (game-text-id gungame-yellow-or-purple-prompt)) - (training-manager-method-30 self (game-text-id gungame-yellow-prompt)) + (render-text self (game-text-id gungame-prompt-yellow-or-purple)) + (render-text self (game-text-id gungame-prompt-yellow)) ) ) ) @@ -1089,7 +1089,7 @@ ) (let ((gp-2 (-> *game-info* gun-type))) (until (!= gp-2 (-> *game-info* gun-type)) - (training-manager-method-30 self (game-text-id text-x230)) + (render-text self (game-text-id gungame-tutorial-switch-to-yellow)) (suspend) ) ) @@ -1112,7 +1112,7 @@ ) ) (until #f - (training-manager-method-30 self (game-text-id text-x233)) + (render-text self (game-text-id gungame-tutorial-kick-combo)) (suspend) (when (and (not (handle->process (-> self dummies 0))) (not (handle->process (-> self dummies 1)))) #t @@ -1345,15 +1345,7 @@ (gp-1 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-0 "~S") ) - (let* ((s3-0 format) - (s2-0 (clear *temp-string*)) - (a0-7 *common-text*) - (t9-4 (method-of-object a0-7 lookup-text!)) - (a1-2 566) - (a2-0 #f) - ) - (s3-0 s2-0 (t9-4 a0-7 (the-as game-text-id a1-2) a2-0) (the-as none a2-0)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-1 gp-1 s4-0 *temp-string*) ) ) @@ -1363,15 +1355,7 @@ (gp-2 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-1 "~S") ) - (let* ((s3-1 format) - (s2-1 (clear *temp-string*)) - (a0-12 *common-text*) - (t9-9 (method-of-object a0-12 lookup-text!)) - (a1-5 566) - (a2-2 #f) - ) - (s3-1 s2-1 (t9-9 a0-12 (the-as game-text-id a1-5) a2-2) (the-as none a2-2)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-2 gp-2 s4-1 *temp-string*) ) ) @@ -1381,15 +1365,7 @@ (gp-3 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-2 "~S") ) - (let* ((s3-2 format) - (s2-2 (clear *temp-string*)) - (a0-17 *common-text*) - (t9-14 (method-of-object a0-17 lookup-text!)) - (a1-8 567) - (a2-4 #f) - ) - (s3-2 s2-2 (t9-14 a0-17 (the-as game-text-id a1-8) a2-4) (the-as none a2-4)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) (s5-3 gp-3 s4-2 *temp-string*) ) ) @@ -1399,15 +1375,7 @@ (gp-4 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-3 "~S") ) - (let* ((s3-3 format) - (s2-3 (clear *temp-string*)) - (a0-22 *common-text*) - (t9-19 (method-of-object a0-22 lookup-text!)) - (a1-11 568) - (a2-6 #f) - ) - (s3-3 s2-3 (t9-19 a0-22 (the-as game-text-id a1-11) a2-6) (the-as none a2-6)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-bronze) #f)) (s5-4 gp-4 s4-3 *temp-string*) ) ) @@ -1421,15 +1389,7 @@ (gp-5 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-4 "~S") ) - (let* ((s3-4 format) - (s2-4 (clear *temp-string*)) - (a0-28 *common-text*) - (t9-25 (method-of-object a0-28 lookup-text!)) - (a1-14 566) - (a2-8 #f) - ) - (s3-4 s2-4 (t9-25 a0-28 (the-as game-text-id a1-14) a2-8) (the-as none a2-8)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-5 gp-5 s4-4 *temp-string*) ) ) @@ -1439,15 +1399,7 @@ (gp-6 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-5 "~S") ) - (let* ((s3-5 format) - (s2-5 (clear *temp-string*)) - (a0-33 *common-text*) - (t9-30 (method-of-object a0-33 lookup-text!)) - (a1-17 567) - (a2-10 #f) - ) - (s3-5 s2-5 (t9-30 a0-33 (the-as game-text-id a1-17) a2-10) (the-as none a2-10)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) (s5-6 gp-6 s4-5 *temp-string*) ) ) @@ -1457,15 +1409,7 @@ (gp-7 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-6 "~S") ) - (let* ((s3-6 format) - (s2-6 (clear *temp-string*)) - (a0-38 *common-text*) - (t9-35 (method-of-object a0-38 lookup-text!)) - (a1-20 567) - (a2-12 #f) - ) - (s3-6 s2-6 (t9-35 a0-38 (the-as game-text-id a1-20) a2-12) (the-as none a2-12)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) (s5-7 gp-7 s4-6 *temp-string*) ) ) @@ -1481,15 +1425,7 @@ (gp-8 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-7 "~S") ) - (let* ((s3-7 format) - (s2-7 (clear *temp-string*)) - (a0-45 *common-text*) - (t9-42 (method-of-object a0-45 lookup-text!)) - (a1-23 566) - (a2-14 #f) - ) - (s3-7 s2-7 (t9-42 a0-45 (the-as game-text-id a1-23) a2-14) (the-as none a2-14)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-8 gp-8 s4-7 *temp-string*) ) ) @@ -1499,15 +1435,7 @@ (gp-9 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-8 "~S") ) - (let* ((s3-8 format) - (s2-8 (clear *temp-string*)) - (a0-50 *common-text*) - (t9-47 (method-of-object a0-50 lookup-text!)) - (a1-26 566) - (a2-16 #f) - ) - (s3-8 s2-8 (t9-47 a0-50 (the-as game-text-id a1-26) a2-16) (the-as none a2-16)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-9 gp-9 s4-8 *temp-string*) ) ) @@ -1519,15 +1447,7 @@ (gp-10 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-9 "~S") ) - (let* ((s3-9 format) - (s2-9 (clear *temp-string*)) - (a0-55 *common-text*) - (t9-52 (method-of-object a0-55 lookup-text!)) - (a1-29 566) - (a2-18 #f) - ) - (s3-9 s2-9 (t9-52 a0-55 (the-as game-text-id a1-29) a2-18) (the-as none a2-18)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-10 gp-10 s4-9 *temp-string*) ) ) @@ -1537,15 +1457,7 @@ (gp-11 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-10 "~S") ) - (let* ((s3-10 format) - (s2-10 (clear *temp-string*)) - (a0-60 *common-text*) - (t9-57 (method-of-object a0-60 lookup-text!)) - (a1-32 566) - (a2-20 #f) - ) - (s3-10 s2-10 (t9-57 a0-60 (the-as game-text-id a1-32) a2-20) (the-as none a2-20)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) (s5-11 gp-11 s4-10 *temp-string*) ) ) @@ -1555,15 +1467,7 @@ (gp-12 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-11 "~S") ) - (let* ((s3-11 format) - (s2-11 (clear *temp-string*)) - (a0-65 *common-text*) - (t9-62 (method-of-object a0-65 lookup-text!)) - (a1-35 567) - (a2-22 #f) - ) - (s3-11 s2-11 (t9-62 a0-65 (the-as game-text-id a1-35) a2-22) (the-as none a2-22)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) (s5-12 gp-12 s4-11 *temp-string*) ) ) @@ -1573,15 +1477,7 @@ (gp-13 (the-as hud (clear (-> (the-as hud gp-0) strings 1 text)))) (s4-12 "~S") ) - (let* ((s3-12 format) - (s2-12 (clear *temp-string*)) - (a0-70 *common-text*) - (t9-67 (method-of-object a0-70 lookup-text!)) - (a1-38 568) - (a2-24 #f) - ) - (s3-12 s2-12 (t9-67 a0-70 (the-as game-text-id a1-38) a2-24) (the-as none a2-24)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-bronze) #f)) (s5-13 gp-13 s4-12 *temp-string*) ) ) @@ -1591,15 +1487,7 @@ (gp-14 (clear (-> (the-as hud gp-0) strings 1 text))) (s4-13 "~S") ) - (let* ((s3-13 format) - (s2-13 (clear *temp-string*)) - (a0-75 *common-text*) - (t9-72 (method-of-object a0-75 lookup-text!)) - (a1-41 565) - (a2-26 #f) - ) - (s3-13 s2-13 (t9-72 a0-75 (the-as game-text-id a1-41) a2-26) (the-as none a2-26)) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-goal) #f)) (s5-14 gp-14 s4-13 *temp-string*) ) ) @@ -2638,6 +2526,37 @@ (set! (-> self close-sound) (sound-play "door-close-all")) (none) ) + :code (behavior () + (let ((gp-0 #t)) + (until #f + (cond + ((gungame-door-method-23 self) + (if gp-0 + (sound-play "door-stopped") + ) + (sound-pause (-> self close-sound)) + (set! gp-0 #f) + ) + (else + (if (not gp-0) + (sound-continue (-> self close-sound)) + ) + (set! gp-0 #t) + (ja :num! (seek! 0.0)) + ) + ) + (suspend) + (when (>= 0.0 (ja-frame-num 0)) + (ja-no-eval :num! zero) + (goto cfg-12) + ) + ) + ) + #f + (label cfg-12) + (go-virtual idle) + (none) + ) :post (the-as (function none :behavior gungame-door) transform-post) ) diff --git a/test/decompiler/reference/jak2/levels/stadium/jetboard/skatea-obs_REF.gc b/test/decompiler/reference/jak2/levels/stadium/jetboard/skatea-obs_REF.gc new file mode 100644 index 0000000000..8586acf74d --- /dev/null +++ b/test/decompiler/reference/jak2/levels/stadium/jetboard/skatea-obs_REF.gc @@ -0,0 +1,2033 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type hoverboard-training-manager +(deftype hoverboard-training-manager (process) + ((actor-group (pointer actor-group) :offset-assert 128) + (actor-group-count int32 :offset-assert 132) + (trick-type board-tricks :offset-assert 136) + (board-picked-up symbol :offset-assert 140) + (boost symbol :offset-assert 144) + (grind symbol :offset-assert 148) + (text symbol :offset-assert 152) + (score float :offset-assert 156) + (challenge-done symbol :offset-assert 160) + (arrow handle :offset-assert 168) + (minimap connection-minimap :offset-assert 176) + (hud-score handle :offset-assert 184) + (hud-goal handle :offset-assert 192) + (voicebox handle :offset-assert 200) + (last-sound-id sound-id :offset-assert 208) + (combo-done? symbol :offset-assert 212) + (task-gold uint16 :offset-assert 216) + (task-silver uint16 :offset-assert 218) + (task-bronze uint16 :offset-assert 220) + (game-score uint8 :offset-assert 222) + (training? symbol :offset-assert 224) + (training-goal float :offset-assert 228) + (egg-count int32 :offset-assert 232) + (medal int32 :offset-assert 236) + (gui-id sound-id :offset-assert 240) + (hint-time time-frame :offset-assert 248) + ) + :heap-base #x80 + :method-count-assert 31 + :size-assert #x100 + :flag-assert #x1f00800100 + (:methods + (wait-for-pickup () _type_ :state 14) + (wait-for-pickup-training () _type_ :state 15) + (wait-for-board () _type_ :state 16) + (wait () _type_ :state 17) + (jump () _type_ :state 18) + (duck-jump () _type_ :state 19) + (boost-jump () _type_ :state 20) + (grind () _type_ :state 21) + (spin () _type_ :state 22) + (flip () _type_ :state 23) + (trick () _type_ :state 24) + (game () _type_ :state 25) + (idle () _type_ :state 26) + (idle-training () _type_ :state 27) + (render-text (_type_ game-text-id) float 28) + (hoverboard-training-manager-method-29 (_type_) none 29) + (hoverboard-training-manager-method-30 (_type_) none 30) + ) + ) + +;; definition for method 3 of type hoverboard-training-manager +(defmethod inspect hoverboard-training-manager ((obj hoverboard-training-manager)) + (when (not obj) + (set! obj obj) + (goto cfg-7) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~2Tactor-group: #x~X~%" (-> obj actor-group)) + (dotimes (s5-0 (-> obj actor-group-count)) + (format #t "~T [~D]~2Tactor-group: ~`actor-group`P~%" s5-0 (-> obj actor-group s5-0)) + ) + (format #t "~2Tactor-group-count: ~D~%" (-> obj actor-group-count)) + (format #t "~2Ttrick-type: ~D~%" (-> obj trick-type)) + (format #t "~2Tboard-picked-up: ~A~%" (-> obj board-picked-up)) + (format #t "~2Tboost: ~A~%" (-> obj boost)) + (format #t "~2Tgrind: ~A~%" (-> obj grind)) + (format #t "~2Ttext: ~A~%" (-> obj text)) + (format #t "~2Tscore: ~f~%" (-> obj score)) + (format #t "~2Tchallenge-done: ~A~%" (-> obj challenge-done)) + (format #t "~2Tarrow: ~D~%" (-> obj arrow)) + (format #t "~2Tminimap: #~%" (-> obj minimap)) + (format #t "~2Thud-score: ~D~%" (-> obj hud-score)) + (format #t "~2Thud-goal: ~D~%" (-> obj hud-goal)) + (format #t "~2Tvoicebox: ~D~%" (-> obj voicebox)) + (format #t "~2Tlast-sound-id: ~D~%" (-> obj last-sound-id)) + (format #t "~2Tcombo-done?: ~A~%" (-> obj combo-done?)) + (format #t "~2Ttask-gold: ~D~%" (-> obj task-gold)) + (format #t "~2Ttask-silver: ~D~%" (-> obj task-silver)) + (format #t "~2Ttask-bronze: ~D~%" (-> obj task-bronze)) + (format #t "~2Tgame-score: ~D~%" (-> obj game-score)) + (format #t "~2Ttraining?: ~A~%" (-> obj training?)) + (format #t "~2Ttraining-goal: ~f~%" (-> obj training-goal)) + (format #t "~2Tegg-count: ~D~%" (-> obj egg-count)) + (format #t "~2Tmedal: ~D~%" (-> obj medal)) + (format #t "~2Tgui-id: ~D~%" (-> obj gui-id)) + (format #t "~2Thint-time: ~D~%" (-> obj hint-time)) + (label cfg-7) + obj + ) + +;; definition for method 28 of type hoverboard-training-manager +(defmethod render-text hoverboard-training-manager ((obj hoverboard-training-manager) (arg0 game-text-id)) + (when (= (get-status *gui-control* (-> obj gui-id)) (gui-status active)) + (let ((s5-1 (new + 'stack + 'font-context + *font-default-matrix* + 32 + 280 + 0.0 + (font-color default-#cddbcd) + (font-flags shadow kerning) + ) + ) + ) + (set! (-> s5-1 flags) (font-flags shadow kerning large)) + (let ((v1-4 s5-1)) + (set! (-> v1-4 width) (the float 440)) + ) + (let ((v1-5 s5-1)) + (set! (-> v1-5 height) (the float 80)) + ) + (let ((v1-6 s5-1)) + (set! (-> v1-6 scale) 0.75) + ) + (let ((s4-0 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* arg0 #f)) + (s4-0 *temp-string* s5-1 #f 44 (bucket-id progress)) + ) + ) + ) + ) + +;; definition for function trick-type-trick? +(defun trick-type-trick? ((arg0 board-tricks)) + (or (= arg0 (board-tricks board-spin)) + (= arg0 (board-tricks board-flip)) + (= arg0 (board-tricks board-nosegrab)) + (= arg0 (board-tricks board-method)) + (= arg0 (board-tricks board-board-spin)) + (= arg0 (board-tricks board-board-flip)) + (= arg0 (board-tricks board-noseflip)) + (= arg0 (board-tricks board-kickflip)) + ) + ) + +;; definition for function hoverboard-training-manager-event-handler +;; WARN: Return type mismatch object vs hoverboard-training-manager. +(defbehavior hoverboard-training-manager-event-handler hoverboard-training-manager ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (the-as + hoverboard-training-manager + (case arg2 + (('notify) + (case (-> arg3 param 0) + (('trick-point) + (set! v0-0 (-> arg3 param 1)) + (set! (-> self trick-type) (the-as board-tricks v0-0)) + v0-0 + ) + (('trick-judge) + (set! (-> self score) (the-as float (-> arg3 param 1))) + (set! v0-0 #t) + (set! (-> self challenge-done) (the-as symbol v0-0)) + v0-0 + ) + (('pickup) + (set! v0-0 #t) + (set! (-> self board-picked-up) (the-as symbol v0-0)) + v0-0 + ) + (('trick-flush) + (the-as float (-> arg3 param 1)) + (let ((gp-0 (the-as object (-> arg3 param 2))) + (s5-0 (-> arg3 param 3)) + ) + (dotimes (s4-0 (the-as int (+ s5-0 -2))) + (cond + ((= (-> (the-as (pointer board-tricks) gp-0) s4-0) (board-tricks board-rail-jump)) + (if (and (trick-type-trick? (-> (the-as (pointer board-tricks) gp-0) (+ s4-0 1))) + (= (-> (the-as (pointer board-tricks) gp-0) (+ s4-0 2)) (board-tricks board-rail-jump)) + ) + (set! (-> self combo-done?) #t) + ) + ) + ((trick-type-trick? (-> (the-as (pointer board-tricks) gp-0) s4-0)) + (if (and (= (-> (the-as (pointer board-tricks) gp-0) (+ s4-0 1)) (board-tricks board-rail-jump)) + (trick-type-trick? (-> (the-as (pointer board-tricks) gp-0) (+ s4-0 2))) + ) + (set! (-> self combo-done?) #t) + ) + ) + ) + ) + ) + #f + ) + ) + ) + (('boost) + (set! v0-0 #t) + (set! (-> self boost) (the-as symbol v0-0)) + v0-0 + ) + (('grind) + (set! v0-0 #t) + (set! (-> self grind) (the-as symbol v0-0)) + v0-0 + ) + (('text-on) + (set! v0-0 #t) + (set! (-> self text) (the-as symbol v0-0)) + v0-0 + ) + (('text-off) + (set! (-> self text) #f) + #f + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate wait-for-pickup (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :enter (behavior () + (set! (-> self board-picked-up) #f) + (cond + ((task-node-closed? (game-task-node forest-scouts-get-board)) + (set! (-> self board-picked-up) #t) + ) + (else + (let ((v1-0 (birth-pickup-at-point + (new 'static 'vector :x 505282.56 :y -38912.0 :z -2533785.5 :w 1.0) + (pickup-type board) + 1.0 + #t + self + (the-as fact-info #f) + ) + ) + ) + (send-event (ppointer->process v1-0) 'get-notify #t) + ) + (let ((gp-0 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> gp-0 pos quad) (-> (new 'static 'vector :x 505282.56 :y -38912.0 :z -2533785.5 :w 1.0) quad)) + (quaternion-identity! (-> gp-0 quat)) + (set! (-> gp-0 flags) (task-arrow-flags)) + (set! (-> gp-0 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-0 (the-as task-arrow self)))) + ) + ) + ) + (none) + ) + :exit (behavior () + (set-continue! *game-info* "skatea-training" #f) + (none) + ) + :trans (behavior () + (when (-> self board-picked-up) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'complete) + (let ((t9-0 send-event-function) + (v1-5 (-> *game-info* sub-task-list 64)) + ) + (t9-0 + (handle->process (if (-> v1-5 info) + (-> v1-5 info manager) + (the-as handle #f) + ) + ) + a1-0 + ) + ) + ) + (send-event (handle->process (-> self arrow)) 'leave) + (go-virtual jump) + ) + (none) + ) + :code (the-as (function none :behavior hoverboard-training-manager) sleep-code) + ) + +;; failed to figure out what this is: +(defstate wait-for-pickup-training (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :enter (behavior () + (set! (-> self board-picked-up) #f) + (cond + ((task-node-closed? (game-task-node forest-scouts-get-board)) + (set! (-> self board-picked-up) #t) + ) + (else + (let ((v1-0 (birth-pickup-at-point + (new 'static 'vector :x 505282.56 :y -38912.0 :z -2533785.5 :w 1.0) + (pickup-type board) + 1.0 + #t + self + (the-as fact-info #f) + ) + ) + ) + (send-event (ppointer->process v1-0) 'get-notify #t) + ) + ) + ) + (none) + ) + :exit (behavior () + (set-continue! *game-info* "skatea-training" #f) + (none) + ) + :trans (behavior () + (if (-> self board-picked-up) + (go-virtual idle-training) + ) + (none) + ) + :code (the-as (function none :behavior hoverboard-training-manager) sleep-code) + ) + +;; failed to figure out what this is: +(defstate wait-for-board (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :trans (behavior () + (if (task-node-open? (game-task-node stadium-board1-board)) + (go-virtual wait-for-pickup) + ) + (none) + ) + :code (the-as (function none :behavior hoverboard-training-manager) sleep-code) + ) + +;; failed to figure out what this is: +(defstate wait (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :trans (behavior () + (if (task-node-open? (game-task-node stadium-board1-training-judge)) + (go-virtual jump) + ) + (none) + ) + :code (the-as (function none :behavior hoverboard-training-manager) sleep-code) + ) + +;; failed to figure out what this is: +(defstate jump (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + (if (= (-> self voicebox) #f) + (set! (-> self voicebox) (ppointer->handle (voicebox-spawn *target* (target-pos 0)))) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei001" -99.0 0) + ) + (while (or (not *target*) (zero? (logand (focus-status board) (-> *target* focus-status)))) + (if (= (get-status *gui-control* (-> self last-sound-id)) (gui-status unknown)) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + ) + (render-text self (game-text-id board-tutorial-get-on-board)) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei002" -99.0 0) + ) + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-jump)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-jump)) + (goto cfg-51) + ) + ) + #f + (label cfg-51) + (send-event *target* 'get-notify #f) + (go-virtual duck-jump) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate duck-jump (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei006" -99.0 0) + ) + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-duck-jump)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-duck-jump)) + (goto cfg-36) + ) + ) + #f + (label cfg-36) + (send-event *target* 'get-notify #f) + (go-virtual boost-jump) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate boost-jump (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :exit (behavior () + (send-event (handle->process (-> self arrow)) 'leave) + (none) + ) + :code (behavior () + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei008" -99.0 0) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei009" -99.0 0) + ) + (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> gp-1 pos quad) (-> (new 'static 'vector :x 592158.75 :y -18391.04 :z -2367201.2 :w 1.0) quad)) + (quaternion-identity! (-> gp-1 quat)) + (set! (-> gp-1 flags) (task-arrow-flags)) + (set! (-> gp-1 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-1 (the-as task-arrow self)))) + ) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (let ((gp-2 #f) + (s5-0 (+ (-> self clock frame-counter) (seconds 15))) + ) + (until #f + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer self)) + (set! (-> a1-7 num-params) 0) + (set! (-> a1-7 message) 'off) + (let ((t9-8 send-event-function) + (v1-43 (-> self actor-group 0 data 0 actor)) + ) + (t9-8 + (if v1-43 + (-> v1-43 extra process) + ) + a1-7 + ) + ) + ) + (render-text self (game-text-id board-tutorial-boost-jump)) + (when (< s5-0 (-> self clock frame-counter)) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei009" -99.0 0) + ) + (set! s5-0 (+ (-> self clock frame-counter) (seconds 15))) + ) + (suspend) + (if (= (-> self trick-type) (board-tricks board-quick-jump)) + (set! gp-2 #t) + ) + (if (and gp-2 (-> self boost)) + (goto cfg-42) + ) + ) + ) + #f + (label cfg-42) + (send-event *target* 'get-notify #f) + (go-virtual grind) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate grind (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :exit (behavior () + (send-event (handle->process (-> self arrow)) 'leave) + (none) + ) + :code (behavior () + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei013" -99.0 0) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei014" -99.0 0) + ) + (let ((gp-1 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> gp-1 pos quad) (-> (new 'static 'vector :x 520232.97 :y -18391.04 :z -1988730.9 :w 1.0) quad)) + (quaternion-identity! (-> gp-1 quat)) + (set! (-> gp-1 flags) (task-arrow-flags)) + (set! (-> gp-1 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-1 (the-as task-arrow self)))) + ) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (let ((gp-2 #f)) + (until #f + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (process->ppointer self)) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'off) + (let ((t9-6 send-event-function) + (v1-26 (-> self actor-group 0 data 1 actor)) + ) + (t9-6 + (if v1-26 + (-> v1-26 extra process) + ) + a1-5 + ) + ) + ) + (render-text self (game-text-id board-tutorial-grind)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-rail-jump)) + (set! gp-2 #t) + ) + (if (= (get-status *gui-control* (-> self last-sound-id)) (gui-status unknown)) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + ) + (if (and gp-2 (-> self grind)) + (goto cfg-35) + ) + ) + ) + #f + (label cfg-35) + (send-event *target* 'get-notify #f) + (go-virtual spin) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate spin (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei010" -99.0 0) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei011" -99.0 0) + ) + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-spin)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-spin)) + (goto cfg-36) + ) + ) + #f + (label cfg-36) + (send-event *target* 'get-notify #f) + (go-virtual flip) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate flip (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei016" -99.0 0) + ) + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-flip)) + (suspend) + (if (= (-> self trick-type) (board-tricks board-flip)) + (goto cfg-36) + ) + ) + #f + (label cfg-36) + (send-event *target* 'get-notify #f) + (go-virtual trick) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate trick (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei017" -99.0 0) + ) + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event *target* 'get-notify self) + (set! (-> self trick-type) (board-tricks none)) + (until #f + (render-text self (game-text-id board-tutorial-trick)) + (suspend) + (case (-> self trick-type) + (((board-tricks board-nosegrab) + (board-tricks board-method) + (board-tricks board-board-spin) + (board-tricks board-board-flip) + (board-tricks board-noseflip) + (board-tricks board-kickflip) + ) + (goto cfg-47) + ) + ) + ) + #f + (label cfg-47) + (send-event *target* 'get-notify #f) + (go-virtual game) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate game (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :code (behavior () + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (send-event (handle->process (-> self voicebox)) 'speak-effect #t) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei018" -99.0 0) + ) + (set! (-> self last-sound-id) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei019" -99.0 0) + ) + (while (nonzero? (get-status *gui-control* (-> self last-sound-id))) + (suspend) + ) + (send-event (handle->process (-> self voicebox)) 'speak-effect #f) + (when (!= (-> self voicebox) #f) + (send-event (handle->process (-> self voicebox)) 'die) + (set! (-> self voicebox) (the-as handle #f)) + ) + (task-node-close! (game-task-node stadium-board1-training)) + (go-virtual idle) + (none) + ) + ) + +;; definition for method 29 of type hoverboard-training-manager +;; WARN: Return type mismatch int vs none. +(defmethod hoverboard-training-manager-method-29 hoverboard-training-manager ((obj hoverboard-training-manager)) + (let ((s5-0 (get-game-score-ref *game-info* (the-as int (-> obj game-score)))) + (gp-0 (handle->process (-> obj hud-goal))) + ) + (cond + ((-> obj training?) + (cond + ((>= (-> *game-info* score) (-> s5-0 0)) + (set! (-> *game-info* goal) (-> *game-info* score)) + (let ((s5-1 format) + (gp-1 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-1 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-1 gp-1 s4-1 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 1)) + (set! (-> *game-info* goal) (-> s5-0 0)) + (let ((s5-2 format) + (gp-2 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-2 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-2 gp-2 s4-2 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 2)) + (set! (-> *game-info* goal) (-> s5-0 1)) + (let ((s5-3 format) + (gp-3 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-3 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) + (s5-3 gp-3 s4-3 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> obj training-goal)) + (set! (-> *game-info* goal) (-> s5-0 2)) + (let ((s5-4 format) + (gp-4 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-4 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-bronze) #f)) + (s5-4 gp-4 s4-4 *temp-string*) + ) + ) + (else + (set! (-> *game-info* goal) (-> obj training-goal)) + (let ((s5-5 format) + (gp-5 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-5 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-goal) #f)) + (s5-5 gp-5 s4-5 *temp-string*) + ) + ) + ) + ) + ((task-node-open? (the-as game-task-node (-> obj task-bronze))) + (cond + ((>= (-> *game-info* score) (-> s5-0 0)) + (set! (-> *game-info* goal) (-> *game-info* score)) + (let ((s5-6 format) + (gp-6 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-6 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-6 gp-6 s4-6 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 1)) + (set! (-> *game-info* goal) (-> s5-0 0)) + (let ((s5-7 format) + (gp-7 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-7 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-7 gp-7 s4-7 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 2)) + (set! (-> *game-info* goal) (-> s5-0 1)) + (let ((s5-8 format) + (gp-8 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-8 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) + (s5-8 gp-8 s4-8 *temp-string*) + ) + ) + (else + (set! (-> *game-info* goal) (-> s5-0 2)) + (let ((s5-9 format) + (gp-9 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-9 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-bronze) #f)) + (s5-9 gp-9 s4-9 *temp-string*) + ) + ) + ) + ) + ((task-node-open? (the-as game-task-node (-> obj task-silver))) + (cond + ((>= (-> *game-info* score) (-> s5-0 0)) + (set! (-> *game-info* goal) (-> *game-info* score)) + (let ((s5-10 format) + (gp-10 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-10 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-10 gp-10 s4-10 *temp-string*) + ) + ) + ((>= (-> *game-info* score) (-> s5-0 1)) + (set! (-> *game-info* goal) (-> s5-0 0)) + (let ((s5-11 format) + (gp-11 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-11 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) + (s5-11 gp-11 s4-11 *temp-string*) + ) + ) + (else + (set! (-> *game-info* goal) (-> s5-0 1)) + (let ((s5-12 format) + (gp-12 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-12 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-silver) #f)) + (s5-12 gp-12 s4-12 *temp-string*) + ) + ) + ) + ) + ((or (task-node-open? (the-as game-task-node (-> obj task-gold))) + (task-node-closed? (the-as game-task-node (-> obj task-gold))) + ) + (cond + ((>= (-> *game-info* score) (-> s5-0 0)) + (set! (-> *game-info* goal) (-> *game-info* score)) + (let ((s5-13 format) + (gp-13 (the-as hud-goal (clear (-> (the-as hud-goal gp-0) strings 1 text)))) + (s4-13 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-13 gp-13 s4-13 *temp-string*) + ) + ) + (else + (set! (-> *game-info* goal) (-> s5-0 0)) + (let ((s5-14 format) + (gp-14 (clear (-> (the-as hud-goal gp-0) strings 1 text))) + (s4-14 "~S") + ) + (format (clear *temp-string*) (lookup-text! *common-text* (game-text-id highscore-text-gold) #f)) + (s5-14 gp-14 s4-14 *temp-string*) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 30 of type hoverboard-training-manager +;; WARN: Return type mismatch int vs none. +(defmethod hoverboard-training-manager-method-30 hoverboard-training-manager ((obj hoverboard-training-manager)) + (set! (-> obj egg-count) 0) + (set! (-> obj medal) 0) + (let ((s5-0 (get-game-score-ref *game-info* (the-as int (-> obj game-score))))) + (when (or (-> obj training?) (task-node-open? (the-as game-task-node (-> obj task-bronze)))) + (when (>= (-> *game-info* score) (-> s5-0 2)) + (task-node-close! (the-as game-task-node (-> obj task-bronze))) + (logior! (-> *game-info* features) (game-feature board)) + (+! (-> obj egg-count) 1) + (set! (-> obj medal) 2) + ) + ) + (when (task-node-open? (the-as game-task-node (-> obj task-silver))) + (when (>= (-> *game-info* score) (-> s5-0 1)) + (task-node-close! (the-as game-task-node (-> obj task-silver))) + (logior! (-> *game-info* features) (game-feature board)) + (+! (-> obj egg-count) 1) + (set! (-> obj medal) 1) + ) + ) + (when (task-node-open? (the-as game-task-node (-> obj task-gold))) + (when (>= (-> *game-info* score) (-> s5-0 0)) + (task-node-close! (the-as game-task-node (-> obj task-gold))) + (logior! (-> *game-info* features) (game-feature board)) + (+! (-> obj egg-count) 1) + (set! (-> obj medal) 0) + 0 + ) + ) + ) + (game-info-method-28 *game-info* (the-as game-score (-> obj game-score)) (-> obj score)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate idle (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :enter (behavior () + (if (= (-> self hud-score) #f) + (set! (-> self hud-score) (ppointer->handle (process-spawn hud-score :init hud-init-by-other :to self))) + ) + (if (= (-> self hud-goal) #f) + (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) + ) + (set! (-> self training-goal) 15000.0) + (set! (-> self training?) #t) + (set! (-> self game-score) (the-as uint 10)) + (set! (-> self task-gold) (the-as uint 71)) + (set! (-> self task-silver) (the-as uint 70)) + (set! (-> self task-bronze) (the-as uint 69)) + (set! (-> self challenge-done) #t) + (if (task-node-closed? (game-task-node stadium-board1-training-judge)) + (set! (-> self training?) #f) + ) + (none) + ) + :exit (behavior () + (send-event *target* 'get-notify #f) + (none) + ) + :trans (behavior () + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'off) + (let ((t9-0 send-event-function) + (v1-5 (-> self actor-group 0 data 0 actor)) + ) + (t9-0 + (if v1-5 + (-> v1-5 extra process) + ) + a1-0 + ) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'off) + (let ((t9-1 send-event-function) + (v1-13 (-> self actor-group 0 data 1 actor)) + ) + (t9-1 + (if v1-13 + (-> v1-13 extra process) + ) + a1-1 + ) + ) + ) + (cond + ((not (logtest? (-> *game-info* features) (game-feature board))) + (if (!= (-> self hud-score) #f) + (send-event (handle->process (-> self hud-score)) 'force-hide) + ) + (if (!= (-> self hud-goal) #f) + (send-event (handle->process (-> self hud-goal)) 'force-hide) + ) + ) + (else + (if (!= (-> self hud-score) #f) + (send-event (handle->process (-> self hud-score)) 'force-show) + ) + (if (!= (-> self hud-goal) #f) + (send-event (handle->process (-> self hud-goal)) 'force-show) + ) + ) + ) + (send-event *target* 'get-notify self) + (hoverboard-training-manager-method-29 self) + (when (not (-> self challenge-done)) + (when (and (not (-> self combo-done?)) + (>= (- (-> self clock frame-counter) (-> self hint-time)) (seconds 30)) + (not (task-node-closed? (game-task-node stadium-board1-resolution))) + ) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei018" -99.0 0) + (set! (-> self hint-time) (-> self clock frame-counter)) + ) + ) + (none) + ) + :code (behavior () + (suspend) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'open) + (let ((t9-0 send-event-function) + (v1-5 (-> self actor-group 1 data 0 actor)) + ) + (t9-0 + (if v1-5 + (-> v1-5 extra process) + ) + a1-0 + ) + ) + ) + (until #f + (when (not (task-node-closed? (game-task-node stadium-board1-training-judge))) + (let ((gp-0 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> gp-0 pos quad) (-> (new 'static 'vector :x 191037.44 :y -53780.48 :z -2148638.8 :w 1.0) quad)) + (quaternion-identity! (-> gp-0 quat)) + (set! (-> gp-0 flags) (task-arrow-flags)) + (set! (-> gp-0 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-0 (the-as task-arrow self)))) + ) + (set! (-> self score) -1.0) + ) + (let ((gp-1 + (ppointer->handle + (judge-spawn self (new 'static 'vector :x 190382.08 :y -47063.04 :z -2148475.0 :w 1.0) (the-as uint 10)) + ) + ) + ) + (suspend) + (while (send-event (handle->process gp-1) 'waiting) + (when (-> self text) + (cond + ((not (task-node-closed? (game-task-node stadium-board1-resolution))) + (cond + ((task-node-open? (game-task-node stadium-board1-training-judge)) + (cond + ((< (-> self score) 0.0) + (render-text self (game-text-id board-score-activate-judge)) + ) + ((< (-> self score) 15000.0) + (render-text self (game-text-id board-score-try-again)) + ) + ) + ) + ((not (task-node-closed? (game-task-node stadium-board1-done))) + (if (not (movie?)) + (render-text self (game-text-id board-score-return-to-garage)) + ) + ) + ((task-node-closed? (game-task-node stadium-board1-done)) + (when (!= (-> self arrow) #f) + (send-event (handle->process (-> self arrow)) 'leave) + (set! (-> self arrow) (the-as handle #f)) + ) + ) + ) + ) + (else + (go-virtual wait-for-pickup-training) + ) + ) + ) + (suspend) + ) + (if (!= (-> self arrow) #f) + (send-event (handle->process (-> self arrow)) 'leave) + ) + (set! (-> self score) 0.0) + (set! (-> self challenge-done) #f) + (set! (-> self combo-done?) #f) + (set! (-> self hint-time) (-> self clock frame-counter)) + (while (and (not (-> self challenge-done)) (logtest? (-> *game-info* features) (game-feature board))) + (suspend) + ) + (send-event (handle->process gp-1) 'die) + ) + (when (-> self challenge-done) + (hoverboard-training-manager-method-30 self) + (when (> (-> self egg-count) 0) + (let ((s5-0 0)) + (let ((gp-3 (ppointer->handle (voicebox-spawn *target* (target-pos 0))))) + (let ((v1-83 (-> self medal))) + (cond + ((zero? v1-83) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv179" -99.0 0)) + ) + ) + ((= v1-83 1) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv180" -99.0 0)) + ) + ) + ((= v1-83 2) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv181" -99.0 0)) + ) + ) + ) + ) + (while (nonzero? (get-status *gui-control* (the-as sound-id s5-0))) + (suspend) + ) + (let* ((s5-1 (handle->process gp-3)) + (v1-97 (if (type? s5-1 process-drawable) + (the-as process-drawable s5-1) + ) + ) + (t1-3 (new 'static 'fact-info)) + ) + (set! (-> t1-3 options) (actor-option)) + (logior! (-> t1-3 options) (actor-option suck-in)) + (birth-pickup-at-point + (-> v1-97 root trans) + (pickup-type skill) + (* (the float (-> self egg-count)) (-> *FACT-bank* super-skill-inc)) + #t + *entity-pool* + t1-3 + ) + ) + (let ((s5-2 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s5-2) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process gp-3) 'die) + ) + ) + (auto-save-user) + ) + ) + (set! (-> self challenge-done) #t) + (let ((gp-4 (new 'stack-no-clear 'task-arrow-params))) + (cond + ((not (task-node-closed? (game-task-node stadium-board1-training-judge))) + (cond + ((>= (-> self score) 15000.0) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei021" -99.0 0) + (task-node-close! (game-task-node stadium-board1-training-judge)) + (set! (-> self training?) #f) + (set! (-> gp-4 pos quad) (-> (new 'static 'vector :x 426885.12 :y -38461.44 :z -2598625.2 :w 1.0) quad)) + (quaternion-identity! (-> gp-4 quat)) + (set! (-> gp-4 flags) (task-arrow-flags)) + (set! (-> gp-4 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-4 (the-as task-arrow self)))) + ) + (else + (set! (-> *game-info* sub-task-list 66 death-count) + (the-as uint (seekl (the-as int (-> *game-info* sub-task-list 66 death-count)) #xffff 1)) + ) + (add-process *gui-control* self (gui-channel sig) (gui-action play) "kei020" -99.0 0) + ) + ) + ) + (else + (set! (-> self training?) #f) + (set! (-> gp-4 pos quad) (-> (new 'static 'vector :x 426885.12 :y -38461.44 :z -2598625.2 :w 1.0) quad)) + (quaternion-identity! (-> gp-4 quat)) + (set! (-> gp-4 flags) (task-arrow-flags)) + (set! (-> gp-4 map-icon) (the-as uint 15)) + (set! (-> self arrow) (process->handle (task-arrow-spawn gp-4 (the-as task-arrow self)))) + ) + ) + ) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle-training (hoverboard-training-manager) + :virtual #t + :event hoverboard-training-manager-event-handler + :enter (behavior () + (if (= (-> self hud-score) #f) + (set! (-> self hud-score) (ppointer->handle (process-spawn hud-score :init hud-init-by-other :to self))) + ) + (if (= (-> self hud-goal) #f) + (set! (-> self hud-goal) (ppointer->handle (process-spawn hud-goal :init hud-init-by-other :to self))) + ) + (set! (-> self training-goal) 15000.0) + (set! (-> self training?) #f) + (set! (-> self game-score) (the-as uint 10)) + (set! (-> self task-gold) (the-as uint 71)) + (set! (-> self task-silver) (the-as uint 70)) + (set! (-> self task-bronze) (the-as uint 69)) + (none) + ) + :exit (behavior () + (send-event *target* 'get-notify #f) + (none) + ) + :trans (behavior () + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'off) + (let ((t9-0 send-event-function) + (v1-5 (-> self actor-group 0 data 0 actor)) + ) + (t9-0 + (if v1-5 + (-> v1-5 extra process) + ) + a1-0 + ) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'off) + (let ((t9-1 send-event-function) + (v1-13 (-> self actor-group 0 data 1 actor)) + ) + (t9-1 + (if v1-13 + (-> v1-13 extra process) + ) + a1-1 + ) + ) + ) + (cond + ((not (logtest? (-> *game-info* features) (game-feature board))) + (if (!= (-> self hud-score) #f) + (send-event (handle->process (-> self hud-score)) 'force-hide) + ) + (if (!= (-> self hud-goal) #f) + (send-event (handle->process (-> self hud-goal)) 'force-hide) + ) + ) + (else + (if (!= (-> self hud-score) #f) + (send-event (handle->process (-> self hud-score)) 'force-show) + ) + (if (!= (-> self hud-goal) #f) + (send-event (handle->process (-> self hud-goal)) 'force-show) + ) + ) + ) + (hoverboard-training-manager-method-29 self) + (none) + ) + :code (behavior () + (send-event *target* 'get-notify self) + (until #f + (let ((gp-0 + (ppointer->handle + (judge-spawn self (new 'static 'vector :x 190382.08 :y -47063.04 :z -2148475.0 :w 1.0) (the-as uint 10)) + ) + ) + ) + (suspend) + (while (send-event (handle->process (the-as handle gp-0)) 'waiting) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'open) + (let ((t9-2 send-event-function) + (v1-11 (-> self actor-group 1 data 0 actor)) + ) + (t9-2 + (if v1-11 + (-> v1-11 extra process) + ) + a1-2 + ) + ) + ) + (suspend) + ) + ) + (set! (-> self score) 0.0) + (set! (-> self challenge-done) #f) + (until (-> self challenge-done) + (suspend) + ) + (hoverboard-training-manager-method-30 self) + (when (> (-> self egg-count) 0) + (let ((s5-0 0)) + (let ((gp-2 (ppointer->handle (voicebox-spawn *target* (target-pos 0))))) + (let ((v1-30 (-> self medal))) + (cond + ((zero? v1-30) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv179" -99.0 0)) + ) + ) + ((= v1-30 1) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv180" -99.0 0)) + ) + ) + ((= v1-30 2) + (set! s5-0 + (the-as int (add-process *gui-control* self (gui-channel sig) (gui-action play) "cityv181" -99.0 0)) + ) + ) + ) + ) + (while (nonzero? (get-status *gui-control* (the-as sound-id s5-0))) + (suspend) + ) + (let* ((s5-1 (handle->process gp-2)) + (v1-44 (if (type? s5-1 process-drawable) + (the-as process-drawable s5-1) + ) + ) + (t1-3 (new 'static 'fact-info)) + ) + (set! (-> t1-3 options) (actor-option)) + (logior! (-> t1-3 options) (actor-option suck-in)) + (birth-pickup-at-point + (-> v1-44 root trans) + (pickup-type skill) + (* (the float (-> self egg-count)) (-> *FACT-bank* super-skill-inc)) + #t + *entity-pool* + t1-3 + ) + ) + (let ((s5-2 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s5-2) (seconds 1)) + (suspend) + ) + ) + (send-event (handle->process gp-2) 'die) + ) + ) + (auto-save-user) + ) + ) + #f + (none) + ) + :post (behavior () + (if (not (logtest? (-> *game-info* features) (game-feature board))) + (go-virtual wait-for-pickup-training) + ) + (none) + ) + ) + +;; definition for method 10 of type hoverboard-training-manager +(defmethod deactivate hoverboard-training-manager ((obj hoverboard-training-manager)) + (send-event *traffic-manager* 'restore-default-settings) + ((the-as (function process none) (find-parent-method hoverboard-training-manager 10)) obj) + (none) + ) + +;; definition for method 11 of type hoverboard-training-manager +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! hoverboard-training-manager ((obj hoverboard-training-manager) (arg0 entity-actor)) + (local-vars (sv-16 res-tag)) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-1 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (cond + ((and v1-1 (nonzero? (-> sv-16 elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) v1-1)) + (set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count))) + ) + (else + (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) + (set! (-> obj actor-group-count) 0) + (go process-drawable-art-error "actor-group training-manager") + ) + ) + ) + (set! (-> obj boost) #f) + (set! (-> obj grind) #f) + (set! (-> obj text) #t) + (set! (-> obj combo-done?) #f) + (set! (-> obj hud-score) (the-as handle #f)) + (set! (-> obj hud-goal) (the-as handle #f)) + (set! (-> obj voicebox) (the-as handle #f)) + (set! (-> obj arrow) (the-as handle #f)) + (set! (-> obj gui-id) (new 'static 'sound-id)) + (set! (-> obj gui-id) + (add-process *gui-control* obj (gui-channel message) (gui-action play) (-> obj name) 81920.0 0) + ) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'set-object-target-count 11 0) + (send-event s5-0 'set-object-target-count 12 0) + (send-event s5-0 'set-object-target-count 13 0) + (send-event s5-0 'set-object-target-count 14 0) + (send-event s5-0 'set-object-target-count 15 0) + (send-event s5-0 'set-object-target-count 16 0) + (send-event s5-0 'set-object-target-count 0 0) + (send-event s5-0 'set-object-target-count 1 0) + (send-event s5-0 'set-object-target-count 2 0) + (send-event s5-0 'set-object-target-count 6 0) + (send-event s5-0 'set-object-target-count 7 0) + (send-event s5-0 'set-object-target-count 8 0) + (send-event s5-0 'set-object-target-count 9 0) + (send-event s5-0 'set-object-target-count 10 0) + (send-event s5-0 'set-object-target-count 18 0) + (send-event s5-0 'set-object-target-count 19 0) + (send-event s5-0 'set-guard-target-level 0) + ) + (set-setting! 'allow-continue #f 0 0) + (cond + ((task-node-closed? (game-task-node forest-scouts-get-board)) + (go (method-of-object obj idle)) + ) + ((task-node-closed? (game-task-node stadium-board1-resolution)) + (go (method-of-object obj wait-for-pickup-training)) + ) + ((task-node-open? (game-task-node stadium-board1-training)) + (go (method-of-object obj jump)) + ) + ((task-node-open? (game-task-node stadium-board1-training-judge)) + (go (method-of-object obj idle)) + ) + ((task-node-closed? (game-task-node stadium-board1-training-judge)) + (go (method-of-object obj idle)) + ) + (else + (go (method-of-object obj wait-for-board)) + ) + ) + (none) + ) + +;; definition of type skate-training-ramp +(deftype skate-training-ramp (process-focusable) + ((onoff symbol :offset-assert 204) + ) + :heap-base #x50 + :method-count-assert 29 + :size-assert #xd0 + :flag-assert #x1d005000d0 + (:methods + (idle () _type_ :state 27) + (skate-training-ramp-method-28 (_type_) collide-shape-moving 28) + ) + ) + +;; definition for method 3 of type skate-training-ramp +(defmethod inspect skate-training-ramp ((obj skate-training-ramp)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 obj) + ) + (format #t "~2Tonoff: ~A~%" (-> obj onoff)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-skate-training-ramp skate-training-ramp 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 4 -4 8 12) + ) + +;; failed to figure out what this is: +(defstate idle (skate-training-ramp) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('open) + (let ((v0-0 #t)) + (set! (-> self onoff) v0-0) + v0-0 + ) + ) + (('close) + (set! (-> self onoff) #f) + #f + ) + ) + ) + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (none) + ) + :code (behavior () + (until #f + (if (-> self onoff) + (ja :num! (seek! max 0.05)) + (ja :num! (seek! 0.0 0.05)) + ) + (suspend) + ) + #f + (none) + ) + :post (behavior () + (transform-post) + (none) + ) + ) + +;; definition for method 28 of type skate-training-ramp +(defmethod skate-training-ramp-method-28 skate-training-ramp ((obj skate-training-ramp)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 61440.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-12 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-12 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-12 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-12 prim-core action) (collide-action solid)) + (set! (-> v1-12 transform-index) 4) + (set-vector! (-> v1-12 local-sphere) 16384.0 -16384.0 32768.0 49152.0) + ) + (let ((v1-14 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-14 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-14 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-14 prim-core action) (collide-action solid)) + (set! (-> v1-14 transform-index) 3) + (set-vector! (-> v1-14 local-sphere) 16384.0 -16384.0 32768.0 49152.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-17 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + s5-0 + ) + ) + +;; definition for method 11 of type skate-training-ramp +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! skate-training-ramp ((obj skate-training-ramp) (arg0 entity-actor)) + (skate-training-ramp-method-28 obj) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton + obj + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-skate-training-ramp" (the-as (pointer uint32) #f)) + ) + (the-as pair 0) + ) + (set! (-> obj onoff) #f) + (ja-channel-push! 1 0) + (let ((a0-7 (-> obj skel root-channel 0))) + (set! (-> a0-7 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-7 frame-num) 0.0) + (joint-control-channel-group! a0-7 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (transform-post) + (go (method-of-object obj idle)) + (none) + ) + +;; definition of type skate-gate +(deftype skate-gate (process-focusable) + ((onoff symbol :offset-assert 204) + ) + :heap-base #x50 + :method-count-assert 30 + :size-assert #xd0 + :flag-assert #x1e005000d0 + (:methods + (idle () _type_ :state 27) + (open () _type_ :state 28) + (skate-gate-method-29 (_type_) collide-shape-moving 29) + ) + ) + +;; definition for method 3 of type skate-gate +(defmethod inspect skate-gate ((obj skate-gate)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 obj) + ) + (format #t "~2Tonoff: ~A~%" (-> obj onoff)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-skate-gate skate-gate 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 8 0 30)) + +;; failed to figure out what this is: +(defstate idle (skate-gate) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('open) + (remove-setting! 'minimap) + (let ((v0-1 #t)) + (set! (-> self onoff) v0-1) + v0-1 + ) + ) + (('close) + (set-setting! 'minimap 'clear 0 128) + (set! (-> self onoff) #f) + #f + ) + ) + ) + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (none) + ) + :code (behavior () + (until #f + (if (-> self onoff) + (ja :num! (seek! max 0.05)) + (ja :num! (seek! 0.0 0.05)) + ) + (suspend) + ) + #f + (none) + ) + :post (behavior () + (if (logtest? (-> *game-info* features) (game-feature board)) + (send-event self 'close) + (send-event self 'open) + ) + (transform-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate open (skate-gate) + :virtual #t + :code (the-as (function none :behavior skate-gate) sleep-code) + ) + +;; definition for method 29 of type skate-gate +(defmethod skate-gate-method-29 skate-gate ((obj skate-gate)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((v1-6 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-6 prim-core action) (collide-action solid)) + (set! (-> v1-6 transform-index) 3) + (set-vector! (-> v1-6 local-sphere) 32768.0 32768.0 0.0 49152.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + s5-0 + ) + ) + +;; definition for method 11 of type skate-gate +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! skate-gate ((obj skate-gate) (arg0 entity-actor)) + (skate-gate-method-29 obj) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-skate-gate" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj onoff) #f) + (send-event *target* 'reset-pickup 'trick-judge) + (send-event *target* 'reset-pickup 'trick-point) + (ja-channel-push! 1 0) + (cond + ((and (not (task-node-open? (game-task-node stadium-board1-training-judge))) + (logtest? (-> *game-info* features) (game-feature board)) + ) + (let ((a0-15 (-> obj skel root-channel 0))) + (set! (-> a0-15 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-15 frame-num) 1.0) + (joint-control-channel-group! a0-15 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (transform-post) + (go (method-of-object obj open)) + ) + (else + (let ((a0-16 (-> obj skel root-channel 0))) + (set! (-> a0-16 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-16 frame-num) 0.0) + (joint-control-channel-group! a0-16 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (transform-post) + (go (method-of-object obj idle)) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defskelgroup skel-skatea-jump-pad skatea-jump-pad 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 15) + ) + +;; definition of type skatea-jump-pad +(deftype skatea-jump-pad (bouncer) + () + :heap-base #x60 + :method-count-assert 25 + :size-assert #xd4 + :flag-assert #x19006000d4 + ) + +;; definition for method 3 of type skatea-jump-pad +(defmethod inspect skatea-jump-pad ((obj skatea-jump-pad)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type bouncer inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; definition for method 23 of type skatea-jump-pad +;; WARN: Return type mismatch int vs none. +(defmethod init-skeleton! skatea-jump-pad ((obj skatea-jump-pad)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-skatea-jump-pad" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + 0 + (none) + ) + +;; definition for method 24 of type skatea-jump-pad +;; WARN: Return type mismatch int vs none. +(defmethod bouncer-method-24 skatea-jump-pad ((obj skatea-jump-pad)) + "TODO - collision stuff" + (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec crate)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 61440.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 2)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec crate)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 0) + (set-vector! (-> v1-8 local-sphere) 0.0 0.0 0.0 12288.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 8)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec crate)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-10 prim-core action) (collide-action)) + (set-vector! (-> v1-10 local-sphere) 0.0 4096.0 0.0 6144.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> obj root) s5-0) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate fire (skatea-jump-pad) + :virtual #t + :code (behavior () + (sound-play "dig-air-lifter") + (let ((s5-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3))) + (gp-1 (get-process *default-dead-pool* part-tracker #x4000)) + ) + (when gp-1 + (let ((t9-4 (method-of-type part-tracker activate))) + (t9-4 + (the-as part-tracker gp-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-5 run-function-in-process) + (a0-5 gp-1) + (a1-4 part-tracker-init) + (a2-5 (-> *part-group-id-table* 12)) + (a3-2 0) + (t0-1 #f) + (t1-1 #f) + (t2-1 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> s5-1 quad)) + ((the-as (function object object object object object object object object none) t9-5) + a0-5 + a1-4 + a2-5 + a3-2 + t0-1 + t1-1 + t2-1 + t3-0 + ) + ) + (-> gp-1 ppointer) + ) + ) + (let ((t9-6 (-> (method-of-type bouncer fire) code))) + (if t9-6 + ((the-as (function none) t9-6)) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defskelgroup skel-skatea-floating-ring skatea-floating-ring 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 4 0 8) + ) + +;; definition of type skatea-floating-ring +(deftype skatea-floating-ring (process-focusable) + ((pos-y float :offset-assert 204) + (offset float :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 29 + :size-assert #xd4 + :flag-assert #x1d006000d4 + (:methods + (idle () _type_ :state 27) + (skatea-floating-ring-method-28 (_type_) none 28) + ) + ) + +;; definition for method 3 of type skatea-floating-ring +(defmethod inspect skatea-floating-ring ((obj skatea-floating-ring)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 obj) + ) + (format #t "~2Tpos-y: ~f~%" (-> obj pos-y)) + (format #t "~2Toffset: ~f~%" (-> obj offset)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defstate idle (skatea-floating-ring) + :virtual #t + :exit (behavior () + '() + (none) + ) + :code (the-as (function none :behavior skatea-floating-ring) sleep-code) + :post (behavior () + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (if (nonzero? (-> self sound)) + (update! (-> self sound)) + ) + (let* ((a0-1 (-> self part)) + (t9-1 (method-of-object a0-1 spawn)) + (a1-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-6 (-> self root-override trans))) + (let ((a2-0 *up-vector*)) + (let ((a3-1 16384.0)) + (.mov vf7 a3-1) + ) + (.lvf vf5 (&-> a2-0 quad)) + ) + (.lvf vf4 (&-> v1-6 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a1-0 quad) vf6) + (t9-1 a0-1 a1-0) + ) + (set! (-> self root-override trans y) + (+ (-> self pos-y) + (* 2048.0 (cos (* 18204.445 (+ (-> self offset) (* 0.0033333334 (the float (-> self clock frame-counter))))))) + ) + ) + (transform-post) + (none) + ) + ) + ) + +;; definition for method 28 of type skatea-floating-ring +;; WARN: Return type mismatch int vs none. +(defmethod skatea-floating-ring-method-28 skatea-floating-ring ((obj skatea-floating-ring)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec crate camera-blocker)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list tobot)) + (set! (-> v1-6 prim-core action) (collide-action solid deadly)) + (set! (-> v1-6 transform-index) 3) + (set-vector! (-> v1-6 local-sphere) 0.0 16384.0 0.0 32768.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + 0 + (none) + ) + +;; definition for method 11 of type skatea-floating-ring +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! skatea-floating-ring ((obj skatea-floating-ring) (arg0 entity-actor)) + (skatea-floating-ring-method-28 obj) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-skatea-floating-ring" (the-as (pointer uint32) #f)) + ) + (the-as pair 0) + ) + (set! (-> obj mask) (logior (process-mask crate) (-> obj mask))) + (set! (-> obj pos-y) (-> obj root-override trans y)) + (set! (-> obj offset) (rand-vu)) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 539) obj)) + (set! (-> obj sound) (new + 'process + 'ambient-sound + (static-sound-spec "fire-ring" :fo-min 10 :fo-max 30) + (-> obj root-override trans) + ) + ) + (go (method-of-object obj idle)) + (none) + ) diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 18526f8832..2daede312e 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -40,6 +40,7 @@ "DGO/LBOMBBOT.DGO", "DGO/LERLCHAL.DGO", "DGO/LKIDDOGE.DGO", + "DGO/LSACK.DGO", "DGO/MCN.DGO", "DGO/MTN.DGO", "DGO/NEB.DGO", @@ -269,7 +270,6 @@ "skip_compile_states": { "(idle process-taskable)": ["event"], "(impact gun-dark-shot)": ["code"], - "(target-gun-stance target)": ["code"], - "(close gungame-door)": ["code"] // ja macro + "(target-gun-stance target)": ["code"] } }