From 82e051727560ccfc8d70cd3d6ca96891e92d5b52 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 14 Sep 2022 19:37:12 -0400 Subject: [PATCH] d/jak2: get `script` decompiling, no ref tests yet (#1877) Has boxed array accessing that prevents me from adding anything to ref tests (the entire file is lambdas so the access pattern that i would like to ignore happens at the top-level, can't ignore it. This code actually already has quite a bit of original docstrings so it's not too bad in that regard considering a `script-context` can have 16 arbitrary objects. It seems they rarely put more than a single object in the context and the types are usually obvious / are actually type checked! --- decompiler/config/jak2/all-types.gc | 124 +- .../jak2/anonymous_function_types.jsonc | 89 + decompiler/config/jak2/hacks.jsonc | 28 +- decompiler/config/jak2/label_types.jsonc | 7 +- decompiler/config/jak2/stack_structures.jsonc | 5 + decompiler/config/jak2/type_casts.jsonc | 73 +- decompiler/config/jak2/var_names.jsonc | 214 +- decompiler/util/type_utils.cpp | 4 +- goal_src/jak2/engine/ambient/ambient-h.gc | 7 +- goal_src/jak2/engine/debug/default-menu.gc | 7 +- goal_src/jak2/engine/debug/editable-player.gc | 2576 ----------------- goal_src/jak2/engine/debug/menu.gc | 17 +- goal_src/jak2/engine/entity/entity-h.gc | 5 +- goal_src/jak2/engine/game/game-info-h.gc | 4 +- goal_src/jak2/engine/game/settings-h.gc | 2 +- goal_src/jak2/engine/game/settings.gc | 18 +- goal_src/jak2/engine/game/task/game-task-h.gc | 1 + goal_src/jak2/engine/sound/gsound.gc | 94 +- goal_src/jak2/engine/target/logic-target.gc | 7 +- goal_src/jak2/engine/util/script-h.gc | 15 +- goal_src/jak2/engine/util/script.gc | 37 + goal_src/jak2/levels/common/airlock.gc | 77 +- goalc/compiler/compilation/Static.cpp | 2 +- .../jak2/engine/ambient/ambient-h_REF.gc | 6 +- .../jak2/engine/debug/editable-player_REF.gc | 2 +- .../reference/jak2/engine/debug/menu_REF.gc | 19 +- .../jak2/engine/entity/entity-h_REF.gc | 4 +- .../jak2/engine/game/game-info-h_REF.gc | 4 +- .../jak2/engine/game/settings-h_REF.gc | 2 +- .../jak2/engine/game/settings_REF.gc | 11 +- .../reference/jak2/engine/sound/gsound_REF.gc | 102 +- .../jak2/engine/target/logic-target_REF.gc | 7 +- .../jak2/engine/util/script-h_REF.gc | 15 +- .../jak2/levels/common/airlock_REF.gc | 23 +- 34 files changed, 635 insertions(+), 2973 deletions(-) diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 7cda913871..72f833eaee 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -7421,8 +7421,8 @@ :flag-assert #x1300000fb0 (:methods (new (symbol type int) _type_ 0) - (add-setting (_type_ process symbol object object object) none 9) - (persist-with-delay (_type_ process time-frame object object float object) none 10) + (add-setting "Originally called `setting-set` see (anon-function 48 script)" (_type_ process symbol object object object) none 9) + (persist-with-delay "Originally called `setting-pers` see (anon-function 46 script)" (_type_ symbol time-frame symbol symbol float int) none 10) (set-setting (_type_ process symbol object object object) none 11) (remove-setting (_type_ process symbol) none 12) (kill-persister "Calls [[engine-pers::kill-matching]]" (_type_ engine-pers object) none 13) @@ -8315,6 +8315,7 @@ (defenum game-task :type uint8 :bitfield #f + (unknown -1) (none 0) (complete 1) (dummy0 2) @@ -11607,7 +11608,7 @@ (vis-nick symbol :offset-assert 112) (command-list pair) (object-name string 256) - (object-status basic 256) + (object-status basic 256) ;; see (anon-function 25 script), should be an `entity-perm-status` but that's too small! ) :method-count-assert 22 :size-assert #x878 @@ -11622,7 +11623,7 @@ (want-display-level (_type_ symbol symbol) int 13) (want-vis-level (_type_ symbol) none 14) (want-force-vis (_type_ symbol symbol) int 15) - (execute-command (_type_ pair) none 16) + (execute-command (_type_ pair object) none 16) (execute-commands-up-to (_type_ float) none 17) (backup-load-state-and-set-cmds (_type_ pair) int 18) (restore-load-state-and-cleanup (_type_) int 19) @@ -11884,7 +11885,7 @@ (game-info-method-18 () none 18) (get-current-continue-point (_type_) continue-point 19) (get-continue-by-name (_type_ string) continue-point 20) - (set-continue! (_type_ basic) continue-point 21) + (set-continue! (_type_ basic symbol) continue-point 21) (game-info-method-22 () none 22) (game-info-method-23 () none 23) (game-info-method-24 () none 24) @@ -12055,10 +12056,10 @@ ;; field on-close uses ~A with a signed load (:methods (talker-speech-class-method-9 () none 9) - (talker-speech-class-method-10 () none 10) + (talker-speech-class-method-10 (_type_) none 10) (talker-speech-class-method-11 () none 11) - (talker-speech-class-method-12 () none 12) - (talker-speech-class-method-13 () none 13) + (talker-speech-class-method-12 (_type_ int) none 12) + (talker-speech-class-method-13 (_type_ int) none 13) ) ) @@ -14034,11 +14035,13 @@ ;; script-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(declare-type script-context structure) (deftype script-form (structure) - ((name string :offset-assert 0) - (spec basic :offset-assert 4) - (func basic :offset-assert 8) + ((name symbol :offset-assert 0) + (spec pair :offset-assert 4) ;; a pair of forms/symbols ie. (return macro) + (func (function script-context object) :offset-assert 8) ;; takes atleast 1 arg, probably the script-context WHICH IS ALL ARBITRARY DATA ) + :pack-me :method-count-assert 10 :size-assert #xc :flag-assert #xa0000000c @@ -14048,26 +14051,25 @@ ) (deftype script-context (structure) - ((load-state load-state) - (key basic) - (process process) - (trans vector) - (side-effect? symbol) - (got-error? symbol) - (expr basic) - (param-count int32) - (param object 16) - (param-type object 16) + ((load-state load-state :offset-assert 0) + (key basic :offset-assert 4) + (process process :offset-assert 8) + (trans vector :offset-assert 12) + (side-effect? symbol :offset-assert 16) + (got-error? symbol :offset-assert 20) + (expr pair :offset-assert 24) + (param-count int32 :offset-assert 28) + (param object 16 :offset-assert 32) + (param-type object 16 :offset-assert 96) ) :method-count-assert 12 :size-assert #xa0 :flag-assert #xc000000a0 - ;; Failed to read fields. (:methods (new (symbol type basic process vector) _type_ 0) - (eval! (_type_ structure) pair 9) - (script-context-method-10 () none 10) - (script-context-method-11 () none 11) + (eval! "TODO - Argument can be a [[symbol]] or a [[pair]]" (_type_ object) object 9) + (script-context-method-10 (_type_ object pair) object 10) + (script-context-method-11 (_type_ pair pair symbol) symbol 11) ) ) @@ -18178,6 +18180,7 @@ (complete 8) (bit-9 9) (bit-10 10) + (entity-perm-status-12 12) ) (deftype entity-perm (structure) @@ -18256,7 +18259,7 @@ ;; Failed to read fields. (:methods (entity-method-22 (_type_) _type_ 22) ;; (birth! (_type_) _type_ 22) - (entity-method-23 (_type_) _type_ 23) ;; (kill! (_type_) _type_ 23) + (kill! (_type_ ) _type_ 23) ;; (kill! (_type_) _type_ 23) (entity-method-24 () none 24) ;; (add-to-level! (_type_ level-group level actor-id) none 24) (entity-method-25 () none 25) ;; (remove-from-level! (_type_ level-group) _type_ 25) (entity-method-26 () none 26) ;; (get-level (_type_) level 26) @@ -18308,7 +18311,7 @@ (next-actor (_type_) entity-actor 27) (prev-actor (_type_) entity-actor 28) (entity-actor-method-29 () none 29) ;; (debug-print (_type_ symbol type) none 29) - (entity-actor-method-30 () none 30) ;; (dummy-30 (_type_ entity-perm-status symbol) none 30) + (entity-actor-method-30 (_type_ entity-perm-status symbol) none 30) ;; (dummy-30 (_type_ entity-perm-status symbol) none 30) (entity-actor-method-31 (_type_ vector vector vector object float) nav-mesh 31) (entity-actor-method-32 (_type_ vector vector nav-poly float) nav-poly 32) ) @@ -21469,8 +21472,11 @@ (define-extern sound-set-volume (function sound-group float int)) (define-extern sound-set-reverb (function int float float uint int)) (define-extern sound-set-ear-trans (function vector vector vector float int)) -(define-extern sound-play-by-name (function sound-name sound-id int int int sound-group symbol sound-id)) -(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id)) ;; NOTE - the `vector` can also be #t +(define-extern sound-play-by-name + "Last arg can by a symbol with value [[#t]], in which case it will pull `trans` [[vector]] off the current [[process-drawable]] + otherwise, an explicit [[vector]] can be provided" + (function sound-name sound-id int int int sound-group object sound-id :behavior process-drawable)) +(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id :behavior process-drawable)) (define-extern sound-pause (function sound-id int)) (define-extern sound-stop (function sound-id int)) (define-extern sound-continue (function sound-id int)) @@ -24625,7 +24631,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern *display-load-commands* object) ;; symbol -;; (define-extern *backup-load-state* object) ;; load-state +(define-extern *backup-load-state* load-state) ;; (define-extern *load-state* load-state) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -26042,8 +26048,8 @@ (define-extern talker-surpress! (function none)) ;; (define-extern talker-displayed? function) ;; (define-extern kill-current-talker function) -;; (define-extern string->talker-speech function) -;; (define-extern talker-spawn-func function) +(define-extern string->talker-speech (function string talker-speech-class)) +(define-extern talker-spawn-func (function talker-speech-class process-tree vector basic int)) ;; (define-extern talker-init function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -26058,23 +26064,30 @@ ;; (define-extern region-tree-execute function) (define-extern region-execute (function none)) -;; (define-extern region-prim-lookup-by-id function) -;; (define-extern region-lookup-by-id function) +(define-extern region-prim-lookup-by-id (function int drawable-region-prim)) +(define-extern region-lookup-by-id (function int region)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fma-sphere ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum fma-sphere-mode + :type uint32 + :bitfield #t + (nav 0) + (kill-once 1) + (danger 2) + (deadly-overlap 3)) + (deftype fma-sphere (process-drawable) - ((first-time? basic :offset-assert 196) - (mode uint32 :offset-assert 200) - (track-handle uint64 :offset-assert 204) - (track-joint int32 :offset-assert 212) - (attack-id uint32 :offset-assert 216) - (duration uint64 :offset-assert 220) - (sphere sphere :inline :offset-assert 236) - (danger traffic-danger-info :inline :offset-assert 252) + ((first-time? symbol :offset-assert 200) + (mode fma-sphere-mode :offset-assert 204) + (track-handle handle :offset-assert 208) + (track-joint int32 :offset-assert 216) + (attack-id uint32 :offset-assert 220) + (duration time-frame :offset-assert 224) + (sphere sphere :inline :offset-assert 240) + (danger traffic-danger-info :inline :offset-assert 256) ) :method-count-assert 21 :size-assert #x136 @@ -26083,9 +26096,8 @@ (idle () _type_ :state 20) ) ) -|# -;; (define-extern fma-sphere-init-by-other function) +(define-extern fma-sphere-init-by-other (function fma-sphere-mode process-drawable int time-frame object object fma-sphere)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; script ;; @@ -26093,10 +26105,10 @@ (define-extern command-get-int (function object int int)) (define-extern command-get-float (function object float float)) -(define-extern command-get-time (function object int int)) +(define-extern command-get-time (function object int time-frame)) (define-extern command-get-param (function object object object)) (define-extern command-get-quoted-param (function object object object)) -;; (define-extern command-get-process (function object process process :behavior camera-tracker)) +(define-extern command-get-process (function object symbol process)) (define-extern command-get-entity "- If `search` is a [[process]] - return it's `entity` - If `search` is an [[entity]] - return it @@ -26104,9 +26116,9 @@ - If `search` is [[null?]] or [[empty]] or if no other condition passes, return `fallback`" (function object entity entity)) (define-extern command-get-trans (function object vector vector)) -(define-extern key-assoc (function none)) -(define-extern *script-form* int) -;; (define-extern level-from-heap function) +(define-extern key-assoc "TODO [[vector4w]] is probably wrong!" (function object pair vector4w pair)) +(define-extern *script-form* (inline-array script-form)) +(define-extern level-from-heap (function int level)) (define-extern *syntax-context* script-context) (define-extern *script-context* script-context) @@ -26181,11 +26193,11 @@ ;; (define-extern swingpole-init function) ;; (define-extern manipy-post function) (define-extern manipy-init (function vector entity-actor skeleton-group vector none :behavior manipy)) ;; (function vector entity-actor skeleton-group vector none :behavior manipy) -;; (define-extern part-tracker-init function) ;; (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker) +(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker)) ;; ;; (define-extern part-tracker-track-root function) ;; (function sparticle-system sparticle-cpuinfo vector none) ;; (define-extern part-tracker-move-to-target function) ;; (function part-tracker vector) ;; (define-extern part-tracker-track-target function) ;; (function part-tracker vector) -;; (define-extern lightning-tracker-init function) +(define-extern lightning-tracker-init (function lightning-spec time-frame symbol process-drawable vector vector none)) ;; (define-extern process-grab? function) ;; (function process symbol :behavior camera-tracker) ;; (define-extern process-release? function) ;; (function process symbol :behavior process) ;; (define-extern camera-look-at function) ;; (function pair uint process :behavior camera-tracker) @@ -28105,7 +28117,7 @@ (define-extern process-drawable-from-entity! (function process-drawable entity-actor none)) ;; (define-extern reset-actors (function symbol none)) (define-extern reset-cameras (function none)) -;; (define-extern entity-birth-no-kill function) ;; (function entity none) +(define-extern entity-birth-no-kill (function entity none)) ;; ;; (define-extern entity-task-complete-on function) ;; (function entity none) ;; (define-extern entity-task-complete-off function) ;; (function entity none) (define-extern process-entity-status! (function process entity-perm-status symbol int)) ;; @@ -28499,7 +28511,7 @@ ;; (define-extern *collectable-dummy-shadow-control* shadow-control) ;; (define-extern initialize-ammo-by-other function) ;; (define-extern initialize-upgrade-by-other function) -;; (define-extern birth-pickup-at-point function) ;; (function vector pickup-type float symbol process-tree fact-info (pointer process) :behavior process) +(define-extern birth-pickup-at-point (function vector pickup-type float symbol process-tree fact-info (pointer process) :behavior process)) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; task-control ;; @@ -28586,7 +28598,7 @@ ;; (define-extern task-node-reset function) ;; (define-extern task-node-dump function) ;; (define-extern fail-mission-init-by-other function) -;; (define-extern task-manager-init-by-other function) +(define-extern task-manager-init-by-other (function game-task-node-info object none)) ;; (define-extern task-manager-event-handler function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -28746,7 +28758,7 @@ ;; (define-extern hide-hud function) ;; (function none) ;; (define-extern enable-hud function) ;; (function none) ;; (define-extern hide-hud-quick function) ;; (function none) -;; (define-extern show-hud function) ;; (function none) +(define-extern show-hud (function object none)) ;; ;; (define-extern hud-hidden? function) ;; (function symbol) ;; (define-extern set-hud-piece-position! function) ;; (define-extern set-as-offset-from! function) diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index dbac05e81a..8365b52a5f 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -236,5 +236,94 @@ [24, "(function editable symbol symbol)"], [25, "(function editable symbol symbol)"], [28, "(function editable symbol)"] + ], + "script": [ + [0, "(function script-context none)"], + [1, "(function script-context int)"], + [2, "(function script-context int)"], + [3, "(function script-context int)"], + [4, "(function script-context int :behavior process)"], + [5, "(function script-context int)"], + [6, "(function script-context object)"], + [7, "(function script-context object :behavior process)"], + [8, "(function script-context none :behavior process)"], + [9, "(function script-context none :behavior process)"], + [10, "(function script-context none :behavior process)"], + [11, "(function script-context none :behavior process)"], + [12, "(function script-context symbol)"], + [13, "(function script-context symbol)"], + [14, "(function script-context symbol)"], + [16, "(function script-context object)"], + [17, "(function script-context string)"], + [18, "(function script-context symbol)"], + [19, "(function script-context symbol)"], + [20, "(function script-context symbol)"], + [21, "(function script-context none)"], + [22, "(function script-context none)"], + [23, "(function script-context symbol)"], + [24, "(function script-context none)"], + [25, "(function script-context symbol)"], + [26, "(function script-context none)"], + [27, "(function script-context entity-perm-status)"], + [28, "(function script-context (pointer process))"], + [29, "(function script-context symbol)"], + [30, "(function script-context none)"], + [31, "(function script-context none)"], + [32, "(function script-context none)"], + [33, "(function script-context object)"], + [34, "(function script-context region)"], + [35, "(function script-context drawable-region-prim)"], + [36, "(function script-context symbol :behavior time-of-day-proc)"], + [37, "(function script-context object :behavior time-of-day-proc)"], + [38, "(function script-context none)"], + // TODO - ugly time-frame casts + [39, "(function script-context none)"], + // TODO - ugly time-frame casts + [40, "(function script-context none)"], + [41, "(function script-context sound-id)"], + [42, "(function script-context sound-id)"], + [43, "(function script-context none)"], + [44, "(function script-context object)"], + [45, "(function script-context none)"], + [46, "(function script-context none)"], + [47, "(function script-context none)"], + [48, "(function script-context none)"], + [49, "(function script-context symbol)"], + [50, "(function script-context symbol)"], + [51, "(function script-context none)"], + [52, "(function script-context symbol)"], + [53, "(function script-context symbol)"], + [54, "(function script-context symbol)"], + [55, "(function script-context none)"], + [56, "(function script-context none)"], + [57, "(function script-context none)"], + [58, "(function script-context none)"], + [59, "(function script-context none)"], + [60, "(function script-context none)"], + [61, "(function script-context none)"], + [62, "(function script-context none)"], + [64, "(function script-context object)"], + [65, "(function script-context symbol)"], + [66, "(function script-context symbol)"], + [67, "(function script-context symbol)"], + [68, "(function script-context symbol)"], + [69, "(function script-context symbol)"], + [70, "(function script-context pair)"], + [71, "(function script-context object)"], + [72, "(function script-context pair)"], + [73, "(function script-context pair)"], + [74, "(function script-context pair)"], + [75, "(function script-context pair)"], + [76, "(function script-context pair)"], + [77, "(function script-context symbol)"], + [78, "(function script-context pair)"], + [79, "(function script-context object)"], + [80, "(function script-context pair)"], + [81, "(function script-context int)"], + [82, "(function script-context float)"], + [83, "(function script-context time-frame)"], + [84, "(function script-context meters)"], + [85, "(function script-context object)"], + [15, "(function script-context pair :behavior process)"] // NOTE - an interesting one ] } diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 1409e20c06..28698e26c8 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -38,19 +38,6 @@ "name=", "(method 21 game-info)", "cspace-inspect-tree", - "command-get-process", - "command-get-trans", - "(method 10 script-context)", - "(method 11 script-context)", - "(method 9 script-context)", - "(anon-function 64 script)", - "(anon-function 61 script)", - "(anon-function 60 script)", - "(anon-function 54 script)", - "(anon-function 52 script)", - "(anon-function 49 script)", - "(anon-function 33 script)", - "debug-menu-func-decode", "scene-player-init", "(method 77 spyder)", "(method 77 flamer)", @@ -190,6 +177,21 @@ "command-get-param", "command-get-quoted-param", "command-get-entity", + "(method 9 script-context)", + "(anon-function 6 script)", + "(anon-function 49 script)", + "(anon-function 52 script)", + "(anon-function 72 script)", + "(anon-function 73 script)", + "(anon-function 74 script)", + "(anon-function 75 script)", + "(anon-function 76 script)", + "(anon-function 80 script)", + "(method 11 script-context)", + "(method 10 script-context)", + "command-get-trans", + "key-assoc", + "(anon-function 0 script)", // default-menu "dm-scene-load-pick-func", "debug-menu-make-continue-sub-menu", diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 8e376702a3..4a676571a8 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -93,7 +93,12 @@ ["L1", "(inline-array vector)", 250], ["L2", "(inline-array vector)", 250] ], - "script": [["L2358", "vector4"]], + "script": [ + ["L2358", "vector4"], + ["L787", "attack-info"], + ["L1777", "attack-info"], + ["L1776", "attack-info"] + ], "text": [ ["L96", "vector4"], ["L95", "matrix"], diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 5bf580c982..633f1b8c6d 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -771,6 +771,11 @@ "(method 10 editable-face)": [[16, ["inline-array", "vector", 6]]], "(method 11 editable)": [[16, "collide-query"]], "(method 10 editable-plane)": [[16, "matrix"]], + "(method 9 script-context)": [[16, "script-context"]], + "(anon-function 32 script)": [ + [16, "vector"], + [32, "vector"] + ], // placeholder "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index f10367fe2e..7a56649c21 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -1944,7 +1944,6 @@ [582, "a0", "editable"], [611, "a0", "editable"] ], - "(event idle editable-player)": [ [351, "s4", "editable-light"], [409, "s4", "editable-light"], @@ -2028,9 +2027,7 @@ [156, "a0", "(pointer gs-reg64)"], [[160, 166], "v1", "dma-packet"] ], - "(method 14 texture-pool)": [ - [22, "a3", "(pointer int32)"] - ], + "(method 14 texture-pool)": [[22, "a3", "(pointer int32)"]], "(method 13 texture-page)": [ [[16, 23], "a0", "dma-packet"], [[25, 32], "a0", "gs-gif-tag"], @@ -2079,11 +2076,11 @@ [209, "a0", "(pointer int64)"], [[198, 205], "a0", "gs-gif-tag"] ], - "texture-page-login": [ - [[34, 45], "s2", "texture-page"] + "texture-page-login": [[[34, 45], "s2", "texture-page"]], + "(method 9 texture-page-dir)": [ + [[27, 32], "t3", "adgif-shader"], + [[20, 30], "t2", "(pointer shader-ptr)"] ], - "(method 9 texture-page-dir)": [[[27, 32], "t3", "adgif-shader"], - [[20, 30], "t2", "(pointer shader-ptr)"]], "texture-page-dir-inspect": [[[137, 138], "v1", "adgif-shader"]], "level-remap-texture": [ [15, "t0", "(pointer uint32)"], @@ -2092,8 +2089,11 @@ [12, "v1", "int"], [12, "a3", "int"] ], - "debug-menu-func-decode": [ - [18, "a0", "symbol"] + "debug-menu-func-decode": [[18, "a0", "symbol"]], + "(anon-function 6 script)": [[17, "v1", "pair"]], + "(anon-function 16 script)": [ + [10, "s4", "game-task-node-info"], + [12, "v1", "symbol"] ], "(method 13 mysql-nav-graph)": [[[15, 37], "gp", "mysql-nav-node"]], "(method 14 mysql-nav-graph)": [[[16, 31], "v1", "mysql-nav-edge"]], @@ -2126,6 +2126,59 @@ [[39, 59], "a1", "mysql-nav-edge"], [[48, 58], "a2", "mysql-nav-node"] ], + "(anon-function 24 script)": [[14, "s5", "entity-actor"]], + "(anon-function 31 script)": [ + [25, "s3", "process-drawable"], + [59, "v0", "joint"], + [14, "s5", "(function process vector cspace)"] + ], + "(method 9 script-context)": [[81, "s5", "symbol"]], + "(anon-function 33 script)": [ + // TODO - cast had to be added even though `object` is in type_utils.cpp + [14, "a0", "symbol"], + [34, "gp", "process-drawable"], + [95, "s3", "drawable-region-prim"], + [150, "v0", "joint"] + ], + "(anon-function 36 script)": [[15, "v0", "int"]], + "(anon-function 49 script)": [[10, "gp", "pair"]], + "(anon-function 52 script)": [ + [14, "s5", "pair"], + [11, "s4", "process-focusable"] + ], + "(anon-function 64 script)": [[21, "v1", "bfloat"]], + "(anon-function 69 script)": [[3, "t9", "(function script-context symbol)"]], + "(anon-function 72 script)": [[3, "s4", "pair"]], + "(anon-function 73 script)": [[5, "s5", "pair"]], + "(anon-function 74 script)": [[5, "s5", "pair"]], + "(anon-function 75 script)": [[3, "s5", "pair"]], + "(anon-function 76 script)": [[3, "s5", "pair"]], + "(anon-function 80 script)": [[3, "s5", "pair"]], + "(method 10 script-context)": [[22, "s3", "symbol"]], + "command-get-trans": [ + [36, "v0", "process-drawable"], + [58, "s3", "process-drawable"], + [76, "v0", "joint"] + ], + "(anon-function 0 script)": [ + [30, "s5", "pair"], + [16, "s5", "process-drawable"], + [90, "v0", "joint"] + ], + "(anon-function 32 script)": [ + // TODO - cast had to be added even though `object` is in type_utils.cpp + [13, "a0", "symbol"], + [43, "s5", "process-drawable"], + [32, "s5", "process-drawable"], + [105, "v0", "joint"], + [145, "v0", "joint"] + ], + "command-get-process": [[37, "gp", "entity-actor"]], + "command-get-float": [[20, "gp", "bfloat"]], + "command-get-int": [[17, "gp", "bfloat"]], + "(anon-function 54 script)": [[66, "v1", "entity-actor"]], + "(anon-function 53 script)": [[40, "v1", "entity-actor"]], + "(anon-function 71 script)": [[4, "v1", "symbol"]], // placeholder "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index aa885f5147..b43bc344a8 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -752,200 +752,200 @@ "dma-buffer-add-ref-texture": { "args": ["dma-buf", "tex-data-ptr", "width", "height", "tex-fmt"], "vars": { - "s5-0":"padr", - "v1-0":"qwc-remaining", - "a0-4":"qwc-transfer", - "a1-3":"eop" + "s5-0": "padr", + "v1-0": "qwc-remaining", + "a0-4": "qwc-transfer", + "a1-3": "eop" } }, "gs-find-block": { - "args" : ["bx", "by", "fmt"] + "args": ["bx", "by", "fmt"] }, "(method 18 texture-pool)": { - "args":["obj", "tpage-id"] + "args": ["obj", "tpage-id"] }, "(method 10 texture-page)": { - "args":["obj", "num-segments", "upload-offset"], - "vars": {"v1-0":"offset", "a2-1":"i"} + "args": ["obj", "num-segments", "upload-offset"], + "vars": { "v1-0": "offset", "a2-1": "i" } }, "(method 16 texture-pool)": { - "args":["obj", "seg", "num-words"] + "args": ["obj", "seg", "num-words"] }, "(method 9 texture-page)": { - "args":["obj", "heap"] + "args": ["obj", "heap"] }, - "texture-page-default-allocate" : { - "args":["pool", "tpage", "heap", "tpage-id"], + "texture-page-default-allocate": { + "args": ["pool", "tpage", "heap", "tpage-id"], "vars": { - "s3-0":"seg", - "a1-2":"vram-loc", - "v1-12":"tex-idx", - "a0-7":"tex", - "a1-6":"mask-idx", - "a2-2":"mask-word" + "s3-0": "seg", + "a1-2": "vram-loc", + "v1-12": "tex-idx", + "a0-7": "tex", + "a1-6": "mask-idx", + "a2-2": "mask-word" } }, "texture-page-common-allocate": { - "args":["pool", "tpage", "heap", "tpage-id"], + "args": ["pool", "tpage", "heap", "tpage-id"], "vars": { - "s5-0":"vram-loc", - "s4-0":"seg" + "s5-0": "vram-loc", + "s4-0": "seg" } }, "texture-page-font-allocate": { - "args":["pool", "tpage", "heap", "tpage-id"], + "args": ["pool", "tpage", "heap", "tpage-id"], "vars": { - "v1-4":"tex-idx", - "a0-5":"tex", - "a1-5":"mask-idx", - "a2-2":"mask-word" + "v1-4": "tex-idx", + "a0-5": "tex", + "a1-5": "mask-idx", + "a2-2": "mask-word" } }, "(method 22 texture-pool)": { "vars": { - "s5-0":"vram-loc", - "gp-0":"level-idx", - "v1-3":"lev", - "s4-0":"tpage", - "s3-0":"seg" + "s5-0": "vram-loc", + "gp-0": "level-idx", + "v1-3": "lev", + "s4-0": "tpage", + "s3-0": "seg" } }, "(method 23 texture-pool)": { "vars": { - "s5-0":"vram-loc", - "gp-0":"level-idx", - "v1-3":"lev", - "s4-0":"tpage", - "s3-0":"seg" + "s5-0": "vram-loc", + "gp-0": "level-idx", + "v1-3": "lev", + "s4-0": "tpage", + "s3-0": "seg" } }, "(method 24 texture-pool)": { "vars": { - "gp-0":"vram-loc", - "s5-0":"level-idx", - "v1-3":"lev", - "s4-0":"tpage", - "s3-0":"old-dest-base", - "s2-0":"new-dest-base", - "v1-15":"new-tbp", - "a0-11":"texture-idx", - "a1-12":"adgif-iter" + "gp-0": "vram-loc", + "s5-0": "level-idx", + "v1-3": "lev", + "s4-0": "tpage", + "s3-0": "old-dest-base", + "s2-0": "new-dest-base", + "v1-15": "new-tbp", + "a0-11": "texture-idx", + "a1-12": "adgif-iter" } }, "texture-page-common-boot-allocate": { - "args":["pool", "tpage", "heap", "tpage-id"], + "args": ["pool", "tpage", "heap", "tpage-id"], "vars": { - "s2-0":"common-page-slot-id" + "s2-0": "common-page-slot-id" } }, "upload-vram-data": { "args": ["buf", "dest", "data", "height", "width"], "vars": { - "a3-2":"height-this-time" + "a3-2": "height-this-time" } }, "upload-vram-pages": { - "args":["pool", "dest-seg", "tpage", "mode", "bucket"], + "args": ["pool", "dest-seg", "tpage", "mode", "bucket"], "vars": { - "gp-0":"num-chunks", - "s3-0":"dma-buf", - "sv-16":"data-ptr", - "sv-20":"vram-ptr", - "sv-24":"tpage-num-chunks", - "sv-32":"chunks-pending", - "sv-40":"first-chunk", - "sv-48":"tpage-id" + "gp-0": "num-chunks", + "s3-0": "dma-buf", + "sv-16": "data-ptr", + "sv-20": "vram-ptr", + "sv-24": "tpage-num-chunks", + "sv-32": "chunks-pending", + "sv-40": "first-chunk", + "sv-48": "tpage-id" } }, "update-vram-pages": { - "args":["pool", "dest-seg", "tpage", "mode", "bucket"], + "args": ["pool", "dest-seg", "tpage", "mode", "bucket"], "vars": { - "t1-0":"vram-ptr", - "t2-0":"tpage-num-chunks", - "v1-2":"chunks-pending", - "t0-1":"tpage-id", - "a1-4":"adjusted-num-chunks", - "a2-3":"chunk-idx", - "a3-8":"chunk-ptr" + "t1-0": "vram-ptr", + "t2-0": "tpage-num-chunks", + "v1-2": "chunks-pending", + "t0-1": "tpage-id", + "a1-4": "adjusted-num-chunks", + "a2-3": "chunk-idx", + "a3-8": "chunk-ptr" } }, "upload-vram-pages-pris": { "args": ["pool", "dest-seg", "tpage", "bucket"], "vars": { - "gp-0":"total-chunks-uploaded", - "s3-0":"dma-buf", - "sv-16":"data-ptr", - "sv-20":"vram-ptr", - "sv-24":"tpage-num-chunks", - "sv-32":"chunks-pending", - "sv-40":"first-chunk", - "sv-48":"tpage-id", - "s0-0":"chunk-idx", - "v1-17":"chunk-dest", - "a1-1":"mask-work", - "sv-52":"should-upload" + "gp-0": "total-chunks-uploaded", + "s3-0": "dma-buf", + "sv-16": "data-ptr", + "sv-20": "vram-ptr", + "sv-24": "tpage-num-chunks", + "sv-32": "chunks-pending", + "sv-40": "first-chunk", + "sv-48": "tpage-id", + "s0-0": "chunk-idx", + "v1-17": "chunk-dest", + "a1-1": "mask-work", + "sv-52": "should-upload" } }, "texture-page-level-allocate": { - "args":["pool", "tpage", "heap", "tpage-id"], - "vars": {"s2-0": "common-page-slot-id"} + "args": ["pool", "tpage", "heap", "tpage-id"], + "vars": { "s2-0": "common-page-slot-id" } }, "texture-page-size-check": { - "args":["pool", "lev", "silent"] + "args": ["pool", "lev", "silent"] }, "(method 13 texture-pool)": { - "args":["pool", "lev", "num-tpage-ids", "tpage-ids"], + "args": ["pool", "lev", "num-tpage-ids", "tpage-ids"], "vars": { - "s2-0":"lev-tex-ids", - "a0-3":"tpage-id", - "s1-0":"loaded-tpage-idx", - "v1-9":"logged-in-tpage-id" + "s2-0": "lev-tex-ids", + "a0-3": "tpage-id", + "s1-0": "loaded-tpage-idx", + "v1-9": "logged-in-tpage-id" } }, "(method 14 texture-pool)": { - "args":["pool", "lev", "cat", "bucket"], + "args": ["pool", "lev", "cat", "bucket"], "vars": { "a2-1": "tpage" } }, "upload-textures": { "vars": { - "v1-6":"lev-idx", - "a0-7":"lev", - "s5-0":"num-tpage", - "v1-11":"tpage-info", - "a1-9":"src-level" + "v1-6": "lev-idx", + "a0-7": "lev", + "s5-0": "num-tpage", + "v1-11": "tpage-info", + "a1-9": "src-level" } }, "texture-relocate": { "args": ["dma-buff", "tex", "dest-loc", "dest-fmt", "clut-dst"] }, "(method 11 texture-page)": { - "args":["obj", "new-dest", "segs"], + "args": ["obj", "new-dest", "segs"], "vars": { - "v1-0":"new-tbp", - "a3-4":"old-tbp", - "t0-1":"tex-idx", - "t1-6":"tex", - "t2-0":"num-mips", - "t3-4":"mip-idx" + "v1-0": "new-tbp", + "a3-4": "old-tbp", + "t0-1": "tex-idx", + "t1-6": "tex", + "t2-0": "num-mips", + "t3-4": "mip-idx" } }, "(method 7 texture-page)": { - "args":["obj", "loading-heap", "name"], + "args": ["obj", "loading-heap", "name"], "vars": { - "v1-2":"loading-level", - "a3-0":"tpage-id", - "s4-0":"dir-entry" + "v1-2": "loading-level", + "a3-0": "tpage-id", + "s4-0": "dir-entry" } }, "texture-page-login": { - "args":["tex-id", "alloc-func", "heap"], + "args": ["tex-id", "alloc-func", "heap"], "vars": { - "s5-0":"dir-entry", - "s4-0":"old-alloc-func", - "s3-0":"name", - "s2-0":"loaded-tpage" + "s5-0": "dir-entry", + "s4-0": "old-alloc-func", + "s3-0": "name", + "s2-0": "loaded-tpage" } }, "(method 9 texture-page-dir)": { diff --git a/decompiler/util/type_utils.cpp b/decompiler/util/type_utils.cpp index 522d924aa2..916c7d9722 100644 --- a/decompiler/util/type_utils.cpp +++ b/decompiler/util/type_utils.cpp @@ -3,6 +3,6 @@ namespace decompiler { bool allowable_base_type_for_symbol_to_string(const TypeSpec& ts) { auto& bt = ts.base_type(); - return bt == "symbol" || bt == "basic" || bt == "structure"; + return bt == "symbol" || bt == "basic" || bt == "structure" || bt == "object"; } -} // namespace decompiler \ No newline at end of file +} // namespace decompiler diff --git a/goal_src/jak2/engine/ambient/ambient-h.gc b/goal_src/jak2/engine/ambient/ambient-h.gc index d4f2c9123f..abff5adc5e 100644 --- a/goal_src/jak2/engine/ambient/ambient-h.gc +++ b/goal_src/jak2/engine/ambient/ambient-h.gc @@ -25,13 +25,14 @@ :flag-assert #xe00000018 (:methods (talker-speech-class-method-9 () none 9) - (talker-speech-class-method-10 () none 10) + (talker-speech-class-method-10 (_type_) none 10) (talker-speech-class-method-11 () none 11) - (talker-speech-class-method-12 () none 12) - (talker-speech-class-method-13 () none 13) + (talker-speech-class-method-12 (_type_ int) none 12) + (talker-speech-class-method-13 (_type_ int) none 13) ) ) + (deftype talker (process) ((trans vector :inline :offset-assert 128) (message talker-speech-class :offset-assert 144) diff --git a/goal_src/jak2/engine/debug/default-menu.gc b/goal_src/jak2/engine/debug/default-menu.gc index 512fb253a8..25eeb1451b 100644 --- a/goal_src/jak2/engine/debug/default-menu.gc +++ b/goal_src/jak2/engine/debug/default-menu.gc @@ -5997,9 +5997,10 @@ arg0 ) -(debug-menu-context-make-default-menus *debug-menu-context*) - -(popup-menu-context-make-default-menus *popup-menu-context*) +;; NOTE - disabled for now to prevent a crash at startup +;; The debug menu stuff accesses a lot of stuff that is currently undefined, which will crash the game +;; (debug-menu-context-make-default-menus *debug-menu-context*) +;; (popup-menu-context-make-default-menus *popup-menu-context*) (defun menu-respond-to-pause () (case *master-mode* diff --git a/goal_src/jak2/engine/debug/editable-player.gc b/goal_src/jak2/engine/debug/editable-player.gc index 64cb1c7907..8281e04c56 100644 --- a/goal_src/jak2/engine/debug/editable-player.gc +++ b/goal_src/jak2/engine/debug/editable-player.gc @@ -15,2579 +15,3 @@ ;; DECOMP BEGINS -(format 0 "SKIP: editable-player setup~%") -(format #t "SKIP: editable-player setup~%") -#| -;; this file is debug only -(declare-file (debug)) -(when *debug-segment* -;; WARN: Return type mismatch int vs none. -(defun cleanup-selection ((arg0 editable-array)) - (let* ((v1-0 (-> arg0 length)) - (a0-1 0) - (a1-2 (-> arg0 data a0-1)) - ) - (while (< a0-1 v1-0) - (if a1-2 - (logclear! (-> a1-2 flags) (editable-flag mark)) - ) - (+! a0-1 1) - (set! a1-2 (-> arg0 data a0-1)) - ) - ) - (let* ((s5-0 (-> arg0 length)) - (s4-0 0) - (a0-2 (-> arg0 data s4-0)) - ) - (while (< s4-0 s5-0) - (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) - (editable-method-29 a0-2 (editable-filter)) - ) - (+! s4-0 1) - (set! a0-2 (-> arg0 data s4-0)) - ) - ) - 0 - (none) - ) - -;; WARN: Return type mismatch int vs none. -;; WARN: Function insert-box has a return type of none, but the expression builder found a return statement. - -(defun execute-select ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) - (case arg1 - (((editable-command select-none)) - (let* ((s5-1 (-> arg0 length)) - (s4-0 0) - (a0-2 (-> arg0 data s4-0)) - ) - (while (< s4-0 s5-1) - (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) - (select-editable! a0-2 #f) - ) - (+! s4-0 1) - (set! a0-2 (-> arg0 data s4-0)) - ) - ) - (if (not (-> arg0 region-lock?)) - (set! (-> arg0 region) #f) - ) - ) - (((editable-command select-all)) - (let* ((s5-2 (-> arg0 length)) - (s4-1 0) - (a0-4 (-> arg0 data s4-1)) - ) - (while (< s4-1 s5-2) - (if (and a0-4 (or (and (logtest? (-> a0-4 region filter) (-> arg0 filter 0)) - (logtest? (-> a0-4 region filter) (-> arg0 filter 1)) - ) - (logtest? (-> a0-4 flags) (editable-flag selected)) - ) - ) - (select-editable! a0-4 #t) - ) - (+! s4-1 1) - (set! a0-4 (-> arg0 data s4-1)) - ) - ) - ) - (((editable-command select-one)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a0-7 arg0) - (t9-4 (method-of-object a0-7 editable-array-method-10)) - (a1-12 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-12 x) (-> arg2 edit-plane-normal x)) - (set! (-> a1-12 y) (-> arg2 edit-plane-normal y)) - (set! (-> a1-12 z) 0.0) - (set! (-> a1-12 w) 1.0) - (let ((s4-3 (t9-4 a0-7 a1-12 0))) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (when s4-3 - (select-editable! s4-3 #t) - (if (not (-> arg0 region-lock?)) - (set! (-> arg0 region) (-> s4-3 region)) - ) - ) - ) - ) - ) - (((editable-command select-toggle)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a0-12 arg0) - (t9-9 (method-of-object a0-12 editable-array-method-10)) - (a1-16 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-16 x) (-> arg2 edit-plane-normal x)) - (set! (-> a1-16 y) (-> arg2 edit-plane-normal y)) - (set! (-> a1-16 z) 0.0) - (set! (-> a1-16 w) 1.0) - (let ((s5-3 (t9-9 a0-12 a1-16 1))) - (when s5-3 - (select-editable! s5-3 'toggle) - (if (and (logtest? (-> s5-3 flags) (editable-flag selected)) (not (-> arg0 region-lock?))) - (set! (-> arg0 region) (-> s5-3 region)) - ) - ) - ) - ) - ) - (((editable-command select-region)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a0-16 arg0) - (t9-13 (method-of-object a0-16 editable-array-method-10)) - (a1-19 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-19 x) (-> arg2 edit-plane-normal x)) - (set! (-> a1-19 y) (-> arg2 edit-plane-normal y)) - (set! (-> a1-19 z) 0.0) - (set! (-> a1-19 w) 1.0) - (let ((s4-6 (t9-13 a0-16 a1-19 0))) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (when s4-6 - (select-editable! s4-6 #t) - (set! (-> arg0 backup-region) (-> arg0 region)) - (set! (-> arg0 region) (-> s4-6 region)) - (editable-array-method-9 arg0 (editable-command select-current-region) arg2) - (if (-> arg0 region-lock?) - (set! (-> arg0 region) (-> arg0 backup-region)) - ) - ) - ) - ) - ) - (((editable-command select-face)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a0-22 arg0) - (t9-19 (method-of-object a0-22 editable-array-method-10)) - (a1-24 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-24 x) (-> arg2 edit-plane-normal x)) - (set! (-> a1-24 y) (-> arg2 edit-plane-normal y)) - (set! (-> a1-24 z) 0.0) - (set! (-> a1-24 w) 1.0) - (let ((s4-8 (t9-19 a0-22 a1-24 0))) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (when s4-8 - (select-editable! s4-8 #t) - (set! (-> arg0 backup-region) (-> arg0 region)) - (set! (-> arg0 region) (-> s4-8 region)) - (editable-array-method-9 arg0 (editable-command select-current-face) arg2) - (if (-> arg0 region-lock?) - (set! (-> arg0 region) (-> arg0 backup-region)) - ) - ) - ) - ) - ) - (((editable-command select-prim)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a0-28 arg0) - (t9-25 (method-of-object a0-28 editable-array-method-10)) - (a1-29 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-29 x) (-> arg2 edit-plane-normal x)) - (set! (-> a1-29 y) (-> arg2 edit-plane-normal y)) - (set! (-> a1-29 z) 0.0) - (set! (-> a1-29 w) 1.0) - (let ((s4-10 (t9-25 a0-28 a1-29 0))) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (when s4-10 - (select-editable! s4-10 #t) - (set! (-> arg0 backup-region) (-> arg0 region)) - (set! (-> arg0 region) (-> s4-10 region)) - (editable-array-method-9 arg0 (editable-command select-current-prim) arg2) - (if (-> arg0 region-lock?) - (set! (-> arg0 region) (-> arg0 backup-region)) - ) - ) - ) - ) - ) - (((editable-command select-current-region)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (when (-> arg0 region) - (let ((s4-12 (-> arg0 region))) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (set! (-> arg0 region) s4-12) - ) - (let* ((s5-4 (-> arg0 length)) - (s4-13 0) - (a0-35 (-> arg0 data s4-13)) - ) - (while (< s4-13 s5-4) - (when (and a0-35 (or (and (logtest? (-> a0-35 region filter) (-> arg0 filter 0)) - (logtest? (-> a0-35 region filter) (-> arg0 filter 1)) - ) - (logtest? (-> a0-35 flags) (editable-flag selected)) - ) - ) - (if (= (-> arg0 region) (-> a0-35 region)) - (select-editable! a0-35 #t) - ) - ) - (+! s4-13 1) - (set! a0-35 (-> arg0 data s4-13)) - ) - ) - ) - ) - (((editable-command select-current-owner)) - (let* ((s5-5 (-> arg0 length)) - (s4-14 0) - (v1-121 (-> arg0 data s4-14)) - ) - (while (< s4-14 s5-5) - (when (and v1-121 (logtest? (-> v1-121 flags) (editable-flag selected))) - (let* ((s3-6 (-> v1-121 owner)) (a0-40 (car s3-6))) (while (not (null? s3-6)) - (select-editable! (the-as editable a0-40) #t) - (set! s3-6 (cdr s3-6)) - (set! a0-40 (car s3-6)) - ) - ) - ) - (+! s4-14 1) - (set! v1-121 (-> arg0 data s4-14)) - ) - ) - ) - (((editable-command select-current-face)) - (let* ((s5-6 (-> arg0 length)) - (s4-15 0) - (v1-134 (-> arg0 data s4-15)) - ) - (while (< s4-15 s5-6) - (when (and v1-134 (logtest? (-> v1-134 flags) (editable-flag selected))) - (let* ((s3-7 (-> v1-134 owner)) (a0-45 (car s3-7))) (while (not (null? s3-7)) - (select-editable! (the-as editable a0-45) #t) - (set! s3-7 (cdr s3-7)) - (set! a0-45 (car s3-7)) - ) - ) - ) - (+! s4-15 1) - (set! v1-134 (-> arg0 data s4-15)) - ) - ) - (let* ((s5-7 (-> arg0 length)) - (s4-16 0) - (s3-8 (-> arg0 data s4-16)) - ) - (while (< s4-16 s5-7) - (when (and s3-8 - (or (and (logtest? (-> s3-8 region filter) (-> arg0 filter 0)) - (logtest? (-> s3-8 region filter) (-> arg0 filter 1)) - ) - (logtest? (-> s3-8 flags) (editable-flag selected)) - ) - ) - (let* ((s2-0 (-> s3-8 owner)) - (v1-155 (car s2-0)) - ) - (while (not (null? s2-0)) - (if (logtest? (-> (the-as editable v1-155) flags) (editable-flag selected)) - (select-editable! s3-8 #t) - ) - (set! s2-0 (cdr s2-0)) - (set! v1-155 (car s2-0)) - ) - ) - ) - (+! s4-16 1) - (set! s3-8 (-> arg0 data s4-16)) - ) - ) - ) - (((editable-command select-current-prim)) - (countdown (s5-8 10) - (let* ((s4-17 (-> arg0 length)) - (s3-9 0) - (v1-169 (-> arg0 data s3-9)) - ) - (while (< s3-9 s4-17) - (when (and v1-169 (logtest? (-> v1-169 flags) (editable-flag selected))) - (let* ((s2-1 (-> v1-169 owner)) (a0-58 (car s2-1))) (while (not (null? s2-1)) - (select-editable! (the-as editable a0-58) #t) - (set! s2-1 (cdr s2-1)) - (set! a0-58 (car s2-1)) - ) - ) - ) - (+! s3-9 1) - (set! v1-169 (-> arg0 data s3-9)) - ) - ) - (let* ((s4-18 (-> arg0 length)) - (s3-10 0) - (s2-2 (-> arg0 data s3-10)) - ) - (while (< s3-10 s4-18) - (when (and s2-2 - (or (and (logtest? (-> s2-2 region filter) (-> arg0 filter 0)) - (logtest? (-> s2-2 region filter) (-> arg0 filter 1)) - ) - (logtest? (-> s2-2 flags) (editable-flag selected)) - ) - ) - (let* ((s1-0 (-> s2-2 owner)) - (v1-190 (car s1-0)) - ) - (while (not (null? s1-0)) - (if (logtest? (-> (the-as editable v1-190) flags) (editable-flag selected)) - (select-editable! s2-2 #t) - ) - (set! s1-0 (cdr s1-0)) - (set! v1-190 (car s1-0)) - ) - ) - ) - (+! s3-10 1) - (set! s2-2 (-> arg0 data s3-10)) - ) - ) - ) - ) - (((editable-command cancel)) - (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) - ) - (((editable-command pick-target)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a0-71 arg0) - (t9-41 (method-of-object a0-71 editable-array-method-10)) - (a1-58 (new 'stack-no-clear 'vector)) - ) - (set! (-> a1-58 x) (-> arg2 edit-plane-normal x)) - (set! (-> a1-58 y) (-> arg2 edit-plane-normal y)) - (set! (-> a1-58 z) 0.0) - (set! (-> a1-58 w) 1.0) - (let ((v1-208 (t9-41 a0-71 a1-58 0))) - (when v1-208 - (set! (-> arg0 target) v1-208) - (editable-array-method-9 arg0 (the-as editable-command (-> arg0 target-command)) arg2) - ) - ) - ) - (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) - ) - (((editable-command pick-loc) (editable-command pick-yes-no)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (editable-array-method-9 arg0 (the-as editable-command (-> arg0 target-command)) arg2) - (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) - ) - (((editable-command edit-plane-clear)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (set! (-> arg0 edit-plane) #f) - (editable-array-method-16 arg0) - ) - (((editable-command edit-plane-set)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (cond - ((-> arg0 target) - (let ((s5-11 (-> arg0 target))) - (set! (-> arg0 edit-plane) (the-as editable-plane (if (type? s5-11 editable-plane) - s5-11 - ) - ) - ) - ) - (editable-array-method-16 arg0) - ) - (else - (editable-array-method-14 - arg0 - (the-as (function symbol) (lambda ((arg0 editable)) (type? arg0 editable-plane))) - #f - ) - (cond - ((>= (-> arg0 selection length) 1) - (set! (-> arg0 edit-plane) (the-as editable-plane (-> arg0 selection 0))) - (editable-array-method-16 arg0) - ) - (else - (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 45) "pick the plane to edit-from") - ) - ) - ) - ) - ) - (((editable-command print-region-info)) - (let ((s5-12 (-> arg0 region))) - (when s5-12 - (format #t "~%~%region-~D~%~%" (-> s5-12 id)) - (let ((a2-35 (-> s5-12 on-enter))) - (if a2-35 - (format #t "(on-enter ~S)~%" a2-35) - ) - ) - (let ((a2-36 (-> s5-12 on-inside))) - (if a2-36 - (format #t "(on-inside ~S)~%" a2-36) - ) - ) - (let ((a2-37 (-> s5-12 on-exit))) - (if a2-37 - (format #t "(on-exit ~S)~%" a2-37) - ) - ) - (format #t "~%~%") - ) - ) - (format #t "~%selected:~%") - (let* ((s5-13 (-> arg0 length)) - (s4-23 0) - (a2-38 (-> arg0 data s4-23)) - ) - (while (< s4-23 s5-13) - (if (and a2-38 (logtest? (-> a2-38 flags) (editable-flag selected))) - (format #t "~A~%" a2-38) - ) - (+! s4-23 1) - (set! a2-38 (-> arg0 data s4-23)) - ) - ) - (format #t "~%~%") - ) - (else - (return #f) - ) - ) - #t - ) - -(defun execute-mouse-move ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) - (local-vars (f0-6 float) (f0-18 float) (f0-29 float)) - (case arg1 - (((editable-command camera-tumble)) - (set-setting! 'mouse-input 'abs #t 0) - (let ((s5-0 (new-stack-vector0)) - (f30-0 0.0) - ) - (let* ((s4-0 (-> arg0 length)) - (s3-0 0) - (a0-3 (-> arg0 data s3-0)) - ) - (while (< s3-0 s4-0) - (when (and a0-3 (logtest? (-> a0-3 flags) (editable-flag selected))) - (vector+! s5-0 s5-0 (edit-get-trans a0-3)) - (set! f30-0 (+ 1.0 f30-0)) - ) - (+! s3-0 1) - (set! a0-3 (-> arg0 data s3-0)) - ) - ) - (cond - ((= f30-0 0.0) - (remove-setting! 'mouse-tumble-point) - ) - (else - (vector-float/! s5-0 s5-0 f30-0) - (set-setting! 'mouse-tumble-point 'abs s5-0 0) - ) - ) - ) - ) - (((editable-command camera-xy)) - (set-setting! 'mouse-input 'abs #t 0) - ) - (((editable-command camera-xz)) - (set-setting! 'mouse-input 'abs #t 0) - ) - (((editable-command drag-move-x)) - (let ((v1-25 (-> arg2 level-offset)) - (a0-12 (-> arg2 edit-plane-normal)) - (s5-1 (new-stack-vector0)) - (s4-1 (-> *math-camera* trans)) - ) - 0.0 - (let* ((f0-4 (- (-> v1-25 x) (-> a0-12 x))) - (f1-2 (- (-> v1-25 y) (-> a0-12 y))) - (f30-1 (if (< (fabs f1-2) (fabs f0-4)) - f0-4 - f1-2 - ) - ) - ) - (if (< (-> *math-camera* camera-rot vector 0 x) 0.0) - (set! f30-1 (- f30-1)) - ) - (let* ((s3-1 (-> arg0 length)) - (s2-1 0) - (s1-2 (-> arg0 data s2-1)) - ) - (while (< s2-1 s3-1) - (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) - (set! f0-6 (cond - ((-> arg0 move-lock?) - (-> arg0 move-speed) - ) - (else - (vector-! s5-1 (edit-get-trans s1-2) s4-1) - (let ((f0-9 (* 0.00390625 f30-1 (vector-length s5-1)))) - (set! f0-6 (fmax -40960.0 (fmin 40960.0 f0-9))) - ) - (set! (-> arg0 move-speed) f0-6) - (set! (-> arg0 move-lock?) #t) - f0-6 - ) - ) - ) - (set-vector! s5-1 f0-6 0.0 0.0 0.0) - (editable-method-15 s1-2 s5-1 56) - ) - (+! s2-1 1) - (set! s1-2 (-> arg0 data s2-1)) - ) - ) - ) - ) - (cleanup-selection arg0) - ) - (((editable-command drag-move-y)) - (let ((v1-54 (-> arg2 level-offset)) - (a0-20 (-> arg2 edit-plane-normal)) - (s5-2 (new-stack-vector0)) - (s4-2 (-> *math-camera* trans)) - ) - 0.0 - (let* ((f0-16 (- (-> v1-54 x) (-> a0-20 x))) - (f1-8 (- (-> v1-54 y) (-> a0-20 y))) - (f30-2 (if (< (fabs f1-8) (fabs f0-16)) - f0-16 - f1-8 - ) - ) - ) - (if (< (-> *math-camera* camera-rot vector 1 y) 0.0) - (set! f30-2 (- f30-2)) - ) - (let* ((s3-2 (-> arg0 length)) - (s2-2 0) - (s1-3 (-> arg0 data s2-2)) - ) - (while (< s2-2 s3-2) - (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) - (set! f0-18 (cond - ((-> arg0 move-lock?) - (-> arg0 move-speed) - ) - (else - (vector-! s5-2 (edit-get-trans s1-3) s4-2) - (let ((f0-21 (* 0.00390625 f30-2 (vector-length s5-2)))) - (set! f0-18 (fmax -40960.0 (fmin 40960.0 f0-21))) - ) - (set! (-> arg0 move-speed) f0-18) - (set! (-> arg0 move-lock?) #t) - f0-18 - ) - ) - ) - (set-vector! s5-2 0.0 f0-18 0.0 0.0) - (editable-method-15 s1-3 s5-2 56) - ) - (+! s2-2 1) - (set! s1-3 (-> arg0 data s2-2)) - ) - ) - ) - ) - (cleanup-selection arg0) - ) - (((editable-command drag-move-z)) - (let ((v1-83 (-> arg2 level-offset)) - (a0-28 (-> arg2 edit-plane-normal)) - (s5-3 (new-stack-vector0)) - (s4-3 (-> *math-camera* trans)) - ) - 0.0 - (let* ((f0-27 (- (-> v1-83 x) (-> a0-28 x))) - (f1-15 (- (-> v1-83 y) (-> a0-28 y))) - (f30-3 (if (< (fabs f1-15) (fabs f0-27)) - f0-27 - f1-15 - ) - ) - ) - (if (>= (-> *math-camera* camera-rot vector 0 z) 0.0) - (set! f30-3 (- f30-3)) - ) - (let* ((s3-3 (-> arg0 length)) - (s2-3 0) - (s1-4 (-> arg0 data s2-3)) - ) - (while (< s2-3 s3-3) - (when (and s1-4 (logtest? (-> s1-4 flags) (editable-flag selected))) - (set! f0-29 (cond - ((-> arg0 move-lock?) - (-> arg0 move-speed) - ) - (else - (vector-! s5-3 (edit-get-trans s1-4) s4-3) - (let ((f0-32 (* 0.00390625 f30-3 (vector-length s5-3)))) - (set! (-> arg0 move-speed) f0-32) - (set! f0-29 (fmax -40960.0 (fmin 40960.0 f0-32))) - ) - (set! (-> arg0 move-lock?) #t) - f0-29 - ) - ) - ) - (set-vector! s5-3 0.0 0.0 f0-29 0.0) - (editable-method-15 s1-4 s5-3 56) - ) - (+! s2-3 1) - (set! s1-4 (-> arg0 data s2-3)) - ) - ) - ) - ) - (cleanup-selection arg0) - ) - (((editable-command drag-move-xz)) - (let ((s5-4 (-> arg2 level-offset)) - (s4-4 (-> arg2 edit-plane-normal)) - (s3-4 (new 'stack-no-clear 'vector)) - ) - (set! (-> s3-4 x) 0.0) - (set! (-> s3-4 y) 1.0) - (set! (-> s3-4 z) 0.0) - (set! (-> s3-4 w) 1.0) - (let* ((s2-4 (new-stack-vector0)) - (s1-5 (-> arg0 length)) - (s0-6 0) - (a0-36 (-> arg0 data s0-6)) - ) - (while (< s0-6 s1-5) - (when (and a0-36 (logtest? (-> a0-36 flags) (editable-flag selected))) - (if (= (-> s2-4 w) 0.0) - (editable-method-20 a0-36 s5-4 s4-4 s3-4 s2-4) - (editable-method-15 a0-36 s2-4 56) - ) - ) - (+! s0-6 1) - (set! a0-36 (-> arg0 data s0-6)) - ) - ) - ) - (cleanup-selection arg0) - ) - (((editable-command drag-move-xy)) - (let ((s5-5 (-> arg2 level-offset)) - (s4-5 (-> arg2 edit-plane-normal)) - (s3-5 (-> *math-camera* inv-camera-rot vector 2)) - (s2-5 (new-stack-vector0)) - ) - (set! (-> s3-5 y) 0.0) - (vector-normalize! s3-5 1.0) - (let* ((s1-6 (-> arg0 length)) - (s0-7 0) - (a0-40 (-> arg0 data s0-7)) - ) - (while (< s0-7 s1-6) - (when (and a0-40 (logtest? (-> a0-40 flags) (editable-flag selected))) - (if (= (-> s2-5 w) 0.0) - (editable-method-20 a0-40 s5-5 s4-5 s3-5 s2-5) - (editable-method-15 a0-40 s2-5 56) - ) - ) - (+! s0-7 1) - (set! a0-40 (-> arg0 data s0-7)) - ) - ) - ) - (cleanup-selection arg0) - ) - (else - (return #f) - ) - ) - #t - ) - -(defun execute-move ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) - (case arg1 - (((editable-command drag-resize)) - (let ((s4-0 (new 'stack-no-clear 'vector))) - (set! (-> s4-0 x) (* 100.0 (- (-> arg2 edit-plane-normal x) (-> arg2 level-offset x)))) - (set! (-> s4-0 y) 0.0) - (set! (-> s4-0 z) 0.0) - (set! (-> s4-0 w) 1.0) - (let* ((s5-1 (-> arg0 length)) - (s3-0 0) - (a0-2 (-> arg0 data s3-0)) - ) - (while (< s3-0 s5-1) - (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) - (editable-method-17 a0-2 s4-0) - ) - (+! s3-0 1) - (set! a0-2 (-> arg0 data s3-0)) - ) - ) - ) - ) - (((editable-command refresh-filter)) - (let* ((s5-2 (-> arg0 length)) - (s4-1 0) - (s3-1 (-> arg0 data s4-1)) - ) - (while (< s4-1 s5-2) - (if (and s3-1 (-> s3-1 region)) - (set! (-> s3-1 region filter) (editable-region-method-12 (-> s3-1 region))) - ) - (+! s4-1 1) - (set! s3-1 (-> arg0 data s4-1)) - ) - ) - ) - (((editable-command resize)) - (let ((s5-3 (new 'stack-no-clear 'vector))) - (set! (-> s5-3 x) 0.0) - (set! (-> s5-3 y) (* 4096.0 (-> arg0 edit-param0))) - (set! (-> s5-3 z) 0.0) - (set! (-> s5-3 w) 1.0) - (let* ((s4-2 (-> arg0 length)) - (s3-2 0) - (a0-7 (-> arg0 data s3-2)) - ) - (while (< s3-2 s4-2) - (if (and a0-7 (logtest? (-> a0-7 flags) (editable-flag selected))) - (editable-method-17 a0-7 s5-3) - ) - (+! s3-2 1) - (set! a0-7 (-> arg0 data s3-2)) - ) - ) - ) - ) - (((editable-command insert-sphere)) - (let ((s4-3 (editable-array-method-11 arg0))) - (when (>= s4-3 0) - (if (and (-> arg0 region) (-> arg0 region locked)) - (set! (-> arg0 region) (new 'debug 'editable-region)) - ) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a2-3 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) - (s3-4 (new 'debug 'editable-sphere a2-3 2048.0 (-> arg0 region))) - ) - (set! (-> arg0 data s4-3) s3-4) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (select-editable! s3-4 #t) - ) - ) - ) - ) - (((editable-command insert-point)) - (let ((s4-4 (editable-array-method-11 arg0))) - (when (>= s4-4 0) - (if (and (-> arg0 region) (-> arg0 region locked)) - (set! (-> arg0 region) (new 'debug 'editable-region)) - ) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a2-7 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) - (s3-6 (new 'debug 'editable-point a2-7 (-> arg0 region))) - ) - (set! (-> arg0 data s4-4) s3-6) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (select-editable! s3-6 #t) - ) - ) - ) - ) - (((editable-command insert-sample)) - (let ((s4-5 (editable-array-method-11 arg0))) - (when (>= s4-5 0) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a2-11 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) - (s3-8 (new 'debug 'editable-sample a2-11 *editable-sample-region*)) - ) - (set! (-> arg0 data s4-5) s3-8) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (select-editable! s3-8 #t) - ) - ) - ) - ) - (((editable-command insert-sample-camera)) - (let ((s4-6 (editable-array-method-11 arg0))) - (when (>= s4-6 0) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let ((s3-11 (new 'debug 'editable-sample (math-camera-pos) *editable-sample-region*))) - (set! (-> arg0 data s4-6) s3-11) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (select-editable! s3-11 #t) - ) - ) - ) - ) - (((editable-command insert-light)) - (let ((s4-7 (editable-array-method-11 arg0))) - (when (>= s4-7 0) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a2-18 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) - (s3-13 (new 'debug 'editable-light a2-18 2048.0 *editable-light-region*)) - ) - (set! (-> arg0 data s4-7) s3-13) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (select-editable! s3-13 #t) - (editable-method-23 s3-13) - ) - (update-light-hash *light-hash*) - ) - ) - ) - (((editable-command insert-entity)) - (let ((s4-8 (editable-array-method-11 arg0))) - (when (>= s4-8 0) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((a2-22 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) - (s3-15 (new 'debug 'editable-entity a2-22 *editable-entity-region*)) - ) - (set! (-> arg0 data s4-8) s3-15) - (editable-array-method-9 arg0 (editable-command select-none) arg2) - (select-editable! s3-15 #t) - ) - ) - ) - ) - (((editable-command insert-box)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (if (and (-> arg0 region) (-> arg0 region locked)) - (set! (-> arg0 region) (new 'debug 'editable-region)) - ) - (let ((a1-42 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal)))) - (insert-box arg0 a1-42) - ) - ) - (((editable-command insert-face)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (if (and (-> arg0 region) (-> arg0 region locked)) - (set! (-> arg0 region) (new 'debug 'editable-region)) - ) - (let ((s4-11 (editable-array-method-11 arg0))) - 0 - (editable-array-method-14 - arg0 - (the-as - (function symbol) - (lambda ((arg0 editable) (arg1 symbol)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) - ) - (the-as symbol (-> arg0 region)) - ) - (let ((s5-5 (-> arg0 selection length))) - (cond - ((= s5-5 1) - (cond - ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) - (set! (-> arg0 selection 1) (-> arg0 target)) - (+! (-> arg0 selection length) 1) - (+! s5-5 1) - ) - (else - (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 33) "pick the point to complete the face") - (return #f) - ) - ) - ) - ((and (>= s5-5 2) (>= 6 s5-5)) - ) - (else - (format - 0 - "ERROR: face can only be inserted if there are 2-6 points selected in the current region, got ~D.~%" - s5-5 - ) - (return #f) - ) - ) - (when (>= s4-11 0) - (let ((s3-17 (new 'debug 'editable-face (-> arg0 region)))) - (set! (-> arg0 data s4-11) s3-17) - (dotimes (s4-12 s5-5) - (set! (-> s3-17 vertex s4-12) (the-as editable-point (-> arg0 selection s4-12))) - (set! (-> arg0 selection s4-12 owner) (cons s3-17 (-> arg0 selection s4-12 owner))) - ) - (set! (-> s3-17 length) s5-5) - (select-editable! s3-17 #t) - (editable-method-28 s3-17 (editable-filter load)) - (editable-method-29 s3-17 (editable-filter load)) - ) - ) - ) - ) - ) - (((editable-command insert-plane)) - (if (and (-> arg0 region) (-> arg0 region locked)) - (set! (-> arg0 region) (new 'debug 'editable-region)) - ) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let ((s3-18 (editable-array-method-11 arg0))) - 0 - (editable-array-method-14 - arg0 - (the-as - (function symbol) - (lambda ((arg0 editable) (arg1 symbol)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) - ) - (the-as symbol (-> arg0 region)) - ) - (let ((s5-7 (-> arg0 selection length))) - (cond - ((= s5-7 1) - (cond - ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) - (set! (-> arg0 selection 1) (-> arg0 target)) - (+! (-> arg0 selection length) 1) - (+! s5-7 1) - ) - (else - (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 34) "pick the point to complete the plane") - (return #f) - ) - ) - ) - ((= s5-7 2) - ) - (else - (format - 0 - "ERROR: plane can only be inserted if there are 2 points selected in the current region, got ~D.~%" - s5-7 - ) - (return #f) - ) - ) - (when (>= s3-18 0) - (let ((s4-14 (new 'debug 'editable-plane (-> arg0 region)))) - (set! (-> arg0 data s3-18) s4-14) - (dotimes (s3-19 s5-7) - (set! (-> s4-14 vertex s3-19) (the-as editable-point (-> arg0 selection s3-19))) - (set! (-> arg0 selection s3-19 owner) (cons s4-14 (-> arg0 selection s3-19 owner))) - ) - (set! (-> s4-14 length) s5-7) - (select-editable! s4-14 #t) - (editable-method-28 s4-14 (editable-filter load)) - (editable-method-29 s4-14 (editable-filter load)) - ) - ) - ) - ) - ) - (else - (return #f) - ) - ) - #t - ) - -(defmethod editable-array-method-9 editable-array ((obj editable-array) (arg0 editable-command) (arg1 editable-array)) - (if (execute-select obj arg0 arg1) - (return #f) - ) - (if (execute-move obj arg0 arg1) - (return #f) - ) - (if (execute-mouse-move obj arg0 arg1) - (return #f) - ) - (cond - ((= arg0 (editable-command copy)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (set! (-> obj selection length) 0) - (let* ((s4-2 (-> obj length)) - (s3-1 0) - (s2-0 (-> obj data s3-1)) - ) - (while (< s3-1 s4-2) - (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) - (editable-method-27 s2-0 obj) - (when (= (-> s2-0 type) editable-light) - (editable-method-23 s2-0) - (update-light-hash *light-hash*) - ) - ) - (+! s3-1 1) - (set! s2-0 (-> obj data s3-1)) - ) - ) - (editable-array-method-9 obj (editable-command select-none) arg1) - (let ((s5-1 (the-as editable-region #f))) - (dotimes (s4-3 (-> obj selection length)) - (let ((a0-13 (-> obj selection s4-3))) - (when (and a0-13 (logtest? s4-3 1)) - (set! s5-1 (-> a0-13 region)) - (select-editable! a0-13 #t) - ) - ) - ) - (if (not (-> obj region-lock?)) - (set! (-> obj region) s5-1) - ) - ) - ) - ((= arg0 (editable-command copy-region)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (when (and (-> obj region) (not (-> obj region locked))) - (editable-array-method-9 obj (editable-command select-current-region) arg1) - (let ((v1-52 (copy (-> obj region) 'debug))) - (set! (-> v1-52 id) (the-as uint 0)) - (set! (-> v1-52 changed) #t) - (set! (-> obj region) v1-52) - ) - (editable-array-method-9 obj (editable-command copy) arg1) - ) - ) - ((= arg0 (editable-command delete)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((s5-3 (-> obj length)) - (s4-6 0) - (s3-3 (-> obj data s4-6)) - ) - (while (< s4-6 s5-3) - (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) - (editable-array-method-15 obj s3-3) - (when (= (-> s3-3 type) editable-light) - (editable-method-23 s3-3) - (update-light-hash *light-hash*) - ) - ) - (+! s4-6 1) - (set! s3-3 (-> obj data s4-6)) - ) - ) - (if (not (-> obj region-lock?)) - (set! (-> obj region) #f) - ) - ) - ((= arg0 (editable-command delete-region)) - (when (-> obj region) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (when (!= (-> obj region) *editable-light-region*) - (editable-array-method-9 obj (editable-command select-current-region) arg1) - (editable-array-method-9 obj (editable-command delete) arg1) - (set! (-> obj region) #f) - ) - ) - ) - ((= arg0 (editable-command snap-to-ground)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((s5-5 (new 'stack-no-clear 'vector)) - (s4-9 (-> obj length)) - (s3-5 0) - (s2-1 (-> obj data s3-5)) - ) - (while (< s3-5 s4-9) - (when (and s2-1 (logtest? (-> s2-1 flags) (editable-flag selected))) - (if (editable-method-11 s2-1 s5-5) - (editable-method-19 s2-1 s5-5) - ) - ) - (+! s3-5 1) - (set! s2-1 (-> obj data s3-5)) - ) - ) - ) - ((= arg0 (editable-command snap-y)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (cond - ((-> obj target) - (let* ((s5-7 (edit-get-trans (-> obj target))) - (s4-11 (-> obj length)) - (s3-6 0) - (a0-37 (-> obj data s3-6)) - ) - (while (< s3-6 s4-11) - (if (and a0-37 (logtest? (-> a0-37 flags) (editable-flag selected))) - (edit-coord! a0-37 s5-7 (editable-flag y no-plane-snap)) - ) - (+! s3-6 1) - (set! a0-37 (-> obj data s3-6)) - ) - ) - ) - (else - (editable-array-method-13 obj (the-as uint 14) (the-as basic 41) "pick the editable to use the y from") - ) - ) - ) - ((= arg0 (editable-command snap-xz)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (cond - ((-> obj target) - (let* ((s5-9 (edit-get-trans (-> obj target))) - (s4-13 (-> obj length)) - (s3-7 0) - (a0-41 (-> obj data s3-7)) - ) - (while (< s3-7 s4-13) - (if (and a0-41 (logtest? (-> a0-41 flags) (editable-flag selected))) - (edit-coord! a0-41 s5-9 (editable-flag x z no-plane-snap)) - ) - (+! s3-7 1) - (set! a0-41 (-> obj data s3-7)) - ) - ) - ) - (else - (editable-array-method-13 obj (the-as uint 14) (the-as basic 40) "pick the editable to use the xz from") - ) - ) - ) - ((= arg0 (editable-command region-set)) - (when (and (-> obj region) (not (-> obj region locked))) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((s5-11 (-> obj length)) - (s4-15 0) - (a0-44 (-> obj data s4-15)) - ) - (while (< s4-15 s5-11) - (if (and a0-44 (logtest? (-> a0-44 flags) (editable-flag selected))) - (editable-method-21 a0-44 (-> obj region)) - ) - (+! s4-15 1) - (set! a0-44 (-> obj data s4-15)) - ) - ) - ) - ) - ((= arg0 (editable-command region-add)) - (when (and (-> obj region) (not (-> obj region locked))) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (if (-> obj target) - (editable-method-21 (-> obj target) (-> obj region)) - (editable-array-method-13 obj (the-as uint 14) (the-as basic 49) "pick the editable to add to current region") - ) - ) - ) - ((= arg0 (editable-command region-new)) - (let ((v1-175 (new 'debug 'editable-region))) - (if (and (-> obj region) (not (-> obj region locked))) - (set! (-> v1-175 tree) (-> obj region tree)) - ) - (set! (-> obj region) v1-175) - ) - (editable-array-method-9 obj (editable-command region-set) arg1) - ) - ((= arg0 (editable-command flip-side)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (let* ((s5-14 (-> obj length)) - (s4-18 0) - (a0-58 (-> obj data s4-18)) - ) - (while (< s4-18 s5-14) - (if (and a0-58 (logtest? (-> a0-58 flags) (editable-flag selected))) - (editable-method-24 a0-58) - ) - (+! s4-18 1) - (set! a0-58 (-> obj data s4-18)) - ) - ) - ) - ((= arg0 (editable-command rotate-level)) - (let* ((f0-1 (* 182.04445 (-> obj edit-param0))) - (s5-15 (matrix-rotate-y! (new 'stack-no-clear 'matrix) f0-1)) - (s4-19 (-> obj length)) - (s3-8 0) - (a0-60 (-> obj data s3-8)) - ) - (while (< s3-8 s4-19) - (if (and a0-60 region (= (-> a0-60 region level) (-> obj level))) - (editable-method-18 a0-60 (-> obj level-offset) s5-15) - ) - (+! s3-8 1) - (set! a0-60 (-> obj data s3-8)) - ) - ) - ) - ((= arg0 (editable-command translate-y-level)) - (let ((s5-16 (new 'stack-no-clear 'vector))) - (set! (-> s5-16 x) 0.0) - (set! (-> s5-16 y) (* 4096.0 (-> obj edit-param0))) - (set! (-> s5-16 z) 0.0) - (set! (-> s5-16 w) 1.0) - (let* ((s4-20 (-> obj length)) - (s3-9 0) - (a0-61 (-> obj data s3-9)) - ) - (while (< s3-9 s4-20) - (if (and a0-61 region (= (-> a0-61 region level) (-> obj level))) - (editable-method-15 a0-61 s5-16 56) - ) - (+! s3-9 1) - (set! a0-61 (-> obj data s3-9)) - ) - ) - ) - ) - ((= arg0 (editable-command save)) - (let* ((s5-17 (-> obj length)) - (s4-21 0) - (v1-231 (-> obj data s4-21)) - ) - (while (< s4-21 s5-17) - (when (and v1-231 (-> v1-231 region)) - (let ((t9-53 (method-of-object (-> v1-231 region) editable-region-method-9))) - 0 - 0 - (t9-53) - ) - ) - (+! s4-21 1) - (set! v1-231 (-> obj data s4-21)) - ) - ) - (let ((t9-54 (method-of-object *editable-sample-region* editable-region-method-9))) - 0 - 0 - (t9-54) - ) - (let ((t9-55 (method-of-object *editable-light-region* editable-region-method-9))) - 0 - 0 - (t9-55) - ) - (let ((t9-56 (method-of-object *editable-entity-region* editable-region-method-9))) - 0 - 0 - (t9-56) - ) - ) - ((= arg0 (editable-command load)) - (editable-array-method-9 obj (editable-command select-none) arg1) - (dotimes (v1-248 (-> obj length)) - (set! (-> obj data v1-248) #f) - ) - (set! (-> obj length) 0) - (let* ((s5-18 obj) - (s4-22 (method-of-object s5-18 editable-array-method-12)) - (v1-253 (level-get-target-inside *level*)) - ) - (s4-22 s5-18 (the-as editable-array (if v1-253 - (-> v1-253 info dbname) - #f - ) - ) - ) - ) - (editable-array-method-9 obj (editable-command update-game) (the-as editable-array #f)) - ) - ((= arg0 (editable-command update-game)) - (let ((t9-61 reset-light-hash)) - *light-hash* - (t9-61) - ) - (let* ((s5-19 (-> obj length)) (s4-23 0) (a0-76 (-> obj data s4-23))) (while (< s4-23 s5-19) - (if a0-76 - (editable-method-23 a0-76) - ) - (+! s4-23 1) - (set! a0-76 (-> obj data s4-23)) - ) - ) - (update-light-hash *light-hash*) - ) - ((or (= arg0 (editable-command exit)) (= arg0 (editable-command kill))) - (deactivate self) - ) - ) - #f - ) - -(defmethod deactivate editable-player ((obj editable-player)) - (dotimes (v1-0 (-> *level* length)) - (let ((a1-3 (-> *level* level v1-0))) - (if (= (-> a1-3 status) 'active) - (set! (-> a1-3 light-hash) (-> a1-3 bsp light-hash)) - ) - ) - ) - (set! *editable* (the-as (pointer editable-player) #f)) - (set! *external-cam-mode* (-> obj external-cam-mode)) - ((method-of-type process-drawable deactivate) obj) - (none) - ) - -;; WARN: Return type mismatch process-drawable vs editable-player. -(defmethod relocate editable-player ((obj editable-player) (arg0 int)) - (let ((v1-0 *kernel-context*)) - (set! (-> v1-0 relocating-process) obj) - (set! (-> v1-0 relocating-min) (the-as int (&-> obj type))) - (set! (-> v1-0 relocating-max) - (the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj))) - ) - (set! (-> v1-0 relocating-offset) arg0) - ) - (let ((v1-2 (-> obj current))) - (if (and (>= (the-as int v1-2) (-> *kernel-context* relocating-min)) - (< (the-as int v1-2) (-> *kernel-context* relocating-max)) - ) - (&+! (-> obj current) arg0) - ) - ) - (the-as editable-player ((method-of-type process-drawable relocate) obj arg0)) - ) - -;; WARN: Return type mismatch int vs none. -(defmethod editable-player-method-21 editable-player ((obj editable-player)) - (set! *display-region-marks* #f) - (let* ((s5-0 (-> obj current length)) - (s4-0 0) - (a0-2 (-> obj current data s4-0)) - ) - (while (< s4-0 s5-0) - (if (and a0-2 (or (and (logtest? (-> a0-2 region filter) (-> obj current filter 0)) - (logtest? (-> a0-2 region filter) (-> obj current filter 1)) - ) - (logtest? (-> a0-2 flags) (editable-flag selected)) - ) - ) - (editable-method-10 a0-2) - ) - (+! s4-0 1) - (set! a0-2 (-> obj current data s4-0)) - ) - ) - (when #t - (format *stdcon* "~0K") - (format *stdcon* "~16S~16S~16S~%" "Left button" "Middle button" "Right button") - (format - *stdcon* - "~16S~16S~16S~%" - (editable-command->string - (the-as - editable-command - (if (and (nonzero? (-> obj command 1)) (or (zero? (-> obj command 0)) (logtest? (-> *mouse* button0-abs 0) 1))) - (-> obj command 1) - (-> obj command 0) - ) - ) - ) - (editable-command->string - (the-as - editable-command - (if (and (nonzero? (-> obj command 5)) (or (zero? (-> obj command 4)) (logtest? (-> *mouse* button0-abs 0) 4))) - (-> obj command 5) - (-> obj command 4) - ) - ) - ) - (editable-command->string - (the-as - editable-command - (if (and (nonzero? (-> obj command 3)) (or (zero? (-> obj command 2)) (logtest? (-> *mouse* button0-abs 0) 2))) - (-> obj command 3) - (-> obj command 2) - ) - ) - ) - ) - (let* ((s5-2 (-> obj current length)) - (s4-2 0) - (v1-35 (-> obj current data s4-2)) - ) - (while (< s4-2 s5-2) - (when (and v1-35 (logtest? (-> v1-35 flags) (editable-flag selected))) - (let ((s3-1 (-> v1-35 name))) - (if (not (string-prefix= "undefined" s3-1)) - (format *stdcon* "~s~%" s3-1) - ) - ) - ) - (+! s4-2 1) - (set! v1-35 (-> obj current data s4-2)) - ) - ) - (when (!= *master-mode* 'menu) - (let ((a2-5 (-> obj current target-message))) - (if a2-5 - (format *stdcon* "~%~3L~S~0L~%" a2-5) - ) - ) - (when (cpad-hold? 1 triangle) - (let* ((s5-3 (-> obj current length)) - (s4-3 0) - (a0-29 (-> obj current data s4-3)) - ) - (while (< s4-3 s5-3) - (when (and a0-29 - (or (and (logtest? (-> a0-29 region filter) (-> obj current filter 0)) - (logtest? (-> a0-29 region filter) (-> obj current filter 1)) - ) - (logtest? (-> a0-29 flags) (editable-flag selected)) - ) - ) - (if (and (-> a0-29 region) (!= (-> a0-29 type) editable-point)) - (editable-region-method-11 (-> a0-29 region) (edit-get-trans a0-29) (if (cpad-hold? 1 circle) - 1 - 0 - ) - ) - ) - ) - (+! s4-3 1) - (set! a0-29 (-> obj current data s4-3)) - ) - ) - (format *stdcon* "~%") - (cond - ((-> obj current region) - (let ((s5-4 (-> obj current region))) - (format - *stdcon* - "~%region: region-~D ~S ~S~S~%" - (-> s5-4 id) - (-> s5-4 level) - (-> s5-4 tree) - (if (-> s5-4 changed) - " (modified)" - "" - ) - ) - (format *stdcon* " (on-enter ~S)~%" (-> s5-4 on-enter)) - (format *stdcon* " (on-inside ~S)~%" (-> s5-4 on-inside)) - (format *stdcon* " (on-exit ~S)~%" (-> s5-4 on-exit)) - ) - ) - (else - (format *stdcon* "no region~%") - ) - ) - (when (-> obj current edit-plane) - (let ((a2-13 (-> obj current edit-plane))) - (format *stdcon* "~%edit-plane: ~A~%" a2-13) - ) - ) - (format *stdcon* "~%selected:~%") - (let* ((s5-5 (-> obj current length)) - (s4-4 0) - (a2-14 (-> obj current data s4-4)) - ) - (while (< s4-4 s5-5) - (if (and a2-14 (logtest? (-> a2-14 flags) (editable-flag selected))) - (format *stdcon* " ~A~%" a2-14) - ) - (+! s4-4 1) - (set! a2-14 (-> obj current data s4-4)) - ) - ) - ) - ) - (format *stdcon* "~1K~%") - ) - 0 - (none) - ) - -(defstate idle (editable-player) - :virtual #t - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v0-0 none)) - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'execute) - (let ((a2-1 (-> arg3 param 0))) - (case a2-1 - ((28 27 35 29 31 32) - (editable-array-method-13 - (-> self current) - (the-as uint 15) - (the-as basic a2-1) - "click on the point to insert at (up target, down camera)" - ) - ) - ((51 1 47 36 55 56) - (if (not (-> self left-handed)) - (editable-array-method-13 - (-> self current) - (the-as uint 16) - (the-as basic a2-1) - "press x to confirm, square to cancel" - ) - (editable-array-method-13 - (-> self current) - (the-as uint 16) - (the-as basic a2-1) - "press down to confirm, left to cancel" - ) - ) - ) - (else - (editable-array-method-9 (-> self current) (the-as editable-command a2-1) (the-as editable-array *mouse*)) - ) - ) - ) - ) - ((= v1-0 'exit) - (deactivate self) - ) - ((= v1-0 'menu) - (set! v0-0 (the-as none (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0))))) - (set! (-> self close-menu-time) (the-as time-frame v0-0)) - v0-0 - ) - ((or (= v1-0 'on-enter) (= v1-0 'on-exit) (= v1-0 'on-inside)) - (let ((s4-0 (-> self current region))) - (when s4-0 - (let ((gp-1 (-> arg3 param 0))) - (set! (-> *syntax-context* got-error?) #f) - (eval! *syntax-context* (the-as structure gp-1)) - (when (not (-> *syntax-context* got-error?)) - (set! (-> s4-0 changed) #t) - (cond - ((= arg2 'on-enter) - (set! (-> s4-0 on-enter) (the-as string gp-1)) - ) - ((= arg2 'on-inside) - (set! (-> s4-0 on-inside) (the-as string gp-1)) - ) - ((= arg2 'on-exit) - (set! (-> s4-0 on-exit) (the-as string gp-1)) - ) - ) - ) - ) - (set! v0-0 (the-as none (editable-region-method-12 s4-0))) - (set! (-> s4-0 filter) (the-as editable-filter v0-0)) - v0-0 - ) - ) - ) - ((= v1-0 'select) - (let ((gp-2 (-> arg3 param 0))) - (editable-array-method-9 (-> self current) (editable-command select-none) (the-as editable-array #f)) - (let* ((s5-1 (-> self current length)) - (s4-1 0) - (a0-36 (-> self current data s4-1)) - ) - (while (< s4-1 s5-1) - (when (and a0-36 (or (and (logtest? (-> a0-36 region filter) (-> self current filter 0)) - (logtest? (-> a0-36 region filter) (-> self current filter 1)) - ) - (logtest? (-> a0-36 flags) (editable-flag selected)) - ) - ) - (when (and (-> a0-36 region) (= gp-2 (-> a0-36 region id))) - (set! (-> self current region) (-> a0-36 region)) - (select-editable! a0-36 #t) - ) - ) - (+! s4-1 1) - (set! a0-36 (-> self current data s4-1)) - ) - ) - ) - #f - ) - ((= v1-0 'name) - (let* ((s5-2 (-> self current length)) - (s4-2 0) - (s3-0 (-> self current data s4-2)) - ) - (while (< s4-2 s5-2) - (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) - (let ((v1-60 (if (type? s3-0 editable) - s3-0 - ) - ) - ) - (when v1-60 - (set! (-> v1-60 name) (the-as string (-> arg3 param 0))) - (logior! (-> v1-60 flags) (editable-flag changed)) - (let ((v1-61 (-> v1-60 region))) - (if v1-61 - (set! (-> v1-61 changed) #t) - ) - ) - ) - ) - ) - (+! s4-2 1) - (set! s3-0 (-> self current data s4-2)) - ) - ) - #f - ) - ((= v1-0 'level) - (let ((gp-3 (lookup-level-info (the-as symbol (-> arg3 param 0))))) - (when (-> gp-3 dbname) - (let* ((s5-3 (-> self current length)) - (s4-3 0) - (s3-1 (-> self current data s4-3)) - ) - (while (< s4-3 s5-3) - (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) - (let ((v1-73 (if (type? s3-1 editable) - s3-1 - ) - ) - ) - (when (and v1-73 (-> v1-73 region)) - (set! (-> v1-73 region level) (the-as string (-> gp-3 dbname))) - (set! (-> v1-73 region changed) #t) - ) - ) - ) - (+! s4-3 1) - (set! s3-1 (-> self current data s4-3)) - ) - ) - #f - ) - ) - ) - ((= v1-0 'get-level) - (-> self current level) - ) - ((= v1-0 'direction) - (let* ((f30-0 (the-as float (-> arg3 param 0))) - (f28-0 (the-as float (-> arg3 param 1))) - (f26-0 (the-as float (-> arg3 param 2))) - (f24-0 (if (and (zero? (-> arg3 param 0)) (zero? (-> arg3 param 1)) (zero? (-> arg3 param 2))) - 0.0 - 1.0 - ) - ) - (gp-4 (-> self current length)) - (s5-4 0) - (s4-4 (-> self current data s5-4)) - ) - (while (< s5-4 gp-4) - (when (and s4-4 (logtest? (-> s4-4 flags) (editable-flag selected))) - (let ((s3-2 (if (type? s4-4 editable-light) - (the-as editable-light s4-4) - ) - ) - ) - (when s3-2 - (set-vector! (-> s3-2 direction) f30-0 f28-0 f26-0 f24-0) - (vector-normalize! (-> s3-2 direction) 1.0) - (logior! (-> s3-2 flags) (editable-flag changed)) - (let ((a0-73 (-> s3-2 region))) - (if a0-73 - (set! (-> a0-73 changed) #t) - ) - ) - ) - ) - ) - (+! s5-4 1) - (set! s4-4 (-> self current data s5-4)) - ) - ) - #f - ) - ((= v1-0 'color) - (let* ((f30-1 (the-as float (-> arg3 param 0))) - (f28-1 (the-as float (-> arg3 param 1))) - (f26-1 (the-as float (-> arg3 param 2))) - (f24-1 (the-as float (-> arg3 param 3))) - (gp-5 (-> self current length)) - (s5-5 0) - (s4-5 (-> self current data s5-5)) - ) - (while (< s5-5 gp-5) - (when (and s4-5 (logtest? (-> s4-5 flags) (editable-flag selected))) - (let ((v1-114 (if (type? s4-5 editable-light) - (the-as editable-light s4-5) - ) - ) - ) - (when v1-114 - (set-vector! (-> v1-114 color) f30-1 f28-1 f26-1 f24-1) - (logior! (-> v1-114 flags) (editable-flag changed)) - (let ((v1-115 (-> v1-114 region))) - (if v1-115 - (set! (-> v1-115 changed) #t) - ) - ) - ) - ) - ) - (+! s5-5 1) - (set! s4-5 (-> self current data s5-5)) - ) - ) - #f - ) - ((= v1-0 'param) - (let ((s5-6 (-> arg3 param 0)) - (f30-2 (the-as float (-> arg3 param 1))) - ) - (when (and (>= (the-as int s5-6) 0) (>= 2 (the-as int s5-6))) - (let* ((gp-6 (-> self current length)) - (s4-6 0) - (s3-3 (-> self current data s4-6)) - ) - (while (< s4-6 gp-6) - (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) - (let ((v1-129 (if (type? s3-3 editable-light) - s3-3 - ) - ) - ) - (when v1-129 - (set! (-> (the-as editable-light (+ (* s5-6 4) (the-as uint v1-129))) decay-start) f30-2) - (logior! (-> v1-129 flags) (editable-flag changed)) - (let ((v1-130 (-> v1-129 region))) - (if v1-130 - (set! (-> v1-130 changed) #t) - ) - ) - ) - ) - ) - (+! s4-6 1) - (set! s3-3 (-> self current data s4-6)) - ) - ) - #f - ) - ) - ) - ) - ) - ) - ) - :trans (behavior () - (let ((gp-0 (-> self current))) - (set! (-> gp-0 move-lock?) #f) - (when (cpad-pressed? 1 start) - (when (!= *master-mode* 'menu) - (set-master-mode 'menu) - (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons start)) - (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons start)) - ) - ) - (when (or (and (= *master-mode* 'menu) - (> (-> self close-menu-time) 0) - (>= (-> self clock frame-counter) (-> self close-menu-time)) - ) - (cpad-pressed? 1 start) - ) - (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) - (set-master-mode 'game) - (set! (-> self close-menu-time) 0) - 0 - ) - (debug-menus-handler *editable-menu-context*) - (set-setting! 'cpad1-skip-buttons 'abs #t 0) - (set-setting! 'mouse-input 'abs #f 0) - (when (!= *master-mode* 'menu) - (cond - ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) - (or (and (cpad-hold? 1 left) (not (-> self left-handed))) (and (cpad-hold? 1 square) (-> self left-handed))) - ) - (set! (-> self command 0) (the-as function 48)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 47)) - (set! (-> self command 3) (the-as function 0)) - (set! (-> self command 4) (the-as function 49)) - (set! (-> self command 5) (the-as function 0)) - 0 - ) - ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) - (or (and (cpad-hold? 1 right) (not (-> self left-handed))) (and (cpad-hold? 1 circle) (-> self left-handed))) - ) - (set! (-> self command 0) (the-as function 52)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 36)) - (set! (-> self command 3) (the-as function 0)) - (set! (-> self command 4) (the-as function 37)) - (set! (-> self command 5) (the-as function 0)) - 0 - ) - ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) - (or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) - ) - (set! (-> self command 0) (the-as function 6)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 53)) - (set! (-> self command 3) (the-as function 0)) - (set! (-> self command 4) (the-as function 42)) - (set! (-> self command 5) (the-as function 0)) - 0 - ) - ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) - (or (and (cpad-hold? 1 down) (not (-> self left-handed))) (and (cpad-hold? 1 x) (-> self left-handed))) - ) - (set! (-> self command 0) (the-as function 29)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 30)) - (set! (-> self command 3) (the-as function 0)) - (set! (-> self command 4) (the-as function 32)) - (set! (-> self command 5) (the-as function 0)) - 0 - ) - ((or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) - (set! (-> self command 0) (the-as function 0)) - (set! (-> self command 1) (the-as function 24)) - (set! (-> self command 2) (the-as function 0)) - (set! (-> self command 3) (the-as function 26)) - (set! (-> self command 4) (the-as function 0)) - (set! (-> self command 5) (the-as function 25)) - ) - ((and (cpad-hold? 1 up) - (cpad-hold? 1 left) - (or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) - ) - (set! (-> self command 0) (the-as function 3)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 9)) - (set! (-> self command 3) (the-as function 0)) - (set! (-> self command 4) (the-as function 8)) - (set! (-> self command 5) (the-as function 0)) - 0 - ) - ((or (and (cpad-hold? 1 left) (not (-> self left-handed))) (and (cpad-hold? 1 square) (-> self left-handed))) - (set! (-> self command 0) (the-as function 0)) - (set! (-> self command 1) (the-as function 20)) - (set! (-> self command 2) (the-as function 0)) - (set! (-> self command 3) (the-as function 22)) - (set! (-> self command 4) (the-as function 0)) - (set! (-> self command 5) (the-as function 21)) - ) - ((or (and (cpad-hold? 1 right) (not (-> self left-handed))) (and (cpad-hold? 1 circle) (-> self left-handed))) - (set! (-> self command 0) (the-as function 31)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 27)) - (set! (-> self command 3) (the-as function 0)) - (set! (-> self command 4) (the-as function 28)) - (set! (-> self command 5) (the-as function 0)) - 0 - ) - ((or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) - (set! (-> self command 0) (the-as function 3)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 4)) - (set! (-> self command 3) (the-as function 0)) - (set! (-> self command 4) (the-as function 7)) - (set! (-> self command 5) (the-as function 0)) - 0 - ) - ((or (and (cpad-hold? 1 down) (not (-> self left-handed))) (and (cpad-hold? 1 x) (-> self left-handed))) - (set! (-> self command 0) (the-as function 33)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 35)) - (set! (-> self command 3) (the-as function 0)) - (set! (-> self command 4) (the-as function 34)) - (set! (-> self command 5) (the-as function 0)) - 0 - ) - (else - (set! (-> self command 0) (the-as function 0)) - (set! (-> self command 1) (the-as function 18)) - (set! (-> self command 2) (the-as function 0)) - (set! (-> self command 3) (the-as function 23)) - (set! (-> self command 4) (the-as function 0)) - (set! (-> self command 5) (the-as function 19)) - ) - ) - (case (-> self current target-mode) - ((14 15) - (set! (-> self command 0) (the-as function (-> self current target-mode))) - ) - ((16) - (when (!= *master-mode* 'menu) - (cond - ((not (-> self left-handed)) - (cond - ((cpad-hold? 1 x) - (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x)) - (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons x)) - (editable-array-method-9 - gp-0 - (the-as editable-command (-> self current target-mode)) - (the-as editable-array *mouse*) - ) - ) - ((cpad-pressed? 1 square) - (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons square)) - (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons square)) - (editable-array-method-9 gp-0 (editable-command cancel) (the-as editable-array *mouse*)) - ) - ) - ) - (else - (cond - ((cpad-hold? 1 down) - (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons down)) - (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons down)) - (editable-array-method-9 - gp-0 - (the-as editable-command (-> self current target-mode)) - (the-as editable-array *mouse*) - ) - ) - ((cpad-pressed? 1 left) - (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons left)) - (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons left)) - (editable-array-method-9 gp-0 (editable-command cancel) (the-as editable-array *mouse*)) - ) - ) - ) - ) - ) - ) - ) - (if (logtest? (-> *mouse* button0-rel 0) 1) - (editable-array-method-9 gp-0 (the-as editable-command (-> self command 0)) (the-as editable-array *mouse*)) - ) - (if (logtest? (-> *mouse* button0-abs 0) 1) - (editable-array-method-9 gp-0 (the-as editable-command (-> self command 1)) (the-as editable-array *mouse*)) - ) - (if (logtest? (-> *mouse* button0-rel 0) 2) - (editable-array-method-9 gp-0 (the-as editable-command (-> self command 2)) (the-as editable-array *mouse*)) - ) - (if (logtest? (-> *mouse* button0-abs 0) 2) - (editable-array-method-9 gp-0 (the-as editable-command (-> self command 3)) (the-as editable-array *mouse*)) - ) - (when (logtest? (-> *mouse* button0-rel 0) 4) - (let ((a2-11 (-> self command 4))) - (case a2-11 - ((36) - (if (not (-> self left-handed)) - (editable-array-method-13 gp-0 (the-as uint 16) a2-11 "press x to confirm, square to cancel") - (editable-array-method-13 gp-0 (the-as uint 16) a2-11 "press down to confirm, left to cancel") - ) - ) - (else - (editable-array-method-9 gp-0 (the-as editable-command a2-11) (the-as editable-array *mouse*)) - ) - ) - ) - ) - (if (logtest? (-> *mouse* button0-abs 0) 4) - (editable-array-method-9 gp-0 (the-as editable-command (-> self command 5)) (the-as editable-array *mouse*)) - ) - ) - ) - (none) - ) - :code (behavior () - (until #f - (suspend) - ) - #f - (none) - ) - :post (behavior () - (editable-player-method-21 self) - (none) - ) - ) - -;; WARN: Return type mismatch object vs none. -(defbehavior editable-player-init editable-player ((arg0 symbol)) - (set! *editable-temp-id* 0) - (set! *display-profile* #f) - (set! *display-entity-errors* #f) - (set! *display-actor-marks* #f) - (logclear! (-> self mask) (process-mask freeze pause menu)) - (set! (-> self clock) (-> *display* real-clock)) - (set! (-> self current) (new 'debug 'editable-array 4096)) - (add-setting! 'mouse #t 0 0) - (add-setting! 'cursor #t 0 0) - (set! (-> self select-command) (the-as function 3)) - (set! (-> self move-command) (the-as function 18)) - (set! (-> self extra-command) (the-as function 23)) - (set! (-> self left-handed) #f) - (set! (-> self light-names) #f) - (set! (-> self command 0) (-> self select-command)) - (set! (-> self command 1) (the-as function 0)) - (set! (-> self command 2) (the-as function 0)) - (set! (-> self command 3) (-> self extra-command)) - (set! (-> self command 4) (the-as function 0)) - (set! (-> self command 5) (-> self move-command)) - (let* ((s5-0 (-> self current)) - (s4-0 (method-of-object s5-0 editable-array-method-12)) - (s3-0 (if arg0 - (lookup-level-info arg0) - ) - ) - (gp-1 (level-get-target-inside *level*)) - (a1-5 (cond - (s3-0 - (let ((gp-2 (level-get *level* (-> s3-0 dbname)))) - (when gp-2 - (format 0 "setting level~d ~s to *light-hash*~%" (-> gp-2 index) (-> gp-2 name)) - (set! (-> gp-2 light-hash) *light-hash*) - ) - ) - (-> s3-0 dbname) - ) - (gp-1 - (let ((s3-1 (level-get *level* (-> gp-1 info dbname)))) - (when s3-1 - (format 0 "setting level~d ~s to *light-hash*~%" (-> s3-1 index) (-> s3-1 name)) - (set! (-> s3-1 light-hash) *light-hash*) - ) - ) - (-> gp-1 info dbname) - ) - ) - ) - ) - (s4-0 s5-0 (the-as editable-array a1-5)) - ) - (set! *editable* (the-as (pointer editable-player) (process->ppointer self))) - (set! (-> self event-hook) (-> (method-of-object self idle) event)) - (set! (-> self external-cam-mode) *external-cam-mode*) - (set! *external-cam-mode* 'pad-1) - (editable-array-method-9 (-> self current) (editable-command update-game) (the-as editable-array #f)) - (go-virtual idle) - (none) - ) - -(define *editable-menu-context* (new 'debug 'debug-menu-context)) - -(set! (-> *editable-menu-context* joypad-number) 1) - -;; WARN: Return type mismatch object vs none. -(defun editable-menu-command ((arg0 int)) - (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) - (send-event (ppointer->process *editable*) 'menu 90) - (none) - ) - -;; WARN: Return type mismatch object vs none. -(defun editable-menu-command-no-close ((arg0 int)) - (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) - (none) - ) - -;; WARN: Return type mismatch object vs symbol. -(defun dm-region-tree-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) - (when (= arg1 (debug-menu-msg press)) - (when (and *editable* (-> *editable* 0 current region)) - (let ((s5-0 (-> *editable* 0 current region))) - (set! (-> s5-0 tree) (the-as string arg0)) - (set! (-> s5-0 changed) #t) - (set! (-> s5-0 filter) (editable-region-method-12 s5-0)) - ) - ) - ) - (the-as - symbol - (and *editable* (-> *editable* 0 current region) (= arg0 (-> *editable* 0 current region tree))) - ) - ) - -(defun dm-editable-flag-pick-func ((arg0 editable-flag) (arg1 debug-menu-msg)) - (when *editable* - (let ((gp-0 (/ (the-as int arg0) 8))) - (editable-array-method-14 (-> *editable* 0 current) true-func #f) - (when (= arg1 (debug-menu-msg press)) - (let* ((v1-10 (-> *editable* 0 current length)) - (a0-2 0) - (a1-4 (-> *editable* 0 current data a0-2)) - ) - (while (< a0-2 v1-10) - (if (and a1-4 (logtest? (-> a1-4 flags) (editable-flag selected))) - (logxor! (-> a1-4 flags) (the-as uint gp-0)) - ) - (+! a0-2 1) - (set! a1-4 (-> *editable* 0 current data a0-2)) - ) - ) - ) - (and (>= (-> *editable* 0 current selection length) 1) - (logtest? (-> *editable* 0 current selection 0 flags) gp-0) - ) - ) - ) - ) - -(defun dm-editable-filter0-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) - (when *editable* - (let ((v1-1 (/ (the-as int arg0) 8))) - (if (= arg1 (debug-menu-msg press)) - (logxor! (-> *editable* 0 current filter 0) (the-as uint v1-1)) - ) - (logtest? (-> *editable* 0 current filter 0) v1-1) - ) - ) - ) - -(defun dm-editable-filter1-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) - (when *editable* - (let ((v1-1 (/ (the-as int arg0) 8))) - (if (= arg1 (debug-menu-msg press)) - (logxor! (-> *editable* 0 current filter 1) (the-as uint v1-1)) - ) - (logtest? (-> *editable* 0 current filter 1) v1-1) - ) - ) - ) - -;; ERROR: failed type prop at 36: add failed: editable uint - -;; WARN: Return type mismatch symbol vs object. - -(defun dm-cam-externalize2 ((arg0 symbol) (arg1 debug-menu-msg)) - (when (= arg1 (debug-menu-msg press)) - (cond - ((= arg0 'reset) - (if (!= *external-cam-mode* 'locked) - (external-cam-reset!) - ) - ) - ((= arg0 'allow-z) - (set! *external-cam-options* (logxor *external-cam-options* (external-cam-option allow-z))) - ) - ((= *external-cam-mode* arg0) - (set! *external-cam-mode* #f) - ) - (else - (if (not *external-cam-mode*) - (external-cam-reset!) - ) - (set! *external-cam-mode* arg0) - ) - ) - ) - (if (= arg0 'allow-z) - (logtest? *external-cam-options* (external-cam-option allow-z)) - (= *external-cam-mode* arg0) - ) - ) - -;; ERROR: failed type prop at 5: add failed: editable-player int - - -;; ERROR: function was not converted to expressions. Cannot decompile. - -(editable-menu-context-make-menus *editable-menu-context*) - -;; WARN: Return type mismatch int vs none. -;; WARN: Function insert-sample-camera has a return type of none, but the expression builder found a return statement. -(defun insert-sample-camera ((arg0 symbol)) - (cond - (level - (let ((s5-0 sql-query)) - (format - (clear *temp-string*) - "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" - arg0 - ) - (let ((s5-1 (s5-0 *temp-string*))) - (cond - ((and (= (-> s5-1 error) 'select) (= (-> s5-1 len) 4)) - (let ((f26-0 (* 4096.0 (string->float (the-as string (-> s5-1 data 0))))) - (f28-0 (* 4096.0 (string->float (the-as string (-> s5-1 data 1))))) - (f30-3 (* 4096.0 (string->float (the-as string (-> s5-1 data 2))))) - (s5-2 (string->int (the-as string (-> s5-1 data 3)))) - (s3-0 (math-camera-pos)) - (s4-1 (clear *temp-string*)) - ) - (format - s4-1 - "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" - s5-2 - (* 0.00024414062 (- (-> s3-0 x) f26-0)) - (* 0.00024414062 (- (-> s3-0 y) f28-0)) - (* 0.00024414062 (- (-> s3-0 z) f30-3)) - ) - (let ((a2-2 (sql-query s4-1))) - (cond - ((= (-> a2-2 error) 'modify) - (format - (clear s4-1) - "update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D" - s5-2 - ) - (let ((a2-4 (sql-query s4-1))) - (when (!= (-> a2-4 error) 'modify) - (format 0 "ERROR: sql: modify error ~A~%" a2-4) - (return #f) - ) - ) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) - (format #t "EDITABLE: saved camera sample point for level ~A~%" arg0) - ) - (else - (format 0 "ERROR: sql: insert error ~A~%" a2-2) - ) - ) - ) - ) - ) - (else - (format 0 "ERROR: sql: select error ~A~%" s5-1) - ) - ) - ) - ) - ) - (else - (format 0 "ERROR: EDITABLE: no current level~%") - ) - ) - 0 - (none) - ) - -(define *debug-hook* (cons - (lambda () - (when (and *debug-segment* *manual-sample-point*) - (when (cpad-pressed? 1 select) - (cond - (*editable* - ) - ((not *artist-fix-visible*) - (insert-sample-camera (-> (level-get-target-inside *level*) info dbname)) - ) - (else - (dotimes (gp-1 (-> *level* length)) - (let ((v1-14 (-> *level* level gp-1))) - (when (= (-> v1-14 status) 'active) - (if (zero? (logand *fix-visible-level-mask* (ash 1 (-> v1-14 index)))) - (insert-sample-camera (-> v1-14 name)) - ) - ) - ) - ) - ) - ) - ) - ) - (none) - ) - *debug-hook* - ) - ) - -) - -|# \ No newline at end of file diff --git a/goal_src/jak2/engine/debug/menu.gc b/goal_src/jak2/engine/debug/menu.gc index 991d01dc9a..d12564b11b 100644 --- a/goal_src/jak2/engine/debug/menu.gc +++ b/goal_src/jak2/engine/debug/menu.gc @@ -655,7 +655,22 @@ arg0 ) -;; ERROR: function was not converted to expressions. Cannot decompile. +(defun debug-menu-func-decode ((arg0 object)) + (let ((v1-2 (rtype-of arg0))) + (the-as function (cond + ((or (= v1-2 symbol) (= v1-2 type)) + (-> (the-as symbol arg0) value) + ) + ((= v1-2 function) + arg0 + ) + (else + nothing + ) + ) + ) + ) + ) ;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 diff --git a/goal_src/jak2/engine/entity/entity-h.gc b/goal_src/jak2/engine/entity/entity-h.gc index a0b1d681ab..9a88fb1371 100644 --- a/goal_src/jak2/engine/entity/entity-h.gc +++ b/goal_src/jak2/engine/entity/entity-h.gc @@ -19,6 +19,7 @@ (complete 8) (bit-9 9) (bit-10 10) + (entity-perm-status-12 12) ) (declare-type race-mesh basic) @@ -125,7 +126,7 @@ :flag-assert #x1b00000034 (:methods (entity-method-22 (_type_) _type_ 22) - (entity-method-23 (_type_) _type_ 23) + (kill! (_type_) _type_ 23) (entity-method-24 () none 24) (entity-method-25 () none 25) (entity-method-26 () none 26) @@ -178,7 +179,7 @@ (next-actor (_type_) entity-actor 27) (prev-actor (_type_) entity-actor 28) (entity-actor-method-29 () none 29) - (entity-actor-method-30 () none 30) + (entity-actor-method-30 (_type_ entity-perm-status symbol) none 30) (entity-actor-method-31 (_type_ vector vector vector object float) nav-mesh 31) (entity-actor-method-32 (_type_ vector vector nav-poly float) nav-poly 32) ) diff --git a/goal_src/jak2/engine/game/game-info-h.gc b/goal_src/jak2/engine/game/game-info-h.gc index 1dcc2b7c46..0c5225cefc 100644 --- a/goal_src/jak2/engine/game/game-info-h.gc +++ b/goal_src/jak2/engine/game/game-info-h.gc @@ -212,7 +212,7 @@ (want-display-level (_type_ symbol symbol) int 13) (want-vis-level (_type_ symbol) none 14) (want-force-vis (_type_ symbol symbol) int 15) - (execute-command (_type_ pair) none 16) + (execute-command (_type_ pair object) none 16) (execute-commands-up-to (_type_ float) none 17) (backup-load-state-and-set-cmds (_type_ pair) int 18) (restore-load-state-and-cleanup (_type_) int 19) @@ -364,7 +364,7 @@ (game-info-method-18 () none 18) (get-current-continue-point (_type_) continue-point 19) (get-continue-by-name (_type_ string) continue-point 20) - (set-continue! (_type_ basic) continue-point 21) + (set-continue! (_type_ basic symbol) continue-point 21) (game-info-method-22 () none 22) (game-info-method-23 () none 23) (game-info-method-24 () none 24) diff --git a/goal_src/jak2/engine/game/settings-h.gc b/goal_src/jak2/engine/game/settings-h.gc index f80a1ee814..0953a18fdd 100644 --- a/goal_src/jak2/engine/game/settings-h.gc +++ b/goal_src/jak2/engine/game/settings-h.gc @@ -275,7 +275,7 @@ (:methods (new (symbol type int) _type_ 0) (add-setting (_type_ process symbol object object object) none 9) - (persist-with-delay (_type_ process time-frame object object float object) none 10) + (persist-with-delay (_type_ symbol time-frame symbol symbol float int) none 10) (set-setting (_type_ process symbol object object object) none 11) (remove-setting (_type_ process symbol) none 12) (kill-persister (_type_ engine-pers object) none 13) diff --git a/goal_src/jak2/engine/game/settings.gc b/goal_src/jak2/engine/game/settings.gc index e906b877c4..231bcc4077 100644 --- a/goal_src/jak2/engine/game/settings.gc +++ b/goal_src/jak2/engine/game/settings.gc @@ -547,6 +547,7 @@ obj ) +;; WARN: Return type mismatch cam-setting-data vs none. (defmethod cam-setting-data-method-10 cam-setting-data ((obj cam-setting-data) (arg0 object) (arg1 (pointer process)) (arg2 float) (arg3 int)) (case arg0 (('fov) @@ -805,12 +806,15 @@ (none) ) +;; WARN: Return type mismatch int vs none. (defmethod add-setting setting-control ((obj setting-control) (arg0 process) (arg1 symbol) (arg2 object) (arg3 object) (arg4 object)) + "Originally called `setting-set` see (anon-function 48 script)" (add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4) 0 (none) ) +;; WARN: Return type mismatch int vs none. (defmethod set-setting setting-control ((obj setting-control) (arg0 process) (arg1 symbol) (arg2 object) (arg3 object) (arg4 object)) (remove-setting obj arg0 arg1) (add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4) @@ -818,14 +822,9 @@ (none) ) -(defmethod persist-with-delay setting-control ((obj setting-control) - (arg0 process) - (arg1 time-frame) - (arg2 object) - (arg3 object) - (arg4 float) - (arg5 object) - ) +;; WARN: Return type mismatch int vs none. +(defmethod persist-with-delay setting-control ((obj setting-control) (arg0 symbol) (arg1 time-frame) (arg2 symbol) (arg3 symbol) (arg4 float) (arg5 int)) + "Originally called `setting-pers` see (anon-function 46 script)" (let ((v1-1 (schedule-callback (-> obj engine-pers) arg0 arg1))) (when v1-1 (set! (-> v1-1 param 0) arg2) @@ -838,6 +837,7 @@ (none) ) +;; WARN: Return type mismatch int vs none. (defmethod remove-setting setting-control ((obj setting-control) (arg0 process) (arg1 symbol)) (when arg0 (let ((s5-0 (-> obj engine)) @@ -857,6 +857,7 @@ (none) ) +;; WARN: Return type mismatch int vs none. (defmethod kill-persister setting-control ((obj setting-control) (arg0 engine-pers) (arg1 object)) "Calls [[engine-pers::kill-matching]]" (kill-matching @@ -888,6 +889,7 @@ (the-as connectable #f) ) +;; WARN: Return type mismatch int vs none. (defmethod remove-setting-by-arg0 setting-control ((obj setting-control) (arg0 object)) "Calls [[engine::remove-by-param0]] on `engine-hi`" (remove-by-param0 (-> obj engine-hi) arg0) diff --git a/goal_src/jak2/engine/game/task/game-task-h.gc b/goal_src/jak2/engine/game/task/game-task-h.gc index 461bc03e98..a7b2495502 100644 --- a/goal_src/jak2/engine/game/task/game-task-h.gc +++ b/goal_src/jak2/engine/game/task/game-task-h.gc @@ -9,6 +9,7 @@ (defenum game-task :type uint8 :bitfield #f + (unknown -1) (none 0) (complete 1) (dummy0 2) diff --git a/goal_src/jak2/engine/sound/gsound.gc b/goal_src/jak2/engine/sound/gsound.gc index cbf37f0bbd..2fe913f0bd 100644 --- a/goal_src/jak2/engine/sound/gsound.gc +++ b/goal_src/jak2/engine/sound/gsound.gc @@ -408,66 +408,64 @@ 0 ) -(defun sound-play-by-name ((arg0 sound-name) (arg1 sound-id) (arg2 int) (arg3 int) (arg4 int) (arg5 sound-group) (arg6 symbol)) +(defbehavior sound-play-by-name process-drawable ((arg0 sound-name) (arg1 sound-id) (arg2 int) (arg3 int) (arg4 int) (arg5 sound-group) (arg6 object)) (local-vars (sv-16 sound-group)) - (with-pp - (set! sv-16 arg5) - (let ((s4-0 (the-as object arg6))) - (when *sound-player-enable* - (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) - (set! (-> s5-0 command) (sound-command play)) - (set! (-> s5-0 id) arg1) - (set! (-> s5-0 name) arg0) - (set! (-> s5-0 params mask) (the-as uint 0)) - (set! (-> s5-0 params group) (the-as uint sv-16)) - (set! (-> s5-0 params volume) arg2) - (set! (-> s5-0 params pitch-mod) arg3) - (set! (-> s5-0 params bend) arg4) - (let ((s3-1 (the-as process-drawable pp))) - (when (= (the-as symbol s4-0) #t) - (if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root))) - (set! s4-0 (-> s3-1 root trans)) - (set! s4-0 #f) - ) - ) - ) - (sound-trans-convert (the-as vector3w (-> s5-0 params trans)) (the-as vector s4-0)) - ) - ) - ) - arg1 - ) - ) - -(defun sound-play-by-spec ((arg0 sound-spec) (arg1 sound-id) (arg2 vector)) - (with-pp + "Last arg can by a symbol with value [[#t]], in which case it will pull `trans` [[vector]] off the current [[process-drawable]] + otherwise, an explicit [[vector]] can be provided" + (set! sv-16 arg5) + (let ((s4-0 arg6)) (when *sound-player-enable* (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) (set! (-> s5-0 command) (sound-command play)) (set! (-> s5-0 id) arg1) - (set! (-> s5-0 name) (-> arg0 sound-name)) - (set! (-> s5-0 params mask) (the-as uint (-> arg0 mask))) - (set! (-> s5-0 params group-and-regs) (-> arg0 group-and-regs)) - (set! (-> s5-0 params volume) (-> arg0 volume)) - (set! (-> s5-0 params pitch-mod) (-> arg0 pitch-mod)) - (set! (-> s5-0 params bend) (-> arg0 bend)) - (set! (-> s5-0 params fo-min) (-> arg0 fo-min)) - (set! (-> s5-0 params fo-max) (-> arg0 fo-max)) - (set! (-> s5-0 params fo-curve) (-> arg0 fo-curve)) - (set! (-> s5-0 params priority) (-> arg0 priority)) - (let ((s3-1 (the-as process-drawable pp))) - (when (= arg2 #t) + (set! (-> s5-0 name) arg0) + (set! (-> s5-0 params mask) (the-as uint 0)) + (set! (-> s5-0 params group) (the-as uint sv-16)) + (set! (-> s5-0 params volume) arg2) + (set! (-> s5-0 params pitch-mod) arg3) + (set! (-> s5-0 params bend) arg4) + (let ((s3-1 self)) + (when (= s4-0 #t) (if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root))) - (set! arg2 (-> s3-1 root trans)) - (set! arg2 (the-as vector #f)) + (set! s4-0 (-> s3-1 root trans)) + (set! s4-0 #f) ) ) ) - (sound-trans-convert (the-as vector3w (-> s5-0 params trans)) arg2) + (sound-trans-convert (the-as vector3w (-> s5-0 params trans)) (the-as vector s4-0)) ) ) - arg1 ) + arg1 + ) + +(defbehavior sound-play-by-spec process-drawable ((arg0 sound-spec) (arg1 sound-id) (arg2 vector)) + (when *sound-player-enable* + (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) + (set! (-> s5-0 command) (sound-command play)) + (set! (-> s5-0 id) arg1) + (set! (-> s5-0 name) (-> arg0 sound-name)) + (set! (-> s5-0 params mask) (the-as uint (-> arg0 mask))) + (set! (-> s5-0 params group-and-regs) (-> arg0 group-and-regs)) + (set! (-> s5-0 params volume) (-> arg0 volume)) + (set! (-> s5-0 params pitch-mod) (-> arg0 pitch-mod)) + (set! (-> s5-0 params bend) (-> arg0 bend)) + (set! (-> s5-0 params fo-min) (-> arg0 fo-min)) + (set! (-> s5-0 params fo-max) (-> arg0 fo-max)) + (set! (-> s5-0 params fo-curve) (-> arg0 fo-curve)) + (set! (-> s5-0 params priority) (-> arg0 priority)) + (let ((s3-1 self)) + (when (= arg2 #t) + (if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root))) + (set! arg2 (-> s3-1 root trans)) + (set! arg2 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (the-as vector3w (-> s5-0 params trans)) arg2) + ) + ) + arg1 ) (defun sound-pause ((arg0 sound-id)) diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index 72eedec056..5f7d445fc1 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -3244,12 +3244,7 @@ (if (not arg0) (set! arg0 (get-current-continue-point *game-info*)) ) - (let* ((a0-6 *game-info*) - (t9-4 (method-of-object a0-6 set-continue!)) - (a1-3 arg0) - ) - (t9-4 a0-6 a1-3) - ) + (set-continue! *game-info* arg0 #f) (stack-size-set! (-> obj main-thread) 1024) (logior! (-> obj mask) (process-mask target)) (set! (-> obj state-hook) (the-as (function none :behavior target) nothing)) diff --git a/goal_src/jak2/engine/util/script-h.gc b/goal_src/jak2/engine/util/script-h.gc index 9f51ccdf33..ec41456aef 100644 --- a/goal_src/jak2/engine/util/script-h.gc +++ b/goal_src/jak2/engine/util/script-h.gc @@ -19,10 +19,11 @@ ;; DECOMP BEGINS (deftype script-form (structure) - ((name string :offset-assert 0) - (spec basic :offset-assert 4) - (func basic :offset-assert 8) + ((name symbol :offset-assert 0) + (spec pair :offset-assert 4) + (func (function script-context object) :offset-assert 8) ) + :pack-me :method-count-assert 10 :size-assert #xc :flag-assert #xa0000000c @@ -39,7 +40,7 @@ (trans vector :offset-assert 12) (side-effect? symbol :offset-assert 16) (got-error? symbol :offset-assert 20) - (expr basic :offset-assert 24) + (expr pair :offset-assert 24) (param-count int32 :offset-assert 28) (param object 16 :offset-assert 32) (param-type object 16 :offset-assert 96) @@ -49,9 +50,9 @@ :flag-assert #xc000000a0 (:methods (new (symbol type basic process vector) _type_ 0) - (eval! (_type_ structure) pair 9) - (script-context-method-10 () none 10) - (script-context-method-11 () none 11) + (eval! (_type_ object) object 9) + (script-context-method-10 (_type_ object pair) object 10) + (script-context-method-11 (_type_ pair pair symbol) symbol 11) ) ) diff --git a/goal_src/jak2/engine/util/script.gc b/goal_src/jak2/engine/util/script.gc index 789c35532d..8414feb9f9 100644 --- a/goal_src/jak2/engine/util/script.gc +++ b/goal_src/jak2/engine/util/script.gc @@ -7,3 +7,40 @@ ;; DECOMP BEGINS +(defun command-get-int ((arg0 object) (arg1 int)) + (cond + ((null? arg0) + (empty) + arg1 + ) + ((type? arg0 binteger) + (the-as int (/ (the-as int arg0) 8)) + ) + ((type? arg0 bfloat) + (the int (-> (the-as bfloat arg0) data)) + ) + (else + (empty) + arg1 + ) + ) + ) + +(defun command-get-float ((arg0 object) (arg1 float)) + (cond + ((null? arg0) + (empty) + arg1 + ) + ((type? arg0 binteger) + (the float (/ (the-as int arg0) 8)) + ) + ((type? arg0 bfloat) + (-> (the-as bfloat arg0) data) + ) + (else + (empty) + arg1 + ) + ) + ) diff --git a/goal_src/jak2/levels/common/airlock.gc b/goal_src/jak2/levels/common/airlock.gc index 1da47a0fea..a6617cb6a6 100644 --- a/goal_src/jak2/levels/common/airlock.gc +++ b/goal_src/jak2/levels/common/airlock.gc @@ -186,7 +186,9 @@ (set! (-> obj were-behind?) #t) ) (and (< (-> obj latch-closed-time) (-> self clock frame-counter)) - (or (not (and *target* (logtest? (focus-status pilot teleporting) (-> *target* focus-status)))) (< f30-0 -409.6)) + (or (not (and *target* (logtest? (focus-status pilot teleporting) (-> *target* focus-status)))) + (< f30-0 -409.6) + ) (or (and (< f30-0 (-> obj open-distance)) (or (not (-> obj were-behind?)) (< f30-0 20480.0)) (and (or (< 409.6 f30-0) @@ -200,7 +202,7 @@ ) (and (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) - (the-as structure (-> obj open-test)) + (-> obj open-test) ) (-> *setting-control* user-current airlock) ) @@ -241,19 +243,22 @@ ) ) (arg0 - (let* ((s3-0 gp-1) (s2-0 (car s3-0))) (while (not (null? s3-0)) - (let ((v1-4 (level-status *level* (the-as symbol s2-0)))) - (if (not (or (= v1-4 'loaded) (= v1-4 'active))) - (return #f) - ) - ) - (if (= s2-0 'ctywide) - (set! s4-0 (-> ctywide borrow-level 1)) - ) - (set! s3-0 (cdr s3-0)) - (set! s2-0 (car s3-0)) - ) + (let* ((s3-0 gp-1) + (s2-0 (car s3-0)) + ) + (while (not (null? s3-0)) + (let ((v1-4 (level-status *level* (the-as symbol s2-0)))) + (if (not (or (= v1-4 'loaded) (= v1-4 'active))) + (return #f) + ) ) + (if (= s2-0 'ctywide) + (set! s4-0 (-> ctywide borrow-level 1)) + ) + (set! s3-0 (cdr s3-0)) + (set! s2-0 (car (the-as pair s3-0))) + ) + ) (when s4-0 (let ((v1-17 (level-status *level* s4-0))) (if (not (or (= v1-17 'loaded) (= v1-17 'active))) @@ -272,25 +277,28 @@ ) ) (set! gp-1 (cdr gp-1)) - (set! a1-7 (car gp-1)) + (set! a1-7 (car (the-as pair gp-1))) ) ) #t ) (else - (let* ((v1-33 gp-1) (a0-11 (car v1-33))) (while (not (null? v1-33)) - (dotimes (a1-10 6) - (if (= a0-11 (-> *load-state* want a1-10 name)) - (goto cfg-50) - ) - ) - #t - (return #f) - (label cfg-50) - (set! v1-33 (cdr v1-33)) - (set! a0-11 (car v1-33)) - ) + (let* ((v1-33 gp-1) + (a0-11 (car v1-33)) + ) + (while (not (null? v1-33)) + (dotimes (a1-10 6) + (if (= a0-11 (-> *load-state* want a1-10 name)) + (goto cfg-50) + ) ) + #t + (return #f) + (label cfg-50) + (set! v1-33 (cdr v1-33)) + (set! a0-11 (car (the-as pair v1-33))) + ) + ) #t ) ) @@ -550,12 +558,15 @@ (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-0) ) ) - (when (-> self were-behind?) - (let ((gp-1 (res-lump-struct (-> self entity) 'on-inside structure))) - (set! (-> self were-behind?) #f) - (if (and gp-1 (not *scene-player*)) - (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-1) - ) + (the-as + pair + (when (-> self were-behind?) + (let ((gp-1 (res-lump-struct (-> self entity) 'on-inside structure))) + (set! (-> self were-behind?) #f) + (if (and gp-1 (not *scene-player*)) + (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-1) + ) + ) ) ) ) diff --git a/goalc/compiler/compilation/Static.cpp b/goalc/compiler/compilation/Static.cpp index 4bd9e3d82a..b5e1b26b2c 100644 --- a/goalc/compiler/compilation/Static.cpp +++ b/goalc/compiler/compilation/Static.cpp @@ -1081,7 +1081,7 @@ StaticResult Compiler::fill_static_inline_array(const goos::Object& form, Val* Compiler::compile_static_pair(const goos::Object& form, Env* env, int seg) { ASSERT(form.is_pair()); // (quote PAIR) - auto result = compile_static_no_eval_for_pairs(form, env, seg, true); + auto result = compile_static_no_eval_for_pairs(form, env, seg, false); ASSERT(result.is_reference()); auto fe = env->function_env(); auto static_result = fe->alloc_val(result.reference(), result.typespec()); diff --git a/test/decompiler/reference/jak2/engine/ambient/ambient-h_REF.gc b/test/decompiler/reference/jak2/engine/ambient/ambient-h_REF.gc index 6ba4638853..f1a9e2c91b 100644 --- a/test/decompiler/reference/jak2/engine/ambient/ambient-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ambient/ambient-h_REF.gc @@ -20,10 +20,10 @@ :flag-assert #xe00000018 (:methods (talker-speech-class-method-9 () none 9) - (talker-speech-class-method-10 () none 10) + (talker-speech-class-method-10 (_type_) none 10) (talker-speech-class-method-11 () none 11) - (talker-speech-class-method-12 () none 12) - (talker-speech-class-method-13 () none 13) + (talker-speech-class-method-12 (_type_ int) none 12) + (talker-speech-class-method-13 (_type_ int) none 13) ) ) diff --git a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc index 6ed7bef172..6fc1cf6b06 100644 --- a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc @@ -2005,7 +2005,7 @@ (when s4-0 (let ((gp-1 (-> arg3 param 0))) (set! (-> *syntax-context* got-error?) #f) - (eval! *syntax-context* (the-as structure gp-1)) + (eval! *syntax-context* gp-1) (when (not (-> *syntax-context* got-error?)) (set! (-> s4-0 changed) #t) (cond diff --git a/test/decompiler/reference/jak2/engine/debug/menu_REF.gc b/test/decompiler/reference/jak2/engine/debug/menu_REF.gc index 96bce554b8..a1f1f81c53 100644 --- a/test/decompiler/reference/jak2/engine/debug/menu_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/menu_REF.gc @@ -684,7 +684,24 @@ ) ;; definition for function debug-menu-func-decode -;; ERROR: function was not converted to expressions. Cannot decompile. +;; WARN: Return type mismatch object vs function. +;; WARN: Using new Jak 2 rtype-of +(defun debug-menu-func-decode ((arg0 object)) + (let ((v1-2 (rtype-of arg0))) + (the-as function (cond + ((or (= v1-2 symbol) (= v1-2 type)) + (-> (the-as symbol arg0) value) + ) + ((= v1-2 function) + arg0 + ) + (else + nothing + ) + ) + ) + ) + ) ;; definition for function debug-menu-make-from-template ;; INFO: Used lq/sq diff --git a/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc b/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc index a94e7777e3..88eca62a06 100644 --- a/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc @@ -231,7 +231,7 @@ :flag-assert #x1b00000034 (:methods (entity-method-22 (_type_) _type_ 22) - (entity-method-23 (_type_) _type_ 23) + (kill! (_type_) _type_ 23) (entity-method-24 () none 24) (entity-method-25 () none 25) (entity-method-26 () none 26) @@ -288,7 +288,7 @@ (next-actor (_type_) entity-actor 27) (prev-actor (_type_) entity-actor 28) (entity-actor-method-29 () none 29) - (entity-actor-method-30 () none 30) + (entity-actor-method-30 (_type_ entity-perm-status symbol) none 30) (entity-actor-method-31 (_type_ vector vector vector object float) nav-mesh 31) (entity-actor-method-32 (_type_ vector vector nav-poly float) nav-poly 32) ) diff --git a/test/decompiler/reference/jak2/engine/game/game-info-h_REF.gc b/test/decompiler/reference/jak2/engine/game/game-info-h_REF.gc index db57d9104d..1de5a6fa62 100644 --- a/test/decompiler/reference/jak2/engine/game/game-info-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-info-h_REF.gc @@ -131,7 +131,7 @@ (want-display-level (_type_ symbol symbol) int 13) (want-vis-level (_type_ symbol) none 14) (want-force-vis (_type_ symbol symbol) int 15) - (execute-command (_type_ pair) none 16) + (execute-command (_type_ pair object) none 16) (execute-commands-up-to (_type_ float) none 17) (backup-load-state-and-set-cmds (_type_ pair) int 18) (restore-load-state-and-cleanup (_type_) int 19) @@ -335,7 +335,7 @@ (game-info-method-18 () none 18) (get-current-continue-point (_type_) continue-point 19) (get-continue-by-name (_type_ string) continue-point 20) - (set-continue! (_type_ basic) continue-point 21) + (set-continue! (_type_ basic symbol) continue-point 21) (game-info-method-22 () none 22) (game-info-method-23 () none 23) (game-info-method-24 () none 24) diff --git a/test/decompiler/reference/jak2/engine/game/settings-h_REF.gc b/test/decompiler/reference/jak2/engine/game/settings-h_REF.gc index 21f1b02c1a..fe713a516b 100644 --- a/test/decompiler/reference/jak2/engine/game/settings-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/settings-h_REF.gc @@ -560,7 +560,7 @@ (:methods (new (symbol type int) _type_ 0) (add-setting (_type_ process symbol object object object) none 9) - (persist-with-delay (_type_ process time-frame object object float object) none 10) + (persist-with-delay (_type_ symbol time-frame symbol symbol float int) none 10) (set-setting (_type_ process symbol object object object) none 11) (remove-setting (_type_ process symbol) none 12) (kill-persister (_type_ engine-pers object) none 13) diff --git a/test/decompiler/reference/jak2/engine/game/settings_REF.gc b/test/decompiler/reference/jak2/engine/game/settings_REF.gc index 0db25ccaac..71c4c5c4d2 100644 --- a/test/decompiler/reference/jak2/engine/game/settings_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/settings_REF.gc @@ -806,6 +806,7 @@ ;; definition for method 9 of type setting-control ;; WARN: Return type mismatch int vs none. (defmethod add-setting setting-control ((obj setting-control) (arg0 process) (arg1 symbol) (arg2 object) (arg3 object) (arg4 object)) + "Originally called `setting-set` see (anon-function 48 script)" (add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4) 0 (none) @@ -822,14 +823,8 @@ ;; definition for method 10 of type setting-control ;; WARN: Return type mismatch int vs none. -(defmethod persist-with-delay setting-control ((obj setting-control) - (arg0 process) - (arg1 time-frame) - (arg2 object) - (arg3 object) - (arg4 float) - (arg5 object) - ) +(defmethod persist-with-delay setting-control ((obj setting-control) (arg0 symbol) (arg1 time-frame) (arg2 symbol) (arg3 symbol) (arg4 float) (arg5 int)) + "Originally called `setting-pers` see (anon-function 46 script)" (let ((v1-1 (schedule-callback (-> obj engine-pers) arg0 arg1))) (when v1-1 (set! (-> v1-1 param 0) arg2) diff --git a/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc b/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc index fbb387e310..c34328ae4f 100644 --- a/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc @@ -687,68 +687,66 @@ ;; definition for function sound-play-by-name ;; INFO: Used lq/sq -(defun sound-play-by-name ((arg0 sound-name) (arg1 sound-id) (arg2 int) (arg3 int) (arg4 int) (arg5 sound-group) (arg6 symbol)) +(defbehavior sound-play-by-name process-drawable ((arg0 sound-name) (arg1 sound-id) (arg2 int) (arg3 int) (arg4 int) (arg5 sound-group) (arg6 object)) + "Last arg can by a symbol with value [[#t]], in which case it will pull `trans` [[vector]] off the current [[process-drawable]] + otherwise, an explicit [[vector]] can be provided" (local-vars (sv-16 sound-group)) - (with-pp - (set! sv-16 arg5) - (let ((s4-0 (the-as object arg6))) - (when *sound-player-enable* - (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) - (set! (-> s5-0 command) (sound-command play)) - (set! (-> s5-0 id) arg1) - (set! (-> s5-0 name) arg0) - (set! (-> s5-0 params mask) (the-as uint 0)) - (set! (-> s5-0 params group) (the-as uint sv-16)) - (set! (-> s5-0 params volume) arg2) - (set! (-> s5-0 params pitch-mod) arg3) - (set! (-> s5-0 params bend) arg4) - (let ((s3-1 (the-as process-drawable pp))) - (when (= (the-as symbol s4-0) #t) - (if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root))) - (set! s4-0 (-> s3-1 root trans)) - (set! s4-0 #f) - ) - ) - ) - (sound-trans-convert (the-as vector3w (-> s5-0 params trans)) (the-as vector s4-0)) - ) - ) - ) - arg1 - ) - ) - -;; definition for function sound-play-by-spec -;; INFO: Used lq/sq -(defun sound-play-by-spec ((arg0 sound-spec) (arg1 sound-id) (arg2 vector)) - (with-pp + (set! sv-16 arg5) + (let ((s4-0 arg6)) (when *sound-player-enable* (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) (set! (-> s5-0 command) (sound-command play)) (set! (-> s5-0 id) arg1) - (set! (-> s5-0 name) (-> arg0 sound-name)) - (set! (-> s5-0 params mask) (the-as uint (-> arg0 mask))) - (set! (-> s5-0 params group-and-regs) (-> arg0 group-and-regs)) - (set! (-> s5-0 params volume) (-> arg0 volume)) - (set! (-> s5-0 params pitch-mod) (-> arg0 pitch-mod)) - (set! (-> s5-0 params bend) (-> arg0 bend)) - (set! (-> s5-0 params fo-min) (-> arg0 fo-min)) - (set! (-> s5-0 params fo-max) (-> arg0 fo-max)) - (set! (-> s5-0 params fo-curve) (-> arg0 fo-curve)) - (set! (-> s5-0 params priority) (-> arg0 priority)) - (let ((s3-1 (the-as process-drawable pp))) - (when (= arg2 #t) + (set! (-> s5-0 name) arg0) + (set! (-> s5-0 params mask) (the-as uint 0)) + (set! (-> s5-0 params group) (the-as uint sv-16)) + (set! (-> s5-0 params volume) arg2) + (set! (-> s5-0 params pitch-mod) arg3) + (set! (-> s5-0 params bend) arg4) + (let ((s3-1 self)) + (when (= s4-0 #t) (if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root))) - (set! arg2 (-> s3-1 root trans)) - (set! arg2 (the-as vector #f)) + (set! s4-0 (-> s3-1 root trans)) + (set! s4-0 #f) ) ) ) - (sound-trans-convert (the-as vector3w (-> s5-0 params trans)) arg2) + (sound-trans-convert (the-as vector3w (-> s5-0 params trans)) (the-as vector s4-0)) ) ) - arg1 ) + arg1 + ) + +;; definition for function sound-play-by-spec +;; INFO: Used lq/sq +(defbehavior sound-play-by-spec process-drawable ((arg0 sound-spec) (arg1 sound-id) (arg2 vector)) + (when *sound-player-enable* + (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) + (set! (-> s5-0 command) (sound-command play)) + (set! (-> s5-0 id) arg1) + (set! (-> s5-0 name) (-> arg0 sound-name)) + (set! (-> s5-0 params mask) (the-as uint (-> arg0 mask))) + (set! (-> s5-0 params group-and-regs) (-> arg0 group-and-regs)) + (set! (-> s5-0 params volume) (-> arg0 volume)) + (set! (-> s5-0 params pitch-mod) (-> arg0 pitch-mod)) + (set! (-> s5-0 params bend) (-> arg0 bend)) + (set! (-> s5-0 params fo-min) (-> arg0 fo-min)) + (set! (-> s5-0 params fo-max) (-> arg0 fo-max)) + (set! (-> s5-0 params fo-curve) (-> arg0 fo-curve)) + (set! (-> s5-0 params priority) (-> arg0 priority)) + (let ((s3-1 self)) + (when (= arg2 #t) + (if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root))) + (set! arg2 (-> s3-1 root trans)) + (set! arg2 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (the-as vector3w (-> s5-0 params trans)) arg2) + ) + ) + arg1 ) ;; definition for function sound-pause @@ -1023,7 +1021,7 @@ (-> obj pitch) 0 (sound-group sfx) - (the-as symbol (-> obj trans)) + (-> obj trans) ) ) ) @@ -1037,7 +1035,7 @@ (-> obj pitch) 0 (sound-group sfx) - (the-as symbol (-> obj trans)) + (-> obj trans) ) ) (set! (-> obj play-time) diff --git a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc index abd510d7aa..b2f98bcd4e 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -3293,12 +3293,7 @@ (if (not arg0) (set! arg0 (get-current-continue-point *game-info*)) ) - (let* ((a0-6 *game-info*) - (t9-4 (method-of-object a0-6 set-continue!)) - (a1-3 arg0) - ) - (t9-4 a0-6 a1-3) - ) + (set-continue! *game-info* arg0 #f) (stack-size-set! (-> obj main-thread) 1024) (logior! (-> obj mask) (process-mask target)) (set! (-> obj state-hook) (the-as (function none :behavior target) nothing)) diff --git a/test/decompiler/reference/jak2/engine/util/script-h_REF.gc b/test/decompiler/reference/jak2/engine/util/script-h_REF.gc index 7d675efa01..78c23e5a24 100644 --- a/test/decompiler/reference/jak2/engine/util/script-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/util/script-h_REF.gc @@ -3,10 +3,11 @@ ;; definition of type script-form (deftype script-form (structure) - ((name string :offset-assert 0) - (spec basic :offset-assert 4) - (func basic :offset-assert 8) + ((name symbol :offset-assert 0) + (spec pair :offset-assert 4) + (func (function script-context object) :offset-assert 8) ) + :pack-me :method-count-assert 10 :size-assert #xc :flag-assert #xa0000000c @@ -37,7 +38,7 @@ (trans vector :offset-assert 12) (side-effect? symbol :offset-assert 16) (got-error? symbol :offset-assert 20) - (expr basic :offset-assert 24) + (expr pair :offset-assert 24) (param-count int32 :offset-assert 28) (param object 16 :offset-assert 32) (param-type object 16 :offset-assert 96) @@ -47,9 +48,9 @@ :flag-assert #xc000000a0 (:methods (new (symbol type basic process vector) _type_ 0) - (eval! (_type_ structure) pair 9) - (script-context-method-10 () none 10) - (script-context-method-11 () none 11) + (eval! (_type_ object) object 9) + (script-context-method-10 (_type_ object pair) object 10) + (script-context-method-11 (_type_ pair pair symbol) symbol 11) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc index c6af24d84a..4dd41446c5 100644 --- a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc @@ -251,7 +251,7 @@ ) (and (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) - (the-as structure (-> obj open-test)) + (-> obj open-test) ) (-> *setting-control* user-current airlock) ) @@ -306,7 +306,7 @@ (set! s4-0 (-> ctywide borrow-level 1)) ) (set! s3-0 (cdr s3-0)) - (set! s2-0 (car s3-0)) + (set! s2-0 (car (the-as pair s3-0))) ) ) (when s4-0 @@ -327,7 +327,7 @@ ) ) (set! gp-1 (cdr gp-1)) - (set! a1-7 (car gp-1)) + (set! a1-7 (car (the-as pair gp-1))) ) ) #t @@ -346,7 +346,7 @@ (return #f) (label cfg-50) (set! v1-33 (cdr v1-33)) - (set! a0-11 (car v1-33)) + (set! a0-11 (car (the-as pair v1-33))) ) ) #t @@ -613,12 +613,15 @@ (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-0) ) ) - (when (-> self were-behind?) - (let ((gp-1 (res-lump-struct (-> self entity) 'on-inside structure))) - (set! (-> self were-behind?) #f) - (if (and gp-1 (not *scene-player*)) - (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-1) - ) + (the-as + pair + (when (-> self were-behind?) + (let ((gp-1 (res-lump-struct (-> self entity) 'on-inside structure))) + (set! (-> self were-behind?) #f) + (if (and gp-1 (not *scene-player*)) + (eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-1) + ) + ) ) ) )