diff --git a/.vscode/launch.json b/.vscode/launch.json index 6db58b557a..197e1c8c32 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,8 @@ "request": "launch", "program": "${workspaceFolder}/scripts/gsrc/update-from-decomp.py", "console": "integratedTerminal", - "cwd": "${workspaceFolder}" + "cwd": "${workspaceFolder}", + "args": ["--game", "jak2", "--file", "sky-data"] }, ] } diff --git a/Taskfile.yml b/Taskfile.yml index ba25f23205..b6d9644a43 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -83,10 +83,17 @@ tasks: decomp: cmds: - '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/{{.DECOMP_CONFIG}}" "./iso_data" "./decompiler_out"' + decomp-file: + cmds: + - "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler \"./decompiler/config/{{.DECOMP_CONFIG}}\" \"./iso_data\" \"./decompiler_out\" --config-override '{\"allowed_objects\": [\"{{.FILE}}\"]}'" decomp-clean: cmds: - rm ./decompiler_out/**/*.asm - rm ./decompiler_out/**/*disasm.gc + update-gsrc: # TODO - make this use git to update all files changed in _REF + cmds: + - task: decomp-file + - python ./scripts/gsrc/update-from-decomp.py --game "{{.GAME}}" --file {{.FILE}} # TOOLS analyze-ee-memory: cmds: @@ -108,15 +115,10 @@ tasks: ignore_error: true - python ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/ - task: offline-tests - # find-label-types: - # cmds: - # - python ./scripts/next-decomp-file.py --files "{{.FILES}}" - # - task: decomp - # - python ./scripts/find-label-types.py --file "{{.FILES}}" # check-gsrc-file: # cmds: # - python ./scripts/check-gsrc-file.py --files "{{.FILES}}" type-test: cmds: - - cmd: '{{.GOALCTEST_BIN_RELEASE_DIR}}/goalc-test --gtest_brief=0 --gtest_filter="*MANUAL_TEST_TypeConsistencyWithBuildFirst*"' + - cmd: '{{.GOALCTEST_BIN_RELEASE_DIR}}/goalc-test --gtest_brief=0 --gtest_filter="*Jak2TypeConsistency*"' ignore_error: true diff --git a/decompiler/config.cpp b/decompiler/config.cpp index 4f2673b301..69b2080118 100644 --- a/decompiler/config.cpp +++ b/decompiler/config.cpp @@ -29,6 +29,7 @@ Config read_config_file(const fs::path& path_to_config_file, const std::string& Config config; auto config_str = file_util::read_text_file(path_to_config_file); auto cfg = parse_commented_json(config_str, path_to_config_file.string()); + fmt::print("Config Overide: '{}'\n", override_json); auto cfg_override = parse_commented_json(override_json, ""); cfg.update(cfg_override); diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index f519e28a07..c66434858d 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -18887,7 +18887,6 @@ ;; - Unknowns -;;(define-extern sky-base-polygons object) ;; unknown type (define-extern sky-base-polygons (inline-array sky-vertex)) diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 55586a6c6c..2861024b0f 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -2995,6 +2995,7 @@ (debug-no-zbuf 325) ) +;; TODO - names in `render` menu (defenum vu1-renderer-mask :type uint64 :bitfield #t @@ -4830,6 +4831,7 @@ ) ) +(declare-type adgif-shader structure) (deftype shader-ptr (uint32) ((shader uint32 :offset 8 :size 24)) :method-count-assert 9 @@ -4838,7 +4840,7 @@ ) (deftype texture-link (structure) - ((next shader-ptr :offset-assert 0) ;; guessed by decompiler + ((next shader-ptr 1 :offset-assert 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x4 @@ -5441,8 +5443,8 @@ (time-until-random mood-weather :inline :offset-assert 80) (time-until-random-min mood-weather :inline :offset-assert 88) (time-until-random-max mood-weather :inline :offset-assert 96) - (display-flag basic :offset-assert 104) - (overide-weather-flag basic :offset-assert 108) + (display-flag symbol :offset-assert 104) + (overide-weather-flag symbol :offset-assert 108) (overide mood-weather :inline :offset-assert 112) (lightning-index int32 :offset-assert 120) (lightning-val int32 :offset-assert 124) @@ -5720,7 +5722,7 @@ (vis-self-index int32 :offset-assert 2440) (vis-adj-index int32 :offset-assert 2444) (vis-buffer uint8 2048 :offset-assert 2448) - (mem-usage-block basic :offset-assert 4496) + (mem-usage-block memory-usage-block :offset-assert 4496) (mem-usage int32 :offset-assert 4500) (code-memory-start pointer :offset-assert 4504) (code-memory-end pointer :offset-assert 4508) @@ -5819,7 +5821,7 @@ (load-order uint64 :offset-assert 208) ;; ? (pad uint8 30) - (level level 7 :inline :offset-assert 256) + (level level 7 :inline :offset-assert 256 :score -1) (level0 level :inline :offset 256) (level1 level :inline :offset 5488) (level2 level :inline :offset 10720) @@ -5893,9 +5895,9 @@ (deftype screen-shot-work (structure) ((count int16 :offset-assert 0) (size int16 :offset-assert 2) - (name basic :offset-assert 4) - (highres-enable basic :offset-assert 8) - (hud-enable basic :offset-assert 12) + (name string :offset-assert 4) + (highres-enable symbol :offset-assert 8) + (hud-enable symbol :offset-assert 12) ) :method-count-assert 9 :size-assert #x10 @@ -7035,7 +7037,7 @@ (ambient (pointer process) :offset-assert 56) (video-mode symbol) (aspect-ratio symbol :offset-assert 64) - (unknown-uint32-02 uint32 :offset 68) + (unknown-uint32-00 uint32 :offset 68) (auto-save symbol :offset 72) (bg-r float :offset-assert 76) (bg-g float) @@ -7424,7 +7426,7 @@ ;; (define-extern texture-relocate function) ;; (function dma-buffer texture int gs-psm int dma-buffer) (define-extern relocate-later (function symbol)) ;; (define-extern texture-page-login function) ;; (function texture-id (function texture-pool texture-page kheap int texture-page) kheap texture-page-dir-entry) -;; (define-extern lookup-texture-by-id function) ;; (function texture-id texture) +(define-extern lookup-texture-by-id (function texture-id texture)) ;; (define-extern lookup-texture-by-id-fast function) ;; (define-extern lookup-texture-by-name function) ;; (define-extern lookup-texture-id-by-name function) @@ -7433,7 +7435,7 @@ (define-extern *edit-shader* texture-id) ;; (define-extern link-texture-by-id function) ;; (function texture-id adgif-shader texture-page-dir-entry) ;; (define-extern adgif-shader<-texture! function) ;; (function adgif-shader texture adgif-shader) -;; (define-extern adgif-shader-update! function) ;; (function adgif-shader texture none) +(define-extern adgif-shader-update! (function adgif-shader texture none)) ;; (define-extern adgif-shader<-texture-with-update! function) ;; (function adgif-shader texture adgif-shader) ;; (define-extern hack-texture function) ;; (define-extern adgif-shader-login function) ;; (function adgif-shader texture) @@ -7444,7 +7446,7 @@ (define-extern set-dirty-mask! "First arg is the level name off the [[*level*]]'s `default-level`" (function string int int int none)) -;; (define-extern texture-page-dir-inspect function) ;; (function texture-page-dir symbol none) +(define-extern texture-page-dir-inspect (function texture-page-dir symbol none)) (define-extern *texture-pool* texture-pool) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -7554,7 +7556,28 @@ (define-extern *display-instance-info* symbol) (define-extern *display-deci-count* symbol) (define-extern *sync-dma* symbol) -(define-extern *display-strip-lines* int) + +;; +++main-h:strip-lines-controls +(defenum strip-lines-controls + :type int64 + (none 0) + (strippable 1) + (convertible 2) + (good 3) + (edgeable 4) + (ordinary 8) + (color-mismatch 16) + (shader-mismatch 32) + (uv-mismatch 64) + (too-big 128) + (bad 240) + (all-edges 255) + (strips 256) + (frags 512)) +;; ---main-h:strip-lines-controls + +(define-extern *display-strip-lines* strip-lines-controls) + (define-extern *display-battle-marks* symbol) (define-extern *display-joint-axes* symbol) (define-extern *display-nav-marks* symbol) @@ -7590,19 +7613,111 @@ (define-extern *debug-unkillable* symbol) (define-extern *debug-actor* object) (define-extern *gun-marks* symbol) + +;; TODO - is a symbol for sure but...you can pick multiple options? +;; (defenum bug-report-mode +;; :bitfield #t +;; :type int64 +;; (display) +;; (screen) +;; (listener) +;; (file)) + (define-extern *bug-report-output-mode* symbol) -(define-extern *display-scene-control* int) -(define-extern *display-bot-marks* int) -(define-extern *display-race-marks* int) + +;; +++main-h:scene-controls +(defenum scene-controls + :type int64 + (all-off 0) + (channel 1) + (anim-name 2) + (dma-size 4) + (bounds-spheres 8) + (actors 16) + (actor-marks 32) + (special-fma-spheres 64) + (all-on 95)) +;; ---main-h:scene-controls + +(define-extern *display-scene-control* scene-controls) + +;; +++main-h:bot-marks-controls +(defenum bot-marks-controls + :type int64 + (all-off 0) + (course-spots 1) + (task-spots 2) + (all-on 3)) +;; ---main-h:bot-marks-controls + +(define-extern *display-bot-marks* bot-marks-controls) + +;; +++main-h:race-marks-controls +(defenum race-marks-controls + :type int64 + (all-off 0) + (path0-red 1) + (path1-green 2) + (path2-blue 4) + (path3-yellow 8) + (path4-cyan 16) + (path5-violet 32) + (path6-orange 64) + (path7-black 128) + (all-paths-on 255)) +;; ---main-h:race-marks-controls + +(define-extern *display-race-marks* race-marks-controls) (define-extern *race-record-path* symbol) -(define-extern *select-race* int) + +;; +++main-h:race-selection +(defenum race-selection + :type int64 + (kiera-class3 0) + (kiera-class2 1) + (kiera-class1 2) + (errol 3) + (bush-class3 4) + (bush-class2 5) + (bush-class1 6) + (bush-errol 7) + (bush-port 8) + (bush-class3-reverse 9) + (bush-class2-reverse 10) + (bush-class1-reverse 11)) +;; ---main-h:race-selection + +(define-extern *select-race* race-selection) (define-extern *select-race-path* int) (define-extern *bot-record-path* int) -(define-extern *subdivide-draw-mode* int) -(define-extern *subdivide-scissor-draw-mode* int) -(define-extern *subdivide-foreground-draw-mode* int) -(define-extern *subdivide-ocean-draw-mode* int) -(define-extern *ocean-height-hack* int) + +;; +++main-h:subdivide-setting +(defenum subdivide-setting + :type int64 + (textured 0) + (outline 1) + (gouraud 2) + (hack 3)) +;; ---main-h:subdivide-setting + +(define-extern *subdivide-draw-mode* subdivide-setting) +(define-extern *subdivide-scissor-draw-mode* subdivide-setting) +(define-extern *subdivide-foreground-draw-mode* subdivide-setting) +(define-extern *subdivide-ocean-draw-mode* subdivide-setting) + +;; +++main-h:ocean-height-hack +(defenum ocean-height-hack + :type int64 + (zero 1) + (far-below 2) + (sewer-start 3) + (sewer-hi 4) + (sewer-med 5) + (sewer-lo 6)) +;; ---main-h:ocean-height-hack + +(define-extern *ocean-height-hack* ocean-height-hack) + (define-extern *dproc* process) (define-extern *run* symbol) (define-extern *teleport* symbol) @@ -8762,7 +8877,7 @@ ) (deftype sky-sun-data (structure) - ((data uint128 4 :offset-assert 0) ;; guessed by decompiler + ((data uint128 4 :offset-assert 0 :score -1) ;; guessed by decompiler (pos vector :inline :offset 0) (r-sun float :offset 16) (r-halo float :offset 20) @@ -8804,7 +8919,7 @@ ) (deftype sky-upload-data (structure) - ((data uint128 10 :offset-assert 0) ;; guessed by decompiler + ((data uint128 10 :offset-assert 0 :score -1) ;; guessed by decompiler (sun sky-sun-data 2 :inline :offset 0) ;; guessed by decompiler (moon sky-moon-data :inline :offset 128) ) @@ -8913,12 +9028,12 @@ (moon1-coords vector 2 :inline :offset-assert 320) (moon2-coords vector 2 :inline :offset-assert 352) (star-coords vector 2 :inline :offset-assert 384) - (sun-colors vector 2 :inline :offset-assert 416) - (green-colors vector 2 :inline :offset-assert 448) - (moon-colors vector 3 :inline :offset-assert 480) - (star-colors vector 16 :inline :offset-assert 528) + (sun-colors vector4w 2 :inline :offset-assert 416) + (green-colors vector4w 2 :inline :offset-assert 448) + (moon-colors vector4w 3 :inline :offset-assert 480) + (star-colors vector4w 16 :inline :offset-assert 528) (st-coords vector 2 :inline :offset-assert 784) - (random vector 8 :inline :offset-assert 816) + (random vector4w 8 :inline :offset-assert 816) (giftag-base dma-gif :inline :offset-assert 944) (giftag-haze dma-gif :inline :offset-assert 960) (giftag-roof dma-gif :inline :offset-assert 976) @@ -8930,12 +9045,12 @@ (off-t uint16 :offset-assert 1062) (orbit sky-orbit 3 :inline :offset-assert 1064) (upload-data sky-upload-data :inline :offset-assert 1168) - (ambi-color vector :inline :offset-assert 1328) - (ambi-color-lower vector :inline :offset-assert 1344) - (sun0-color vector :inline :offset-assert 1360) - (sun1-color vector :inline :offset-assert 1376) - (moon-color vector :inline :offset-assert 1392) - (sun0-color-lower vector :inline :offset-assert 1408) + (ambi-color vector4w :inline :offset-assert 1328) + (ambi-color-lower vector4w :inline :offset-assert 1344) + (sun0-color vector4w :inline :offset-assert 1360) + (sun1-color vector4w :inline :offset-assert 1376) + (moon-color vector4w :inline :offset-assert 1392) + (sun0-color-lower vector4w :inline :offset-assert 1408) (cam-mat matrix :inline :offset-assert 1424) (star-mat matrix :inline :offset-assert 1488) (vec0 vector4w :inline :offset-assert 1552) @@ -8950,8 +9065,8 @@ :size-assert #x2760 :flag-assert #x2500002760 (:methods - (sky-work-method-9 () none 9) - (sky-work-method-10 () none 10) + (init-sun-data! "Sets the sun related upload data - the sun, halo and aurora" (_type_ int float float float) none 9) + (init-orbit-settings! (_type_ int float float float float float float) none 10) (sky-work-method-11 () none 11) (sky-work-method-12 () none 12) (sky-work-method-13 () none 13) @@ -9353,7 +9468,7 @@ :size-assert #x38 :flag-assert #xb00000038 (:methods - (ocean-map-method-9 () none 9) + (set-height! (_type_ float) none 9) (ocean-map-method-10 () none 10) ) ) @@ -9648,6 +9763,23 @@ :flag-assert #x900000014 ) +(defenum time-of-day-palette-id + :type uint32 + :bitfield #t + (unk0 0) ;; 1 + (unk1 1) ;; 2 + (unk2 2) ;; 4 + (unk3 3) ;; 8 + (palette-0 4) ;; 16 + (palette-1 5) ;; 32 + (palette-2 6) ;; 64 + (palette-3 7) ;; 128 + (palette-4 8) ;; 256 + (palette-5 9) ;; 512 + (palette-6 10) ;; 1024 + (palette-7 11) ;; 2048 + ) + (deftype time-of-day-context (basic) ((interp float 6 :offset-assert 4) ;; guessed by decompiler (current-fog mood-fog :inline :offset-assert 32) @@ -9667,9 +9799,9 @@ (sky symbol :offset-assert 2060) ;; guessed by decompiler (use-camera-other basic :offset-assert 2064) (title-updated symbol :offset-assert 2068) ;; guessed by decompiler - (mode uint32 :offset-assert 2072) ;; TODO - bitfield? - (overide-enable basic :offset-assert 2076) - (overide-palette uint32 :offset-assert 2080) + (mode time-of-day-palette-id :offset-assert 2072) + (overide-enable symbol :offset-assert 2076) + (overide-palette time-of-day-palette-id :offset-assert 2080) (max-rain float :offset-assert 2084) (fog-mult float :offset-assert 2088) (exterior-level basic :offset-assert 2092) @@ -11408,6 +11540,58 @@ (declare-type continue-point basic) (declare-type game-save basic) +(defenum game-feature + :type uint64 + :bitfield #t + (unk-game-feature-01) + (unk-game-feature-02) + (unk-game-feature-03) + (unk-game-feature-04) + (unk-game-feature-05) + (unk-game-feature-06) + (gun-yellow) + (gun-red) + (gun-blue) + (gun-dark) + (board) + (carry) + (sidekick) + (darkjak) + (gun-upgrade-speed) + (gun-upgrade-ammo) + (gun-upgrade-damage) + (unk-game-feature-18) + (pass-red) + (pass-green) + (pass-yellow) + (unk-game-feature-22) + (darkjak-bomb0) + (darkjak-bomb1) + (darkjak-invinc) + (darkjak-giant) + (board-training)) + +(defenum game-secrets + :type uint32 + :bitfield #t + (toggle-beard) + (hflip-screen) + (endless-ammo) + (invulnerable) + (endless-dark) + (scene-player-1) + (scene-player-2) + (scene-player-3) + (level-select) + (scrap-book-1) + (scrap-book-2) + (gungame-blue) + (gungame-dark) + (reverse-races) + (hero-mode) + (big-head) + (little-head)) + (deftype game-info (basic) ((mode symbol :offset-assert 4) (save-name string :offset-assert 8) @@ -11426,10 +11610,10 @@ (karma float :offset-assert 116) (eco-pill-dark float :offset-assert 120) (eco-pill-dark-total float :offset-assert 124) - (features uint64 :offset-assert 128) - (debug-features uint64 :offset-assert 136) - (secrets uint32 :offset-assert 144) - (unknown-pad1 uint32 :offset-assert 148) + (features game-feature :offset-assert 128) + (debug-features game-feature :offset-assert 136) + (secrets game-secrets :offset-assert 144) + (unknown-pad1 uint32) (purchase-secrets uint32 :offset-assert 152) (unknown-pad2 uint32 :offset-assert 156) (gun-type int32 :offset-assert 160) @@ -11447,9 +11631,11 @@ (task-perm-list entity-perm-array :offset-assert 236) (current-continue continue-point :offset-assert 240) (last-continue continue-point :offset-assert 244) - (unknown-pad3 uint32 3 :offset-assert 248) + (unknown-pad3 array :offset-assert 248) + (unknown-pad4 array :offset-assert 252) + (unknown-pad5 array :offset-assert 256) (task-counter uint32 :offset-assert 260) - (unknown-pad4 uint32 :offset-assert 264) + (unknown-pad6 uint32 :offset-assert 264) (level-opened uint8 32 :offset-assert 268) (total-deaths int32 :offset-assert 300) (continue-deaths int32 :offset-assert 304) @@ -11516,10 +11702,10 @@ (game-info-method-14 () none 14) ;; 14) (game-info-method-15 () none 15) (copy-perms-from-level! (_type_ level) none 16) - (copy-perms-to-level! (_type_ level) none 17) + (copy-perms-to-level! (_type_ level) none 17) (game-info-method-18 () none 18) - (game-info-method-19 () none 19) - (game-info-method-20 () none 20) + (get-current-continue-point (_type_) continue-point 19) + (get-continue-by-name (_type_ string) continue-point 20) (set-continue! (_type_ basic) continue-point 21) (game-info-method-22 () none 22) (game-info-method-23 () none 23) @@ -14114,6 +14300,7 @@ ) +;; +++joint-mod-h:track-mode (defenum track-mode :bitfield #t :type uint16 @@ -14125,6 +14312,7 @@ (no-rotate 5) ;; 32 (no-scale 6) ;; 64 ) +;; ---joint-mod-h:track-mode (deftype joint-mod (basic) ((mode joint-mod-mode) @@ -15212,6 +15400,7 @@ (deftype control-info (collide-shape-moving) ((unknown-qword00 vector :offset 12) ;; from board-h::want-to-board? + (unknown-float00 float :offset 528) ;; (anon-function 82 default-menu) (unknown-surface00 surface :offset 3832) ;; from board-h::want-to-board? (unknown-cpad-info00 cpad-info :offset 3848) ;; from board-h::want-to-board? (unknown-time-frame00 time-frame :offset 4624) ;; from board-h::want-to-board? @@ -17706,10 +17895,10 @@ ) (deftype entity-info (basic) - ((ptype type :offset-assert 4) ;; guessed by decompiler - (package basic :offset-assert 8) - (art-group pair :offset-assert 12) ;; guessed by decompiler - (pool basic :offset-assert 16) + ((ptype type :offset-assert 4) + (package string :offset-assert 8) + (art-group pair :offset-assert 12) + (pool symbol :offset-assert 16) (heap-size int32 :offset-assert 20) ) :method-count-assert 9 @@ -18511,6 +18700,21 @@ :flag-assert #xe01b0022c ) +(defenum camera-slave-options + :type uint32 + :bitfield #t + (butt-cam) + (same-side) + (move-spherical) + (allow-z-rot) + (pitch-for-jump) + (collide) + (find-hidden-target) + (drag) + (line-of-sight) + (no-rotate) + (sticky-angle)) + (deftype camera-slave (process) ((trans vector :inline :offset-assert 128) (fov float :offset-assert 144) @@ -18531,7 +18735,7 @@ (circular-follow vector :inline :offset-assert 2256) (max-angle-offset float :offset-assert 2272) (max-angle-curr float :offset-assert 2276) - (options uint32 :offset-assert 2280) + (options camera-slave-options :offset-assert 2280) (cam-entity entity :offset-assert 2284) ;; guessed by decompiler (butt-timer uint64 :offset-assert 2288) (butt-seek basic :offset-assert 2296) @@ -18654,9 +18858,9 @@ ;; cam-interface-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define-extern *camera-init-mat* matrix) -(define-extern *camera* camera-master) -(define-extern *camera-combiner* camera-combiner) +(define-extern *camera-init-mat* matrix) +(define-extern *camera* camera-master) +(define-extern *camera-combiner* camera-combiner) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-update-h ;; @@ -20952,9 +21156,9 @@ ;; (define-extern *merc-global-stats* object) ;; merc-global-stats ;; (define-extern clear-tr-stat function) ;; (function tr-stat none) -;; (define-extern *stat-string-tfrag* object) ;; string -;; (define-extern *stat-string-tfrag-scissor* object) -;; (define-extern *stat-string-total* object) ;; string +(define-extern *stat-string-tfrag* string) +(define-extern *stat-string-tfrag-scissor* string) +(define-extern *stat-string-total* string) ;; (define-extern print-tr-stat function) ;; (function tr-stat string string none) (define-extern print-terrain-stats (function none)) ;; (define-extern update-subdivide-settings! function) ;; (function subdivide-settings math-camera int none) @@ -21650,7 +21854,7 @@ ;; (define-extern texture-usage-init function) ;; (define-extern texture-usage-update function) ;; (define-extern merc-stats-display function) ;; (function merc-ctrl none) -;; (define-extern merc-stats function) ;; (function none) +(define-extern merc-stats (function none)) ;; (define-extern merc-edge-stats function) ;; (function none) ;; (define-extern merc-vu1-add-vu-function function) ;; (function dma-packet vu-function int dma-gif-packet) ;; (define-extern merc-vu1-initialize-chain function) ;; (function dma-gif-packet dma-packet) @@ -21802,7 +22006,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern *target-lock* object) ;; symbol -;; (define-extern *generic-consts* object) ;; generic-consts +(define-extern *generic-consts* generic-consts) ;; (define-extern generic-work-init function) ;; (function generic-dma-foreground-sink none) ;; (define-extern generic-upload-vu0 function) ;; (function none) ;; (define-extern upload-vu0-program function) ;; (function vu-function pointer none) @@ -22706,7 +22910,7 @@ ;; (define-extern sp-process-particle-system function) ;; (function sparticle-system int sprite-array-2d none) ;; (define-extern *particles-flag* object) ;; symbol ;; (define-extern forall-particles-with-key-runner function) ;; (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) sparticle-system none) -;; (define-extern forall-particles-with-key function) ;; (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) symbol symbol none) +(define-extern forall-particles-with-key (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) symbol symbol none)) ;; (define-extern sparticle-kill-it function) ;; (function sparticle-system sparticle-cpuinfo none) ;; (define-extern sparticle-kill-it-level0 function) ;; (function sparticle-system sparticle-cpuinfo none) ;; (define-extern sparticle-kill-it-level1 function) ;; (function sparticle-system sparticle-cpuinfo none) @@ -22729,8 +22933,14 @@ ;; entity-table ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *entity-info* array) ;; (array entity-info) -;; (define-extern entity-info-lookup function) ;; (function type entity-info) +(define-extern *entity-info* (array entity-info)) +(define-extern entity-info-lookup + "Given a type, return the [[entity-info]] from [[*entity-info*]] whos type + matches the `ptype` field. Set's `method 13` on said type that returns the `length` + off the [[entity-info]] + + If nothing matches, set `method 13` to `#f` and return `#f`" + (function type entity-info)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; loader ;; @@ -22791,9 +23001,9 @@ (define-extern *default-continue* continue-point) ;; (define-extern task-level->string function) ;; (define-extern level-name->task-level function) -;; (define-extern trsq->continue-point function) ;; (function trsq none) +(define-extern trsq->continue-point (function trsq none)) (define-extern position->stream (function string symbol symbol none)) -;; (define-extern bug-report-display function) +(define-extern bug-report-display (function none)) ;; (define-extern print-continues function) (define-extern *highscore-info-array* (array highscore-info)) @@ -22922,7 +23132,7 @@ ;; (define-extern *auto-save-info* object) ;; mc-slot-info ;; (define-extern auto-save-post function) ;; (function none :behavior auto-save) ;; (define-extern auto-save-init-by-other function) ;; (function symbol process-tree int int none :behavior auto-save) -;; (define-extern auto-save-command function) ;; (function symbol int int process-tree none) +(define-extern auto-save-command (function symbol int int process-tree symbol none)) (define-extern auto-save-check (function none)) ;; (define-extern auto-save-user function) @@ -23984,7 +24194,7 @@ ;; (define-extern time-of-day-tick state) ;; (state time-of-day-proc) ;; (define-extern init-time-of-day function) ;; (function none :behavior time-of-day-proc) ;; (define-extern start-time-of-day function) ;; (function none) -;; (define-extern time-of-day-setup function) ;; (function symbol symbol) +(define-extern time-of-day-setup (function symbol symbol)) ;; (define-extern time-of-day-interp-colors function) ;; (function (pointer rgba) uint mood-context none) ;; (define-extern time-of-day-interp-colors-scratch function) ;; (function (pointer rgba) time-of-day-palette mood-context none) (define-extern init-time-of-day-context (function time-of-day-context none)) @@ -23999,16 +24209,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern *sky-work* sky-work) -;; (define-extern sky-base-polygons object) ;; (inline-array sky-vertex) -;; (define-extern sky-roof-polygons object) ;; (inline-array sky-vertex) -;; (define-extern *cloud-vert-array* object) -;; (define-extern *cloud-poly* object) -;; (define-extern init-cloud-vert-array function) -;; (define-extern *haze-vert-array* object) -;; (define-extern *haze-poly* object) -;; (define-extern init-haze-vert-array function) -;; (define-extern sky-make-sun-data function) ;; (function sky-parms int float none) -;; (define-extern sky-make-moon-data function) ;; (function sky-parms float none) +(define-extern sky-base-polygons (inline-array sky-vertex)) +(define-extern sky-roof-polygons (inline-array sky-vertex)) +(define-extern *cloud-vert-array* cloud-vert-array) +(define-extern *cloud-poly* (inline-array cloud-vertex)) +(define-extern init-cloud-vert-array (function symbol)) +(define-extern *haze-vert-array* haze-vert-array) +(define-extern *haze-poly* (inline-array haze-vertex)) +(define-extern init-haze-vert-array (function symbol)) +(define-extern sky-make-sun-data "Initialize `upload-data` with [[sky-sun-data]] in [[*sky-work*]]" (function sky-work int float none)) +(define-extern sky-make-moon-data "Initialize `upload-data` with [[sky-moon-data]] in [[*sky-work*]]" (function sky-work float none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sky-tng ;; @@ -24756,7 +24966,7 @@ ;; cam-interface ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern position-in-front-of-camera! function) ;; (function vector float float vector) +(define-extern position-in-front-of-camera! (function vector float float vector)) ;; (define-extern position-in-front-of-screen! function) ;; (define-extern matrix-local->world function) ;; (function symbol symbol matrix) ;; (define-extern matrix-world->local function) ;; (function matrix) @@ -24882,24 +25092,24 @@ |# ;; (define-extern cam-really-fixed state) -;; (define-extern cam-fixed state) ;; (state camera-slave) +(define-extern cam-fixed (state camera-slave)) ;; (define-extern cam-fixed-read-entity state) ;; (state camera-slave) -;; (define-extern cam-pov state) ;; (state camera-slave) -;; (define-extern cam-pov180 state) ;; (state camera-slave) -;; (define-extern cam-pov-track state) ;; (state camera-slave) +(define-extern cam-pov (state camera-slave)) +(define-extern cam-pov180 (state camera-slave)) +(define-extern cam-pov-track (state camera-slave)) ;; (define-extern cam-standoff-calc-trans function) ;; (function vector :behavior camera-slave) -;; (define-extern cam-standoff state) ;; (state camera-slave) +(define-extern cam-standoff (state camera-slave)) ;; (define-extern cam-standoff-read-entity state) ;; (state camera-slave) ;; (define-extern *CAM_EYE-bank* cam-eye-bank) ;; cam-eye-bank (define-extern cam-eye (state camera-slave)) -;; (define-extern cam-spline state) ;; (state camera-slave) -;; (define-extern cam-decel state) ;; (state camera-slave) +(define-extern cam-spline (state camera-slave)) +(define-extern cam-decel (state camera-slave)) (define-extern cam-endlessfall (state camera-slave)) ;; (define-extern cam-circular-position-into-max-angle function) ;; (function vector vector float vector :behavior camera-slave) ;; (define-extern cam-circular-position function) ;; (function symbol vector :behavior camera-slave) ;; (define-extern cam-circular-code function) ;; (function float :behavior camera-slave) -;; (define-extern cam-circular state) ;; (state camera-slave) -;; (define-extern cam-lookat state) ;; (state camera-slave) +(define-extern cam-circular (state camera-slave)) +(define-extern cam-lookat (state camera-slave)) ;; (define-extern *CAM_STRING-bank* cam-string-bank) ;; cam-string-bank ;; (define-extern cam-string-find-position-rel! function) ;; (function vector symbol) ;; (define-extern cam-string-set-position-rel! function) ;; (function vector int :behavior camera-slave) @@ -24921,14 +25131,16 @@ ;; (define-extern cam-string-move function) ;; (function object :behavior camera-slave) ;; (define-extern cam-string-code function) ;; (function vector :behavior camera-slave) ;; (define-extern set-string-params function) -;; (define-extern cam-string state) ;; (state camera-slave) +(define-extern cam-string (state camera-slave)) ;; (define-extern *CAM_STICK-bank* cam-stick-bank) ;; cam-stick-bank ;; (define-extern cam-stick-code function) ;; (function none :behavior camera-slave) -;; (define-extern cam-stick state) ;; (state camera-slave) +(define-extern cam-stick (state camera-slave)) ;; (define-extern *CAM_BIKE-bank* cam-bike-bank) ;; cam-bike-bank ;; (define-extern cam-calc-bike-follow! function) ;; (function cam-rotation-tracker vector symbol vector :behavior camera-slave) ;; (define-extern cam-bike-code function) ;; (function none :behavior camera-slave) -;; (define-extern cam-bike state) ;; (state camera-slave) +(define-extern cam-bike (state camera-slave)) + +(define-extern cam-robotboss "A holdout from jak 1?" (state camera-slave)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-states-dbg ;; @@ -24970,7 +25182,7 @@ |# ;; (define-extern *CAM_POINT_WATCH-bank* cam-point-watch-bank) ;; cam-point-watch-bank -;; (define-extern cam-point-watch state) ;; (state camera-slave) +(define-extern cam-point-watch (state camera-slave)) ;; (define-extern *CAM_FREE-bank* cam-free-bank) ;; cam-free-bank ;; (define-extern cam-mouse-input function) ;; (define-extern cam-free-floating-input function) ;; (function vector vector symbol int vector) @@ -25287,9 +25499,9 @@ ;; (define-extern cam-layout-do-menu function) ;; (function clm none :behavior cam-layout) ;; (define-extern cam-layout-active state) ;; (state cam-layout) ;; (define-extern cam-layout-init function) ;; (function none :behavior cam-layout) -;; (define-extern cam-layout-stop function) ;; (function symbol) -;; (define-extern cam-layout-start function) ;; (function none) -;; (define-extern cam-layout-restart function) ;; (function none) +(define-extern cam-layout-stop (function symbol)) +(define-extern cam-layout-start (function symbol)) +(define-extern cam-layout-restart (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-debug ;; @@ -27068,7 +27280,7 @@ ;; menu ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(declare-type debug-menu basic) (deftype debug-menu-context (basic) ((is-active symbol :offset-assert 4) ;; guessed by decompiler (sel-length int32 :offset-assert 8) @@ -27084,9 +27296,7 @@ :size-assert #x44 :flag-assert #x900000044 ) -|# -#| (deftype debug-menu-node (basic) ((name string :offset-assert 4) ;; guessed by decompiler (parent debug-menu :offset-assert 8) ;; guessed by decompiler @@ -27097,9 +27307,8 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| +(declare-type debug-menu-item debug-menu-node) (deftype debug-menu (debug-menu-node) ((context debug-menu-context :offset-assert 20) ;; guessed by decompiler (selected-item debug-menu-item :offset-assert 24) ;; guessed by decompiler @@ -27111,9 +27320,7 @@ :size-assert #x28 :flag-assert #x900000028 ) -|# -#| (deftype debug-menu-item (debug-menu-node) ((id int32 :offset-assert 20) ) @@ -27121,9 +27328,7 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype debug-menu-item-submenu (debug-menu-item) ((submenu debug-menu :offset-assert 24) ;; guessed by decompiler ) @@ -27131,9 +27336,7 @@ :size-assert #x1c :flag-assert #x90000001c ) -|# -#| (deftype debug-menu-item-function (debug-menu-item) ((activate-func (function object object) :offset-assert 24) ;; guessed by decompiler (hilite-timer int8 :offset-assert 28) @@ -27142,9 +27345,15 @@ :size-assert #x1d :flag-assert #x90000001d ) -|# -#| +(defenum debug-menu-msg + :type int32 + (activate 1) + (deactivate 2) + (update 3) + (press 4) + ) + (deftype debug-menu-item-flag (debug-menu-item) ((activate-func (function object debug-menu-msg object) :offset-assert 24) ;; guessed by decompiler (is-on object :offset-assert 28) ;; guessed by decompiler @@ -27153,9 +27362,7 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype debug-menu-item-var (debug-menu-item) ((display-str string :offset-assert 24) ;; guessed by decompiler (grabbed-joypad-p symbol :offset-assert 28) ;; guessed by decompiler @@ -27174,36 +27381,42 @@ (fstep float :offset-assert 80) (fprecision int32 :offset-assert 84) (factivate-func (function int debug-menu-msg float float float) :offset-assert 88) ;; guessed by decompiler - (ival int32 :offset-assert 60) - (iundo-val int32 :offset-assert 64) - (irange-min int32 :offset-assert 68) - (irange-max int32 :offset-assert 72) - (istart-inc int32 :offset-assert 76) - (istep int32 :offset-assert 80) + (ival int32 :offset 60) + (iundo-val int32 :offset 64) + (irange-min int32 :offset 68) + (irange-max int32 :offset 72) + (istart-inc int32 :offset 76) + (istep int32 :offset 80) (ihex-p symbol :offset-assert 92) ;; guessed by decompiler - (iactivate-func (function int debug-menu-msg int int int) :offset-assert 88) ;; guessed by decompiler + (iactivate-func (function int debug-menu-msg int int int) :offset 88) ;; guessed by decompiler (ifloat-p symbol :offset-assert 96) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x64 :flag-assert #x900000064 ) -|# + +(defenum debug-menu-dest + :type int32 + (activation 0) + (root 1) + (open-menus 2) + (current-selection 3)) ;; (define-extern debug-menu-item-var-update-display-str function) ;; (function debug-menu-item-var debug-menu-item-var) -;; (define-extern debug-menu-item-var-make-int function) ;; (function debug-menu-item-var (function int debug-menu-msg int int int) int symbol int int symbol debug-menu-item-var) -;; (define-extern debug-menu-item-var-make-float function) ;; (function debug-menu-item-var (function int debug-menu-msg float float float) float symbol float float int debug-menu-item-var) +(define-extern debug-menu-item-var-make-int (function debug-menu-item-var (function int debug-menu-msg int int int) int symbol int int symbol debug-menu-item-var)) +(define-extern debug-menu-item-var-make-float (function debug-menu-item-var (function int debug-menu-msg float float float) float symbol float float int debug-menu-item-var)) ;; (define-extern debug-menu-context-grab-joypad function) ;; (function debug-menu-context basic (function basic none) symbol) ;; (define-extern debug-menu-context-release-joypad function) ;; (function debug-menu-context symbol) ;; (define-extern debug-menu-item-get-max-width function) ;; (function debug-menu-item debug-menu int) ;; (define-extern debug-menu-context-default-selection function) ;; (function debug-menu-context symbol debug-menu-context) ;; (define-extern debug-menu-rebuild function) ;; (function debug-menu debug-menu) -;; (define-extern debug-menu-context-set-root-menu function) ;; (function debug-menu-context debug-menu debug-menu-context) -;; (define-extern debug-menu-append-item function) ;; (function debug-menu debug-menu-node debug-menu-node) -;; (define-extern debug-menu-remove-all-items function) ;; (function debug-menu debug-menu) +(define-extern debug-menu-context-set-root-menu (function debug-menu-context debug-menu debug-menu-context)) +(define-extern debug-menu-append-item (function debug-menu debug-menu-node debug-menu-node)) +(define-extern debug-menu-remove-all-items (function debug-menu debug-menu)) ;; (define-extern debug-menu-func-decode function) ;; (function object function) -;; (define-extern debug-menu-make-from-template function) ;; (function debug-menu-context pair debug-menu-node) -;; (define-extern debug-menu-find-from-template function) ;; (function debug-menu-context pair debug-menu) +(define-extern debug-menu-make-from-template (function debug-menu-context pair debug-menu-node)) +(define-extern debug-menu-find-from-template (function debug-menu-context pair debug-menu)) ;; (define-extern debug-menu-item-submenu-render function) ;; (function debug-menu-item-submenu int int int symbol debug-menu-item-submenu) ;; (define-extern debug-menu-item-function-render function) ;; (function debug-menu-item-function int int int symbol debug-menu-item-function) ;; (define-extern debug-menu-item-flag-render function) ;; (function debug-menu-item-flag int int int symbol debug-menu-item-flag) @@ -27222,11 +27435,11 @@ ;; (define-extern debug-menu-item-var-msg function) ;; (function debug-menu-item-var debug-menu-msg debug-menu-item-var) ;; (define-extern debug-menu-item-send-msg function) ;; (function debug-menu-item debug-menu-msg debug-menu-item) ;; (define-extern debug-menu-send-msg function) ;; (function debug-menu debug-menu-msg symbol debug-menu) -;; (define-extern debug-menu-context-send-msg function) ;; (function debug-menu-context debug-menu-msg debug-menu-dest debug-menu-context) +(define-extern debug-menu-context-send-msg (function debug-menu-context debug-menu-msg debug-menu-dest debug-menu-context)) ;; (define-extern debug-menu-context-activate-selection function) ;; (function debug-menu-context debug-menu-context) ;; (define-extern debug-menus-default-joypad-func function) ;; (function debug-menu-context debug-menu-context) ;; (define-extern debug-menus-active function) ;; (function debug-menu-context debug-menu-context) -;; (define-extern debug-menus-handler function) ;; (function debug-menu-context debug-menu-context) +(define-extern debug-menus-handler (function debug-menu-context debug-menu-context)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drawable ;; @@ -27239,15 +27452,15 @@ (define-extern vis-cull (function int symbol)) ;; (define-extern vis-cull-debug function) (define-extern error-sphere (function drawable-error string none)) -;; (define-extern *edit-instance* object) ;; string +(define-extern *edit-instance* string) ;; (define-extern *instance-mem-usage* object) ;; memory-usage-block ;; (define-extern find-instance-by-name-level function) -;; (define-extern find-instance-by-name function) ;; (function string prototype-bucket) +(define-extern find-instance-by-name (function string prototype-bucket)) ;; (define-extern prototypes-game-visible-set! function) ;; (define-extern find-instance-by-index function) ;; (function type int bsp-header prototype-bucket) -;; (define-extern prototype-bucket-type function) ;; (function prototype-bucket type) -;; (define-extern prototype-bucket-recalc-fields function) ;; (function prototype-bucket prototype-bucket) -;; (define-extern print-prototype-list function) +(define-extern prototype-bucket-type (function prototype-bucket type)) +(define-extern prototype-bucket-recalc-fields (function prototype-bucket prototype-bucket)) +(define-extern print-prototype-list (function none)) ;; (define-extern draw-instance-info function) ;; (function string none) ;; (define-extern set-shadow-by-name function) ;; (define-extern get-shadow-by-name function) @@ -27449,9 +27662,9 @@ ) |# -;; (define-extern *spawn-actors* object) ;; symbol -;; (define-extern *compact-actors* object) ;; symbol -;; (define-extern *vis-actors* object) ;; symbol +(define-extern *spawn-actors* symbol) +(define-extern *compact-actors* symbol) +(define-extern *vis-actors* symbol) (define-extern entity-by-name (function string entity)) (define-extern entity-by-type (function type entity-actor)) (define-extern entity-by-aid (function uint entity)) @@ -27471,14 +27684,14 @@ ;; (define-extern expand-vis-box-with-point function) ;; (function entity vector none) ;; (define-extern *debug-actor-info* debug-actor-info) ;; (define-extern *pid-string* object) -;; (define-extern debug-actor function) +(define-extern debug-actor (function string none)) ;; (define-extern draw-actor-marks function) ;; (define-extern init-entity function) ;; (function process entity-actor none) ;; (define-extern entity-deactivate-handler function) ;; (function process entity-actor none) ;; (define-extern check-for-rougue-process function) ;; (define-extern process-drawable-scale-from-entity! function) ;; (define-extern process-drawable-from-entity! function) ;; (function process-drawable entity-actor none) -;; (define-extern reset-actors function) ;; (function symbol none) +(define-extern reset-actors (function symbol none)) ;; (define-extern reset-cameras function) ;; (function none) ;; (define-extern entity-birth-no-kill function) ;; (function entity none) ;; (define-extern entity-task-complete-on function) ;; (function entity none) @@ -27938,18 +28151,18 @@ ;; (define-extern *fail-mission-control* fail-mission-control) ;; (define-extern game-task-node->string function) (define-extern update-task-masks (function symbol none)) -;; (define-extern play-clean function) -;; (define-extern play-task function) +(define-extern play-clean (function symbol none)) +(define-extern play-task (function game-task symbol symbol string)) ;; (define-extern restart-mission function) ;; (define-extern task-node-by-name function) ;; (define-extern task-resolution-close! function) ;; (define-extern task-close! function) ;; (define-extern task-closed? function) ;; (function game-task task-status symbol) ;; (define-extern open-task-nodes function) -(define-extern task-node-closed? (function int symbol)) ;; TODO - probably the task id? -;; (define-extern task-node-close! function) -;; (define-extern task-node-open? function) -;; (define-extern task-node-open! function) +(define-extern task-node-closed? (function game-task symbol)) +(define-extern task-node-close! (function game-task none)) +(define-extern task-node-open? (function game-task symbol)) +(define-extern task-node-open! (function game-task none)) ;; (define-extern task-node-reset function) ;; (define-extern task-node-dump function) ;; (define-extern fail-mission-init-by-other function) @@ -27989,7 +28202,7 @@ ;; (define-extern *subtitle-work* object) ;; (define-extern draw-subtitle-image function) ;; (define-extern process-drawable-draw-subtitles function) -;; (define-extern scene-player-init function) +(define-extern scene-player-init (function string symbol object none :behavior scene-player)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; pov-camera ;; @@ -28488,7 +28701,6 @@ ;; glist-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype glst-node (structure) ((next glst-node :offset-assert 0) (prev glst-node :offset-assert 4) @@ -28497,7 +28709,6 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# #| (deftype glst-named-node (glst-node) @@ -28509,7 +28720,6 @@ ) |# -#| (deftype glst-list (structure) ((head glst-node :offset-assert 0) (tail glst-node :offset-assert 4) @@ -28520,7 +28730,6 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# ;; (define-extern glst-next function) ;; (function glst-node glst-node) ;; (define-extern glst-prev function) ;; (function glst-node glst-node) @@ -28554,34 +28763,34 @@ ;; anim-tester ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| -(deftype list-control (UNKNOWN) - ((listfunc (function int list-control symbol) :offset-assert 0) ;; guessed by decompiler - (list-owner uint32 :offset-assert 4) - (top int32 :offset-assert 8) - (left int32 :offset-assert 12) - (list glst-list :offset-assert 16) - (the-node glst-node :offset-assert 20) - (top-index int32 :offset-assert 24) - (the-index int32 :offset-assert 28) - (the-disp-line int32 :offset-assert 32) - (highlight-index int32 :offset-assert 36) - (current-index int32 :offset-assert 40) - (numlines int32 :offset-assert 44) - (lines-to-disp int32 :offset-assert 48) - (charswide int32 :offset-assert 52) - (highlight-disp-line int32 :offset-assert 56) - (field-id int32 :offset-assert 60) - (xpos int32 :offset-assert 64) - (ypos int32 :offset-assert 68) - (user-info int32 :offset-assert 72) - (return-int int32 :offset-assert 76) +(deftype list-control (structure) + ((listfunc (function int list-control symbol) :offset-assert 0) + (list-owner uint32 :offset-assert 4) + (top int32 :offset-assert 8) + (left int32 :offset-assert 12) + (list glst-list :offset-assert 16) + (the-node glst-node :offset-assert 20) + (top-index int32 :offset-assert 24) + (the-index int32 :offset-assert 28) + (the-disp-line int32 :offset-assert 32) + (highlight-index int32 :offset-assert 36) + (current-index int32 :offset-assert 40) + (numlines int32 :offset-assert 44) + (lines-to-disp int32 :offset-assert 48) + (charswide int32 :offset-assert 52) + (highlight-disp-line int32 :offset-assert 56) + (field-id int32 :offset-assert 60) + (xpos int32 :offset-assert 64) + (ypos int32 :offset-assert 68) + (user-info int32 :offset-assert 72) + (user-info-u uint32 :offset 72) ;; custom + (return-int int32 :offset-assert 76) ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + :allow-misaligned + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 ) -|# #| (deftype list-field (UNKNOWN) @@ -28639,15 +28848,55 @@ ) |# -#| -(deftype anim-tester (UNKNOWN) - () - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ;; Failed to read fields. +(defenum anim-tester-flags + :bitfield #t + :type int32 + (fanimt0) + (fanimt1) + (fanimt2) + (fanimt3) + (fanimt4) + (fanimt5) + ) + +(defenum anim-tester-debug-flags + :bitfield #t + :type int32 + (unk0) + (unk1) + (unk2) + (unk3) + (at-show-joint-info) + (at-apply-align) + (unk6) + ) + +(deftype anim-tester (process-drawable) + ((flags anim-tester-flags :offset-assert 200) + (debug-flags anim-tester-debug-flags :offset-assert 204) + (obj-list glst-list :inline :offset-assert 208) + (current-obj string :offset-assert 224) + (speed int32 :offset-assert 228) + (list-con list-control :inline :offset-assert 232) + (pick-con list-control :inline :offset-assert 312) + (item-field int64 :offset-assert 392) + (inc-delay int32 :offset-assert 400) + (inc-timer int32 :offset-assert 404) + (edit-mode int32 :offset-assert 408) + (old-mode int32 :offset-assert 412) + (anim-speed float :offset-assert 416) + (anim-gspeed float :offset-assert 420) + (anim-first float :offset-assert 424) + (anim-last float :offset-assert 428) + ) + :method-count-assert 20 + :size-assert #x1b0 + :heap-base #x130 + :flag-assert #x14013001b0 + (:states + anim-tester-process + ) ) -|# #| (deftype anim-test-obj (UNKNOWN) @@ -28709,21 +28958,11 @@ ) |# -#| -(deftype anim-tester (UNKNOWN) - () - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ;; Failed to read fields. - ) -|# - ;; (define-extern *DISP_LIST-bank* DISP_LIST-bank) ;; DISP_LIST-bank ;; (define-extern display-list-control function) ;; (function list-control none) ;; (define-extern *ANIM_TESTER-bank* anim-tester-bank) ;; anim-tester-bank ;; (define-extern anim-tester-num-print function) ;; (function basic float none) -;; (define-extern *anim-tester* object) ;; (pointer anim-tester) +(define-extern *anim-tester* (pointer anim-tester)) ;; (define-extern anim-test-obj-init function) ;; (function anim-test-obj list-control none) ;; (define-extern anim-test-sequence-init function) ;; (function anim-test-sequence anim-test-obj none) ;; (define-extern anim-test-seq-item-copy! function) ;; (function anim-test-seq-item anim-test-seq-item anim-test-sequence) @@ -28754,7 +28993,7 @@ ;; (define-extern anim-tester-save-all-objects function) ;; (function anim-tester symbol) ;; (define-extern anim-tester-add-newobj function) ;; (function anim-tester string art-group object) ;; (define-extern anim-tester-stop function) ;; (function symbol) -;; (define-extern anim-tester-start function) ;; (function symbol) +(define-extern anim-tester-start (function symbol)) (define-extern anim-tester-add-object (function string none)) ;; (define-extern anim-tester-set-name function) ;; (function string object) ;; (define-extern anim-tester-add-sequence function) ;; (function string none) @@ -28978,17 +29217,16 @@ ) |# -#| (deftype editable-player (process-drawable) - ((current basic :offset-assert 196) - (select-command uint32 :offset-assert 200) - (move-command uint32 :offset-assert 204) - (extra-command uint32 :offset-assert 208) - (left-handed basic :offset-assert 212) - (light-names basic :offset-assert 216) - (external-cam-mode basic :offset-assert 220) - (command UNKNOWN 6 :offset-assert 224) - (close-menu-time time-frame :offset-assert 252) + ((current basic :offset-assert 200) + (select-command uint32 :offset-assert 204) + (move-command uint32 :offset-assert 208) + (extra-command uint32 :offset-assert 212) + (left-handed basic :offset-assert 216) + (light-names basic :offset-assert 220) + (external-cam-mode basic :offset-assert 224) + (command object 6 :offset-assert 228) + (close-menu-time time-frame :offset-assert 256) ) :method-count-assert 22 :size-assert #x108 @@ -28998,7 +29236,6 @@ (editable-player-method-21 () none 21) ) ) -|# #| (deftype editable-work (basic) @@ -29019,7 +29256,7 @@ ;; (define-extern editable-command->string function) ;; (define-extern editable-filter->string function) ;; (define-extern *editable-work* object) -;; (define-extern *editable* object) +(define-extern *editable* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; editable ;; @@ -29039,8 +29276,8 @@ ;; (define-extern execute-select function) ;; (define-extern execute-mouse-move function) ;; (define-extern execute-move function) -;; (define-extern editable-player-init function) -;; (define-extern *editable-menu-context* object) +(define-extern editable-player-init (function symbol none)) ;; TODO - return type not confirmed +(define-extern *editable-menu-context* debug-menu-context) ;; (define-extern editable-menu-command function) ;; (define-extern editable-menu-command-no-close function) ;; (define-extern dm-region-tree-pick-func function) @@ -29058,7 +29295,7 @@ ;; mysql-nav-graph ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype mysql-nav-node (structure) ((mysql-save-flag uint32 :offset-assert 0) (runtime-id uint32 :offset-assert 4) @@ -29075,6 +29312,7 @@ (nav_node_flag uint32 :offset-assert 60) (nav_mesh_id uint32 :offset-assert 64) ) + :pack-me :method-count-assert 11 :size-assert #x44 :flag-assert #xb00000044 @@ -29083,7 +29321,6 @@ (mysql-nav-node-method-10 () none 10) ) ) -|# #| (deftype mysql-nav-node-array (inline-array-class) @@ -29097,7 +29334,6 @@ ) |# -#| (deftype mysql-nav-edge (structure) ((mysql-save-flag uint32 :offset-assert 0) (runtime-id uint32 :offset-assert 4) @@ -29117,6 +29353,7 @@ (width float :offset-assert 60) (minimap_edge_flag int32 :offset-assert 64) ) + :pack-me :method-count-assert 10 :size-assert #x44 :flag-assert #xa00000044 @@ -29124,7 +29361,6 @@ (mysql-nav-edge-method-9 () none 9) ) ) -|# #| (deftype mysql-nav-edge-array (inline-array-class) @@ -29243,45 +29479,39 @@ ) |# -#| (deftype nav-graph-editor (process) - ((nav-graph basic :offset-assert 124) - (mode uint32 :offset-assert 128) - (command-id int32 :offset-assert 132) - (max-command int32 :offset-assert 136) - (selected-index int32 :offset-assert 140) - (selected-dist float :offset-assert 144) - (selected-node-edge? basic :offset-assert 148) - (closest-node int32 :offset-assert 152) - (dist-closest-node float :offset-assert 156) - (closest-edge int32 :offset-assert 160) - (dist-closest-edge float :offset-assert 164) - (mouse-pos vector :inline :offset-assert 172) - (mouse-hit vector :inline :offset-assert 188) - (mouse-hit-pick vector :inline :offset-assert 204) - (mouse-normal vector :inline :offset-assert 220) - (mouse-spos-hold vector :inline :offset-assert 236) - (edge-src int32 :offset-assert 252) - (edge-dst int32 :offset-assert 256) - (edge-visibility int32 :offset-assert 260) - (vehicle-edit-mode basic :offset-assert 264) - (hover-edit-mode basic :offset-assert 268) - (clipping-dist float :offset-assert 272) - (plane-height float :offset-assert 276) - (plane-height-hold float :offset-assert 280) - (default-node mysql-nav-node :inline :offset-assert 284) - (default-edge mysql-nav-edge :inline :offset-assert 352) - (command-array basic :offset-assert 420) + ((nav-graph basic :offset-assert 128) + (mode uint32 :offset-assert 132) + (command-id int32 :offset-assert 136) + (max-command int32 :offset-assert 140) + (selected-index int32 :offset-assert 144) + (selected-dist float :offset-assert 148) + (selected-node-edge? basic :offset-assert 152) + (closest-node int32 :offset-assert 156) + (dist-closest-node float :offset-assert 160) + (closest-edge int32 :offset-assert 164) + (dist-closest-edge float :offset-assert 168) + (mouse-pos vector :inline :offset-assert 176) + (mouse-hit vector :inline :offset-assert 192) + (mouse-hit-pick vector :inline :offset-assert 208) + (mouse-normal vector :inline :offset-assert 224) + (mouse-spos-hold vector :inline :offset-assert 240) + (edge-src int32 :offset-assert 256) + (edge-dst int32 :offset-assert 260) + (edge-visibility int32 :offset-assert 264) + (vehicle-edit-mode basic :offset-assert 268) + (hover-edit-mode basic :offset-assert 272) + (clipping-dist float :offset-assert 276) + (plane-height float :offset-assert 280) + (plane-height-hold float :offset-assert 284) + (default-node mysql-nav-node :inline :offset-assert 288) + (default-edge mysql-nav-edge :inline :offset-assert 356) + (command-array basic :offset-assert 424) ) :method-count-assert 64 :size-assert #x1ac :flag-assert #x40013001ac (:methods - (nav-graph-editor-method-9 () none 9) - (nav-graph-editor-method-10 () none 10) - (nav-graph-editor-method-11 () none 11) - (nav-graph-editor-method-12 () none 12) - (nav-graph-editor-method-13 () none 13) (move-node () _type_ :state 14) (move-plane () _type_ :state 15) (create () _type_ :state 16) @@ -29334,13 +29564,12 @@ (nav-graph-editor-method-63 () none 63) ) ) -|# ;; (define-extern *nav-graph-editor* object) ;; (define-extern nav-graph-editor-init-by-other function) -;; (define-extern run-nav-graph-editor function) -;; (define-extern get-nav-graph-editor function) -;; (define-extern exit-nav-graph-editor function) +(define-extern run-nav-graph-editor (function symbol none)) +(define-extern get-nav-graph-editor (function nav-graph-editor)) +(define-extern exit-nav-graph-editor (function none)) ;; (define-extern set-minimap-edge-flag function) ;; (define-extern set-vehicle-edit-mode function) ;; (define-extern translate-nav-graph function) @@ -29364,106 +29593,135 @@ ;; default-menu ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *debug-menu-context* object) ;; debug-menu-context -;; (define-extern *dm-cam-mode-interpolation* object) ;; int -;; (define-extern dm-cam-mode-func function) ;; (function (state camera-slave) debug-menu-msg object) -;; (define-extern dm-cam-mode-default function) -;; (define-extern dm-cam-settings-default function) -;; (define-extern dm-cam-settings-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-cam-settings-func-int function) ;; (function int debug-menu-msg int int int) -;; (define-extern dm-cam-externalize function) ;; (function symbol debug-menu-msg symbol) -;; (define-extern dm-cam-setting-float function) -;; (define-extern dm-cam-render-float function) ;; (function int debug-menu-msg float float float) -;; (define-extern dm-subdiv-float function) ;; (function symbol debug-menu-msg float float float) -;; (define-extern dm-subdiv-int function) ;; (function symbol debug-menu-msg int int int) -;; (define-extern dm-select-race-path function) -;; (define-extern dm-setting-language function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-setting-subtitle-language function) -;; (define-extern dm-setting-stereo-mode function) -;; (define-extern dm-current-continue function) ;; (function string debug-menu-msg symbol) -;; (define-extern dm-subdiv-draw-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-scissor-subdiv-draw-func function) -;; (define-extern dm-foreground-subdiv-draw-func function) -;; (define-extern dm-col-rend-on-func function) -;; (define-extern dm-col-rend-outline-func function) -;; (define-extern dm-col-rend-back-face-func function) -;; (define-extern dm-col-rend-normals-func function) -;; (define-extern dm-col-rend-ghost-hidden-func function) -;; (define-extern dm-col-rend-track-func function) -;; (define-extern dm-col-rend-show-only-toggle-func function) -;; (define-extern dm-col-rend-show-only-set-func function) -;; (define-extern dm-col-rend-cspec-toggle function) -;; (define-extern dm-col-rend-size function) -;; (define-extern dm-col-rend-cam-dist function) -;; (define-extern dm-ocean-height-func function) -;; (define-extern dm-ocean-subdiv-draw-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-time-of-day-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-time-of-day-func2 function) ;; (function (pointer symbol) debug-menu-msg symbol) -;; (define-extern dm-time-of-day-palette-func function) -;; (define-extern dm-boolean-toggle-pick-func function) ;; (function (pointer symbol) debug-menu-msg symbol) -;; (define-extern dm-time-of-day-pick-func function) ;; (function symbol debug-menu-msg none) -;; (define-extern dm-stats-memory-func function) -;; (define-extern dm-actor-marks-pick-func function) ;; (function symbol debug-menu-msg symbol) -;; (define-extern dm-select-race-pick-func function) -;; (define-extern dm-compact-actor-pick-func function) ;; (function symbol debug-menu-msg symbol) -;; (define-extern dm-actor-vis-pick-func function) ;; (function symbol debug-menu-msg symbol) -;; (define-extern dm-game-mode-pick-func function) ;; (function symbol debug-menu-msg symbol) -;; (define-extern dm-game-feature-toggle-pick-func function) -;; (define-extern dm-game-secret-toggle-pick-func function) -;; (define-extern display-scene-control-toggle-pick-func function) -;; (define-extern display-scene-control-set-pick-func function) -;; (define-extern display-bot-marks-toggle-pick-func function) -;; (define-extern display-bot-marks-set-pick-func function) -;; (define-extern display-race-marks-toggle-pick-func function) -;; (define-extern display-race-marks-set-pick-func function) -;; (define-extern dm-vu1-user-toggle-pick-func function) ;; (function vu1-renderer-mask debug-menu-msg symbol) -;; (define-extern dm-vu1-user-all-pick-func function) -;; (define-extern dm-vu1-user-none-pick-func function) -;; (define-extern dm-texture-user-toggle-pick-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-texture-user-set-pick-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-strip-lines-toggle-pick-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-strip-lines-set-pick-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern dm-edit-instance-toggle-pick-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern all-texture-tweak-adjust function) ;; (function texture-page-dir float none) -;; (define-extern dm-float-field-tie-rvanish-func function) -;; (define-extern dm-float-field-tie-vanish-far-func function) -;; (define-extern dm-bug-report-output-pick-func function) -;; (define-extern dm-bug-report-report-pick-func function) -;; (define-extern debug-menu-node obj type)) - (format #t "~1Tlast-position: #~%" (-> obj last-position)) - (format #t "~1Tangle: ~f~%" (-> obj angle)) - (format #t "~1Tprocess: ~A~%" (-> obj process)) - (format #t "~1Twheel-radius: ~f~%" (-> obj wheel-radius)) - (format #t "~1Twheel-axis: ~D~%" (-> obj wheel-axis)) - (label cfg-4) - obj - ) (defun joint-mod-wheel-callback ((arg0 cspace) (arg1 transformq)) (let ((s4-0 (the-as joint-mod-wheel (-> arg0 param1)))) @@ -197,6 +186,7 @@ ) ) + (defun joint-mod-set-local-callback ((arg0 cspace) (arg1 transformq)) (let ((v1-0 (the-as joint-mod-set-local (-> arg0 param1)))) (cond @@ -259,6 +249,7 @@ ) ) + (defun joint-mod-add-local-callback ((arg0 cspace) (arg1 transformq)) (let ((s4-0 (the-as joint-mod-add-local (-> arg0 param1)))) (when (-> s4-0 enable) @@ -314,6 +305,7 @@ ) ) + (defun joint-mod-set-world-callback ((arg0 cspace) (arg1 transformq)) (let ((v1-0 (the-as joint-mod-set-world (-> arg0 param1)))) (if (-> v1-0 enable) @@ -354,6 +346,7 @@ ) ) + (defun joint-mod-blend-local-callback ((arg0 cspace) (arg1 transformq)) (let ((gp-0 (the-as joint-mod-blend-local (-> arg0 param1)))) (cond @@ -406,6 +399,7 @@ ) ) + (defun joint-mod-spinner-callback ((arg0 cspace) (arg1 transformq)) (with-pp (let ((gp-0 (the-as joint-mod-spinner (-> arg0 param1)))) @@ -456,6 +450,7 @@ ) ) + (defun joint-mod-blend-world-callback ((arg0 cspace) (arg1 transformq)) (rlet ((vf0 :class vf) (vf4 :class vf) @@ -561,6 +556,7 @@ ) ) + (defun joint-mod-rotate-local-callback ((arg0 cspace) (arg1 transformq)) (let ((v1-0 (the-as joint-mod-rotate-local (-> arg0 param1)))) (new 'stack-no-clear 'vector) diff --git a/goal_src/jak2/engine/camera/camera-h.gc b/goal_src/jak2/engine/camera/camera-h.gc index 8b78b36a25..feb2502a60 100644 --- a/goal_src/jak2/engine/camera/camera-h.gc +++ b/goal_src/jak2/engine/camera/camera-h.gc @@ -20,6 +20,21 @@ (between 3) ) +(defenum camera-slave-options + :type uint32 + :bitfield #t + (butt-cam) + (same-side) + (move-spherical) + (allow-z-rot) + (pitch-for-jump) + (collide) + (find-hidden-target) + (drag) + (line-of-sight) + (no-rotate) + (sticky-angle)) + ;; NOTE - for settings (declare-type camera-slave process) (define-extern cam-master-set-entity (function cam-setting-data none)) @@ -303,7 +318,7 @@ (circular-follow vector :inline :offset-assert 2256) (max-angle-offset float :offset-assert 2272) (max-angle-curr float :offset-assert 2276) - (options uint32 :offset-assert 2280) + (options camera-slave-options :offset-assert 2280) (cam-entity entity :offset-assert 2284) (butt-timer uint64 :offset-assert 2288) (butt-seek basic :offset-assert 2296) diff --git a/goal_src/jak2/engine/collide/collide-target-h.gc b/goal_src/jak2/engine/collide/collide-target-h.gc index b15d4593dc..4643b6fa55 100644 --- a/goal_src/jak2/engine/collide/collide-target-h.gc +++ b/goal_src/jak2/engine/collide/collide-target-h.gc @@ -9,6 +9,7 @@ (deftype control-info (collide-shape-moving) ((unknown-qword00 vector :offset 12) + (unknown-float00 float :offset 528) (unknown-surface00 surface :offset 3832) (unknown-cpad-info00 cpad-info :offset 3848) (unknown-time-frame00 time-frame :offset 4624) diff --git a/goal_src/jak2/engine/entity/entity-h.gc b/goal_src/jak2/engine/entity/entity-h.gc index f98240349d..7ba1182d01 100644 --- a/goal_src/jak2/engine/entity/entity-h.gc +++ b/goal_src/jak2/engine/entity/entity-h.gc @@ -184,9 +184,9 @@ (deftype entity-info (basic) ((ptype type :offset-assert 4) - (package basic :offset-assert 8) + (package string :offset-assert 8) (art-group pair :offset-assert 12) - (pool basic :offset-assert 16) + (pool symbol :offset-assert 16) (heap-size int32 :offset-assert 20) ) :method-count-assert 9 diff --git a/goal_src/jak2/engine/entity/entity-table.gc b/goal_src/jak2/engine/entity/entity-table.gc index d16ce541e7..d92f65ad6a 100644 --- a/goal_src/jak2/engine/entity/entity-table.gc +++ b/goal_src/jak2/engine/entity/entity-table.gc @@ -7,3 +7,219 @@ ;; DECOMP BEGINS +(define *entity-info* (the-as (array entity-info) (new 'static 'boxed-array :type entity-info + (new 'static 'entity-info + :ptype (type-ref stadium-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref citywide-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctywide-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref tomb-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctyslumb-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctygena-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctyindb-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref jellyfish :method-count 167) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x10000 + ) + (new 'static 'entity-info + :ptype (type-ref widow :method-count 47) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x10000 + ) + (new 'static 'entity-info + :ptype (type-ref nav-graph :method-count 47) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref pal-electric-fan :method-count 23) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x6000 + ) + (new 'static 'entity-info + :ptype (type-ref lurker-pipe-lid :method-count 31) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctyn-lamp :method-count 31) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref burning-bush :method-count 35) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref sail-boat-a :method-count 179) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref barge :method-count 151) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref propa :method-count 35) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref city-window-a :method-count 179) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref cty-window-a :method-count 179) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref parking-spot :method-count 27) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref security-wall :method-count 27) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref cty-guard-turret :method-count 39) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref cty-fruit-stand :method-count 31) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref fruit-stand :method-count 31) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref torn :method-count 179) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref neon-baron :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x10000 + ) + ) + ) + ) + +(defun entity-info-lookup ((arg0 type)) + "Given a type, return the [[entity-info]] from [[*entity-info*]] whos type + matches the `ptype` field. Set's `method 13` on said type that returns the `length` + off the [[entity-info]] + + If nothing matches, set `method 13` to `#f` and return `#f`" + (the-as entity-info (cond + ((nonzero? (-> arg0 method-table 13)) + (-> arg0 method-table 13) + ) + (else + (let ((v1-1 *entity-info*)) + (dotimes (a1-0 (-> v1-1 length)) + (when (= arg0 (-> v1-1 a1-0 ptype)) + (set! (-> arg0 method-table 13) (the-as function (-> v1-1 a1-0))) + (return (the-as entity-info (-> v1-1 a1-0))) + ) + ) + ) + (set! (-> arg0 method-table 13) #f) + (the-as basic #f) + ) + ) + ) + ) + + + + diff --git a/goal_src/jak2/engine/entity/relocate.gc b/goal_src/jak2/engine/entity/relocate.gc index 6dc6c7f97f..c8422f0d92 100644 --- a/goal_src/jak2/engine/entity/relocate.gc +++ b/goal_src/jak2/engine/entity/relocate.gc @@ -7,3 +7,390 @@ ;; DECOMP BEGINS +(defmethod relocate process ((obj process) (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) + ) + (&+! (-> obj ppointer 0) arg0) + (let ((v1-5 (-> obj entity))) + (if (and v1-5 (= (-> v1-5 extra process) obj)) + (&+! (-> v1-5 extra process) arg0) + ) + ) + (let ((v1-7 (-> obj connection-list next1))) + (while (the-as connection v1-7) + (let ((a0-14 (-> v1-7 prev1))) + (if (and (>= (the-as int a0-14) (-> *kernel-context* relocating-min)) + (< (the-as int a0-14) (-> *kernel-context* relocating-max)) + ) + (&+! (-> v1-7 prev1) arg0) + ) + ) + (let ((a0-19 (-> (the-as connection v1-7) param1))) + (if (and (>= a0-19 (-> *kernel-context* relocating-min)) (< a0-19 (-> *kernel-context* relocating-max))) + (+! (-> (the-as connection v1-7) param1) arg0) + ) + ) + (let ((a0-24 (-> (the-as connection v1-7) param2))) + (if (and (>= a0-24 (-> *kernel-context* relocating-min)) (< a0-24 (-> *kernel-context* relocating-max))) + (+! (-> (the-as connection v1-7) param2) arg0) + ) + ) + (let ((a0-29 (-> (the-as connection v1-7) param3))) + (if (and (>= a0-29 (-> *kernel-context* relocating-min)) (< a0-29 (-> *kernel-context* relocating-max))) + (+! (-> (the-as connection v1-7) param3) arg0) + ) + ) + (set! v1-7 (-> (the-as connection v1-7) next1)) + ) + ) + (let ((v1-10 (-> obj self))) + (if (and (>= (the-as int v1-10) (-> *kernel-context* relocating-min)) + (< (the-as int v1-10) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj self) arg0) + ) + ) + (let ((v1-15 (-> obj ppointer))) + (if (and (>= (the-as int v1-15) (-> *kernel-context* relocating-min)) + (< (the-as int v1-15) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj ppointer) arg0) + ) + ) + (let ((s4-0 (&+ (-> obj heap-base) 4))) + (while (< (the-as int s4-0) (the-as int (-> obj heap-cur))) + (relocate s4-0 arg0) + (&+! s4-0 (logand -16 (+ (asize-of s4-0) 15))) + ) + ) + (&+! (-> obj main-thread) arg0) + (&+! (-> obj top-thread) arg0) + (&+! (-> obj heap-base) arg0) + (&+! (-> obj heap-cur) arg0) + (&+! (-> obj heap-top) arg0) + (let ((a2-4 (asize-of obj)) + (a1-22 (&-> obj type)) + ) + (cond + ((>= arg0 0) + (qmem-copy->! (&+ a1-22 arg0) a1-22 a2-4) + ) + ((< a2-4 2560) + (qmem-copy<-! (&+ a1-22 arg0) a1-22 a2-4) + ) + (else + (ultimate-memcpy (&+ a1-22 arg0) a1-22 (the-as uint a2-4)) + ) + ) + ) + (set! (-> *kernel-context* relocating-process) #f) + (&+ obj arg0) + ) + +(defmethod relocate cpu-thread ((obj cpu-thread) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate process-drawable ((obj process-drawable) (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 ((a0-6 (-> obj nav))) + (if (and (nonzero? a0-6) a0-6) + (relocate a0-6 arg0) + ) + ) + (if (nonzero? (-> obj root)) + (&+! (-> obj root) arg0) + ) + (if (nonzero? (-> obj node-list)) + (&+! (-> obj node-list) arg0) + ) + (if (nonzero? (-> obj draw)) + (&+! (-> obj draw) arg0) + ) + (if (nonzero? (-> obj skel)) + (&+! (-> obj skel) arg0) + ) + (if (nonzero? (-> obj align)) + (&+! (-> obj align) arg0) + ) + (if (nonzero? (-> obj path)) + (&+! (-> obj path) arg0) + ) + (if (nonzero? (-> obj vol)) + (&+! (-> obj vol) arg0) + ) + (if (nonzero? (-> obj fact)) + (&+! (-> obj fact) arg0) + ) + (if (nonzero? (-> obj link)) + (&+! (-> obj link) arg0) + ) + (if (nonzero? (-> obj part)) + (&+! (-> obj part) arg0) + ) + (if (nonzero? (-> obj water)) + (&+! (-> obj water) arg0) + ) + (if (nonzero? (-> obj sound)) + (&+! (-> obj sound) arg0) + ) + (if (nonzero? (-> obj carry)) + (&+! (-> obj carry) arg0) + ) + (if (nonzero? (-> obj rbody)) + (&+! (-> obj rbody) arg0) + ) + (the-as process-drawable ((method-of-type process relocate) obj arg0)) + ) + +(defmethod relocate collide-shape ((obj collide-shape) (arg0 int)) + (&+! (-> obj process) arg0) + (&+! (-> obj root-prim) arg0) + obj + ) + +(defmethod relocate collide-shape-moving ((obj collide-shape-moving) (arg0 int)) + (if (-> obj dynam) + (&+! (-> obj dynam) arg0) + ) + (the-as collide-shape-moving ((method-of-type collide-shape relocate) obj arg0)) + ) + +(defmethod relocate collide-shape-prim ((obj collide-shape-prim) (arg0 int)) + (&+! (-> obj cshape) arg0) + obj + ) + +(defmethod relocate collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 int)) + (&+! (-> obj cshape) arg0) + (set! (-> obj child) (the-as (inline-array collide-shape) (&+ (the-as pointer (-> obj child)) arg0))) + obj + ) + +(defmethod relocate fact-info ((obj fact-info) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate draw-control ((obj draw-control) (arg0 int)) + (&+! (-> obj skeleton) arg0) + (&+! (-> obj process) arg0) + (when (-> obj ripple) + (if (-> obj ripple query) + (&+! (-> obj ripple query) arg0) + ) + (&+! (-> obj ripple) arg0) + ) + (let ((v1-14 (-> obj shadow-ctrl))) + (if (and (>= (the-as int v1-14) (-> *kernel-context* relocating-min)) + (< (the-as int v1-14) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj shadow-ctrl) arg0) + ) + ) + obj + ) + +(defmethod relocate joint-control ((obj joint-control) (arg0 int)) + (if (-> obj effect) + (&+! (-> obj effect) arg0) + ) + (if (-> obj top-anim) + (&+! (-> obj top-anim) arg0) + ) + (+! (-> obj root-channel) arg0) + (countdown (v1-10 (-> obj allocated-length)) + (&+! (-> obj channel v1-10 parent) arg0) + ) + obj + ) + +(defmethod relocate cspace-array ((obj cspace-array) (arg0 int)) + (countdown (v1-0 (-> obj length)) + (let ((a2-2 (-> obj data v1-0))) + (if (-> a2-2 parent) + (&+! (-> a2-2 parent) arg0) + ) + (&+! (-> a2-2 bone) arg0) + (let ((a3-6 (-> a2-2 param1))) + (if (and (>= (the-as int a3-6) (-> *kernel-context* relocating-min)) + (< (the-as int a3-6) (-> *kernel-context* relocating-max)) + ) + (&+! (-> a2-2 param1) arg0) + ) + ) + (let ((a3-11 (-> a2-2 param2))) + (if (and (>= (the-as int a3-11) (-> *kernel-context* relocating-min)) + (< (the-as int a3-11) (-> *kernel-context* relocating-max)) + ) + (&+! (-> a2-2 param2) arg0) + ) + ) + ) + ) + obj + ) + +(defmethod relocate path-control ((obj path-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate vol-control ((obj vol-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate water-control ((obj water-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate actor-link-info ((obj actor-link-info) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate align-control ((obj align-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate joint-mod ((obj joint-mod) (arg0 int)) + (&+! (-> obj process) arg0) + (&+! (-> obj joint) arg0) + obj + ) + +(defmethod relocate joint-mod-wheel ((obj joint-mod-wheel) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate joint-mod-ik ((obj joint-mod-ik) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate effect-control ((obj effect-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +(defmethod relocate sparticle-launch-control ((obj sparticle-launch-control) (arg0 int)) + (&+! (-> obj proc) arg0) + (countdown (v1-2 (-> obj length)) + (let* ((a0-4 (-> obj data v1-2)) + (a2-0 (-> a0-4 center)) + ) + (if (and (>= (the-as int a2-0) (-> *kernel-context* relocating-min)) + (< (the-as int a2-0) (-> *kernel-context* relocating-max)) + ) + (&+! (-> a0-4 center) arg0) + ) + ) + ) + (forall-particles-with-key + obj + (lambda ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (let ((v1-1 (-> *kernel-context* relocating-offset))) + (set! (-> arg1 key) (the-as sparticle-launch-control (+ (the-as int (-> arg1 key)) v1-1))) + (if (-> arg1 binding) + (set! (-> arg1 binding) (the-as sparticle-launch-state (+ (the-as int (-> arg1 binding)) v1-1))) + ) + ) + 0 + (none) + ) + #t + #t + ) + obj + ) + +(defmethod relocate camera-master ((obj camera-master) (arg0 int)) + (if (nonzero? (-> obj water-drip)) + (&+! (-> obj water-drip) arg0) + ) + (the-as camera-master ((method-of-type process relocate) obj arg0)) + ) + +(defmethod relocate time-of-day-proc ((obj time-of-day-proc) (arg0 int)) + (if (nonzero? (-> obj sun)) + (&+! (-> obj sun) arg0) + ) + (if (nonzero? (-> obj green-sun)) + (&+! (-> obj green-sun) arg0) + ) + (if (nonzero? (-> obj moon)) + (&+! (-> obj moon) arg0) + ) + (the-as time-of-day-proc ((method-of-type process relocate) obj arg0)) + ) + +(defmethod relocate part-tracker ((obj part-tracker) (arg0 int)) + (if (nonzero? (-> obj root)) + (&+! (-> obj root) arg0) + ) + (if (nonzero? (-> obj part)) + (&+! (-> obj part) arg0) + ) + (the-as part-tracker ((method-of-type process relocate) obj arg0)) + ) + +(defmethod relocate part-spawner ((obj part-spawner) (arg0 int)) + (if (nonzero? (-> obj root)) + (&+! (-> obj root) arg0) + ) + (if (nonzero? (-> obj part)) + (&+! (-> obj part) arg0) + ) + (if (nonzero? (-> obj sound)) + (&+! (-> obj sound) arg0) + ) + (the-as part-spawner ((method-of-type process relocate) obj arg0)) + ) + +(defmethod relocate lightning-tracker ((obj lightning-tracker) (arg0 int)) + (if (nonzero? (-> obj root)) + (&+! (-> obj root) arg0) + ) + (if (nonzero? (-> obj lightning)) + (&+! (-> obj lightning) arg0) + ) + (the-as lightning-tracker ((method-of-type process relocate) obj arg0)) + ) + +(defmethod relocate manipy ((obj manipy) (arg0 int)) + (if (nonzero? (-> obj joint 0)) + (&+! (-> obj joint 0) arg0) + ) + (if (nonzero? (-> obj joint 1)) + (&+! (-> obj joint 1) arg0) + ) + (if (nonzero? (-> obj joint 2)) + (&+! (-> obj joint 2) arg0) + ) + (if (nonzero? (-> obj joint 3)) + (&+! (-> obj joint 3) arg0) + ) + (the-as manipy ((method-of-type process-drawable relocate) obj arg0)) + ) + + + + diff --git a/goal_src/jak2/engine/game/game-info-h.gc b/goal_src/jak2/engine/game/game-info-h.gc index 09fbe8a80b..d1cb3cf0ba 100644 --- a/goal_src/jak2/engine/game/game-info-h.gc +++ b/goal_src/jak2/engine/game/game-info-h.gc @@ -68,8 +68,68 @@ (cf30 30) ) +(defenum game-feature + :type uint64 + :bitfield #t + (unk-game-feature-01) + (unk-game-feature-02) + (unk-game-feature-03) + (unk-game-feature-04) + (unk-game-feature-05) + (unk-game-feature-06) + (gun-yellow) + (gun-red) + (gun-blue) + (gun-dark) + (board) + (carry) + (sidekick) + (darkjak) + (gun-upgrade-speed) + (gun-upgrade-ammo) + (gun-upgrade-damage) + (unk-game-feature-18) + (pass-red) + (pass-green) + (pass-yellow) + (unk-game-feature-22) + (darkjak-bomb0) + (darkjak-bomb1) + (darkjak-invinc) + (darkjak-giant) + (board-training)) + +(defenum game-secrets + :type uint32 + :bitfield #t + (toggle-beard) + (hflip-screen) + (endless-ammo) + (invulnerable) + (endless-dark) + (scene-player-1) + (scene-player-2) + (scene-player-3) + (level-select) + (scrap-book-1) + (scrap-book-2) + (gungame-blue) + (gungame-dark) + (reverse-races) + (hero-mode) + (big-head) + (little-head)) + +(declare-type game-info basic) +(define-extern *game-info* game-info) +(declare-type process-drawable process) +(define-extern process-drawable-art-error (state string process-drawable)) +(define-extern part-group-pointer? (function pointer symbol)) + ;; DECOMP BEGINS +(local-vars (gp-0 game-info)) + (deftype game-bank (basic) ((life-max-default float :offset-assert 4) (life-start-default float :offset-assert 8) @@ -82,6 +142,7 @@ :flag-assert #x900000018 ) + (define *GAME-bank* (new 'static 'game-bank :life-max-default 99.0 :life-start-default 5.0 @@ -113,6 +174,7 @@ ) ) + (deftype level-buffer-state (structure) ((name symbol :offset-assert 0) (display? symbol :offset-assert 4) @@ -125,6 +187,7 @@ :flag-assert #x900000010 ) + (deftype load-state (basic) ((want level-buffer-state 6 :inline :offset-assert 4) (want-sound symbol 3 :offset-assert 100) @@ -154,25 +217,6 @@ ) ) -(defmethod inspect load-state ((obj load-state)) - (when (not obj) - (return obj) - ) - (format #t "[~8x] ~A~%" obj (-> obj type)) - (format #t "~1Twant[6] @ #x~X~%" (-> obj want)) - (dotimes (s5-0 6) - (format #t "~T [~D]~1Twant: ~`level-buffer-state`P~%" s5-0 (-> obj want s5-0)) - ) - (format #t "~1Twant-sound[3] @ #x~X~%" (-> obj want-sound)) - (dotimes (s5-1 3) - (format #t "~T [~D]~1Twant-sound: ~`symbol`P~%" s5-1 (-> obj want-sound s5-1)) - ) - (format #t "~1Tvis-nick: ~A~%" (-> obj vis-nick)) - (format #t "~1Tcommand-list: ~A~%" (-> obj command-list)) - (format #t "~1Tobject-name[256] @ #x~X~%" (-> obj object-name)) - (format #t "~1Tobject-status[256] @ #x~X~%" (-> obj object-status)) - obj - ) (defmethod new load-state ((allocation symbol) (type-to-make type)) (reset! (object-new allocation type-to-make (the-as int (-> type-to-make size)))) @@ -201,126 +245,104 @@ ) ) -(defmethod inspect continue-point ((obj continue-point)) - (when (not obj) - (return obj) - ) - (format #t "[~8x] ~A~%" obj (-> obj type)) - (format #t "~1Tname: ~A~%" (-> obj name)) - (format #t "~1Tlevel: ~A~%" (-> obj level)) - (format #t "~1Tflags: ~D~%" (-> obj flags)) - (format #t "~1Ttrans: ~`vector`P~%" (-> obj trans)) - (format #t "~1Tquat: ~`vector`P~%" (-> obj quat)) - (format #t "~1Tcamera-trans: ~`vector`P~%" (-> obj camera-trans)) - (format #t "~1Tcamera-rot[9] @ #x~X~%" (-> obj camera-rot)) - (format #t "~1Ton-goto: ~A~%" (-> obj on-goto)) - (format #t "~1Tvis-nick: ~A~%" (-> obj vis-nick)) - (format #t "~1Twant[6] @ #x~X~%" (-> obj want)) - (dotimes (s5-0 6) - (format #t "~T [~D]~1Twant: ~`level-buffer-state`P~%" s5-0 (-> obj want s5-0)) - ) - (format #t "~1Twant-sound[3] @ #x~X~%" (-> obj want-sound)) - (dotimes (s5-1 3) - (format #t "~T [~D]~1Twant-sound: ~`symbol`P~%" s5-1 (-> obj want-sound s5-1)) - ) - obj - ) (deftype game-info (basic) - ((mode symbol :offset-assert 4) - (save-name string :offset-assert 8) - (life float :offset-assert 12) - (life-max float :offset-assert 16) - (money float :offset-assert 20) - (money-total float :offset-assert 24) - (money-per-level uint8 32 :offset-assert 28) - (deaths-per-level uint8 32 :offset-assert 60) - (buzzer-total float :offset-assert 92) - (fuel float :offset-assert 96) - (gem float :offset-assert 100) - (gem-total float :offset-assert 104) - (skill float :offset-assert 108) - (skill-total float :offset-assert 112) - (karma float :offset-assert 116) - (eco-pill-dark float :offset-assert 120) - (eco-pill-dark-total float :offset-assert 124) - (features uint64 :offset-assert 128) - (debug-features uint64 :offset-assert 136) - (secrets uint32 :offset-assert 144) - (unknown-pad1 uint32 :offset-assert 148) - (purchase-secrets uint32 :offset-assert 152) - (unknown-pad2 uint32 :offset-assert 156) - (gun-type int32 :offset-assert 160) - (gun-ammo float 4 :offset-assert 164) - (shield float :offset-assert 180) - (score float :offset-assert 184) - (score-owner uint64 :offset-assert 192) - (timer uint64 :offset-assert 200) - (timer-owner uint64 :offset-assert 208) - (timer-flash basic :offset-assert 216) - (counter float :offset-assert 220) - (counter-flash basic :offset-assert 224) - (attack-id uint32 :offset-assert 228) - (perm-list entity-perm-array :offset-assert 232) - (task-perm-list entity-perm-array :offset-assert 236) - (current-continue continue-point :offset-assert 240) - (last-continue continue-point :offset-assert 244) - (unknown-pad3 uint32 3 :offset-assert 248) - (task-counter uint32 :offset-assert 260) - (unknown-pad4 uint32 :offset-assert 264) - (level-opened uint8 32 :offset-assert 268) - (total-deaths int32 :offset-assert 300) - (continue-deaths int32 :offset-assert 304) - (task-deaths int32 :offset-assert 308) - (total-trys int32 :offset-assert 312) - (game-start-time time-frame :offset-assert 320) - (continue-time time-frame :offset-assert 328) - (death-time time-frame :offset-assert 336) - (hit-time time-frame :offset-assert 344) - (task-pickup-time time-frame :offset-assert 352) - (unknown-array1 (array uint64) :offset-assert 360) - (unknown-array2 (array uint64) :offset-assert 364) - (unknown-array3 (array uint64) :offset-assert 368) - (death-pos vector-array :offset 372) - (stop-watch-start uint64 :offset-assert 376) - (stop-watch-stop uint64 :offset-assert 384) - (blackout-time time-frame :offset-assert 392) - (letterbox-time time-frame :offset-assert 400) - (hint-play-time time-frame :offset-assert 408) - (display-text-time time-frame :offset-assert 416) - (display-text-handle uint64 :offset-assert 424) - (death-movie-tick int32 :offset-assert 432) - (want-auto-save symbol :offset-assert 436) - (auto-save-proc handle :offset-assert 440) - (auto-save-status mc-status-code :offset-assert 448) - (auto-save-card int32 :offset-assert 452) - (auto-save-which int32 :offset-assert 456) - (auto-save-count int32 :offset-assert 460) - (pov-camera-handle uint64 :offset-assert 464) - (other-camera-handle uint64 :offset-assert 472) - (controller uint64 2 :offset-assert 480) - (race-timer uint64 :offset-assert 496) - (race-current-lap-count int32 :offset-assert 504) - (race-total-lap-count int32 :offset-assert 508) - (race-position int32 :offset-assert 512) - (race-number-turbos int32 :offset-assert 516) - (bot-health uint32 3 :offset-assert 520) - (demo-state uint32 :offset-assert 532) - (wanted-flash basic :offset-assert 536) - (distance float :offset-assert 540) - (kiosk-timeout uint64 :offset-assert 544) - (pause-start-time time-frame :offset-assert 552) - (game-score (array highscore-info) :offset-assert 560) - (goal float :offset-assert 564) - (miss float :offset-assert 568) - (miss-max float :offset-assert 572) - (unknown-array4 (array uint64) :offset-assert 576) - (live-eco-pill-count int32 :offset-assert 580) - (live-gem-count int32 :offset-assert 584) - (air-supply float :offset-assert 588) - (homing-beacon int32 :offset-assert 592) - (dark-eco-pickup int32 :offset-assert 596) - (green-eco-pickup int32 :offset-assert 600) + ((mode symbol :offset-assert 4) + (save-name string :offset-assert 8) + (life float :offset-assert 12) + (life-max float :offset-assert 16) + (money float :offset-assert 20) + (money-total float :offset-assert 24) + (money-per-level uint8 32 :offset-assert 28) + (deaths-per-level uint8 32 :offset-assert 60) + (buzzer-total float :offset-assert 92) + (fuel float :offset-assert 96) + (gem float :offset-assert 100) + (gem-total float :offset-assert 104) + (skill float :offset-assert 108) + (skill-total float :offset-assert 112) + (karma float :offset-assert 116) + (eco-pill-dark float :offset-assert 120) + (eco-pill-dark-total float :offset-assert 124) + (features game-feature :offset-assert 128) + (debug-features game-feature :offset-assert 136) + (secrets game-secrets :offset-assert 144) + (unknown-pad1 uint32 :offset-assert 148) + (purchase-secrets uint32 :offset-assert 152) + (unknown-pad2 uint32 :offset-assert 156) + (gun-type int32 :offset-assert 160) + (gun-ammo float 4 :offset-assert 164) + (shield float :offset-assert 180) + (score float :offset-assert 184) + (score-owner uint64 :offset-assert 192) + (timer uint64 :offset-assert 200) + (timer-owner uint64 :offset-assert 208) + (timer-flash basic :offset-assert 216) + (counter float :offset-assert 220) + (counter-flash basic :offset-assert 224) + (attack-id uint32 :offset-assert 228) + (perm-list entity-perm-array :offset-assert 232) + (task-perm-list entity-perm-array :offset-assert 236) + (current-continue continue-point :offset-assert 240) + (last-continue continue-point :offset-assert 244) + (unknown-pad3 array :offset-assert 248) + (unknown-pad4 array :offset-assert 252) + (unknown-pad5 array :offset-assert 256) + (task-counter uint32 :offset-assert 260) + (unknown-pad6 uint32 :offset-assert 264) + (level-opened uint8 32 :offset-assert 268) + (total-deaths int32 :offset-assert 300) + (continue-deaths int32 :offset-assert 304) + (task-deaths int32 :offset-assert 308) + (total-trys int32 :offset-assert 312) + (game-start-time time-frame :offset-assert 320) + (continue-time time-frame :offset-assert 328) + (death-time time-frame :offset-assert 336) + (hit-time time-frame :offset-assert 344) + (task-pickup-time time-frame :offset-assert 352) + (unknown-array1 (array uint64) :offset-assert 360) + (unknown-array2 (array uint64) :offset-assert 364) + (unknown-array3 (array uint64) :offset-assert 368) + (death-pos vector-array :offset 372) + (stop-watch-start uint64 :offset-assert 376) + (stop-watch-stop uint64 :offset-assert 384) + (blackout-time time-frame :offset-assert 392) + (letterbox-time time-frame :offset-assert 400) + (hint-play-time time-frame :offset-assert 408) + (display-text-time time-frame :offset-assert 416) + (display-text-handle uint64 :offset-assert 424) + (death-movie-tick int32 :offset-assert 432) + (want-auto-save symbol :offset-assert 436) + (auto-save-proc handle :offset-assert 440) + (auto-save-status mc-status-code :offset-assert 448) + (auto-save-card int32 :offset-assert 452) + (auto-save-which int32 :offset-assert 456) + (auto-save-count int32 :offset-assert 460) + (pov-camera-handle uint64 :offset-assert 464) + (other-camera-handle uint64 :offset-assert 472) + (controller uint64 2 :offset-assert 480) + (race-timer uint64 :offset-assert 496) + (race-current-lap-count int32 :offset-assert 504) + (race-total-lap-count int32 :offset-assert 508) + (race-position int32 :offset-assert 512) + (race-number-turbos int32 :offset-assert 516) + (bot-health uint32 3 :offset-assert 520) + (demo-state uint32 :offset-assert 532) + (wanted-flash basic :offset-assert 536) + (distance float :offset-assert 540) + (kiosk-timeout uint64 :offset-assert 544) + (pause-start-time time-frame :offset-assert 552) + (game-score (array highscore-info) :offset-assert 560) + (goal float :offset-assert 564) + (miss float :offset-assert 568) + (miss-max float :offset-assert 572) + (unknown-array4 (array uint64) :offset-assert 576) + (live-eco-pill-count int32 :offset-assert 580) + (live-gem-count int32 :offset-assert 584) + (air-supply float :offset-assert 588) + (homing-beacon int32 :offset-assert 592) + (dark-eco-pickup int32 :offset-assert 596) + (green-eco-pickup int32 :offset-assert 600) ) :method-count-assert 31 :size-assert #x25c @@ -336,8 +358,8 @@ (copy-perms-from-level! (_type_ level) none 16) (copy-perms-to-level! (_type_ level) none 17) (game-info-method-18 () none 18) - (game-info-method-19 () none 19) - (game-info-method-20 () none 20) + (get-current-continue-point (_type_) continue-point 19) + (get-continue-by-name (_type_ string) continue-point 20) (set-continue! (_type_ basic) continue-point 21) (game-info-method-22 () none 22) (game-info-method-23 () none 23) @@ -359,17 +381,17 @@ ) ) -(define-extern *game-info* game-info) -(when (or (not *game-info*) (zero? *game-info*)) - (let ((gp-0 (new 'static 'game-info :mode 'debug :current-continue #f :last-continue #f))) - (set! (-> gp-0 unknown-array1) (the-as (array uint64) (new 'global 'boxed-array uint64 110))) - (set! (-> gp-0 unknown-array4) (the-as (array uint64) (new 'global 'boxed-array uint64 110))) - (set! (-> gp-0 unknown-array2) (the-as (array uint64) (new 'global 'boxed-array uint64 32))) - (set! (-> gp-0 unknown-array3) (the-as (array uint64) (new 'global 'boxed-array uint64 32))) - (set! *game-info* gp-0) - ) - ) +(set! gp-0 (when (or (not *game-info*) (zero? *game-info*)) + (set! gp-0 (new 'static 'game-info :mode 'debug :current-continue #f :last-continue #f)) + (set! (-> gp-0 unknown-array1) (the-as (array uint64) (new 'global 'boxed-array uint64 110))) + (set! (-> gp-0 unknown-array4) (the-as (array uint64) (new 'global 'boxed-array uint64 110))) + (set! (-> gp-0 unknown-array2) (the-as (array uint64) (new 'global 'boxed-array uint64 32))) + (set! (-> gp-0 unknown-array3) (the-as (array uint64) (new 'global 'boxed-array uint64 32))) + (set! *game-info* gp-0) + gp-0 + ) + ) + + + -(declare-type process-drawable process) -(define-extern process-drawable-art-error (state string process-drawable)) -(define-extern part-group-pointer? (function pointer symbol)) diff --git a/goal_src/jak2/engine/game/main-h.gc b/goal_src/jak2/engine/game/main-h.gc index 9da130e13b..1d969607cc 100644 --- a/goal_src/jak2/engine/game/main-h.gc +++ b/goal_src/jak2/engine/game/main-h.gc @@ -5,6 +5,100 @@ ;; name in dgo: main-h ;; dgos: ENGINE, GAME +;; +++strip-lines-controls +(defenum strip-lines-controls + :type int64 + (none 0) + (strippable 1) + (convertible 2) + (good 3) + (edgeable 4) + (ordinary 8) + (color-mismatch 16) + (shader-mismatch 32) + (uv-mismatch 64) + (too-big 128) + (bad 240) + (all-edges 255) + (strips 256) + (frags 512)) +;; ---strip-lines-controls + +;; +++scene-controls +(defenum scene-controls + :type int64 + (all-off 0) + (channel 1) + (anim-name 2) + (dma-size 4) + (bounds-spheres 8) + (actors 16) + (actor-marks 32) + (special-fma-spheres 64) + (all-on 95)) +;; ---scene-controls + +;; +++bot-marks-controls +(defenum bot-marks-controls + :type int64 + (all-off 0) + (course-spots 1) + (task-spots 2) + (all-on 3)) +;; ---bot-marks-controls + +;; +++race-marks-controls +(defenum race-marks-controls + :type int64 + (all-off 0) + (path0-red 1) + (path1-green 2) + (path2-blue 4) + (path3-yellow 8) + (path4-cyan 16) + (path5-violet 32) + (path6-orange 64) + (path7-black 128) + (all-paths-on 255)) +;; ---race-marks-controls + +;; +++race-selection +(defenum race-selection + :type int64 + (kiera-class3 0) + (kiera-class2 1) + (kiera-class1 2) + (errol 3) + (bush-class3 4) + (bush-class2 5) + (bush-class1 6) + (bush-errol 7) + (bush-port 8) + (bush-class3-reverse 9) + (bush-class2-reverse 10) + (bush-class1-reverse 11)) +;; ---race-selection + +;; +++subdivide-setting +(defenum subdivide-setting + :type int64 + (textured 0) + (outline 1) + (gouraud 2) + (hack 3)) +;; ---subdivide-setting + +;; +++ocean-height-hack +(defenum ocean-height-hack + :type int64 + (zero 1) + (far-below 2) + (sewer-start 3) + (sewer-hi 4) + (sewer-med 5) + (sewer-lo 6)) +;; ---ocean-height-hack + ;; NOTE - for settings (define-extern *master-exit* symbol) @@ -64,7 +158,7 @@ (define *display-instance-info* #f) (define *display-deci-count* #f) (define *sync-dma* #f) -(define *display-strip-lines* 0) +(define *display-strip-lines* (the-as strip-lines-controls 0)) (define *display-battle-marks* #f) (define *display-joint-axes* #f) (define *display-nav-marks* #f) @@ -106,18 +200,18 @@ '*stdcon* ) ) -(define *display-scene-control* 0) -(define *display-bot-marks* 0) -(define *display-race-marks* 0) +(define *display-scene-control* (the-as scene-controls 0)) +(define *display-bot-marks* (the-as bot-marks-controls 0)) +(define *display-race-marks* (the-as race-marks-controls 0)) (define *race-record-path* #f) -(define *select-race* 0) +(define *select-race* (the-as race-selection 0)) (define *select-race-path* 0) (define *bot-record-path* -1) -(define *subdivide-draw-mode* 0) -(define *subdivide-scissor-draw-mode* 0) -(define *subdivide-foreground-draw-mode* 0) -(define *subdivide-ocean-draw-mode* 0) -(define *ocean-height-hack* 0) +(define *subdivide-draw-mode* (the-as subdivide-setting 0)) +(define *subdivide-scissor-draw-mode* (the-as subdivide-setting 0)) +(define *subdivide-foreground-draw-mode* (the-as subdivide-setting 0)) +(define *subdivide-ocean-draw-mode* (the-as subdivide-setting 0)) +(define *ocean-height-hack* (the-as ocean-height-hack 0)) ;; Main Loop stuff (define-perm *dproc* process #f) ;; the main display process diff --git a/goal_src/jak2/engine/game/settings-h.gc b/goal_src/jak2/engine/game/settings-h.gc index 2d845c08a5..465b983aa4 100644 --- a/goal_src/jak2/engine/game/settings-h.gc +++ b/goal_src/jak2/engine/game/settings-h.gc @@ -56,59 +56,6 @@ (argf 0.0) (setting (car s))) (cond - ; ((or (eq? setting 'border-mode) - ; (eq? setting 'allow-look-around) - ; (eq? setting 'ocean-off) - ; (eq? setting 'music) - ; (eq? setting 'vibration) - ; (eq? setting 'auto-save) - ; (eq? setting 'allow-pause) - ; (eq? setting 'allow-progress) - ; (eq? setting 'play-hints) - ; (eq? setting 'movie) - ; (eq? setting 'talking) - ; (eq? setting 'spooling) - ; (eq? setting 'hint) - ; (eq? setting 'ambient) - ; ) - ; (set! argb (car args)) - ; ) - ; ((or (eq? setting 'bg-r) - ; (eq? setting 'bg-g) - ; (eq? setting 'bg-b) - ; (eq? setting 'bg-a) - ; (eq? setting 'bg-a-speed) - ; (eq? setting 'bg-a-force) - ; ) - ; (set! argf (car args)) - ; ) - ; ((or (eq? setting 'language) - ; ) - ; (set! argi (car args)) - ; ) - ; ((or (eq? setting 'sound-flava) - ; ) - ; (set! argi (car args)) - ; (set! argf (cadr args)) - ; ) - ; ((or (eq? setting 'process-mask) - ; (eq? setting 'common-page) - ; ) - ; (set! argb (car args)) - ; (set! argi (cadr args)) - ; ) - ; ((or (eq? setting 'sfx-volume) - ; (eq? setting 'music-volume) - ; (eq? setting 'ambient-volume) - ; (eq? setting 'dialog-volume) - ; (eq? setting 'sfx-volume-movie) - ; (eq? setting 'music-volume-movie) - ; (eq? setting 'ambient-volume-movie) - ; (eq? setting 'dialog-volume-hint) - ; ) - ; (set! argb (car args)) - ; (set! argf (cadr args)) - ; ) (#t (set! argb (car args)) (set! argf (cadr args)) @@ -147,7 +94,7 @@ (ambient (pointer process) :offset-assert 56) (video-mode symbol :offset-assert 60) (aspect-ratio symbol :offset-assert 64) - (unknown-uint32-02 uint32 :offset 68) + (unknown-uint32-00 uint32 :offset 68) (auto-save symbol :offset 72) (bg-r float :offset-assert 76) (bg-g float :offset-assert 80) @@ -239,6 +186,7 @@ ) ) + (deftype cam-setting-data (structure) ((fov degrees :offset-assert 0) (pov-handle handle :offset 16) @@ -304,6 +252,7 @@ ) ) + (deftype setting-control (basic) ((user-current user-setting-data :inline :offset-assert 16) (user-target user-setting-data :inline :offset-assert 544) @@ -338,6 +287,7 @@ ) ) + (defmethod new setting-control ((allocation symbol) (type-to-make type) (arg0 int)) (let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> s4-0 engine) ((method-of-type engine new) allocation engine 'setting-control arg0 connection)) @@ -348,3 +298,9 @@ s4-0 ) ) + +0 + + + + diff --git a/goal_src/jak2/engine/game/settings.gc b/goal_src/jak2/engine/game/settings.gc index 17fd2d5357..b3ed6994cb 100644 --- a/goal_src/jak2/engine/game/settings.gc +++ b/goal_src/jak2/engine/game/settings.gc @@ -931,7 +931,7 @@ (set! (-> s5-0 play-hints) (-> s4-0 play-hints)) (set! (-> s5-0 sound-bank-load) (-> s4-0 sound-bank-load)) (set! (-> s5-0 subtitle) (-> s4-0 subtitle)) - (set! (-> s5-0 beard) (if (logtest? (-> *game-info* secrets) 1) + (set! (-> s5-0 beard) (if (logtest? (-> *game-info* secrets) (game-secrets toggle-beard)) (not (-> s4-0 beard)) (-> s4-0 beard) ) @@ -1203,8 +1203,8 @@ (set! (-> s5-0 aspect-ratio) (-> s4-0 aspect-ratio)) (set-aspect-ratio (-> s5-0 aspect-ratio)) ) - (when (!= (-> s5-0 unknown-uint32-02) (-> s4-0 unknown-uint32-02)) - (set! (-> s5-0 unknown-uint32-02) (-> s4-0 unknown-uint32-02)) + (when (!= (-> s5-0 unknown-uint32-00) (-> s4-0 unknown-uint32-00)) + (set! (-> s5-0 unknown-uint32-00) (-> s4-0 unknown-uint32-00)) (set! (-> *video-params* set-video-mode) (the-as basic #t)) ) (when (!= (-> s5-0 video-mode) (-> s4-0 video-mode)) @@ -1219,7 +1219,9 @@ (set! (-> s5-0 unknown-int32-02) (-> s4-0 unknown-int32-02)) (set! (-> *video-params* display-dy) (* (/ (-> s4-0 unknown-int32-02) 2) 2)) ) - (set! (-> *blit-displays-work* horizontal-flip-flag) (the-as basic (logtest? (-> *game-info* secrets) 2))) + (set! (-> *blit-displays-work* horizontal-flip-flag) + (the-as basic (logtest? (-> *game-info* secrets) (game-secrets hflip-screen))) + ) (set! (-> s5-0 allow-blackout) (-> s4-0 allow-blackout)) (set! (-> s5-0 bg-a-speed) (-> s4-0 bg-a-speed)) (set! (-> s5-0 bg-a-force) (-> s4-0 bg-a-force)) @@ -1421,7 +1423,7 @@ (set! (-> gp-0 language) (scf-get-language)) (set! (-> gp-0 subtitle-language) (-> gp-0 language)) (set! (-> gp-0 process-mask) (process-mask execute sleep)) - (set! (-> gp-0 unknown-uint32-02) (the-as uint #f)) + (set! (-> gp-0 unknown-uint32-00) (the-as uint #f)) (set! (-> gp-0 unknown-int32-01) 0) (set! (-> gp-0 unknown-int32-02) 0) (set! (-> gp-0 vibration) @@ -1528,7 +1530,7 @@ (set! (-> s5-0 language) (+ (-> gp-0 language) -1)) (set! (-> s5-0 subtitle-language) (-> gp-0 subtitle-language)) (set! (-> s5-0 aspect-ratio) #f) - (set! (-> s5-0 unknown-uint32-02) (the-as uint #f)) + (set! (-> s5-0 unknown-uint32-00) (the-as uint #f)) (set! (-> s5-0 video-mode) #f) (set! (-> s5-0 music) #f) (set! (-> s5-0 extra-bank) (the-as symbol '())) diff --git a/goal_src/jak2/engine/gfx/mood/mood-h.gc b/goal_src/jak2/engine/gfx/mood/mood-h.gc index 65dce059e8..ad79660396 100644 --- a/goal_src/jak2/engine/gfx/mood/mood-h.gc +++ b/goal_src/jak2/engine/gfx/mood/mood-h.gc @@ -210,8 +210,8 @@ (time-until-random mood-weather :inline :offset-assert 80) (time-until-random-min mood-weather :inline :offset-assert 88) (time-until-random-max mood-weather :inline :offset-assert 96) - (display-flag basic :offset-assert 104) - (overide-weather-flag basic :offset-assert 108) + (display-flag symbol :offset-assert 104) + (overide-weather-flag symbol :offset-assert 108) (overide mood-weather :inline :offset-assert 112) (lightning-index int32 :offset-assert 120) (lightning-val int32 :offset-assert 124) diff --git a/goal_src/jak2/engine/gfx/mood/mood-tables.gc b/goal_src/jak2/engine/gfx/mood/mood-tables.gc index c712c152f4..9e81110c67 100644 --- a/goal_src/jak2/engine/gfx/mood/mood-tables.gc +++ b/goal_src/jak2/engine/gfx/mood/mood-tables.gc @@ -853,7 +853,7 @@ (set! (-> arg0 time-until-random-max fog) 72000.0) (set! (-> arg0 overide cloud) 0.25) (set! (-> arg0 overide fog) 0.0) - (set! (-> arg0 overide-weather-flag) (the-as basic #t)) + (set! (-> arg0 overide-weather-flag) #t) (set! (-> arg0 display-flag) #f) (none) ) diff --git a/goal_src/jak2/engine/gfx/mood/time-of-day-h.gc b/goal_src/jak2/engine/gfx/mood/time-of-day-h.gc index 63f5c1b550..c950d2695e 100644 --- a/goal_src/jak2/engine/gfx/mood/time-of-day-h.gc +++ b/goal_src/jak2/engine/gfx/mood/time-of-day-h.gc @@ -7,6 +7,22 @@ (declare-type sparticle-launch-control inline-array-class) +(defenum time-of-day-palette-id + :type uint32 + :bitfield #t + (unk0 0) ;; 1 + (unk1 1) ;; 2 + (unk2 2) ;; 4 + (unk3 3) ;; 8 + (palette-0 4) ;; 16 + (palette-1 5) ;; 32 + (palette-2 6) ;; 64 + (palette-3 7) ;; 128 + (palette-4 8) ;; 256 + (palette-5 9) ;; 512 + (palette-6 10) ;; 1024 + (palette-7 11) ;; 2048 + ) ;; DECOMP BEGINS @@ -70,31 +86,31 @@ ) (deftype time-of-day-context (basic) - ((interp float 6 :offset-assert 4) - (current-fog mood-fog :inline :offset-assert 32) - (current-sky-color vector :inline :offset-assert 80) - (current-env-color vector :inline :offset-assert 96) - (current-prt-color vector :inline :offset-assert 112) - (current-shadow-color vector :inline :offset-assert 128) - (light-group light-group 8 :inline :offset-assert 144) - (current-clouds mood-clouds :inline :offset-assert 1680) - (times vector 8 :inline :offset-assert 1696) - (title-light-group light-group :inline :offset-assert 1824) - (filter vector :inline :offset-assert 2016) - (filter-color vector :inline :offset-assert 2032) - (time float :offset-assert 2048) - (target-interp float :offset-assert 2052) - (erase-color rgba :offset-assert 2056) - (sky symbol :offset-assert 2060) - (use-camera-other basic :offset-assert 2064) - (title-updated symbol :offset-assert 2068) - (mode uint32 :offset-assert 2072) - (overide-enable basic :offset-assert 2076) - (overide-palette uint32 :offset-assert 2080) - (max-rain float :offset-assert 2084) - (fog-mult float :offset-assert 2088) - (exterior-level basic :offset-assert 2092) - (ocean-alpha float :offset-assert 2096) + ((interp float 6 :offset-assert 4) + (current-fog mood-fog :inline :offset-assert 32) + (current-sky-color vector :inline :offset-assert 80) + (current-env-color vector :inline :offset-assert 96) + (current-prt-color vector :inline :offset-assert 112) + (current-shadow-color vector :inline :offset-assert 128) + (light-group light-group 8 :inline :offset-assert 144) + (current-clouds mood-clouds :inline :offset-assert 1680) + (times vector 8 :inline :offset-assert 1696) + (title-light-group light-group :inline :offset-assert 1824) + (filter vector :inline :offset-assert 2016) + (filter-color vector :inline :offset-assert 2032) + (time float :offset-assert 2048) + (target-interp float :offset-assert 2052) + (erase-color rgba :offset-assert 2056) + (sky symbol :offset-assert 2060) + (use-camera-other basic :offset-assert 2064) + (title-updated symbol :offset-assert 2068) + (mode time-of-day-palette-id :offset-assert 2072) + (overide-enable symbol :offset-assert 2076) + (overide-palette time-of-day-palette-id :offset-assert 2080) + (max-rain float :offset-assert 2084) + (fog-mult float :offset-assert 2088) + (exterior-level basic :offset-assert 2092) + (ocean-alpha float :offset-assert 2096) ) :method-count-assert 9 :size-assert #x834 diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-h.gc b/goal_src/jak2/engine/gfx/ocean/ocean-h.gc index 85918adbc7..fd973a8536 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-h.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-h.gc @@ -371,7 +371,7 @@ :size-assert #x38 :flag-assert #xb00000038 (:methods - (ocean-map-method-9 () none 9) + (set-height! (_type_ float) none 9) (ocean-map-method-10 () none 10) ) ) diff --git a/goal_src/jak2/engine/gfx/sky/sky-data.gc b/goal_src/jak2/engine/gfx/sky/sky-data.gc index 67682f6e89..7dfca5928f 100644 --- a/goal_src/jak2/engine/gfx/sky/sky-data.gc +++ b/goal_src/jak2/engine/gfx/sky/sky-data.gc @@ -7,3 +7,718 @@ ;; DECOMP BEGINS +(define *sky-work* + (new 'static 'sky-work + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :draw-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x502b400000008001 #x42421) + ) + :draw-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431) + ) + :fog-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x902a400000008001 #x424242421) + ) + :blend-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431) + ) + :sprite-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x2003400000008001 #x55) + ) + :sprite-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x21 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x21 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x2003400000008010 #x55) + ) + :sun-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -267.0 :y -267.0 :w 1.0) + (new 'static 'vector :x 267.0 :y 267.0) + ) + :green-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -126.0 :y -126.0 :w 1.0) + (new 'static 'vector :x 126.0 :y 126.0) + ) + :moon0-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -357.0 :y -357.0) + (new 'static 'vector :x 357.0 :y 357.0) + ) + :moon1-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -1207.0 :y -1207.0 :w 1.0) + (new 'static 'vector :x 1207.0 :y 1207.0) + ) + :moon2-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -232.0 :y -232.0) + (new 'static 'vector :x 232.0 :y 232.0) + ) + :star-coords (new 'static 'inline-array vector 2 (new 'static 'vector :x -1.5 :y -1.5) (new 'static 'vector :x 1.5 :y 1.5)) + :sun-colors (new 'static 'inline-array vector4w 2 + (new 'static 'vector4w :x #xff :y 64 :w 64) + (new 'static 'vector4w :x #xff :y #xff :z #x80 :w 64) + ) + :green-colors (new 'static 'inline-array vector4w 2 + (new 'static 'vector4w :y #xc4 :w #x80) + (new 'static 'vector4w :x #xc4 :y #xff :z #xff :w #x80) + ) + :moon-colors (new 'static 'inline-array vector4w 3 + (new 'static 'vector4w :x 16 :y 32 :z 64 :w 96) + (new 'static 'vector4w :x 16 :y 32 :z 64 :w 64) + (new 'static 'vector4w :x 80 :y 80 :z 80 :w #x80) + ) + :st-coords (new 'static 'inline-array vector 2 (new 'static 'vector :z 1.0) (new 'static 'vector :x 1.0 :y 1.0 :z 1.0)) + :random (new 'static 'inline-array vector4w 8 + (new 'static 'vector4w :x #x181920 :y #x141516 :z #x101112 :w #x234567) + (new 'static 'vector4w :x #x878237 :y #x48778 :z #x489197 :w #x893830) + (new 'static 'vector4w :x #x24762 :y #x289278 :z #x724781 :w #x712983) + (new 'static 'vector4w :x #x176128 :y #x387487 :z #x780983 :w #x723176) + (new 'static 'vector4w :x #x987239 :y #x699872 :z #x987165 :w #x982397) + (new 'static 'vector4w :x #x723897 :y #x238723 :z #x987293 :w #x102981) + (new 'static 'vector4w :x #x387528 :y #x723099 :z #x140983 :w #x874310) + (new 'static 'vector4w :x #x2387 :y #x129818 :z #x219810 :w #x623790) + ) + :giftag-base (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3002c00000008001 #x412)) + :giftag-haze (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3026c00000008001 #x412)) + :giftag-roof (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x302ec00000008001 #x412)) + :giftag-ocean (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x301ec00000008001 #x412)) + :draw-vortex #f + ) + ) + +(define sky-base-polygons (new 'static 'inline-array sky-vertex 12 + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + ) + ) + +(define sky-roof-polygons (new 'static 'inline-array sky-vertex 12 + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + ) + ) + +(define *cloud-vert-array* (new 'static 'cloud-vert-array)) + +(define *cloud-poly* (new 'static 'inline-array cloud-vertex 277 + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + ) + ) + +(defun init-cloud-vert-array () + (let ((gp-0 *cloud-vert-array*)) + (dotimes (s5-0 10) + (dotimes (s4-0 10) + (let ((s3-0 (-> gp-0 data (+ (* 10 s5-0) s4-0)))) + (set! (-> s3-0 pos x) (* 2.0 (+ -4.5 (the float s4-0)))) + (set! (-> s3-0 pos z) (* 2.0 (+ -4.5 (the float s5-0)))) + (set! (-> s3-0 pos y) + (fmin (cos (* 182.04445 (* 10.0 (-> s3-0 pos x)))) (cos (* 182.04445 (* 10.0 (-> s3-0 pos z))))) + ) + (set-vector! (-> s3-0 stq) (* 0.25 (the float (+ s4-0 -4))) (* 0.25 (the float (+ s5-0 -4))) 1.0 1.0) + (set! (-> s3-0 nrm quad) (-> s3-0 pos quad)) + (set! (-> s3-0 nrm y) (+ 1.0 (-> s3-0 nrm y))) + (vector-normalize! (-> s3-0 nrm) 1.0) + (vector-negate! (-> s3-0 nrm2) (-> s3-0 nrm)) + (cond + ((or (zero? s5-0) (= s5-0 9) (zero? s4-0) (= s4-0 9)) + (set! (-> s3-0 col w) 0.0) + (set! (-> s3-0 col2 w) 0.0) + ) + ((or (= s5-0 1) (= s5-0 8) (= s4-0 1) (= s4-0 8)) + (set! (-> s3-0 col w) 48.0) + (set! (-> s3-0 col2 w) 48.0) + ) + (else + (set! (-> s3-0 col w) 128.0) + (set! (-> s3-0 col2 w) 128.0) + ) + ) + ) + ) + ) + ) + #f + ) + +(init-cloud-vert-array) + +(define *haze-vert-array* (new 'static 'haze-vert-array)) + +(define *haze-poly* (new 'static 'inline-array haze-vertex 144 + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + ) + ) + +(defun init-haze-vert-array () + (let ((gp-0 *haze-vert-array*)) + (dotimes (s5-0 36) + (let ((s4-0 (-> gp-0 data s5-0))) + (set! (-> s4-0 pos x) (* 9.0 (sin (* 182.04445 (* 10.0 (the float s5-0)))))) + (set! (-> s4-0 pos z) (* 9.0 (cos (* 182.04445 (* 10.0 (the float s5-0)))))) + (set! (-> s4-0 pos y) 0.0) + (set! (-> (the-as cloud-vertex (-> s4-0 nrm)) pos quad) (-> (the-as cloud-vertex (-> s4-0 pos)) pos quad)) + (set! (-> s4-0 nrm y) (+ 1.0 (-> s4-0 nrm y))) + (vector-normalize! (-> s4-0 nrm) 1.0) + ) + ) + ) + #f + ) + +(init-haze-vert-array) + +(defmethod init-sun-data! sky-work ((obj sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float)) + "Sets the sun related upload data - the sun, halo and aurora" + (let ((v1-0 (logand arg0 1))) + (set! (-> obj upload-data sun v1-0 r-sun) arg1) + (set! (-> obj upload-data sun v1-0 r-halo) arg2) + (set! (-> obj upload-data sun v1-0 r-aurora) arg3) + ) + 0 + (none) + ) + +(defmethod init-orbit-settings! sky-work ((obj sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float) (arg4 float) (arg5 float) (arg6 float)) + (set! (-> obj orbit arg0 high-noon) arg1) + (set! (-> obj orbit arg0 tilt) (* 0.017453292 arg2)) + (set! (-> obj orbit arg0 rise) (* 0.017453292 arg3)) + (set! (-> obj orbit arg0 dist) arg4) + (set! (-> obj orbit arg0 min-halo) arg5) + (set! (-> obj orbit arg0 max-halo) arg6) + 0 + (none) + ) + +(defun sky-make-sun-data ((arg0 sky-work) (arg1 int) (arg2 float)) + "Initialize `upload-data` with [[sky-sun-data]] in [[*sky-work*]]" + (let* ((s4-0 (-> arg0 orbit arg1)) + (s3-0 (the-as sky-sun-data (+ (the-as uint (-> arg0 upload-data)) (* arg1 64)))) + (f0-1 (- arg2 (-> s4-0 high-noon))) + (f30-0 (* 2730.6667 f0-1)) + (f28-0 (* (sin f30-0) (-> s4-0 dist))) + (f30-1 (cos f30-0)) + ) + (let* ((f24-0 (* f30-1 (-> s4-0 dist))) + (f26-0 (* f24-0 (cos-rad (-> s4-0 tilt)))) + (f24-1 (* f24-0 (sin-rad (-> s4-0 tilt)))) + (f22-0 (sin-rad (-> s4-0 rise))) + (f0-10 (cos-rad (-> s4-0 rise))) + ) + (set! (-> s3-0 pos z) (- (+ (* f28-0 f0-10) (* f24-1 f22-0)))) + (set! (-> s3-0 pos y) f26-0) + (set! (-> s3-0 pos x) (- (* f24-1 f0-10) (* f28-0 f22-0))) + ) + (let ((f0-14 (if (< f30-1 0.0) + 0.0 + f30-1 + ) + ) + ) + (set! (-> arg0 upload-data sun arg1 r-aurora) + (+ (* (-> s4-0 min-halo) (- 1.0 f0-14)) (* (-> s4-0 max-halo) f0-14)) + ) + ) + ) + 0 + (none) + ) + +(defun sky-make-moon-data ((arg0 sky-work) (arg1 float)) + "Initialize `upload-data` with [[sky-moon-data]] in [[*sky-work*]]" + (let* ((s5-0 (-> arg0 orbit 2)) + (gp-0 (-> arg0 upload-data moon)) + (f0-1 (- arg1 (-> s5-0 high-noon))) + (f28-0 (* 2730.6667 f0-1)) + (f30-0 (* (sin f28-0) (-> s5-0 dist))) + (f26-0 (* (cos f28-0) (-> s5-0 dist))) + (f28-1 (* f26-0 (cos-rad (-> s5-0 tilt)))) + (f26-1 (* f26-0 (sin-rad (-> s5-0 tilt)))) + (f24-0 (sin-rad (-> s5-0 rise))) + (f0-10 (cos-rad (-> s5-0 rise))) + ) + (set! (-> gp-0 pos z) (- (+ (* f30-0 f0-10) (* f26-1 f24-0)))) + (set! (-> gp-0 pos y) f28-1) + (set! (-> gp-0 pos x) (- (* f26-1 f0-10) (* f30-0 f24-0))) + ) + 0 + (none) + ) + +(init-sun-data! *sky-work* 0 60.0 200.0 300.0) + +(init-sun-data! *sky-work* 1 15.0 20.0 300.0) + +(init-orbit-settings! *sky-work* 0 12.5 -20.0 90.0 9950.0 300.0 300.0) + +(init-orbit-settings! *sky-work* 1 4.0 0.0 90.0 9950.0 300.0 300.0) + +(init-orbit-settings! *sky-work* 2 0.5 -40.0 90.0 9950.0 300.0 300.0) + + + + diff --git a/goal_src/jak2/engine/gfx/sky/sky-h.gc b/goal_src/jak2/engine/gfx/sky/sky-h.gc index 6d7e0621a0..16d97a1aa8 100644 --- a/goal_src/jak2/engine/gfx/sky/sky-h.gc +++ b/goal_src/jak2/engine/gfx/sky/sky-h.gc @@ -18,6 +18,7 @@ :flag-assert #x900000010 ) + (deftype sky-color-day (structure) ((hour sky-color-hour 24 :inline :offset-assert 0) ) @@ -26,6 +27,7 @@ :flag-assert #x900000180 ) + (deftype sky-sun-data (structure) ((data uint128 4 :offset-assert 0) (pos vector :inline :offset 0) @@ -44,6 +46,7 @@ :flag-assert #x900000040 ) + (deftype sky-moon-data (structure) ((data uint128 2 :offset-assert 0) (pos vector :inline :offset 0) @@ -54,6 +57,7 @@ :flag-assert #x900000020 ) + (deftype sky-orbit (structure) ((high-noon float :offset-assert 0) (tilt float :offset-assert 4) @@ -68,6 +72,7 @@ :flag-assert #x900000018 ) + (deftype sky-upload-data (structure) ((data uint128 10 :offset-assert 0) (sun sky-sun-data 2 :inline :offset 0) @@ -78,6 +83,7 @@ :flag-assert #x9000000a0 ) + (deftype sky-vertex (structure) ((pos vector :inline :offset-assert 0) (stq vector :inline :offset-assert 16) @@ -88,15 +94,8 @@ :flag-assert #x900000030 ) -(defmethod inspect sky-vertex ((obj sky-vertex)) - (format #t "sky-vertex [~X]:~%" obj) - (format #t "~TPos: [~F ~F ~F ~F]~%" (-> obj pos x) (-> obj pos y) (-> obj pos z) (-> obj pos w)) - (format #t "~TSTQ: [~F ~F ~F ~F]~%" (-> obj stq x) (-> obj stq y) (-> obj stq z) (-> obj stq w)) - (format #t "~TCol: [~F ~F ~F ~F]~%" (-> obj col x) (-> obj col y) (-> obj col z) (-> obj col w)) - obj - ) -;; definition of type cloud-vertex + (deftype cloud-vertex (structure) ((pos vector :inline :offset-assert 0) (stq vector :inline :offset-assert 16) @@ -111,6 +110,7 @@ :flag-assert #x900000070 ) + (deftype cloud-vert-array (structure) ((data cloud-vertex 100 :inline :offset-assert 0) ) @@ -119,6 +119,7 @@ :flag-assert #x900002bc0 ) + (deftype haze-vertex (structure) ((pos vector :inline :offset-assert 0) (nrm vector :inline :offset-assert 16) @@ -129,6 +130,7 @@ :flag-assert #x900000030 ) + (deftype haze-vert-array (structure) ((data haze-vertex 36 :inline :offset-assert 0) ) @@ -137,6 +139,7 @@ :flag-assert #x9000006c0 ) + (deftype cloud-lights (structure) ((sun0-normal vector :inline :offset-assert 0) (sun1-normal vector :inline :offset-assert 16) @@ -156,6 +159,7 @@ :flag-assert #x90000009c ) + (deftype haze-lights (structure) ((sun0-normal vector :inline :offset-assert 0) (sun1-normal vector :inline :offset-assert 16) @@ -173,6 +177,7 @@ :flag-assert #x90000007c ) + (deftype sky-work (structure) ((adgif-tmpl dma-gif-packet :inline :offset-assert 0) (draw-tmpl dma-gif-packet :inline :offset-assert 32) @@ -187,12 +192,12 @@ (moon1-coords vector 2 :inline :offset-assert 320) (moon2-coords vector 2 :inline :offset-assert 352) (star-coords vector 2 :inline :offset-assert 384) - (sun-colors vector 2 :inline :offset-assert 416) - (green-colors vector 2 :inline :offset-assert 448) - (moon-colors vector 3 :inline :offset-assert 480) - (star-colors vector 16 :inline :offset-assert 528) + (sun-colors vector4w 2 :inline :offset-assert 416) + (green-colors vector4w 2 :inline :offset-assert 448) + (moon-colors vector4w 3 :inline :offset-assert 480) + (star-colors vector4w 16 :inline :offset-assert 528) (st-coords vector 2 :inline :offset-assert 784) - (random vector 8 :inline :offset-assert 816) + (random vector4w 8 :inline :offset-assert 816) (giftag-base dma-gif :inline :offset-assert 944) (giftag-haze dma-gif :inline :offset-assert 960) (giftag-roof dma-gif :inline :offset-assert 976) @@ -204,12 +209,12 @@ (off-t uint16 :offset-assert 1062) (orbit sky-orbit 3 :inline :offset-assert 1064) (upload-data sky-upload-data :inline :offset-assert 1168) - (ambi-color vector :inline :offset-assert 1328) - (ambi-color-lower vector :inline :offset-assert 1344) - (sun0-color vector :inline :offset-assert 1360) - (sun1-color vector :inline :offset-assert 1376) - (moon-color vector :inline :offset-assert 1392) - (sun0-color-lower vector :inline :offset-assert 1408) + (ambi-color vector4w :inline :offset-assert 1328) + (ambi-color-lower vector4w :inline :offset-assert 1344) + (sun0-color vector4w :inline :offset-assert 1360) + (sun1-color vector4w :inline :offset-assert 1376) + (moon-color vector4w :inline :offset-assert 1392) + (sun0-color-lower vector4w :inline :offset-assert 1408) (cam-mat matrix :inline :offset-assert 1424) (star-mat matrix :inline :offset-assert 1488) (vec0 vector4w :inline :offset-assert 1552) @@ -224,8 +229,8 @@ :size-assert #x2760 :flag-assert #x2500002760 (:methods - (sky-work-method-9 () none 9) - (sky-work-method-10 () none 10) + (init-sun-data! (_type_ int float float float) none 9) + (init-orbit-settings! (_type_ int float float float float float float) none 10) (sky-work-method-11 () none 11) (sky-work-method-12 () none 12) (sky-work-method-13 () none 13) @@ -254,3 +259,10 @@ (sky-work-method-36 () none 36) ) ) + + +0 + + + + diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc index 3f27517b93..40f749b079 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc @@ -29,6 +29,11 @@ (set-conerot 20) ) +;; NOTE - for relocate +(declare-type sparticle-system basic) +(declare-type sparticle-cpuinfo structure) +(declare-type sparticle-launch-control inline-array-class) +(define-extern forall-particles-with-key (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) symbol symbol none)) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/gfx/texture/texture-h.gc b/goal_src/jak2/engine/gfx/texture/texture-h.gc index 65de5566ca..fa753dce73 100644 --- a/goal_src/jak2/engine/gfx/texture/texture-h.gc +++ b/goal_src/jak2/engine/gfx/texture/texture-h.gc @@ -181,7 +181,7 @@ ) (deftype texture-link (structure) - ((next shader-ptr :offset-assert 0) + ((next shader-ptr 1 :offset-assert 0) ) :method-count-assert 9 :size-assert #x4 diff --git a/goal_src/jak2/engine/level/level-h.gc b/goal_src/jak2/engine/level/level-h.gc index 1792f1e5b2..54df9e1a38 100644 --- a/goal_src/jak2/engine/level/level-h.gc +++ b/goal_src/jak2/engine/level/level-h.gc @@ -236,7 +236,7 @@ (vis-self-index int32 :offset-assert 2440) (vis-adj-index int32 :offset-assert 2444) (vis-buffer uint8 2048 :offset-assert 2448) - (mem-usage-block basic :offset-assert 4496) + (mem-usage-block memory-usage-block :offset-assert 4496) (mem-usage int32 :offset-assert 4500) (code-memory-start pointer :offset-assert 4504) (code-memory-end pointer :offset-assert 4508) diff --git a/goal_src/jak2/engine/target/gun/gun-h.gc b/goal_src/jak2/engine/target/gun/gun-h.gc index 6f8fdb61b4..a2e6af51c1 100644 --- a/goal_src/jak2/engine/target/gun/gun-h.gc +++ b/goal_src/jak2/engine/target/gun/gun-h.gc @@ -126,12 +126,14 @@ (defbehavior want-to-gun? process ((arg0 target) (arg1 symbol)) (local-vars (v1-36 symbol)) - (and (logtest? (-> arg0 game features) 32) + (and (logtest? (-> arg0 game features) (game-feature unk-game-feature-06)) (>= (- (-> self clock frame-counter) (-> arg0 gun gun-time)) (seconds 0.1)) (zero? (logand (focus-status fs1 fs6 fs18 fs21 fs22 fs30) (-> arg0 focus-status))) (zero? (logand (surface-flag gun-inactive gun-hide gun-off) (-> arg0 control unknown-surface00 flags))) (zero? (logand (state-flags sf18) (-> arg0 state-flags))) - (logtest? (logand (-> *setting-control* user-current features) 960) (-> arg0 game features)) + (logtest? (the-as game-feature (logand (-> *setting-control* user-current features) 960)) + (-> arg0 game features) + ) (or (zero? (logand (-> arg0 control unknown-surface00 flags) (surface-flag duck))) (can-exit-duck?)) (or (zero? (logand (focus-status fs20) (-> arg0 focus-status))) (-> arg0 pilot gun?)) (or arg1 diff --git a/goal_src/jak2/engine/util/capture-h.gc b/goal_src/jak2/engine/util/capture-h.gc index 97e7df37b6..40f82002d6 100644 --- a/goal_src/jak2/engine/util/capture-h.gc +++ b/goal_src/jak2/engine/util/capture-h.gc @@ -32,11 +32,11 @@ ;; screen shot settings. (deftype screen-shot-work (structure) - ((count int16 :offset-assert 0) - (size int16 :offset-assert 2) - (name basic :offset-assert 4) - (highres-enable basic :offset-assert 8) - (hud-enable basic :offset-assert 12) + ((count int16 :offset-assert 0) + (size int16 :offset-assert 2) + (name string :offset-assert 4) + (highres-enable symbol :offset-assert 8) + (hud-enable symbol :offset-assert 12) ) :method-count-assert 9 :size-assert #x10 diff --git a/scripts/find-label-types.py b/scripts/find-label-types.py deleted file mode 100644 index d078f06cba..0000000000 --- a/scripts/find-label-types.py +++ /dev/null @@ -1,57 +0,0 @@ -import argparse -parser = argparse.ArgumentParser() -parser.add_argument("--file") -args = parser.parse_args() - -import re -labels_with_no_type = [] - -file_path = "decompiler_out/jak1/{}_disasm.gc".format(args.file) -with open(file_path) as f: - # Find all - content = f.readlines() - for line in content: - labels_with_no_type = labels_with_no_type + re.findall(r'L\d+', line) - -# dedup list -labels_with_no_type = list(dict.fromkeys(labels_with_no_type)) - -# let's go try to identify the types from the IR2 file if we can -label_lines = [] -file_path = "decompiler_out/jak1/{}_ir2.asm".format(args.file) -with open(file_path) as f: - # Find all - content = f.readlines() - prev_line = "" - next_label_will_be_lambda = False - for i, line in enumerate(content): - if ".function (anon-function" in line: - next_label_will_be_lambda = True - if line.startswith("L"): - for label in labels_with_no_type: - if line.startswith("{}:".format(label)): - # If we were expecting a lambda - if next_label_will_be_lambda: - label_lines.append("[\"{}\", \"_lambda_\", true]".format(label)) - labels_with_no_type.remove(label) - next_label_will_be_lambda = False - break - # special case for pairs - if "(offset 2)" in line: - label_lines.append("[\"{}\", \"pair\", true]".format(label)) - labels_with_no_type.remove(label) - break - # Check if the previous line has a `.type` - prev_line = content[i-1] - if ".type" in prev_line: - the_type = prev_line.split(".type ")[1].strip() - label_lines.append("[\"{}\", \"{}\", true]".format(label, the_type)) - labels_with_no_type.remove(label) - break - -# Print out the labels -print("Here are the labels I couldn't find a type for:") -for label in labels_with_no_type: - print("- {}".format(label)) -print("And here are the ones I could:") -print(",\n".join(label_lines)) diff --git a/scripts/gsrc/code_retention/all_types_retention.py b/scripts/gsrc/code_retention/all_types_retention.py new file mode 100644 index 0000000000..3b612233ce --- /dev/null +++ b/scripts/gsrc/code_retention/all_types_retention.py @@ -0,0 +1,92 @@ +from utils import get_alltypes_path_from_game, get_gsrc_path_from_filename + + +class AllTypesUpdateBlock: + def __init__(self): + self.data = [] + self.file_name = "" + self.block_id = "" + + def __str__(self): + return "{}:{}:{}...".format(self.file_name, self.block_id, self.data[0:20]) + + +def update_alltypes_named_blocks(game_name): + block_dict = {} + # Step 1: Get the blocks + get_all_blocks(game_name, block_dict) + # Step 2: Update the blocks (group by file name to minimize file IO operations) + update_all_blocks(game_name, block_dict) + + +def get_all_blocks(game_name, block_dict): + with open(get_alltypes_path_from_game(game_name)) as f: + lines = f.readlines() + i = 0 + while i < len(lines): + line = lines[i] + if line.startswith(";; +++") and ":" in line: + info = line.replace(";; +++", "") + file_name, block_id = info.split(":") + new_block = AllTypesUpdateBlock() + new_block.file_name = file_name + new_block.block_id = block_id + # Loop until we find the end of the block, collecting the lines as we go + while i < len(lines): + i = i + 1 + next_line = lines[i] + if next_line.startswith(";; ---"): + break + new_block.data.append(next_line) + # Add to the dictionary + if file_name not in block_dict: + block_dict[file_name] = [new_block] + else: + block_dict[file_name].append(new_block) + else: + i = i + 1 + + +def update_all_blocks(game_name, block_dict): + for file_name, blocks in block_dict.items(): + # Get the file's lines + path = get_gsrc_path_from_filename(game_name, file_name) + lines = [] + final_lines = [] + with open(path) as f: + lines = f.readlines() + # Iterate through lines, (before ;; decomp begins) and update the blocks if we find them + i = 0 + while i < len(lines): + line = lines[i] + if line.lower().startswith(";; decomp begins"): + final_lines.append(line) + # Add all the rest of the lines until the end + while i + 1 < len(lines): + i = i + 1 + next_line = lines[i] + final_lines.append(next_line) + break + if line.startswith(";; +++"): + final_lines.append(line) + block_id = line.split(";; +++")[1] + # Look to see if we actually have that block + for block in blocks: + if block.block_id == block_id: + # if we found the block, write the data, then proceed ahead until the end + for block_line in block.data: + final_lines.append(block_line) + while i + 1 < len(lines): + i = i + 1 + next_line = lines[i] + if next_line.startswith(";; ---"): + final_lines.append(next_line) + i = i + 1 + break + break + else: + final_lines.append(line) + i = i + 1 + # Update the file contents + with open(path, "w") as f: + f.writelines(final_lines) diff --git a/scripts/gsrc/code_retention/code_retention.py b/scripts/gsrc/code_retention/code_retention.py new file mode 100644 index 0000000000..986d35f41d --- /dev/null +++ b/scripts/gsrc/code_retention/code_retention.py @@ -0,0 +1,808 @@ +import re +from rapidfuzz import fuzz + +# TODO - rename and refactor all usages, it's not _always_ a comment anymore! +# RetainedCode or something +class CommentMeta: + def __init__(self): + self.data = "" + self.symbol_before = None + self.symbol_inline = None + self.symbol_after = None + self.symbol_padding_before = None + self.symbol_padding_after = None + # NOTE - maybe holding more than just 1 line before/after might help? + self.code_before = None + self.code_after = None + self.code_padding_before = None + self.code_padding_after = None + self.line_num_in_form = None # None == top level + self.containing_form = None # none - top level + self.containing_form_kind = None # function|method|behaviour + self.containing_form_func_name = None # or the method/behaviour + self.containing_form_type = None + self.inline = False + self.code_in_line = None # only for inline comments + self.line_in_file = None # a worst-case scenario fallback + + def __str__(self): + return "{}:{}:{}".format(self.data, self.symbol_before, self.symbol_after) + + +def debug_nice_formatted_code(val): + if val is None: + return None + return val.strip()[0:20] + + +# returns (symbol | None, padding) +def backtrack_for_symbol(lines, index): + padding = 0 + for i in range(index - 1, 0, -1): + tline = lines[i].strip() + matches = re.search( + r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline + ) + if matches is not None: + return matches.group(1), padding + elif ( + not tline.strip() == "" and not tline.strip().startswith(";") + ) or "decomp begins" in tline.lower(): + # we hit a non empty line (but it wasn't a symbol!) + return None, padding + elif tline.strip() == "": + padding = padding + 1 + return None, padding + + +def symbol_on_line(line): + tline = line.lstrip() + matches = re.search( + r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline + ) + if matches is not None: + return matches.group(1) + return None + + +def lookahead_for_symbol(lines, index): + padding = 0 + for i in range(index + 1, len(lines), 1): + tline = lines[i].lstrip() + matches = re.search( + r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline + ) + if matches is not None: + return matches.group(1), padding + elif ( + not tline.strip() == "" and not tline.strip().startswith(";") + ) or "decomp begins" in tline.lower(): + # we hit a non empty line (but it wasn't a symbol!) + return None, padding + elif tline.strip() == "": + padding = padding + 1 + return None, padding + + +def backtrack_for_code(lines, index): + padding = 0 + for i in range(index - 1, 0, -1): + line = lines[i] + if line.strip() == "": + padding = padding + 1 + continue + elif "decomp begins" in line.lower(): + return None, padding + elif line.lstrip().startswith(";"): + continue + return line, padding + + +def lookahead_for_code(lines, index): + padding = 0 + for i in range(index + 1, len(lines), 1): + line = lines[i] + if line.strip() == "": + padding = padding + 1 + continue + elif "decomp begins" in line.lower(): + return None, padding + elif line.lstrip().startswith(";"): + continue + return line, padding + + +# returns form, or none +def is_line_start_of_form(line): + if line.rstrip().startswith(";"): + return None + matches = re.search(r"\(\s*([^\s.]*)\s+", line) + if matches is not None: + return line + return None + + +def has_form_ended(stack, line): + # if the stack is empty, return true + line_before_comment = line.partition(";")[0] + for char in line_before_comment: + if char == "(": + stack.append(char) + elif char == ")": + if len(stack) == 0: + # unbalanced parens? + return True + stack.pop() + if len(stack) == 0: + return True + else: + if len(stack) == 0: + return True + return False + + +def append_form_metadata(comment, form_start_line): + func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_start_line) + if func_matches is not None: + comment.containing_form_kind = "function" + comment.containing_form_func_name = func_matches.group(1) + comment.containing_form_type = None + return + behavior_matches = re.search( + r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_start_line + ) + if behavior_matches is not None: + comment.containing_form_kind = "behavior" + comment.containing_form_func_name = behavior_matches.group(1) + comment.containing_form_type = behavior_matches.group(2) + return + method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_start_line) + if method_matches is not None: + comment.containing_form_kind = "method" + comment.containing_form_func_name = method_matches.group(1) + comment.containing_form_type = method_matches.group(2) + return + comment.containing_form_kind = "unknown" + comment.containing_form_func_name = None + comment.containing_form_type = None + + +def process_original_lines(lines): + comments = [] + debug_lines = [] + # track if we are inside a define*/defun/defmethod/deftype/defstate + within_form = None + line_num_in_form = None + form_paren_stack = [] + found_output = False + i = 0 + while i < len(lines): + debug_lines.append(lines[i]) + tline = lines[i].lstrip() + if "decomp begins" in tline.lower(): + found_output = True + i = i + 1 + continue + if not found_output: + i = i + 1 + continue + # actually process code + if within_form is None: + # lets see if we are now in one + within_form = is_line_start_of_form(lines[i]) + if within_form is not None: + line_num_in_form = 0 + if has_form_ended(form_paren_stack, lines[i]): + within_form = None + form_paren_stack = [] + elif within_form is not None: + # check if the form has ended by counting parens + if has_form_ended(form_paren_stack, lines[i]): + within_form = None + form_paren_stack = [] + line_num_in_form = 0 + else: + line_num_in_form = line_num_in_form + 1 + + if tline.startswith(";") or tline.startswith("#|"): + # treat decomp deviation blocks as essentially comments as well, so include them in a block comment if appropriate + # this is done because there is nothing to match them against (if a comment is inside them for example) + # so we have to copy them in full + in_deviation_block = False + if "decomp deviation" in tline.lower() or tline.startswith("#|"): + in_deviation_block = True + current_comment = CommentMeta() + current_comment.line_in_file = i + current_comment.data = lines[i] + ( + current_comment.symbol_before, + current_comment.symbol_padding_before, + ) = backtrack_for_symbol(lines, i) + ( + current_comment.code_before, + current_comment.code_padding_before, + ) = backtrack_for_code(lines, i) + current_comment.containing_form = within_form + if within_form is not None: + append_form_metadata(current_comment, within_form) + current_comment.line_num_in_form = line_num_in_form + current_comment.inline = False + # look ahead to handle block comments + if i + 1 < len(lines): + next_line = lines[i + 1] + if "decomp deviation" in next_line.lower() or next_line.startswith("|#"): + in_deviation_block = False + while i + 1 < len(lines) and ( + in_deviation_block + or next_line.lstrip().startswith(";") + or next_line.lstrip().startswith("|#") + ): + debug_lines.append(lines[i + 1]) + i = i + 1 + current_comment.data = current_comment.data + next_line + if i + 1 < len(lines): + next_line = lines[i + 1] + if "decomp deviation" in next_line.lower() or next_line.startswith( + "|#" + ): + in_deviation_block = False + ( + current_comment.symbol_after, + current_comment.symbol_padding_after, + ) = lookahead_for_symbol(lines, i) + ( + current_comment.code_after, + current_comment.code_padding_after, + ) = lookahead_for_code(lines, i) + comments.append(current_comment) + debug_lines.append( + ";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format( + current_comment.symbol_before, + current_comment.symbol_padding_before, + current_comment.symbol_after, + current_comment.symbol_padding_after, + debug_nice_formatted_code(current_comment.code_before), + current_comment.code_padding_before, + debug_nice_formatted_code(current_comment.code_after), + current_comment.code_padding_after, + ) + ) + debug_lines.append( + ";; [DEBUG]: in_form - {}...:{}\n".format( + debug_nice_formatted_code(current_comment.containing_form), + current_comment.line_num_in_form, + ) + ) + # inline comments + # TODO - cleanup duplication + elif ";" in tline: + current_comment = CommentMeta() + current_comment.line_in_file = i + current_comment.data = ";" + tline.partition(";")[2] + ( + current_comment.symbol_before, + current_comment.symbol_padding_before, + ) = backtrack_for_symbol(lines, i) + ( + current_comment.symbol_after, + current_comment.symbol_padding_after, + ) = lookahead_for_symbol(lines, i) + ( + current_comment.code_before, + current_comment.code_padding_before, + ) = backtrack_for_code(lines, i) + ( + current_comment.code_after, + current_comment.code_padding_after, + ) = lookahead_for_code(lines, i) + current_comment.containing_form = within_form + if within_form is not None: + append_form_metadata(current_comment, within_form) + current_comment.line_num_in_form = line_num_in_form + current_comment.symbol_inline = symbol_on_line(tline) + current_comment.inline = True + current_comment.code_in_line = tline.partition(";")[0] + comments.append(current_comment) + debug_lines.append( + ";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format( + current_comment.symbol_before, + current_comment.symbol_padding_before, + current_comment.symbol_after, + current_comment.symbol_padding_after, + debug_nice_formatted_code(current_comment.code_before), + current_comment.code_padding_before, + debug_nice_formatted_code(current_comment.code_after), + current_comment.code_padding_after, + ) + ) + debug_lines.append( + ";; [DEBUG]: in_form - {}...:{} || inline_code - {}...\n".format( + debug_nice_formatted_code(current_comment.containing_form), + current_comment.line_num_in_form, + debug_nice_formatted_code(current_comment.code_in_line), + ) + ) + i = i + 1 + return comments, debug_lines + + +def get_symbol_at_line(line): + tline = line.strip() + matches = re.search( + r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline + ) + if matches is not None: + return matches.group(1) + return None + + +def relevant_symbol_comments_for_line_before(line): + symbol = get_symbol_at_line(line) + if symbol is None: + return [] + # Loop through comments, finding any that match the symbol + # they WILL be placed, so we can remove them from our list now + i = 0 + relevant_comments = [] + while i < len(comments): + comment = comments[i] + if comment.symbol_after == symbol: + relevant_comments.append(comment) + comments.pop(i) + else: + i = i + 1 + return relevant_comments + + +def padding_before_comment(comment): + if comment.containing_form is None: + if comment.symbol_after is not None: + return "\n" * comment.symbol_padding_after + return "" + + +def relevant_symbol_comments_for_inline(line): + symbol = get_symbol_at_line(line) + if symbol is None: + return [] + # Loop through comments, finding any that match the symbol + # they WILL be placed, so we can remove them from our list now + i = 0 + relevant_comments = [] + while i < len(comments): + comment = comments[i] + if comment.symbol_inline == symbol: + relevant_comments.append(comment) + comments.pop(i) + else: + i = i + 1 + return relevant_comments + + +def padding_after_comment(comment): + if comment.containing_form is None: + if comment.symbol_before is not None: + return "\n" * comment.symbol_padding_before + return "" + + +def relevant_symbol_comments_for_line_after(line): + symbol = get_symbol_at_line(line) + if symbol is None: + return [] + # Loop through comments, finding any that match the symbol + # they WILL be placed, so we can remove them from our list now + i = 0 + relevant_comments = [] + while i < len(comments): + comment = comments[i] + # if we can, we prefer to put comments before not after (more accurate re-creation) + if comment.symbol_after is None and comment.symbol_before == symbol: + relevant_comments.append(comment) + comments.pop(i) + else: + i = i + 1 + return relevant_comments + + +# the first half of the defmethod/etc lines (before arg list) is less likely to change +# so we want to split it to weight it more heavily +def split_def_line(line): + first_part = "" + second_part = "" + for index, char in enumerate(line): + if char == "(": + if index == 0: + first_part = first_part + char + else: + second_part = second_part + char + continue + else: + if second_part != "": + second_part = second_part + char + else: + first_part = first_part + char + return first_part, second_part + + +def get_form_metadata(form_def_line): + func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_def_line) + if func_matches is not None: + return "function", func_matches.group(1), None + behavior_matches = re.search(r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_def_line) + if behavior_matches is not None: + return "behavior", behavior_matches.group(1), behavior_matches.group(2) + method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_def_line) + if method_matches is not None: + return "method", method_matches.group(1), method_matches.group(2) + return "unknown", None, None + + +built_in_method_names = [ + "new", + "delete", + "print", + "inspect", + "length", + "asize-of", + "copy", + "relocate", + "memusage", +] + + +def different_method_names(form_func_name, comment_form_func_name): + if ( + comment_form_func_name not in built_in_method_names + and form_func_name not in built_in_method_names + ): + return False + return form_func_name != comment_form_func_name + + +def get_relevant_form_comments(form_def_line): + form_kind, form_func_name, form_type = get_form_metadata(form_def_line) + code_def_part, code_rest = split_def_line(form_def_line) + relevant_comments = [] + i = 0 + while i < len(comments): + comment = comments[i] + if comment.containing_form is None: + i = i + 1 + continue + ( + comment_form_kind, + comment_form_func_name, + comment_form_type, + ) = get_form_metadata(comment.containing_form) + # First disqualify the form if it's obviously unrelated + if comment_form_kind != "unknown": + if form_kind != comment_form_kind: + i = i + 1 + continue + elif form_kind == "function" and comment_form_func_name != form_func_name: + i = i + 1 + continue + elif form_kind == "behavior" and comment_form_func_name != form_func_name: + i = i + 1 + continue + elif form_kind == "method" and ( + comment_form_type != form_type + or different_method_names(form_func_name, comment_form_func_name) + ): + i = i + 1 + continue + # Evaluate it's score (comments and current def line) + def_part, rest = split_def_line(comment.containing_form) + def_score = fuzz.ratio(code_def_part, def_part) * 0.65 + if def_score == 65.0 and form_kind != "unknown": + relevant_comments.append(comment) + comments.pop(i) + continue + rest_score = fuzz.ratio(code_rest, rest) * 0.35 + combined_score = def_score + rest_score + threshold = 50.0 + if combined_score < threshold: + i = i + 1 + continue + # Now, let's look at ALL other def lines yet to come from the decomp output + # if any are a better match, don't add the comment yet -- we'll add it when we get there! + # TODO - remove lines from the list as we find them so speed this up + found_better_form = False + for decomp_def_line in decomp_form_def_lines: + line_form_kind, line_form_func_name, line_form_type = get_form_metadata( + decomp_def_line + ) + if form_kind != "unknown": + if form_kind != line_form_kind: + continue + elif form_kind == "function" and line_form_func_name != form_func_name: + continue + elif form_kind == "behavior" and line_form_func_name != form_func_name: + continue + elif form_kind == "method" and ( + line_form_type != form_type + or different_method_names(form_func_name, line_form_func_name) + ): + continue + def_part, rest = split_def_line(decomp_def_line) + def_score = fuzz.ratio(code_def_part, def_part) * 0.65 + if def_score == 65.0 and form_kind != "unknown": + found_better_form = True + break + rest_score = fuzz.ratio(code_rest, rest) * 0.35 + if combined_score < def_score + rest_score: + found_better_form = True + break + # TODO otherwise? still test? + if found_better_form: + i = i + 1 + continue + relevant_comments.append(comment) + comments.pop(i) + return relevant_comments + + +# Simple fuzz ratio, but removes obvious outliers like empty lines / lines with only a paren +def score_alg(line1, line2): + tline1 = line1.strip() + tline2 = line2.strip() + if tline1 == "" or tline1 == ")" or tline1 == "(": + return -1 + if tline2 == "" or tline2 == ")" or tline2 == "(": + return -1 + return fuzz.ratio(tline1, tline2) + + +# TODO - improvement on comparison - a higher score on a longer line == better? some sort of weighting approach here too? +def merge_retained_code_and_new_code(gsrc_path, decomp_lines, final_lines): + decomp_started = False + with open(gsrc_path) as f: + lines = f.readlines() + within_form = None + line_num_in_form = None + form_paren_stack = [] + for line in lines: + if "[DEBUG]" in line: + continue + if line.lower().lstrip().startswith(";; decomp begins"): + decomp_started = True + final_lines.append(line) + break + if not decomp_started: + final_lines.append(line) + continue + + i = 0 + while i < len(decomp_lines): + line = decomp_lines[i] + # Otherwise, its a part of the output we have to be more careful about + # For every line in the decompiled output, we scan our comment list to see if anything matches + # if it does, we insert it appropriately and remove the comment from the list + # + # This is the main source of inefficiency, but the process gets progressively faster as comments are eliminated + if within_form is None: + # lets see if we are now in one + within_form = is_line_start_of_form(line) + # TODO - check line for symbol matches? + if within_form is not None: + line_num_in_form = 0 + if has_form_ended(form_paren_stack, line): + within_form = None + form_paren_stack = [] + else: + # Get all of the lines of the form at once + form_start = decomp_lines[i] + form_lines = [form_start] + while i < len(decomp_lines): + i = i + 1 + line = decomp_lines[i] + if has_form_ended(form_paren_stack, line): + within_form = None + form_paren_stack = [] + break + else: + form_lines.append(line) + # Add any comments needed to the form contents + # - first we get all comments that have match well with the form's start line (ie. defmethod ....) + form_comments = get_relevant_form_comments(form_start) + # - for each comment, let's find which line matches it the best, + # if NONE exceed the threshold (if both match the same, pick the first), we default to the line offset + for comment in form_comments: + highest_score = -1 + index_to_insert = -1 + threshold = 50.0 + place_kind = None + for index, form_line in enumerate(form_lines): + # skip any comments that were previously added + if form_line.lstrip().startswith(";"): + continue + if comment.code_in_line is not None: + score = score_alg(form_line, comment.code_in_line) + if score >= threshold and score > highest_score: + index_to_insert = index + highest_score = score + place_kind = "inline" + if comment.code_before is not None: + score = score_alg(form_line, comment.code_before) + if score >= threshold and score > highest_score: + index_to_insert = index + highest_score = score + place_comment_after = True + place_kind = "next_line" + if comment.code_after is not None: + score = score_alg(form_line, comment.code_after) + if score >= threshold and score > highest_score: + index_to_insert = index + highest_score = score + place_comment_after = False + place_kind = "before_line" + # add the comment! + if index_to_insert == -1: + if comment.inline: + form_lines[comment.line_num_in_form] = ( + form_lines[index_to_insert].rstrip() + + " " + + comment.data + ) + else: + form_lines.insert( + comment.line_num_in_form, comment.data + ) + elif comment.inline: + form_index = index_to_insert + if place_kind == "next_line": + form_index = index_to_insert + 1 + form_lines[form_index] = ( + form_lines[form_index].rstrip() + " " + comment.data + ) + elif place_kind == "next_line": + form_lines.insert( + index_to_insert + 1, + padding_before_comment(comment) + comment.data, + ) + else: + form_lines.insert( + index_to_insert, + padding_after_comment(comment) + comment.data, + ) + # Add the lines to the final output + for form_line in form_lines: + final_lines.append(form_line) + + # Otherwise, we are at the top-level! + if within_form is None: + before_comments = relevant_symbol_comments_for_line_before(line) + for comment in before_comments: + final_lines.append(padding_before_comment(comment) + comment.data) + inline_comments = relevant_symbol_comments_for_inline(line) + if len(inline_comments) > 0: + comment_str = "" + for comment in inline_comments: + comment_str = comment_str + comment.data.strip() + comment_str = comment_str.replace(";", "") + final_lines.append( + "{} ;; {}".format(line.rstrip(), comment_str.strip()) + ) + else: + final_lines.append(line) + after_comments = relevant_symbol_comments_for_line_after(line) + for comment in after_comments: + final_lines.append(padding_after_comment(comment) + comment.data) + # next line + i = i + 1 + + +def handle_dangling_blocks(comments, final_lines, debug_lines): + for comment in comments: + within_form = None + line_num_in_form = None + form_paren_stack = [] + found_output = True + i = 0 + index_to_insert = -1 + highest_score = -1 + place_comment_after = True + threshold = 50.0 + while i < len(final_lines): + debug_lines.append(final_lines[i]) + tline = final_lines[i].lstrip() + if "decomp begins" in tline.lower(): + found_output = True + i = i + 1 + continue + if not found_output: + i = i + 1 + continue + line = final_lines[i] + # We can try to claw back a bit of efficiency by skipping the inside of forms + if within_form is not None: + # check if the form has ended by counting parens + if has_form_ended(form_paren_stack, line): + if comment.code_in_line is not None: + score = score_alg(line, comment.code_in_line) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + if comment.code_before is not None: + score = score_alg(line, comment.code_before) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = True + if comment.code_after is not None: + score = score_alg(line, comment.code_after) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = False + within_form = None + form_paren_stack = [] + line_num_in_form = 0 + else: + line_num_in_form = line_num_in_form + 1 + else: + # lets see if we are now in a form + within_form = is_line_start_of_form(line) + if within_form is not None: + if comment.code_in_line is not None: + score = score_alg(line, comment.code_in_line) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + if comment.code_before is not None: + score = score_alg(line, comment.code_before) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = True + if comment.code_after is not None: + score = score_alg(line, comment.code_after) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = False + line_num_in_form = 0 + else: + # just normal code, check it + if comment.code_in_line is not None: + score = score_alg(line, comment.code_in_line) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + if comment.code_before is not None: + score = score_alg(line, comment.code_before) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = True + if comment.code_after is not None: + score = score_alg(line, comment.code_after) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = False + i = i + 1 + # end of while loop + # add the comment! + if index_to_insert == -1: + if comment.inline: + final_lines[comment.line_in_file] = ( + final_lines[comment.line_in_file].rstrip() + " " + comment.data + ) + else: + final_lines.insert(comment.line_in_file, comment.data) + elif comment.inline: + final_lines[index_to_insert] = ( + final_lines[index_to_insert].rstrip() + " " + comment.data + ) + elif place_comment_after: + final_lines.insert( + index_to_insert + 1, + padding_before_comment(comment) + comment.data, + ) + else: + final_lines.insert( + index_to_insert, + padding_after_comment(comment) + comment.data, + ) diff --git a/scripts/gsrc/update-from-decomp.py b/scripts/gsrc/update-from-decomp.py index 67ce4a4fed..be55ef4c12 100644 --- a/scripts/gsrc/update-from-decomp.py +++ b/scripts/gsrc/update-from-decomp.py @@ -36,41 +36,14 @@ # - there are likely ways to make this more efficient import argparse -import re -from rapidfuzz import fuzz +from code_retention.all_types_retention import update_alltypes_named_blocks from utils import get_gsrc_path_from_filename - -# TODO - rename and refactor all usages, it's not _always_ a comment anymore! -# RetainedCode or something -class CommentMeta: - def __init__(self): - self.data = "" - self.symbol_before = None - self.symbol_inline = None - self.symbol_after = None - self.symbol_padding_before = None - self.symbol_padding_after = None - # NOTE - maybe holding more than just 1 line before/after might help? - self.code_before = None - self.code_after = None - self.code_padding_before = None - self.code_padding_after = None - self.line_num_in_form = None # None == top level - self.containing_form = None # none - top level - self.containing_form_kind = None # function|method|behaviour - self.containing_form_func_name = None # or the method/behaviour - self.containing_form_type = None - self.inline = False - self.code_in_line = None # only for inline comments - self.line_in_file = None # a worst-case scenario fallback - - def __str__(self): - return "{}:{}:{}".format(self.data, self.symbol_before, self.symbol_after) - +from code_retention.code_retention import * parser = argparse.ArgumentParser("update-from-decomp") parser.add_argument("--game", help="The name of the game", type=str) parser.add_argument("--file", help="The name of the file", type=str) +parser.add_argument("--preserve", help="Attempt to preserve comments and marked blocks", action="store_true") parser.add_argument( "--debug", help="Output debug metadata on every block", action="store_true" ) @@ -81,149 +54,12 @@ args = parser.parse_args() gsrc_path = get_gsrc_path_from_filename(args.game, args.file) +# Step 1 - Find and update all named blocks from all-types (useful for enums) +update_alltypes_named_blocks(args.game) + comments = [] debug_lines = [] - - -def debug_nice_formatted_code(val): - if val is None: - return None - return val.strip()[0:20] - - -# returns (symbol | None, padding) -def backtrack_for_symbol(lines, index): - padding = 0 - for i in range(index - 1, 0, -1): - tline = lines[i].strip() - matches = re.search( - r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline - ) - if matches is not None: - return matches.group(1), padding - elif ( - not tline.strip() == "" and not tline.strip().startswith(";") - ) or "decomp begins" in tline.lower(): - # we hit a non empty line (but it wasn't a symbol!) - return None, padding - elif tline.strip() == "": - padding = padding + 1 - return None, padding - - -def symbol_on_line(line): - tline = line.lstrip() - matches = re.search( - r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline - ) - if matches is not None: - return matches.group(1) - return None - - -def lookahead_for_symbol(lines, index): - padding = 0 - for i in range(index + 1, len(lines), 1): - tline = lines[i].lstrip() - matches = re.search( - r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline - ) - if matches is not None: - return matches.group(1), padding - elif ( - not tline.strip() == "" and not tline.strip().startswith(";") - ) or "decomp begins" in tline.lower(): - # we hit a non empty line (but it wasn't a symbol!) - return None, padding - elif tline.strip() == "": - padding = padding + 1 - return None, padding - - -def backtrack_for_code(lines, index): - padding = 0 - for i in range(index - 1, 0, -1): - line = lines[i] - if line.strip() == "": - padding = padding + 1 - continue - elif "decomp begins" in line.lower(): - return None, padding - elif line.lstrip().startswith(";"): - continue - return line, padding - - -def lookahead_for_code(lines, index): - padding = 0 - for i in range(index + 1, len(lines), 1): - line = lines[i] - if line.strip() == "": - padding = padding + 1 - continue - elif "decomp begins" in line.lower(): - return None, padding - elif line.lstrip().startswith(";"): - continue - return line, padding - - -# returns form, or none -def is_line_start_of_form(line): - if line.rstrip().startswith(";"): - return None - matches = re.search(r"\(\s*([^\s.]*)\s+", line) - if matches is not None: - return line - return None - - -def has_form_ended(stack, line): - # if the stack is empty, return true - line_before_comment = line.partition(";")[0] - for char in line_before_comment: - if char == "(": - stack.append(char) - elif char == ")": - if len(stack) == 0: - # unbalanced parens? - return True - stack.pop() - if len(stack) == 0: - return True - else: - if len(stack) == 0: - return True - return False - - -def append_form_metadata(comment, form_start_line): - func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_start_line) - if func_matches is not None: - comment.containing_form_kind = "function" - comment.containing_form_func_name = func_matches.group(1) - comment.containing_form_type = None - return - behavior_matches = re.search( - r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_start_line - ) - if behavior_matches is not None: - comment.containing_form_kind = "behavior" - comment.containing_form_func_name = behavior_matches.group(1) - comment.containing_form_type = behavior_matches.group(2) - return - method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_start_line) - if method_matches is not None: - comment.containing_form_kind = "method" - comment.containing_form_func_name = method_matches.group(1) - comment.containing_form_type = method_matches.group(2) - return - comment.containing_form_kind = "unknown" - comment.containing_form_func_name = None - comment.containing_form_type = None - - -decomp_ignore_forms = [] +decomp_ignore_forms = ["defmethod inspect"] decomp_ignore_errors = False with open(gsrc_path) as f: @@ -239,160 +75,8 @@ with open(gsrc_path) as f: if "og:ignore-form" in line: decomp_ignore_forms.append(line.partition("ignore-form:")[2].strip()) lines.append(line) - # track if we are inside a define*/defun/defmethod/deftype/defstate - within_form = None - line_num_in_form = None - form_paren_stack = [] - found_output = False - i = 0 - while i < len(lines): - debug_lines.append(lines[i]) - tline = lines[i].lstrip() - if "decomp begins" in tline.lower(): - found_output = True - i = i + 1 - continue - if not found_output: - i = i + 1 - continue - # actually process code - if within_form is None: - # lets see if we are now in one - within_form = is_line_start_of_form(lines[i]) - if within_form is not None: - line_num_in_form = 0 - if has_form_ended(form_paren_stack, lines[i]): - within_form = None - form_paren_stack = [] - elif within_form is not None: - # check if the form has ended by counting parens - if has_form_ended(form_paren_stack, lines[i]): - within_form = None - form_paren_stack = [] - line_num_in_form = 0 - else: - line_num_in_form = line_num_in_form + 1 - - if tline.startswith(";") or tline.startswith("#|"): - # treat decomp deviation blocks as essentially comments as well, so include them in a block comment if appropriate - # this is done because there is nothing to match them against (if a comment is inside them for example) - # so we have to copy them in full - in_deviation_block = False - if "decomp deviation" in tline.lower() or tline.startswith("#|"): - in_deviation_block = True - current_comment = CommentMeta() - current_comment.line_in_file = i - current_comment.data = lines[i] - ( - current_comment.symbol_before, - current_comment.symbol_padding_before, - ) = backtrack_for_symbol(lines, i) - ( - current_comment.code_before, - current_comment.code_padding_before, - ) = backtrack_for_code(lines, i) - current_comment.containing_form = within_form - if within_form is not None: - append_form_metadata(current_comment, within_form) - current_comment.line_num_in_form = line_num_in_form - current_comment.inline = False - # look ahead to handle block comments - if i + 1 < len(lines): - next_line = lines[i + 1] - if "decomp deviation" in next_line.lower() or next_line.startswith("|#"): - in_deviation_block = False - while i + 1 < len(lines) and ( - in_deviation_block - or next_line.lstrip().startswith(";") - or next_line.lstrip().startswith("|#") - ): - debug_lines.append(lines[i + 1]) - i = i + 1 - current_comment.data = current_comment.data + next_line - if i + 1 < len(lines): - next_line = lines[i + 1] - if "decomp deviation" in next_line.lower() or next_line.startswith( - "|#" - ): - in_deviation_block = False - ( - current_comment.symbol_after, - current_comment.symbol_padding_after, - ) = lookahead_for_symbol(lines, i) - ( - current_comment.code_after, - current_comment.code_padding_after, - ) = lookahead_for_code(lines, i) - comments.append(current_comment) - debug_lines.append( - ";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format( - current_comment.symbol_before, - current_comment.symbol_padding_before, - current_comment.symbol_after, - current_comment.symbol_padding_after, - debug_nice_formatted_code(current_comment.code_before), - current_comment.code_padding_before, - debug_nice_formatted_code(current_comment.code_after), - current_comment.code_padding_after, - ) - ) - debug_lines.append( - ";; [DEBUG]: in_form - {}...:{}\n".format( - debug_nice_formatted_code(current_comment.containing_form), - current_comment.line_num_in_form, - ) - ) - # inline comments - # TODO - cleanup duplication - elif ";" in tline: - current_comment = CommentMeta() - current_comment.line_in_file = i - current_comment.data = ";" + tline.partition(";")[2] - ( - current_comment.symbol_before, - current_comment.symbol_padding_before, - ) = backtrack_for_symbol(lines, i) - ( - current_comment.symbol_after, - current_comment.symbol_padding_after, - ) = lookahead_for_symbol(lines, i) - ( - current_comment.code_before, - current_comment.code_padding_before, - ) = backtrack_for_code(lines, i) - ( - current_comment.code_after, - current_comment.code_padding_after, - ) = lookahead_for_code(lines, i) - current_comment.containing_form = within_form - if within_form is not None: - append_form_metadata(current_comment, within_form) - current_comment.line_num_in_form = line_num_in_form - current_comment.symbol_inline = symbol_on_line(tline) - current_comment.inline = True - current_comment.code_in_line = tline.partition(";")[0] - comments.append(current_comment) - debug_lines.append( - ";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format( - current_comment.symbol_before, - current_comment.symbol_padding_before, - current_comment.symbol_after, - current_comment.symbol_padding_after, - debug_nice_formatted_code(current_comment.code_before), - current_comment.code_padding_before, - debug_nice_formatted_code(current_comment.code_after), - current_comment.code_padding_after, - ) - ) - debug_lines.append( - ";; [DEBUG]: in_form - {}...:{} || inline_code - {}...\n".format( - debug_nice_formatted_code(current_comment.containing_form), - current_comment.line_num_in_form, - debug_nice_formatted_code(current_comment.code_in_line), - ) - ) - i = i + 1 - + if args.preserve: + comments, debug_lines = process_original_lines(lines) if args.debug: with open(gsrc_path, "w") as f: @@ -428,7 +112,6 @@ def should_ignore_line(line): return False -# TODO - check for existance probably decomp_file_path = "./decompiler_out/{}/{}_disasm.gc".format(args.game, args.file) with open(decomp_file_path) as f: lines = f.readlines() @@ -476,491 +159,25 @@ with open(decomp_file_path) as f: # Step 3: Start merging the new code + comments final_lines = [] -decomp_started = False - - -def get_symbol_at_line(line): - tline = line.strip() - matches = re.search( - r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline - ) - if matches is not None: - return matches.group(1) - return None - - -def relevant_symbol_comments_for_line_before(line): - symbol = get_symbol_at_line(line) - if symbol is None: - return [] - # Loop through comments, finding any that match the symbol - # they WILL be placed, so we can remove them from our list now - i = 0 - relevant_comments = [] - while i < len(comments): - comment = comments[i] - if comment.symbol_after == symbol: - relevant_comments.append(comment) - comments.pop(i) - else: - i = i + 1 - return relevant_comments - - -def padding_before_comment(comment): - if comment.containing_form is None: - if comment.symbol_after is not None: - return "\n" * comment.symbol_padding_after - return "" - - -def relevant_symbol_comments_for_inline(line): - symbol = get_symbol_at_line(line) - if symbol is None: - return [] - # Loop through comments, finding any that match the symbol - # they WILL be placed, so we can remove them from our list now - i = 0 - relevant_comments = [] - while i < len(comments): - comment = comments[i] - if comment.symbol_inline == symbol: - relevant_comments.append(comment) - comments.pop(i) - else: - i = i + 1 - return relevant_comments - - -def padding_after_comment(comment): - if comment.containing_form is None: - if comment.symbol_before is not None: - return "\n" * comment.symbol_padding_before - return "" - - -def relevant_symbol_comments_for_line_after(line): - symbol = get_symbol_at_line(line) - if symbol is None: - return [] - # Loop through comments, finding any that match the symbol - # they WILL be placed, so we can remove them from our list now - i = 0 - relevant_comments = [] - while i < len(comments): - comment = comments[i] - # if we can, we prefer to put comments before not after (more accurate re-creation) - if comment.symbol_after is None and comment.symbol_before == symbol: - relevant_comments.append(comment) - comments.pop(i) - else: - i = i + 1 - return relevant_comments - - -# the first half of the defmethod/etc lines (before arg list) is less likely to change -# so we want to split it to weight it more heavily -def split_def_line(line): - first_part = "" - second_part = "" - for index, char in enumerate(line): - if char == "(": - if index == 0: - first_part = first_part + char - else: - second_part = second_part + char - continue - else: - if second_part != "": - second_part = second_part + char - else: - first_part = first_part + char - return first_part, second_part - - -def get_form_metadata(form_def_line): - func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_def_line) - if func_matches is not None: - return "function", func_matches.group(1), None - behavior_matches = re.search(r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_def_line) - if behavior_matches is not None: - return "behavior", behavior_matches.group(1), behavior_matches.group(2) - method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_def_line) - if method_matches is not None: - return "method", method_matches.group(1), method_matches.group(2) - return "unknown", None, None - - -built_in_method_names = [ - "new", - "delete", - "print", - "inspect", - "length", - "asize-of", - "copy", - "relocate", - "memusage", -] - - -def different_method_names(form_func_name, comment_form_func_name): - if ( - comment_form_func_name not in built_in_method_names - and form_func_name not in built_in_method_names - ): - return False - return form_func_name != comment_form_func_name - - -def get_relevant_form_comments(form_def_line): - form_kind, form_func_name, form_type = get_form_metadata(form_def_line) - code_def_part, code_rest = split_def_line(form_def_line) - relevant_comments = [] - i = 0 - while i < len(comments): - comment = comments[i] - if comment.containing_form is None: - i = i + 1 - continue - ( - comment_form_kind, - comment_form_func_name, - comment_form_type, - ) = get_form_metadata(comment.containing_form) - # First disqualify the form if it's obviously unrelated - if comment_form_kind != "unknown": - if form_kind != comment_form_kind: - i = i + 1 - continue - elif form_kind == "function" and comment_form_func_name != form_func_name: - i = i + 1 - continue - elif form_kind == "behavior" and comment_form_func_name != form_func_name: - i = i + 1 - continue - elif form_kind == "method" and ( - comment_form_type != form_type - or different_method_names(form_func_name, comment_form_func_name) - ): - i = i + 1 - continue - # Evaluate it's score (comments and current def line) - def_part, rest = split_def_line(comment.containing_form) - def_score = fuzz.ratio(code_def_part, def_part) * 0.65 - if def_score == 65.0 and form_kind != "unknown": - relevant_comments.append(comment) - comments.pop(i) - continue - rest_score = fuzz.ratio(code_rest, rest) * 0.35 - combined_score = def_score + rest_score - threshold = 50.0 - if combined_score < threshold: - i = i + 1 - continue - # Now, let's look at ALL other def lines yet to come from the decomp output - # if any are a better match, don't add the comment yet -- we'll add it when we get there! - # TODO - remove lines from the list as we find them so speed this up - found_better_form = False - for decomp_def_line in decomp_form_def_lines: - line_form_kind, line_form_func_name, line_form_type = get_form_metadata( - decomp_def_line - ) - if form_kind != "unknown": - if form_kind != line_form_kind: - continue - elif form_kind == "function" and line_form_func_name != form_func_name: - continue - elif form_kind == "behavior" and line_form_func_name != form_func_name: - continue - elif form_kind == "method" and ( - line_form_type != form_type - or different_method_names(form_func_name, line_form_func_name) - ): - continue - def_part, rest = split_def_line(decomp_def_line) - def_score = fuzz.ratio(code_def_part, def_part) * 0.65 - if def_score == 65.0 and form_kind != "unknown": - found_better_form = True - break - rest_score = fuzz.ratio(code_rest, rest) * 0.35 - if combined_score < def_score + rest_score: - found_better_form = True - break - # TODO otherwise? still test? - if found_better_form: - i = i + 1 - continue - relevant_comments.append(comment) - comments.pop(i) - return relevant_comments - - -# Simple fuzz ratio, but removes obvious outliers like empty lines / lines with only a paren -def score_alg(line1, line2): - tline1 = line1.strip() - tline2 = line2.strip() - if tline1 == "" or tline1 == ")" or tline1 == "(": - return -1 - if tline2 == "" or tline2 == ")" or tline2 == "(": - return -1 - return fuzz.ratio(tline1, tline2) - - -# TODO - improvement on comparison - a higher score on a longer line == better? some sort of weighting approach here too? - -with open(gsrc_path) as f: - lines = f.readlines() - within_form = None - line_num_in_form = None - form_paren_stack = [] - for line in lines: - if "[DEBUG]" in line: - continue - if line.lower().lstrip().startswith(";; decomp begins"): - decomp_started = True +if args.preserve: + merge_retained_code_and_new_code(gsrc_path, decomp_lines, final_lines) +else: + with open(gsrc_path) as f: + lines = f.readlines() + for line in lines: final_lines.append(line) - break - if not decomp_started: + if line.lower().startswith(";; decomp begins"): + break + for line in decomp_lines: final_lines.append(line) - continue - - i = 0 - while i < len(decomp_lines): - line = decomp_lines[i] - # Otherwise, its a part of the output we have to be more careful about - # For every line in the decompiled output, we scan our comment list to see if anything matches - # if it does, we insert it appropriately and remove the comment from the list - # - # This is the main source of inefficiency, but the process gets progressively faster as comments are eliminated - if within_form is None: - # lets see if we are now in one - within_form = is_line_start_of_form(line) - # TODO - check line for symbol matches? - if within_form is not None: - line_num_in_form = 0 - if has_form_ended(form_paren_stack, line): - within_form = None - form_paren_stack = [] - else: - # Get all of the lines of the form at once - form_start = decomp_lines[i] - form_lines = [form_start] - while i < len(decomp_lines): - i = i + 1 - line = decomp_lines[i] - if has_form_ended(form_paren_stack, line): - within_form = None - form_paren_stack = [] - break - else: - form_lines.append(line) - # Add any comments needed to the form contents - # - first we get all comments that have match well with the form's start line (ie. defmethod ....) - form_comments = get_relevant_form_comments(form_start) - # - for each comment, let's find which line matches it the best, - # if NONE exceed the threshold (if both match the same, pick the first), we default to the line offset - for comment in form_comments: - highest_score = -1 - index_to_insert = -1 - threshold = 50.0 - place_kind = None - for index, form_line in enumerate(form_lines): - # skip any comments that were previously added - if form_line.lstrip().startswith(";"): - continue - if comment.code_in_line is not None: - score = score_alg(form_line, comment.code_in_line) - if score >= threshold and score > highest_score: - index_to_insert = index - highest_score = score - place_kind = "inline" - if comment.code_before is not None: - score = score_alg(form_line, comment.code_before) - if score >= threshold and score > highest_score: - index_to_insert = index - highest_score = score - place_comment_after = True - place_kind = "next_line" - if comment.code_after is not None: - score = score_alg(form_line, comment.code_after) - if score >= threshold and score > highest_score: - index_to_insert = index - highest_score = score - place_comment_after = False - place_kind = "before_line" - # add the comment! - if index_to_insert == -1: - if comment.inline: - form_lines[comment.line_num_in_form] = ( - form_lines[index_to_insert].rstrip() - + " " - + comment.data - ) - else: - form_lines.insert( - comment.line_num_in_form, comment.data - ) - elif comment.inline: - form_index = index_to_insert - if place_kind == "next_line": - form_index = index_to_insert + 1 - form_lines[form_index] = ( - form_lines[form_index].rstrip() + " " + comment.data - ) - elif place_kind == "next_line": - form_lines.insert( - index_to_insert + 1, - padding_before_comment(comment) + comment.data, - ) - else: - form_lines.insert( - index_to_insert, - padding_after_comment(comment) + comment.data, - ) - # Add the lines to the final output - for form_line in form_lines: - final_lines.append(form_line) - - # Otherwise, we are at the top-level! - if within_form is None: - before_comments = relevant_symbol_comments_for_line_before(line) - for comment in before_comments: - final_lines.append(padding_before_comment(comment) + comment.data) - inline_comments = relevant_symbol_comments_for_inline(line) - if len(inline_comments) > 0: - comment_str = "" - for comment in inline_comments: - comment_str = comment_str + comment.data.strip() - comment_str = comment_str.replace(";", "") - final_lines.append( - "{} ;; {}".format(line.rstrip(), comment_str.strip()) - ) - else: - final_lines.append(line) - after_comments = relevant_symbol_comments_for_line_after(line) - for comment in after_comments: - final_lines.append(padding_after_comment(comment) + comment.data) - # next line - i = i + 1 # Step 3.b: Handle any remaining top level comments # If we can't find a code line that meets a threshold, default to their line number # - Why is this done after: if a comment is associated with nothing but code, we have no # guarantee where it should go, so we have to wait until all code is populated # This is SUPER inefficient, so hopefully we've processed nearly all comments by this point -for comment in comments: - within_form = None - line_num_in_form = None - form_paren_stack = [] - found_output = True - i = 0 - index_to_insert = -1 - highest_score = -1 - place_comment_after = True - threshold = 50.0 - while i < len(final_lines): - debug_lines.append(final_lines[i]) - tline = final_lines[i].lstrip() - if "decomp begins" in tline.lower(): - found_output = True - i = i + 1 - continue - if not found_output: - i = i + 1 - continue - line = final_lines[i] - # We can try to claw back a bit of efficiency by skipping the inside of forms - if within_form is not None: - # check if the form has ended by counting parens - if has_form_ended(form_paren_stack, line): - if comment.code_in_line is not None: - score = score_alg(line, comment.code_in_line) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - if comment.code_before is not None: - score = score_alg(line, comment.code_before) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - place_comment_after = True - if comment.code_after is not None: - score = score_alg(line, comment.code_after) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - place_comment_after = False - within_form = None - form_paren_stack = [] - line_num_in_form = 0 - else: - line_num_in_form = line_num_in_form + 1 - else: - # lets see if we are now in a form - within_form = is_line_start_of_form(line) - if within_form is not None: - if comment.code_in_line is not None: - score = score_alg(line, comment.code_in_line) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - if comment.code_before is not None: - score = score_alg(line, comment.code_before) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - place_comment_after = True - if comment.code_after is not None: - score = score_alg(line, comment.code_after) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - place_comment_after = False - line_num_in_form = 0 - else: - # just normal code, check it - if comment.code_in_line is not None: - score = score_alg(line, comment.code_in_line) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - if comment.code_before is not None: - score = score_alg(line, comment.code_before) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - place_comment_after = True - if comment.code_after is not None: - score = score_alg(line, comment.code_after) - if score >= threshold and score > highest_score: - index_to_insert = i - highest_score = score - place_comment_after = False - i = i + 1 - # end of while loop - # add the comment! - if index_to_insert == -1: - if comment.inline: - final_lines[comment.line_in_file] = ( - final_lines[comment.line_in_file].rstrip() + " " + comment.data - ) - else: - final_lines.insert(comment.line_in_file, comment.data) - elif comment.inline: - final_lines[index_to_insert] = ( - final_lines[index_to_insert].rstrip() + " " + comment.data - ) - elif place_comment_after: - final_lines.insert( - index_to_insert + 1, - padding_before_comment(comment) + comment.data, - ) - else: - final_lines.insert( - index_to_insert, - padding_after_comment(comment) + comment.data, - ) +if args.preserve: + handle_dangling_blocks(comments, final_lines, debug_lines) # Step 4: Write it out with open(gsrc_path, "w") as f: diff --git a/scripts/gsrc/utils.py b/scripts/gsrc/utils.py index 331aa51dae..ce2c7373d5 100644 --- a/scripts/gsrc/utils.py +++ b/scripts/gsrc/utils.py @@ -29,3 +29,9 @@ def get_gsrc_path_from_filename(game_name, file_name): print("{} couldn't find in /goal_src/{}!".format(file_name, game_name)) exit(1) return path + +def get_alltypes_path_from_game(game_name): + if game_name == "jak1": + return "./decompiler/config/all-types.gc" + else: + return "./decompiler/config/jak2/all-types.gc" diff --git a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc index ac53121178..1fceae64dc 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc @@ -2154,7 +2154,3 @@ ;; failed to figure out what this is: (kmemclose) - - - - diff --git a/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc b/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc index 957daf942f..9f2be346e6 100644 --- a/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc @@ -446,7 +446,7 @@ (circular-follow vector :inline :offset-assert 2256) (max-angle-offset float :offset-assert 2272) (max-angle-curr float :offset-assert 2276) - (options uint32 :offset-assert 2280) + (options camera-slave-options :offset-assert 2280) (cam-entity entity :offset-assert 2284) (butt-timer uint64 :offset-assert 2288) (butt-seek basic :offset-assert 2296) @@ -664,7 +664,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc index 75db38bda0..51b85f4f90 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc @@ -4,6 +4,7 @@ ;; definition of type control-info (deftype control-info (collide-shape-moving) ((unknown-qword00 vector :offset 12) + (unknown-float00 float :offset 528) (unknown-surface00 surface :offset 3832) (unknown-cpad-info00 cpad-info :offset 3848) (unknown-time-frame00 time-frame :offset 4624) @@ -19,7 +20,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc new file mode 100644 index 0000000000..1659d4c4a8 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc @@ -0,0 +1,7329 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition for symbol *debug-menu-context*, type debug-menu-context +(define *debug-menu-context* (new 'debug 'debug-menu-context)) + +;; definition for symbol *dm-cam-mode-interpolation*, type int +(define *dm-cam-mode-interpolation* 0) + +;; definition for function dm-cam-mode-func +(defun dm-cam-mode-func ((arg0 (state camera-slave)) (arg1 debug-menu-msg)) + (if (and (= arg1 (debug-menu-msg press)) arg0) + (set-setting-by-param *setting-control* 'mode-name (-> arg0 name) 0 0) + ) + (if *camera* + (send-event *camera* 'query-state arg0) + (not arg0) + ) + ) + +;; definition for function dm-cam-mode-default +(defun dm-cam-mode-default ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (remove-setting-by-arg0 *setting-control* 'mode-name) + ) + (not (setting-control-method-14 *setting-control* 'mode-name)) + ) + +;; definition for function dm-cam-settings-default +(defun dm-cam-settings-default ((arg0 object) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (remove-setting-by-arg0 *setting-control* 'fov) + (remove-setting-by-arg0 *setting-control* 'slave-options) + ) + (and (not (setting-control-method-14 *setting-control* 'fov)) + (not (setting-control-method-14 *setting-control* 'slave-options)) + ) + ) + +;; definition for function dm-cam-settings-func +(defun dm-cam-settings-func ((arg0 camera-slave-options) (arg1 debug-menu-msg)) + (when (and (= arg1 (debug-menu-msg press)) *camera*) + (cond + ((zero? arg0) + (send-event *camera* 'toggle-slave-option 1) + ) + ((= arg0 (camera-slave-options butt-cam)) + (send-event *camera* 'toggle-slave-option 2) + ) + ((= arg0 (camera-slave-options same-side)) + (send-event *camera* 'toggle-slave-option 4) + ) + ((= arg0 (camera-slave-options butt-cam same-side)) + (send-event *camera* 'toggle-slave-option 128) + ) + ((= arg0 (camera-slave-options move-spherical)) + (send-event *camera* 'toggle-slave-option 8) + ) + ((= arg0 (camera-slave-options same-side move-spherical)) + (set-setting-by-param *setting-control* 'slave-options 'clear 0 16) + ) + ((= arg0 (camera-slave-options butt-cam same-side move-spherical)) + (send-event *camera* 'toggle-slave-option 64) + ) + ((= arg0 (camera-slave-options allow-z-rot)) + (send-event *camera* 'toggle-slave-option 32) + ) + ((= arg0 (camera-slave-options butt-cam allow-z-rot)) + (send-event *camera* 'toggle-slave-option 512) + ) + ((= arg0 (camera-slave-options same-side allow-z-rot)) + (send-event *camera* 'toggle-slave-option #x4000) + ) + ((= arg0 (camera-slave-options butt-cam same-side allow-z-rot)) + (send-event *camera* 'toggle-slave-option #x8000) + ) + ) + ) + (cond + (*camera* + (cond + ((zero? arg0) + (logtest? (-> *camera* slave-options) 1) + ) + ((= arg0 (camera-slave-options butt-cam)) + (logtest? (-> *camera* slave-options) 2) + ) + ((= arg0 (camera-slave-options same-side)) + (logtest? (-> *camera* slave-options) 4) + ) + ((= arg0 (camera-slave-options butt-cam same-side)) + (logtest? (-> *camera* slave-options) 128) + ) + ((= arg0 (camera-slave-options move-spherical)) + (logtest? (-> *camera* slave-options) 8) + ) + ((= arg0 (camera-slave-options same-side move-spherical)) + (not (setting-control-method-14 *setting-control* 'slave-options)) + ) + ((= arg0 (camera-slave-options butt-cam same-side move-spherical)) + (logtest? (-> *camera* slave-options) 64) + ) + ((= arg0 (camera-slave-options allow-z-rot)) + (logtest? (-> *camera* slave-options) 32) + ) + ((= arg0 (camera-slave-options butt-cam allow-z-rot)) + (logtest? (-> *camera* slave-options) 512) + ) + ((= arg0 (camera-slave-options same-side allow-z-rot)) + (logtest? (-> *camera* slave-options) #x4000) + ) + ((= arg0 (camera-slave-options butt-cam same-side allow-z-rot)) + (logtest? (-> *camera* slave-options) #x8000) + ) + (else + #f + ) + ) + ) + (else + #f + ) + ) + ) + +;; definition for function dm-cam-settings-func-int +(defun dm-cam-settings-func-int ((arg0 int) (arg1 debug-menu-msg) (arg2 int) (arg3 int)) + (when (and (= arg1 (debug-menu-msg press)) *camera*) + (if (= (/ arg0 8) 5) + (set! *dm-cam-mode-interpolation* arg2) + ) + ) + (cond + (*camera* + (if (= (/ arg0 8) 5) + *dm-cam-mode-interpolation* + arg3 + ) + ) + (else + arg3 + ) + ) + ) + +;; definition for function dm-cam-externalize +(defun dm-cam-externalize ((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) + ) + ) + +;; definition for function dm-cam-setting-float +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function dm-cam-render-float +(defun dm-cam-render-float ((arg0 int) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (when (= arg1 (debug-menu-msg press)) + (when (zero? (/ arg0 8)) + (when *math-camera* + (set! (-> *math-camera* fov) (* 182.04445 arg2)) + (update-math-camera + *math-camera* + (-> *setting-control* user-current video-mode) + (-> *setting-control* user-current aspect-ratio) + (-> *math-camera* fov) + ) + ) + ) + ) + (cond + ((zero? (/ arg0 8)) + (cond + (*math-camera* + (* 0.005493164 (-> *math-camera* fov)) + ) + (else + (empty) + arg3 + ) + ) + ) + (else + (empty) + arg3 + ) + ) + ) + +;; definition for function dm-subdiv-float +(defun dm-subdiv-float ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (when (= arg1 (debug-menu-msg press)) + (case arg0 + (('close) + (if (and *math-camera* *subdivide-settings*) + (set! (-> *subdivide-settings* close 7) (* 4096.0 arg2)) + ) + ) + (('far) + (if (and *math-camera* *subdivide-settings*) + (set! (-> *subdivide-settings* far 7) (* 4096.0 arg2)) + ) + ) + ) + ) + (case arg0 + (('close) + (if (and *math-camera* *subdivide-settings*) + (* 0.00024414062 (-> *subdivide-settings* close 7)) + arg3 + ) + ) + (('far) + (if (and *math-camera* *subdivide-settings*) + (* 0.00024414062 (-> *subdivide-settings* far 7)) + arg3 + ) + ) + (else + arg3 + ) + ) + ) + +;; definition for function dm-subdiv-int +(defun dm-subdiv-int ((arg0 symbol) (arg1 debug-menu-msg) (arg2 int) (arg3 int)) + (when (= arg1 (debug-menu-msg press)) + (case arg0 + (('anim-speed) + (if *anim-tester* + (set! (-> *anim-tester* 0 speed) arg2) + ) + ) + ) + ) + (case arg0 + (('anim-speed) + (if *anim-tester* + (-> *anim-tester* 0 speed) + arg3 + ) + ) + (else + arg3 + ) + ) + ) + +;; definition for function dm-select-race-path +(defun dm-select-race-path ((arg0 object) (arg1 debug-menu-msg) (arg2 int)) + (if (= arg1 (debug-menu-msg press)) + (set! *select-race-path* arg2) + ) + *select-race-path* + ) + +;; definition for function dm-setting-language +(defun dm-setting-language ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default language) (the-as language-enum (/ arg0 8))) + ) + (= (-> *setting-control* user-default language) (/ arg0 8)) + ) + +;; definition for function dm-setting-subtitle-language +(defun dm-setting-subtitle-language ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default subtitle-language) (the-as language-enum (/ arg0 8))) + ) + (= (-> *setting-control* user-default subtitle-language) (/ arg0 8)) + ) + +;; definition for function dm-setting-stereo-mode +(defun dm-setting-stereo-mode ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default stereo-mode) (the-as int (/ (the-as int arg0) 8))) + ) + (= (-> *setting-control* user-default stereo-mode) (/ (the-as int arg0) 8)) + ) + +;; definition for function dm-current-continue +(defun dm-current-continue ((arg0 string) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (start 'play (get-continue-by-name *game-info* arg0)) + ) + (string= (-> (get-current-continue-point *game-info*) name) arg0) + ) + +;; definition for function dm-subdiv-draw-func +(defun dm-subdiv-draw-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *subdivide-draw-mode* (the-as subdivide-setting (/ arg0 8))) + ) + (= (/ arg0 8) *subdivide-draw-mode*) + ) + +;; definition for function dm-scissor-subdiv-draw-func +(defun dm-scissor-subdiv-draw-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *subdivide-scissor-draw-mode* (the-as subdivide-setting (/ arg0 8))) + ) + (= (/ arg0 8) *subdivide-scissor-draw-mode*) + ) + +;; definition for function dm-foreground-subdiv-draw-func +(defun dm-foreground-subdiv-draw-func ((arg0 int) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (set! *subdivide-foreground-draw-mode* (the-as subdivide-setting (/ arg0 8))) + (let ((v1-3 *generic-consts*) + (a1-1 (/ arg0 8)) + ) + (cond + ((zero? a1-1) + (set! (-> v1-3 base-strgif qword vector4w y) #x303e4000) + (set! (-> v1-3 base-strgif qword vector4w x) #x303ec000) + ) + ((= a1-1 1) + (set! (-> v1-3 base-strgif qword vector4w y) #x303d4000) + (set! (-> v1-3 base-strgif qword vector4w x) #x303d4000) + ) + ((= a1-1 2) + (set! (-> v1-3 base-strgif qword vector4w y) #x30364000) + (set! (-> v1-3 base-strgif qword vector4w x) #x3036c000) + ) + ((= a1-1 3) + (set! (-> v1-3 base-strgif qword vector4w y) #x30354000) + (set! (-> v1-3 base-strgif qword vector4w x) #x3036c000) + ) + ) + ) + ) + (= (/ arg0 8) *subdivide-foreground-draw-mode*) + ) + +;; definition for function dm-col-rend-on-func +(defun dm-col-rend-on-func ((arg0 object) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 draw?) (not (-> v1-0 draw?))) + ) + (-> v1-0 draw?) + ) + ) + +;; definition for function dm-col-rend-outline-func +(defun dm-col-rend-outline-func ((arg0 object) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 outline?) (not (-> v1-0 outline?))) + ) + (-> v1-0 outline?) + ) + ) + +;; definition for function dm-col-rend-back-face-func +(defun dm-col-rend-back-face-func ((arg0 object) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 show-back-faces?) (not (-> v1-0 show-back-faces?))) + ) + (-> v1-0 show-back-faces?) + ) + ) + +;; definition for function dm-col-rend-normals-func +(defun dm-col-rend-normals-func ((arg0 object) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 show-normals?) (not (-> v1-0 show-normals?))) + ) + (-> v1-0 show-normals?) + ) + ) + +;; definition for function dm-col-rend-ghost-hidden-func +(defun dm-col-rend-ghost-hidden-func ((arg0 object) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 ghost-hidden?) (not (-> v1-0 ghost-hidden?))) + ) + (-> v1-0 ghost-hidden?) + ) + ) + +;; definition for function dm-col-rend-track-func +(defun dm-col-rend-track-func ((arg0 int) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 track) (the-as uint (/ arg0 8))) + ) + (= (/ arg0 8) (-> v1-0 track)) + ) + ) + +;; definition for function dm-col-rend-show-only-toggle-func +(defun dm-col-rend-show-only-toggle-func ((arg0 uint) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (when (= arg1 (debug-menu-msg press)) + (logxor! (-> v1-0 show-only) arg0) + (set! (-> v1-0 show-only) (logand -57 (-> v1-0 show-only))) + ) + (logtest? (-> v1-0 show-only) arg0) + ) + ) + +;; definition for function dm-col-rend-show-only-set-func +(defun dm-col-rend-show-only-set-func ((arg0 uint) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 show-only) arg0) + ) + (= (-> v1-0 show-only) arg0) + ) + ) + +;; definition for function dm-col-rend-cspec-toggle +(defun dm-col-rend-cspec-toggle ((arg0 uint) (arg1 debug-menu-msg)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> v1-0 cspec) arg0) + ) + (logtest? (-> v1-0 cspec) arg0) + ) + ) + +;; definition for function dm-col-rend-size +(defun dm-col-rend-size ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 bbox-radius) (* 2048.0 arg2)) + ) + (* 0.00024414062 (* 2.0 (-> v1-0 bbox-radius))) + ) + ) + +;; definition for function dm-col-rend-cam-dist +(defun dm-col-rend-cam-dist ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (let ((v1-0 *col-rend*)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-0 camera-to-bbox-dist) (* 4096.0 arg2)) + ) + (* 0.00024414062 (-> v1-0 camera-to-bbox-dist)) + ) + ) + +;; definition for function dm-ocean-height-func +(defun dm-ocean-height-func ((arg0 ocean-height-hack) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (set! *ocean-height-hack* (the-as ocean-height-hack (/ (the-as int arg0) 8))) + (let* ((v1-3 (/ (the-as int arg0) 8)) + (f0-0 (cond + ((= v1-3 2) + -16384000.0 + ) + ((= v1-3 3) + -216498.17 + ) + ((= v1-3 4) + -265650.2 + ) + ((= v1-3 5) + -314802.2 + ) + ((= v1-3 6) + -368050.2 + ) + (else + 0.0 + ) + ) + ) + ) + (set-height! *ocean-map-sewer* f0-0) + ) + ) + (= (/ (the-as int arg0) 8) *ocean-height-hack*) + ) + +;; definition for function dm-ocean-subdiv-draw-func +(defun dm-ocean-subdiv-draw-func ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *subdivide-ocean-draw-mode* (the-as subdivide-setting (/ (the-as int arg0) 8))) + ) + (= (/ (the-as int arg0) 8) *subdivide-ocean-draw-mode*) + ) + +;; definition for function dm-time-of-day-func +(defun dm-time-of-day-func ((arg0 dm-time-of-day-setting) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (cond + ((zero? (/ (the-as int arg0) 8)) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (send-event (ppointer->process *time-of-day*) 'change 'hour 7) + (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + ) + ((= (/ (the-as int arg0) 8) 1) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (send-event (ppointer->process *time-of-day*) 'change 'hour 10) + (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + ) + ((= (/ (the-as int arg0) 8) 2) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (send-event (ppointer->process *time-of-day*) 'change 'hour 12) + (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + ) + ((= (/ (the-as int arg0) 8) 3) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (send-event (ppointer->process *time-of-day*) 'change 'hour 14) + (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + ) + ((= (/ (the-as int arg0) 8) 4) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (send-event (ppointer->process *time-of-day*) 'change 'hour 18) + (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + ) + ((= (/ (the-as int arg0) 8) 5) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (send-event (ppointer->process *time-of-day*) 'change 'hour 19) + (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + ) + ((= (/ (the-as int arg0) 8) 6) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (send-event (ppointer->process *time-of-day*) 'change 'hour 23) + (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + ) + ((= (/ (the-as int arg0) 8) 7) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (send-event (ppointer->process *time-of-day*) 'change 'hour 4) + (set! (-> *time-of-day-context* mode) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + ) + ((= (/ (the-as int arg0) 8) 8) + (send-event + (ppointer->process *time-of-day*) + 'dest-clock-ratio-set + (if *time-of-day-fast* + #x42700000 + #x3f800000 + ) + 600 + ) + ) + (else + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + (set! (-> *time-of-day-context* mode) + (logand (logxor (-> *time-of-day-context* mode) (the-as uint (/ (the-as int arg0) 8))) + (time-of-day-palette-id palette-0 palette-1 palette-2 palette-3 palette-4 palette-5 palette-6 palette-7) + ) + ) + ) + ) + (send-event (ppointer->process *time-of-day*) 'change 'minutes 0) + (send-event (ppointer->process *time-of-day*) 'change 'seconds 0) + (send-event (ppointer->process *time-of-day*) 'change 'frames 0) + (set! *teleport-count* 1) + ) + (cond + ((< (the-as int (/ (the-as int arg0) 8)) 9) + (= (/ (the-as int arg0) 8) (-> *time-of-day-context* mode)) + ) + ((< (the-as int (/ (the-as int arg0) 8)) 8) + #f + ) + (else + (logtest? (-> *time-of-day-context* mode) (/ (the-as int arg0) 8)) + ) + ) + ) + +;; definition for function dm-time-of-day-func2 +(defun dm-time-of-day-func2 ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (set! (-> arg0 value) (not (-> arg0 value))) + (if (nonzero? (send-event (ppointer->process *time-of-day*) 'ratio)) + (send-event + (ppointer->process *time-of-day*) + 'dest-clock-ratio-set + (if *time-of-day-fast* + #x42700000 + #x3f800000 + ) + 600 + ) + ) + ) + (-> arg0 value) + ) + +;; definition for function dm-time-of-day-palette-func +(defun dm-time-of-day-palette-func ((arg0 dm-time-of-day-palette-settings) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (set! (-> *time-of-day-context* overide-palette) (the-as time-of-day-palette-id (/ (the-as int arg0) 8))) + (cond + ((zero? (/ (the-as int arg0) 8)) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-0)) + ) + ((= (/ (the-as int arg0) 8) 1) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-1)) + ) + ((= (/ (the-as int arg0) 8) 2) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-2)) + ) + ((= (/ (the-as int arg0) 8) 3) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-3)) + ) + ((= (/ (the-as int arg0) 8) 4) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-4)) + ) + ((= (/ (the-as int arg0) 8) 5) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-5)) + ) + ((= (/ (the-as int arg0) 8) 6) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-6)) + ) + ((= (/ (the-as int arg0) 8) 7) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id palette-7)) + ) + ) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0) + ) + (cond + ((zero? (/ (the-as int arg0) 8)) + (= (-> *time-of-day-context* mode) 16) + ) + ((= (/ (the-as int arg0) 8) 1) + (= (-> *time-of-day-context* mode) 32) + ) + ((= (/ (the-as int arg0) 8) 2) + (= (-> *time-of-day-context* mode) 64) + ) + ((= (/ (the-as int arg0) 8) 3) + (= (-> *time-of-day-context* mode) 128) + ) + ((= (/ (the-as int arg0) 8) 4) + (= (-> *time-of-day-context* mode) 256) + ) + ((= (/ (the-as int arg0) 8) 5) + (= (-> *time-of-day-context* mode) 512) + ) + ((= (/ (the-as int arg0) 8) 6) + (= (-> *time-of-day-context* mode) 1024) + ) + ((= (/ (the-as int arg0) 8) 7) + (= (-> *time-of-day-context* mode) 2048) + ) + ) + ) + +;; definition for function dm-boolean-toggle-pick-func +(defun dm-boolean-toggle-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> arg0 value) (not (-> arg0 value))) + ) + (-> arg0 value) + ) + +;; definition for function dm-time-of-day-pick-func +(defun dm-time-of-day-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (time-of-day-setup (= arg1 (debug-menu-msg press))) + ) + +;; definition for function dm-stats-memory-func +(defun dm-stats-memory-func ((arg0 int) (arg1 debug-menu-msg)) + (let ((v1-0 (/ arg0 8))) + (if (= arg1 (debug-menu-msg press)) + (set! *stats-memory-level-index* v1-0) + ) + (= *stats-memory-level-index* v1-0) + ) + ) + +;; definition for function dm-actor-marks-pick-func +(defun dm-actor-marks-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-actor-marks* arg0) + ) + (= *display-actor-marks* arg0) + ) + +;; definition for function dm-select-race-pick-func +(defun dm-select-race-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *select-race* (the-as race-selection (/ arg0 8))) + ) + (= (/ arg0 8) *select-race*) + ) + +;; definition for function dm-compact-actor-pick-func +(defun dm-compact-actor-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *compact-actors* arg0) + ) + (= *compact-actors* arg0) + ) + +;; definition for function dm-actor-vis-pick-func +(defun dm-actor-vis-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-actor-vis* arg0) + ) + (= *display-actor-vis* arg0) + ) + +;; definition for function dm-game-mode-pick-func +(defun dm-game-mode-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *game-info* mode) arg0) + ) + (= (-> *game-info* mode) arg0) + ) + +;; definition for function dm-game-feature-toggle-pick-func +(defun dm-game-feature-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (logxor! (-> *game-info* features) (the-as uint (/ arg0 8))) + (set! (-> *game-info* debug-features) + (logior (logclear (-> *game-info* debug-features) (/ arg0 8)) (logand (-> *game-info* features) (/ arg0 8))) + ) + (if (logtest? (-> *game-info* features) (game-feature gun-yellow gun-red gun-blue gun-dark)) + (logior! (-> *game-info* features) (game-feature unk-game-feature-06)) + (logclear! (-> *game-info* features) (game-feature unk-game-feature-06)) + ) + (if (logtest? (-> *game-info* debug-features) (game-feature gun-yellow gun-red gun-blue gun-dark)) + (logior! (-> *game-info* debug-features) (game-feature unk-game-feature-06)) + (logclear! (-> *game-info* debug-features) (game-feature unk-game-feature-06)) + ) + ) + (logtest? (-> *game-info* features) (/ arg0 8)) + ) + +;; definition for function dm-game-secret-toggle-pick-func +(defun dm-game-secret-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *game-info* secrets) (the-as uint (/ arg0 8))) + ) + (logtest? (-> *game-info* secrets) (/ arg0 8)) + ) + +;; definition for function display-scene-control-toggle-pick-func +(defun display-scene-control-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-scene-control* (logxor *display-scene-control* (the-as uint arg0))) + ) + (logtest? *display-scene-control* arg0) + ) + +;; definition for function display-scene-control-set-pick-func +(defun display-scene-control-set-pick-func ((arg0 scene-controls) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-scene-control* arg0) + ) + (= *display-scene-control* arg0) + ) + +;; definition for function display-bot-marks-toggle-pick-func +(defun display-bot-marks-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-bot-marks* (logxor *display-bot-marks* (the-as uint arg0))) + ) + (logtest? *display-bot-marks* arg0) + ) + +;; definition for function display-bot-marks-set-pick-func +(defun display-bot-marks-set-pick-func ((arg0 bot-marks-controls) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-bot-marks* arg0) + ) + (= *display-bot-marks* arg0) + ) + +;; definition for function display-race-marks-toggle-pick-func +(defun display-race-marks-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-race-marks* (logxor *display-race-marks* (the-as uint arg0))) + ) + (logtest? *display-race-marks* arg0) + ) + +;; definition for function display-race-marks-set-pick-func +(defun display-race-marks-set-pick-func ((arg0 race-marks-controls) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-race-marks* arg0) + ) + (= *display-race-marks* arg0) + ) + +;; definition for function dm-vu1-user-toggle-pick-func +(defun dm-vu1-user-toggle-pick-func ((arg0 vu1-renderer-mask) (arg1 debug-menu-msg)) + (let ((v1-1 (ash 1 (/ (the-as int arg0) 8)))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *display* vu1-enable-user-menu) (the-as uint v1-1)) + ) + (logtest? (-> *display* vu1-enable-user-menu) v1-1) + ) + ) + +;; definition for function dm-vu1-user-all-pick-func +(defun dm-vu1-user-all-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (let ((v1-1 (-> (new 'static 'array uint64 1 #x5fffffff8) 0))) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *display* vu1-enable-user-menu) (the-as vu1-renderer-mask v1-1)) + ) + (= (-> *display* vu1-enable-user-menu) v1-1) + ) + ) + +;; definition for function dm-vu1-user-none-pick-func +(defun dm-vu1-user-none-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (let ((v1-0 0)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *display* vu1-enable-user-menu) (the-as vu1-renderer-mask v1-0)) + ) + (= (-> *display* vu1-enable-user-menu) v1-0) + ) + ) + +;; definition for function dm-texture-user-toggle-pick-func +(defun dm-texture-user-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *texture-pool* texture-enable-user-menu) (the-as uint arg0)) + ) + (logtest? (-> *texture-pool* texture-enable-user-menu) arg0) + ) + +;; definition for function dm-texture-user-set-pick-func +(defun dm-texture-user-set-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *texture-pool* texture-enable-user-menu) (the-as uint arg0)) + ) + (= (-> *texture-pool* texture-enable-user-menu) arg0) + ) + +;; definition for function dm-strip-lines-toggle-pick-func +(defun dm-strip-lines-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-strip-lines* (logxor *display-strip-lines* (the-as uint (/ arg0 8)))) + ) + (logtest? *display-strip-lines* (/ arg0 8)) + ) + +;; definition for function dm-strip-lines-set-pick-func +(defun dm-strip-lines-set-pick-func ((arg0 strip-lines-controls) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *display-strip-lines* (the-as strip-lines-controls (/ (the-as int arg0) 8))) + ) + (= *display-strip-lines* (/ (the-as int arg0) 8)) + ) + +;; definition for function dm-edit-instance-toggle-pick-func +(defun dm-edit-instance-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (let ((v1-0 (find-instance-by-name *edit-instance*))) + (when v1-0 + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> v1-0 flags) (the-as uint arg0)) + ) + (logtest? (-> v1-0 flags) arg0) + ) + ) + ) + +;; definition for function all-texture-tweak-adjust +;; INFO: Return type mismatch int vs none. +(defun all-texture-tweak-adjust ((arg0 texture-page-dir) (arg1 float)) + (dotimes (s4-0 (-> arg0 length)) + (let ((s3-0 (-> arg0 entries s4-0 page))) + (dotimes (s2-0 (min (-> s3-0 length) (-> arg0 entries s4-0 length))) + (when (-> arg0 entries s4-0 link) + (let ((v1-12 (+ (the-as uint (-> arg0 entries s4-0 link)) (* s2-0 4))) + (s1-0 (-> arg0 entries s4-0 page data s2-0)) + ) + (+! (-> s1-0 uv-dist) arg1) + (+ v1-12 0) + (let ((s0-0 (the-as object (* (-> (dynamic-array-field-access v1-12 next PLACEHOLDER) shader) 16)))) + (while (nonzero? (the-as uint s0-0)) + (adgif-shader-update! (the-as adgif-shader s0-0) s1-0) + (&-> (the-as adgif-shader s0-0) reg-2) + (set! s0-0 (* (-> (the-as adgif-shader s0-0) next shader) 16)) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function dm-float-field-tie-rvanish-func +(defun dm-float-field-tie-rvanish-func ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + "NOTE - Weird cast, it's not an instance-tie...but it is?" + (let ((gp-0 (find-instance-by-name (the-as string (-> arg0 value))))) + (cond + (gp-0 + (case (prototype-bucket-type gp-0) + ((instance-tie) + (let* ((f0-0 (-> (the-as prototype-bucket-tie gp-0) tie-vanish-far)) + (f1-2 (- f0-0 (/ 128.0 (-> (the-as prototype-bucket-tie gp-0) tie-rvanish)))) + ) + (let ((f2-1 (-> (the-as prototype-bucket-tie gp-0) dists w))) + (when (= arg1 (debug-menu-msg press)) + (logior! (-> (the-as prototype-bucket-tie gp-0) flags) 8) + (set! f1-2 (fmax (fmin (* 4096.0 arg2) f0-0) (+ 4096.0 f2-1))) + (let ((f0-1 (fmax f0-0 (+ 4096.0 f1-2)))) + (set! (-> (the-as prototype-bucket-tie gp-0) tie-rvanish) (/ 128.0 (- f0-1 f1-2))) + (set! (-> (the-as prototype-bucket-tie gp-0) tie-vanish-far) f0-1) + ) + ) + ) + (* 0.00024414062 f1-2) + ) + ) + (else + (empty) + arg3 + ) + ) + ) + (else + (empty) + arg3 + ) + ) + ) + ) + +;; definition for function dm-float-field-tie-vanish-far-func +(defun dm-float-field-tie-vanish-far-func ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + "NOTE - Weird cast, it's not an instance-tie...but it is?" + (let ((gp-0 (find-instance-by-name (the-as string (-> arg0 value))))) + (cond + (gp-0 + (case (prototype-bucket-type gp-0) + ((instance-tie) + (let ((f0-0 (-> (the-as prototype-bucket-tie gp-0) tie-vanish-far))) + (let ((f2-1 (- f0-0 (/ 128.0 (-> (the-as prototype-bucket-tie gp-0) tie-rvanish)))) + (f1-2 (-> (the-as prototype-bucket-tie gp-0) dists w)) + ) + (when (= arg1 (debug-menu-msg press)) + (logior! (-> (the-as prototype-bucket-tie gp-0) flags) 8) + (set! f0-0 (fmax (* 4096.0 arg2) (+ 4096.0 f2-1))) + (let ((f1-4 (fmax (fmin f2-1 f0-0) (+ 4096.0 f1-2)))) + (set! (-> (the-as prototype-bucket-tie gp-0) tie-rvanish) (/ 128.0 (- f0-0 f1-4))) + ) + (set! (-> (the-as prototype-bucket-tie gp-0) tie-vanish-far) f0-0) + ) + ) + (* 0.00024414062 f0-0) + ) + ) + (else + (empty) + arg3 + ) + ) + ) + (else + (empty) + arg3 + ) + ) + ) + ) + +;; definition for function dm-bug-report-output-pick-func +(defun dm-bug-report-output-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! *bug-report-output-mode* arg0) + ) + (= *bug-report-output-mode* arg0) + ) + +;; definition for function dm-bug-report-report-pick-func +;; INFO: Return type mismatch int vs none. +(defun dm-bug-report-report-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (bug-report-display) + ) + 0 + (none) + ) + +;; definition for function debug-menu-node arg0 name) (-> arg1 name)) + ) + +;; definition for function dm-shader-pick-func +(defun dm-shader-pick-func ((arg0 texture-id) (arg1 debug-menu-msg)) + (if (and (= arg1 (debug-menu-msg press)) + *texture-page-dir* + (-> *texture-page-dir* entries (-> arg0 page) page) + (-> *texture-page-dir* entries (-> arg0 page) link) + (nonzero? (-> *texture-page-dir* entries (-> arg0 page) link next (-> arg0 index))) + ) + (set! *edit-shader* arg0) + ) + (and (nonzero? *edit-shader*) (= arg0 *edit-shader*)) + ) + +;; definition for symbol *shader-pick-menu*, type debug-menu +(define *shader-pick-menu* (the-as debug-menu #f)) + +;; definition for function build-shader-list +;; INFO: Return type mismatch pair vs none. +(defun build-shader-list () + (debug-menu-remove-all-items *shader-pick-menu*) + (when *texture-page-dir* + (dotimes (gp-0 (-> *texture-page-dir* length)) + (let ((s5-0 (-> *texture-page-dir* entries gp-0 page)) + (s4-0 (-> *texture-page-dir* entries gp-0 link)) + ) + (when (and s5-0 s4-0) + (dotimes (s3-0 (-> s5-0 length)) + (when (and (-> s5-0 data s3-0) (nonzero? (-> s4-0 next s3-0))) + (let ((t9-1 (method-of-type debug-menu-item-flag new)) + (a0-8 'debug) + (a1-0 debug-menu-item-flag) + ) + (-> s5-0 data s3-0 name) + (logior (shr (shl s3-0 52) 44) (shr (shl gp-0 52) 32)) + dm-shader-pick-func + (let ((a1-1 (t9-1 a0-8 a1-0))) + (debug-menu-append-item *shader-pick-menu* a1-1) + ) + ) + ) + ) + ) + ) + ) + ) + (set! (-> *shader-pick-menu* items) (sort (-> *shader-pick-menu* items) debug-menu-node v1-0 flags) 1) + ) + (zero? (logand (-> v1-0 flags) 1)) + ) + (else + #f + ) + ) + ) + ) + +;; definition for symbol *instance-shrub-menu*, type debug-menu +(define *instance-shrub-menu* (the-as debug-menu #f)) + +;; definition for symbol *instance-tie-menu*, type debug-menu +(define *instance-tie-menu* (the-as debug-menu #f)) + +;; definition for symbol *enable-instance-shrub-menu*, type debug-menu +(define *enable-instance-shrub-menu* (the-as debug-menu #f)) + +;; definition for symbol *enable-instance-tie-menu*, type debug-menu +(define *enable-instance-tie-menu* (the-as debug-menu #f)) + +;; definition for function build-instance-list +;; INFO: Return type mismatch int vs none. +(defun build-instance-list ((arg0 object)) + (debug-menu-remove-all-items *instance-shrub-menu*) + (debug-menu-remove-all-items *instance-tie-menu*) + (debug-menu-remove-all-items *enable-instance-shrub-menu*) + (debug-menu-remove-all-items *enable-instance-tie-menu*) + (set! *display-instance-info* #f) + (dotimes (gp-0 (-> *level* length)) + (let ((v1-3 (-> *level* level gp-0))) + (when (= (-> v1-3 status) 'active) + (let ((s5-0 (-> v1-3 bsp drawable-trees))) + (dotimes (s4-0 (-> s5-0 length)) + (let ((v1-7 (-> s5-0 trees s4-0))) + (case (-> v1-7 type) + ((drawable-tree-instance-shrub) + (let ((s3-0 (-> (the-as drawable-tree-instance-shrub v1-7) info prototype-inline-array-shrub))) + (dotimes (s2-0 (-> s3-0 length)) + (let ((t9-4 (method-of-type debug-menu-item-flag new)) + (a0-9 'global) + (a1-3 debug-menu-item-flag) + ) + (-> s3-0 data s2-0 name) + (-> s3-0 data s2-0 name) + dm-instance-pick-func + (let ((a1-4 (t9-4 a0-9 a1-3))) + (debug-menu-append-item *instance-shrub-menu* a1-4) + ) + ) + (let ((t9-6 (method-of-type debug-menu-item-flag new)) + (a0-11 'debug) + (a1-5 debug-menu-item-flag) + ) + (-> s3-0 data s2-0 name) + (-> s3-0 data s2-0 name) + dm-enable-instance-func + (let ((a1-6 (t9-6 a0-11 a1-5))) + (set! (-> a1-6 is-on) #t) + (debug-menu-append-item *enable-instance-shrub-menu* a1-6) + ) + ) + ) + ) + ) + ((drawable-tree-instance-tie) + (let ((s3-1 (-> (the-as drawable-tree-instance-tie v1-7) prototypes prototype-array-tie))) + (dotimes (s2-1 (-> s3-1 length)) + (let ((t9-8 (method-of-type debug-menu-item-flag new)) + (a0-15 'debug) + (a1-8 debug-menu-item-flag) + ) + (-> s3-1 array-data s2-1 name) + (-> s3-1 array-data s2-1 name) + dm-instance-pick-func + (let ((a1-9 (t9-8 a0-15 a1-8))) + (debug-menu-append-item *instance-tie-menu* a1-9) + ) + ) + (let ((t9-10 (method-of-type debug-menu-item-flag new)) + (a0-17 'debug) + (a1-10 debug-menu-item-flag) + ) + (-> s3-1 array-data s2-1 name) + (-> s3-1 array-data s2-1 name) + dm-enable-instance-func + (let ((a1-11 (t9-10 a0-17 a1-10))) + (set! (-> a1-11 is-on) #t) + (debug-menu-append-item *enable-instance-tie-menu* a1-11) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! (-> *instance-shrub-menu* items) + (sort + (-> *instance-shrub-menu* items) + (lambda ((arg0 debug-menu) (arg1 debug-menu)) (string<=? (-> arg0 name) (-> arg1 name))) + ) + ) + (set! (-> *instance-tie-menu* items) + (sort + (-> *instance-tie-menu* items) + (lambda ((arg0 debug-menu) (arg1 debug-menu)) (string<=? (-> arg0 name) (-> arg1 name))) + ) + ) + (set! (-> *enable-instance-shrub-menu* items) + (sort + (-> *enable-instance-shrub-menu* items) + (lambda ((arg0 debug-menu) (arg1 debug-menu)) (string<=? (-> arg0 name) (-> arg1 name))) + ) + ) + (set! (-> *enable-instance-tie-menu* items) + (sort + (-> *enable-instance-tie-menu* items) + (lambda ((arg0 debug-menu) (arg1 debug-menu)) (string<=? (-> arg0 name) (-> arg1 name))) + ) + ) + 0 + (none) + ) + +;; definition for function dm-scene-load-pick-func +(defun dm-scene-load-pick-func ((arg0 pair) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (let ((s5-0 *display-profile*)) + (play-clean #f) + (set! *display-profile* s5-0) + ) + (let ((s5-1 (car (cdr arg0)))) + (when (and (type? s5-1 string) + (or (string= (the-as string s5-1) "outro-palace") + (string= (the-as string s5-1) "outro-hiphog") + (string= (the-as string s5-1) "outro-port") + (string= (the-as string s5-1) "outro-nest") + ) + ) + (set! (-> palout memory-mode) (the-as uint 4)) + (set! (-> hiphog memory-mode) (the-as uint 1)) + ) + (process-spawn + scene-player + :init scene-player-init + s5-1 + #t + (car arg0) + :name (symbol->string (-> scene-player symbol)) + ) + ) + (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (set-master-mode 'game) + ) + #f + ) + +;; definition for function debug-create-cam-restore +;; INFO: Return type mismatch object vs none. +(defun debug-create-cam-restore () + (cond + (*math-camera* + (format #t "(defun-debug cam-restore ()~%") + (format #t " ;;this function is a hack, don't use it as an example~%") + (format #t " (let ((pos (new 'stack 'vector))~%") + (format #t " (rot (new 'stack 'matrix)))~%") + (format #t " (set! (-> pos x) ~12F)~%" (-> *math-camera* trans x)) + (format #t " (set! (-> pos y) ~12F)~%" (-> *math-camera* trans y)) + (format #t " (set! (-> pos z) ~12F)~%" (-> *math-camera* trans z)) + (format #t " (set! (-> pos w) 1.0)~%") + (format #t " (set! (-> rot data 0) ~12F)~%" (-> *math-camera* inv-camera-rot data 0)) + (format #t " (set! (-> rot data 1) ~12F)~%" (-> *math-camera* inv-camera-rot data 1)) + (format #t " (set! (-> rot data 2) ~12F)~%" (-> *math-camera* inv-camera-rot data 2)) + (format #t " (set! (-> rot data 3) ~12F)~%" (-> *math-camera* inv-camera-rot data 3)) + (format #t " (set! (-> rot data 4) ~12F)~%" (-> *math-camera* inv-camera-rot data 4)) + (format #t " (set! (-> rot data 5) ~12F)~%" (-> *math-camera* inv-camera-rot data 5)) + (format #t " (set! (-> rot data 6) ~12F)~%" (-> *math-camera* inv-camera-rot data 6)) + (format #t " (set! (-> rot data 7) ~12F)~%" (-> *math-camera* inv-camera-rot data 7)) + (format #t " (set! (-> rot data 8) ~12F)~%" (-> *math-camera* inv-camera-rot data 8)) + (format #t " (set! (-> rot data 9) ~12F)~%" (-> *math-camera* inv-camera-rot data 9)) + (format #t " (set! (-> rot data 10) ~12F)~%" (-> *math-camera* inv-camera-rot data 10)) + (format #t " (set! (-> rot data 11) ~12F)~%" (-> *math-camera* inv-camera-rot data 11)) + (format #t " (set! (-> rot data 12) ~12F)~%" 0) + (format #t " (set! (-> rot data 13) ~12F)~%" 0) + (format #t " (set! (-> rot data 14) ~12F)~%" 0) + (format #t " (set! (-> rot data 15) ~12F)~%" #x3f800000) + (let ((gp-0 (new 'stack-no-clear 'euler-angles))) + (matrix->eul gp-0 (-> *math-camera* inv-camera-rot) 21) + (format #t " ;; euler angles (xyz order degrees) x ~R y ~R z ~R~%" (-> gp-0 x) (-> gp-0 y) (-> gp-0 z)) + (format + #t + " ;; MAYA euler angles (xyz order degrees) x ~R y ~R z ~R~%" + (-> gp-0 x) + (- 32768.0 (-> gp-0 y)) + (-> gp-0 z) + ) + ) + (format #t " (debug-set-camera-pos-rot! pos rot)~%") + (format #t " (send-event *camera* 'set-fov (deg ~f))~%" (* 0.005493164 (-> *math-camera* fov))) + (format #t " (clear *camera-old-level*)~%") + (format #t " (format *camera-old-level* \"~A\")~%" (-> *level* level0 name)) + (let ((t9-31 format) + (a0-31 #t) + (a1-31 " (set! *camera-old-cpu* ~D)~%") + (a2-25 (-> *display* frames (-> *display* last-screen) profile-array data 0)) + ) + (t9-31 a0-31 a1-31 (- (-> a2-25 data 0 end-time) (-> a2-25 data 0 start-time))) + ) + (let ((t9-32 format) + (a0-32 #t) + (a1-32 " (set! *camera-old-vu* ~D)~%") + (a2-29 (-> *display* frames (-> *display* on-screen) profile-array data 1)) + ) + (t9-32 a0-32 a1-32 (- (-> a2-29 data 0 end-time) (-> a2-29 data 0 start-time))) + ) + (compute-memory-usage (-> *level* level0) #f) + (format #t " (set! *camera-old-tfrag-bytes* ~D)~%" (+ (-> *level* level0 mem-usage-block data 1 total) + (-> *level* level0 mem-usage-block data 2 total) + (-> *level* level0 mem-usage-block data 3 total) + (-> *level* level0 mem-usage-block data 4 total) + (-> *level* level0 mem-usage-block data 5 total) + (-> *level* level0 mem-usage-block data 6 total) + (-> *level* level0 mem-usage-block data 7 total) + (-> *level* level0 mem-usage-block data 8 total) + ) + ) + (format #t " (clear *camera-old-stat-string-tfrag*)~%") + (format #t " (clear *camera-old-stat-string-tfrag-near*)~%") + (format #t " (clear *camera-old-stat-string-total*)~%") + (when *stats-poly* + (format #t " (format *camera-old-stat-string-tfrag* \"~S\")~%" *stat-string-tfrag*) + (format #t " (format *camera-old-stat-string-tfrag-near* \"~S\")~%" *stat-string-tfrag-scissor*) + (format #t " (format *camera-old-stat-string-total* \"~S\")~%" *stat-string-total*) + ) + (format #t " (set! *display-camera-old-stats* #t)~%") + (format #t " )~%") + (format #t " )~%") + ) + (else + (format #t "camera save failed~%") + ) + ) + (none) + ) + +;; definition for function debug-menu-make-camera-mode-menu +(defun debug-menu-make-camera-mode-menu ((arg0 debug-menu) (arg1 debug-menu)) + (let ((t9-0 (method-of-type debug-menu-item-submenu new)) + (a0-1 'debug) + (a1-1 debug-menu-item-submenu) + ) + "Camera" + (t9-0 a0-1 a1-1) + ) + (let ((t9-1 (method-of-type debug-menu-item-submenu new)) + (a0-2 'debug) + (a1-2 debug-menu-item-submenu) + ) + "Mode" + (let ((a1-3 (t9-1 a0-2 a1-2))) + (debug-menu-append-item arg0 a1-3) + ) + ) + (let ((t9-3 (method-of-type debug-menu-item-flag new)) + (a0-4 'debug) + (a1-4 debug-menu-item-flag) + ) + "Default" + dm-cam-mode-default + (let ((a1-5 (t9-3 a0-4 a1-4))) + (debug-menu-append-item arg1 a1-5) + ) + ) + (let ((t9-5 (method-of-type debug-menu-item-flag new)) + (a0-6 'debug) + (a1-6 debug-menu-item-flag) + ) + "Free-floating" + cam-free-floating + dm-cam-mode-func + (let ((a1-7 (t9-5 a0-6 a1-6))) + (debug-menu-append-item arg1 a1-7) + ) + ) + (let ((t9-7 (method-of-type debug-menu-item-flag new)) + (a0-8 'debug) + (a1-8 debug-menu-item-flag) + ) + "Fixed" + cam-fixed + dm-cam-mode-func + (let ((a1-9 (t9-7 a0-8 a1-8))) + (debug-menu-append-item arg1 a1-9) + ) + ) + (let ((t9-9 (method-of-type debug-menu-item-flag new)) + (a0-10 'debug) + (a1-10 debug-menu-item-flag) + ) + "Pov" + cam-pov + dm-cam-mode-func + (let ((a1-11 (t9-9 a0-10 a1-10))) + (debug-menu-append-item arg1 a1-11) + ) + ) + (let ((t9-11 (method-of-type debug-menu-item-flag new)) + (a0-12 'debug) + (a1-12 debug-menu-item-flag) + ) + "Pov180" + cam-pov180 + dm-cam-mode-func + (let ((a1-13 (t9-11 a0-12 a1-12))) + (debug-menu-append-item arg1 a1-13) + ) + ) + (let ((t9-13 (method-of-type debug-menu-item-flag new)) + (a0-14 'debug) + (a1-14 debug-menu-item-flag) + ) + "Pov-track" + cam-pov-track + dm-cam-mode-func + (let ((a1-15 (t9-13 a0-14 a1-14))) + (debug-menu-append-item arg1 a1-15) + ) + ) + (let ((t9-15 (method-of-type debug-menu-item-flag new)) + (a0-16 'debug) + (a1-16 debug-menu-item-flag) + ) + "Decel" + cam-decel + dm-cam-mode-func + (let ((a1-17 (t9-15 a0-16 a1-16))) + (debug-menu-append-item arg1 a1-17) + ) + ) + (let ((t9-17 (method-of-type debug-menu-item-flag new)) + (a0-18 'debug) + (a1-18 debug-menu-item-flag) + ) + "Endless fall" + cam-endlessfall + dm-cam-mode-func + (let ((a1-19 (t9-17 a0-18 a1-18))) + (debug-menu-append-item arg1 a1-19) + ) + ) + (let ((t9-19 (method-of-type debug-menu-item-flag new)) + (a0-20 'debug) + (a1-20 debug-menu-item-flag) + ) + "Eye" + cam-eye + dm-cam-mode-func + (let ((a1-21 (t9-19 a0-20 a1-20))) + (debug-menu-append-item arg1 a1-21) + ) + ) + (let ((t9-21 (method-of-type debug-menu-item-flag new)) + (a0-22 'debug) + (a1-22 debug-menu-item-flag) + ) + "Stick" + cam-stick + dm-cam-mode-func + (let ((a1-23 (t9-21 a0-22 a1-22))) + (debug-menu-append-item arg1 a1-23) + ) + ) + (let ((t9-23 (method-of-type debug-menu-item-flag new)) + (a0-24 'debug) + (a1-24 debug-menu-item-flag) + ) + "String" + cam-string + dm-cam-mode-func + (let ((a1-25 (t9-23 a0-24 a1-24))) + (debug-menu-append-item arg1 a1-25) + ) + ) + (let ((t9-25 (method-of-type debug-menu-item-flag new)) + (a0-26 'debug) + (a1-26 debug-menu-item-flag) + ) + "Standoff" + cam-standoff + dm-cam-mode-func + (let ((a1-27 (t9-25 a0-26 a1-26))) + (debug-menu-append-item arg1 a1-27) + ) + ) + (let ((t9-27 (method-of-type debug-menu-item-flag new)) + (a0-28 'debug) + (a1-28 debug-menu-item-flag) + ) + "Circular" + cam-circular + dm-cam-mode-func + (let ((a1-29 (t9-27 a0-28 a1-28))) + (debug-menu-append-item arg1 a1-29) + ) + ) + (let ((t9-29 (method-of-type debug-menu-item-flag new)) + (a0-30 'debug) + (a1-30 debug-menu-item-flag) + ) + "Look At" + cam-lookat + dm-cam-mode-func + (let ((a1-31 (t9-29 a0-30 a1-30))) + (debug-menu-append-item arg1 a1-31) + ) + ) + (let ((t9-31 (method-of-type debug-menu-item-flag new)) + (a0-32 'debug) + (a1-32 debug-menu-item-flag) + ) + "Center of world" + cam-point-watch + dm-cam-mode-func + (let ((a1-33 (t9-31 a0-32 a1-32))) + (debug-menu-append-item arg1 a1-33) + ) + ) + (let ((t9-33 (method-of-type debug-menu-item-flag new)) + (a0-34 'debug) + (a1-34 debug-menu-item-flag) + ) + "Spline" + cam-spline + dm-cam-mode-func + (let ((a1-35 (t9-33 a0-34 a1-34))) + (debug-menu-append-item arg1 a1-35) + ) + ) + (let ((t9-35 (method-of-type debug-menu-item-flag new)) + (a0-36 'debug) + (a1-36 debug-menu-item-flag) + ) + "Bike" + cam-bike + dm-cam-mode-func + (let ((a1-37 (t9-35 a0-36 a1-36))) + (debug-menu-append-item arg1 a1-37) + ) + ) + (let ((t9-37 (method-of-type debug-menu-item-flag new)) + (a0-38 'debug) + (a1-38 debug-menu-item-flag) + ) + "Robotboss" + cam-robotboss + dm-cam-mode-func + (let ((a1-39 (t9-37 a0-38 a1-38))) + (debug-menu-append-item arg1 a1-39) + ) + ) + ) + +;; definition for function debug-menu-make-camera-menu +(defun debug-menu-make-camera-menu ((arg0 debug-menu-context)) + (let ((t9-0 (method-of-type debug-menu new)) + (a0-1 'debug) + (a1-0 debug-menu) + ) + "Camera menu" + (let ((gp-0 (t9-0 a0-1 a1-0)) + (t9-1 (method-of-type debug-menu-item-submenu new)) + (a0-2 'debug) + (a1-1 debug-menu-item-submenu) + ) + "Camera" + (let ((s5-0 (t9-1 a0-2 a1-1))) + (let ((t9-2 (method-of-type debug-menu new)) + (a0-3 'debug) + (a1-2 debug-menu) + ) + "Camera mode menu" + (let ((a1-3 (t9-2 a0-3 a1-2))) + (debug-menu-make-camera-mode-menu gp-0 a1-3) + ) + ) + (let ((t9-4 (method-of-type debug-menu new)) + (a0-5 'debug) + (a1-4 debug-menu) + ) + "Camera externalize menu" + (let ((s3-0 (t9-4 a0-5 a1-4))) + (let ((t9-5 (method-of-type debug-menu-item-submenu new)) + (a0-6 'debug) + (a1-5 debug-menu-item-submenu) + ) + "External" + (let ((a1-6 (t9-5 a0-6 a1-5))) + (debug-menu-append-item gp-0 a1-6) + ) + ) + (let ((t9-7 (method-of-type debug-menu-item-flag new)) + (a0-8 'debug) + (a1-7 debug-menu-item-flag) + ) + "CPad 0" + 'pad-0 + dm-cam-externalize + (let ((a1-8 (t9-7 a0-8 a1-7))) + (debug-menu-append-item s3-0 a1-8) + ) + ) + (let ((t9-9 (method-of-type debug-menu-item-flag new)) + (a0-10 'debug) + (a1-9 debug-menu-item-flag) + ) + "CPad 1" + 'pad-1 + dm-cam-externalize + (let ((a1-10 (t9-9 a0-10 a1-9))) + (debug-menu-append-item s3-0 a1-10) + ) + ) + (let ((t9-11 (method-of-type debug-menu-item-flag new)) + (a0-12 'debug) + (a1-11 debug-menu-item-flag) + ) + "Lock" + 'locked + dm-cam-externalize + (let ((a1-12 (t9-11 a0-12 a1-11))) + (debug-menu-append-item s3-0 a1-12) + ) + ) + (let ((t9-13 (method-of-type debug-menu-item-flag new)) + (a0-14 'debug) + (a1-13 debug-menu-item-flag) + ) + "Reset" + 'reset + dm-cam-externalize + (let ((a1-14 (t9-13 a0-14 a1-13))) + (debug-menu-append-item s3-0 a1-14) + ) + ) + (let ((t9-15 (method-of-type debug-menu-item-flag new)) + (a0-16 'debug) + (a1-15 debug-menu-item-flag) + ) + "Allow z rot" + 'allow-z + dm-cam-externalize + (let ((a1-16 (t9-15 a0-16 a1-15))) + (debug-menu-append-item s3-0 a1-16) + ) + ) + (let ((t9-17 (method-of-type debug-menu-item-var new)) + (a0-18 'debug) + (a1-17 debug-menu-item-var) + ) + "Fov" + 0 + 80 + (let ((s2-0 (t9-17 a0-18 a1-17))) + (debug-menu-item-var-make-float s2-0 dm-cam-render-float 1.0 #t 15.0 180.0 1) + (debug-menu-append-item s3-0 s2-0) + ) + ) + ) + ) + (let ((t9-20 (method-of-type debug-menu new)) + (a0-21 'debug) + (a1-20 debug-menu) + ) + "Camera collision menu" + (let ((s3-1 (t9-20 a0-21 a1-20))) + (let ((t9-21 (method-of-type debug-menu-item-submenu new)) + (a0-22 'debug) + (a1-21 debug-menu-item-submenu) + ) + "Collision" + (let ((a1-22 (t9-21 a0-22 a1-21))) + (debug-menu-append-item gp-0 a1-22) + ) + ) + (let ((t9-23 (method-of-type debug-menu-item-flag new)) + (a0-24 'debug) + (a1-23 debug-menu-item-flag) + ) + "Record" + '*record-cam-collide-history* + dm-boolean-toggle-pick-func + (let ((a1-24 (t9-23 a0-24 a1-23))) + (debug-menu-append-item s3-1 a1-24) + ) + ) + (let ((t9-25 (method-of-type debug-menu-item-flag new)) + (a0-26 'debug) + (a1-25 debug-menu-item-flag) + ) + "Display" + '*display-cam-collide-history* + dm-boolean-toggle-pick-func + (let ((a1-26 (t9-25 a0-26 a1-25))) + (debug-menu-append-item s3-1 a1-26) + ) + ) + ) + ) + (let ((t9-27 (method-of-type debug-menu new)) + (a0-28 'debug) + (a1-27 debug-menu) + ) + "Camera settings menu" + (let ((s4-1 (t9-27 a0-28 a1-27))) + (let ((t9-28 (method-of-type debug-menu-item-submenu new)) + (a0-29 'debug) + (a1-28 debug-menu-item-submenu) + ) + "Settings" + (let ((a1-29 (t9-28 a0-29 a1-28))) + (debug-menu-append-item gp-0 a1-29) + ) + ) + (let ((t9-30 (method-of-type debug-menu-item-flag new)) + (a0-31 'debug) + (a1-30 debug-menu-item-flag) + ) + "Default" + dm-cam-settings-default + (let ((a1-31 (t9-30 a0-31 a1-30))) + (debug-menu-append-item s4-1 a1-31) + ) + ) + (let ((t9-32 (method-of-type debug-menu-item-var new)) + (a0-33 'debug) + (a1-32 debug-menu-item-var) + ) + "Fov" + 'fov + 80 + (let ((s3-2 (t9-32 a0-33 a1-32))) + (debug-menu-item-var-make-float + s3-2 + (the-as (function int debug-menu-msg float float float) dm-cam-setting-float) + 1.0 + #t + 15.0 + 180.0 + 1 + ) + (debug-menu-append-item s4-1 s3-2) + ) + ) + (let ((t9-35 (method-of-type debug-menu-item-flag new)) + (a0-36 'debug) + (a1-35 debug-menu-item-flag) + ) + "Butt cam" + 0 + dm-cam-settings-func + (let ((a1-36 (t9-35 a0-36 a1-35))) + (debug-menu-append-item s4-1 a1-36) + ) + ) + (let ((t9-37 (method-of-type debug-menu-item-flag new)) + (a0-38 'debug) + (a1-37 debug-menu-item-flag) + ) + "Same side" + 1 + dm-cam-settings-func + (let ((a1-38 (t9-37 a0-38 a1-37))) + (debug-menu-append-item s4-1 a1-38) + ) + ) + (let ((t9-39 (method-of-type debug-menu-item-flag new)) + (a0-40 'debug) + (a1-39 debug-menu-item-flag) + ) + "Move spherical" + 2 + dm-cam-settings-func + (let ((a1-40 (t9-39 a0-40 a1-39))) + (debug-menu-append-item s4-1 a1-40) + ) + ) + (let ((t9-41 (method-of-type debug-menu-item-flag new)) + (a0-42 'debug) + (a1-41 debug-menu-item-flag) + ) + "Drag" + 3 + dm-cam-settings-func + (let ((a1-42 (t9-41 a0-42 a1-41))) + (debug-menu-append-item s4-1 a1-42) + ) + ) + (let ((t9-43 (method-of-type debug-menu-item-flag new)) + (a0-44 'debug) + (a1-43 debug-menu-item-flag) + ) + "Allow Z rot" + 4 + dm-cam-settings-func + (let ((a1-44 (t9-43 a0-44 a1-43))) + (debug-menu-append-item s4-1 a1-44) + ) + ) + (let ((t9-45 (method-of-type debug-menu-item-flag new)) + (a0-46 'debug) + (a1-45 debug-menu-item-flag) + ) + "Pitch for jump" + 6 + dm-cam-settings-func + (let ((a1-46 (t9-45 a0-46 a1-45))) + (debug-menu-append-item s4-1 a1-46) + ) + ) + (let ((t9-47 (method-of-type debug-menu-item-flag new)) + (a0-48 'debug) + (a1-47 debug-menu-item-flag) + ) + "Find hidden target" + 7 + dm-cam-settings-func + (let ((a1-48 (t9-47 a0-48 a1-47))) + (debug-menu-append-item s4-1 a1-48) + ) + ) + (let ((t9-49 (method-of-type debug-menu-item-flag new)) + (a0-50 'debug) + (a1-49 debug-menu-item-flag) + ) + "Collide" + 8 + dm-cam-settings-func + (let ((a1-50 (t9-49 a0-50 a1-49))) + (debug-menu-append-item s4-1 a1-50) + ) + ) + (let ((t9-51 (method-of-type debug-menu-item-flag new)) + (a0-52 'debug) + (a1-51 debug-menu-item-flag) + ) + "Line of Sight" + 9 + dm-cam-settings-func + (let ((a1-52 (t9-51 a0-52 a1-51))) + (debug-menu-append-item s4-1 a1-52) + ) + ) + (let ((t9-53 (method-of-type debug-menu-item-flag new)) + (a0-54 'debug) + (a1-53 debug-menu-item-flag) + ) + "No Rotate" + 10 + dm-cam-settings-func + (let ((a1-54 (t9-53 a0-54 a1-53))) + (debug-menu-append-item s4-1 a1-54) + ) + ) + (let ((t9-55 (method-of-type debug-menu-item-flag new)) + (a0-56 'debug) + (a1-55 debug-menu-item-flag) + ) + "Sticky Angle" + 11 + dm-cam-settings-func + (let ((a1-56 (t9-55 a0-56 a1-55))) + (debug-menu-append-item s4-1 a1-56) + ) + ) + (let ((t9-57 (method-of-type debug-menu-item-var new)) + (a0-58 'debug) + (a1-57 debug-menu-item-var) + ) + "Interp Frms" + 40 + 80 + (let ((s3-3 (t9-57 a0-58 a1-57))) + (debug-menu-item-var-make-int s3-3 dm-cam-settings-func-int 1 #f 0 0 #f) + (debug-menu-append-item s4-1 s3-3) + ) + ) + (let ((t9-60 (method-of-type debug-menu-item-flag new)) + (a0-61 'debug) + (a1-60 debug-menu-item-flag) + ) + "no mip/lod correction" + '*camera-no-mip-correction* + dm-boolean-toggle-pick-func + (let ((a1-61 (t9-60 a0-61 a1-60))) + (debug-menu-append-item s4-1 a1-61) + ) + ) + (let ((t9-62 (method-of-type debug-menu-item-flag new)) + (a0-63 'debug) + (a1-62 debug-menu-item-flag) + ) + "last attacker" + '*display-camera-last-attacker* + dm-boolean-toggle-pick-func + (let ((a1-63 (t9-62 a0-63 a1-62))) + (debug-menu-append-item s4-1 a1-63) + ) + ) + (let ((t9-64 (method-of-type debug-menu-item-flag new)) + (a0-65 'debug) + (a1-64 debug-menu-item-flag) + ) + "old stats" + '*display-camera-old-stats* + dm-boolean-toggle-pick-func + (let ((a1-65 (t9-64 a0-65 a1-64))) + (debug-menu-append-item s4-1 a1-65) + ) + ) + (let ((t9-66 (method-of-type debug-menu-item-flag new)) + (a0-67 'debug) + (a1-66 debug-menu-item-flag) + ) + "xyz axes" + '*display-xyz-axes* + dm-boolean-toggle-pick-func + (let ((a1-67 (t9-66 a0-67 a1-66))) + (debug-menu-append-item s4-1 a1-67) + ) + ) + (let ((t9-68 (method-of-type debug-menu-item-flag new)) + (a0-69 'debug) + (a1-68 debug-menu-item-flag) + ) + "Master Marks" + '*display-cam-master-marks* + dm-boolean-toggle-pick-func + (let ((a1-69 (t9-68 a0-69 a1-68))) + (debug-menu-append-item s4-1 a1-69) + ) + ) + (let ((t9-70 (method-of-type debug-menu-item-flag new)) + (a0-71 'debug) + (a1-70 debug-menu-item-flag) + ) + "Other Marks" + '*display-cam-other* + dm-boolean-toggle-pick-func + (let ((a1-71 (t9-70 a0-71 a1-70))) + (debug-menu-append-item s4-1 a1-71) + ) + ) + (let ((t9-72 (method-of-type debug-menu-item-flag new)) + (a0-73 'debug) + (a1-72 debug-menu-item-flag) + ) + "los debug" + '*display-cam-los-debug* + dm-boolean-toggle-pick-func + (let ((a1-73 (t9-72 a0-73 a1-72))) + (debug-menu-append-item s4-1 a1-73) + ) + ) + (let ((t9-74 (method-of-type debug-menu-item-flag new)) + (a0-75 'debug) + (a1-74 debug-menu-item-flag) + ) + "los info" + '*display-cam-los-info* + dm-boolean-toggle-pick-func + (let ((a1-75 (t9-74 a0-75 a1-74))) + (debug-menu-append-item s4-1 a1-75) + ) + ) + (let ((t9-76 (method-of-type debug-menu-item-flag new)) + (a0-77 'debug) + (a1-76 debug-menu-item-flag) + ) + "los Marks" + '*display-cam-los-marks* + dm-boolean-toggle-pick-func + (let ((a1-77 (t9-76 a0-77 a1-76))) + (debug-menu-append-item s4-1 a1-77) + ) + ) + (let ((t9-78 (method-of-type debug-menu-item-flag new)) + (a0-79 'debug) + (a1-78 debug-menu-item-flag) + ) + "coll Marks" + '*display-cam-coll-marks* + dm-boolean-toggle-pick-func + (let ((a1-79 (t9-78 a0-79 a1-78))) + (debug-menu-append-item s4-1 a1-79) + ) + ) + (let ((t9-80 (method-of-type debug-menu-item-flag new)) + (a0-81 'debug) + (a1-80 debug-menu-item-flag) + ) + "Camera Marks" + '*display-camera-marks* + dm-boolean-toggle-pick-func + (let ((a1-81 (t9-80 a0-81 a1-80))) + (debug-menu-append-item s4-1 a1-81) + ) + ) + ) + ) + (let ((t9-82 (method-of-type debug-menu-item-flag new)) + (a0-83 'debug) + (a1-82 debug-menu-item-flag) + ) + "Edit" + '*cam-layout* + L753 + (let ((a1-83 (t9-82 a0-83 a1-82))) + (debug-menu-append-item gp-0 a1-83) + ) + ) + (let ((t9-84 (method-of-type debug-menu-item-function new)) + (a0-85 'debug) + (a1-84 debug-menu-item-function) + ) + "Save Pos" + debug-create-cam-restore + (let ((a1-85 (t9-84 a0-85 a1-84))) + (debug-menu-append-item gp-0 a1-85) + ) + ) + s5-0 + ) + ) + ) + ) + +;; definition for function debug-menu-make-shader-menu +(defun debug-menu-make-shader-menu ((arg0 debug-menu-context)) + (let ((t9-0 (method-of-type debug-menu new)) + (a0-1 'debug) + (a1-0 debug-menu) + ) + "Shader menu" + (let ((gp-0 (t9-0 a0-1 a1-0)) + (t9-1 (method-of-type debug-menu-item-submenu new)) + (a0-2 'debug) + (a1-1 debug-menu-item-submenu) + ) + "Shader" + (let ((s5-0 (t9-1 a0-2 a1-1))) + (let ((t9-2 (method-of-type debug-menu new)) + (a0-3 'debug) + (a1-2 debug-menu) + ) + "Shader pick menu" + (set! *shader-pick-menu* (t9-2 a0-3 a1-2)) + ) + (let ((t9-3 (method-of-type debug-menu-item-submenu new)) + (a0-4 'debug) + (a1-3 debug-menu-item-submenu) + ) + "Pick Shader" + (let ((a1-4 (t9-3 a0-4 a1-3))) + (debug-menu-append-item gp-0 a1-4) + ) + ) + (let ((t9-5 (method-of-type debug-menu-item-function new)) + (a0-6 'debug) + (a1-5 debug-menu-item-function) + ) + "Refresh" + build-shader-list + (let ((a1-6 (t9-5 a0-6 a1-5))) + (debug-menu-append-item gp-0 a1-6) + ) + ) + (let ((t9-7 (method-of-type debug-menu-item-var new)) + (a0-8 'debug) + (a1-7 debug-menu-item-var) + ) + "tweak" + '*edit-shader* + 80 + (let ((s4-1 (t9-7 a0-8 a1-7))) + (debug-menu-item-var-make-float + s4-1 + (the-as + (function int debug-menu-msg float float float) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (cond + (*texture-page-dir* + (let* ((s4-0 (the-as texture-id (-> arg0 value))) + (gp-0 (lookup-texture-by-id s4-0)) + (v1-3 (-> *texture-page-dir* entries (-> s4-0 page) link)) + ) + (cond + ((and gp-0 v1-3) + (when (= arg1 (debug-menu-msg press)) + (set! (-> gp-0 uv-dist) arg2) + (let ((s5-1 (the-as object (* (-> v1-3 next (-> s4-0 index) shader) 16)))) + (while (nonzero? (the-as uint s5-1)) + (adgif-shader-update! (the-as adgif-shader s5-1) gp-0) + (set! s5-1 (* (-> (the-as adgif-shader s5-1) next shader) 16)) + ) + ) + ) + (-> gp-0 uv-dist) + ) + (else + (empty) + arg3 + ) + ) + ) + ) + (else + (empty) + arg3 + ) + ) + ) + ) + 0.1 + #t + 0.1 + 30.0 + 1 + ) + (debug-menu-append-item gp-0 s4-1) + ) + ) + (let ((t9-10 (method-of-type debug-menu-item-function new)) + (a0-11 'debug) + (a1-10 debug-menu-item-function) + ) + "all tweak+" + L744 + (let ((a1-11 (t9-10 a0-11 a1-10))) + (debug-menu-append-item gp-0 a1-11) + ) + ) + (let ((t9-12 (method-of-type debug-menu-item-function new)) + (a0-13 'debug) + (a1-12 debug-menu-item-function) + ) + "all tweak-" + L743 + (let ((a1-13 (t9-12 a0-13 a1-12))) + (debug-menu-append-item gp-0 a1-13) + ) + ) + (let ((t9-14 (method-of-type debug-menu-item-var new)) + (a0-15 'debug) + (a1-14 debug-menu-item-var) + ) + "l" + '*edit-shader* + 80 + (let ((s4-2 (t9-14 a0-15 a1-14))) + (debug-menu-item-var-make-int + s4-2 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex1 l) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) tex1 l) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 3 + #f + ) + (debug-menu-append-item gp-0 s4-2) + ) + ) + (let ((t9-17 (method-of-type debug-menu-item-var new)) + (a0-18 'debug) + (a1-17 debug-menu-item-var) + ) + "k" + '*edit-shader* + 80 + (let ((s4-3 (t9-17 a0-18 a1-17))) + (debug-menu-item-var-make-int + s4-3 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as + float + (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) + (while (nonzero? (the-as int a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex1) + (logior (logand (-> (the-as adgif-shader a1-8) tex1) (-> (new 'static 'array uint64 1 #xfffff000ffffffff) 0)) + (shr (shl (the-as int arg2) 52) 20) + ) + ) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (sar (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) tex1))) 20) 52) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + -2048 + 2047 + #f + ) + (debug-menu-append-item gp-0 s4-3) + ) + ) + (let ((t9-20 (method-of-type debug-menu-item-var new)) + (a0-21 'debug) + (a1-20 debug-menu-item-var) + ) + "mmin" + '*edit-shader* + 80 + (let ((s4-4 (t9-20 a0-21 a1-20))) + (debug-menu-item-var-make-int + s4-4 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex1 mmin) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) tex1 mmin) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 5 + #t + ) + (debug-menu-append-item gp-0 s4-4) + ) + ) + (let ((t9-23 (method-of-type debug-menu-item-var new)) + (a0-24 'debug) + (a1-23 debug-menu-item-var) + ) + "mmag" + '*edit-shader* + 80 + (let ((s4-5 (t9-23 a0-24 a1-23))) + (debug-menu-item-var-make-int + s4-5 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex1 mmag) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) tex1 mmag) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 1 + #t + ) + (debug-menu-append-item gp-0 s4-5) + ) + ) + (let ((t9-26 (method-of-type debug-menu-item-var new)) + (a0-27 'debug) + (a1-26 debug-menu-item-var) + ) + "lcm" + '*edit-shader* + 80 + (let ((s4-6 (t9-26 a0-27 a1-26))) + (debug-menu-item-var-make-int + s4-6 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex1 lcm) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) tex1 lcm) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 1 + #t + ) + (debug-menu-append-item gp-0 s4-6) + ) + ) + (let ((t9-29 (method-of-type debug-menu-item-var new)) + (a0-30 'debug) + (a1-29 debug-menu-item-var) + ) + "tfx" + '*edit-shader* + 80 + (let ((s4-7 (t9-29 a0-30 a1-29))) + (debug-menu-item-var-make-int + s4-7 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as + float + (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) + (while (nonzero? (the-as int a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex0) + (logior (logand (-> (the-as adgif-shader a1-8) tex0) (-> (new 'static 'array uint64 1 #xffffffe7ffffffff) 0)) + (shr (shl (the-as int arg2) 62) 27) + ) + ) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (shr (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) tex0))) 27) 62) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 3 + #t + ) + (debug-menu-append-item gp-0 s4-7) + ) + ) + (let ((t9-32 (method-of-type debug-menu-item-var new)) + (a0-33 'debug) + (a1-32 debug-menu-item-var) + ) + "tbp" + '*edit-shader* + 80 + (let ((s4-8 (t9-32 a0-33 a1-32))) + (debug-menu-item-var-make-int + s4-8 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex0 tbp0) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) tex0 tbp0) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + #x4000 + #t + ) + (debug-menu-append-item gp-0 s4-8) + ) + ) + (let ((t9-35 (method-of-type debug-menu-item-var new)) + (a0-36 'debug) + (a1-35 debug-menu-item-var) + ) + "tbw" + '*edit-shader* + 80 + (let ((s4-9 (t9-35 a0-36 a1-35))) + (debug-menu-item-var-make-int + s4-9 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex0 tbw) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) tex0 tbw) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 15 + #t + ) + (debug-menu-append-item gp-0 s4-9) + ) + ) + (let ((t9-38 (method-of-type debug-menu-item-var new)) + (a0-39 'debug) + (a1-38 debug-menu-item-var) + ) + "tw" + '*edit-shader* + 80 + (let ((s4-10 (t9-38 a0-39 a1-38))) + (debug-menu-item-var-make-int + s4-10 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex0 tw) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) tex0 tw) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 10 + #t + ) + (debug-menu-append-item gp-0 s4-10) + ) + ) + (let ((t9-41 (method-of-type debug-menu-item-var new)) + (a0-42 'debug) + (a1-41 debug-menu-item-var) + ) + "th" + '*edit-shader* + 80 + (let ((s4-11 (t9-41 a0-42 a1-41))) + (debug-menu-item-var-make-int + s4-11 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as + float + (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) + (while (nonzero? (the-as int a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex0) + (logior (logand (-> (the-as adgif-shader a1-8) tex0) (-> (new 'static 'array uint64 1 #xfffffffc3fffffff) 0)) + (shr (shl (the-as int arg2) 60) 30) + ) + ) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (shr (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) tex0))) 30) 60) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 10 + #t + ) + (debug-menu-append-item gp-0 s4-11) + ) + ) + (let ((t9-44 (method-of-type debug-menu-item-var new)) + (a0-45 'debug) + (a1-44 debug-menu-item-var) + ) + "mxl" + '*edit-shader* + 80 + (let ((s4-12 (t9-44 a0-45 a1-44))) + (debug-menu-item-var-make-int + s4-12 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) tex1 mxl) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) tex1 mxl) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 6 + #t + ) + (debug-menu-append-item gp-0 s4-12) + ) + ) + (let ((t9-47 (method-of-type debug-menu-item-var new)) + (a0-48 'debug) + (a1-47 debug-menu-item-var) + ) + "wms" + '*edit-shader* + 80 + (let ((s4-13 (t9-47 a0-48 a1-47))) + (debug-menu-item-var-make-int + s4-13 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) clamp wms) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) clamp wms) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 3 + #t + ) + (debug-menu-append-item gp-0 s4-13) + ) + ) + (let ((t9-50 (method-of-type debug-menu-item-var new)) + (a0-51 'debug) + (a1-50 debug-menu-item-var) + ) + "wmt" + '*edit-shader* + 80 + (let ((s4-14 (t9-50 a0-51 a1-50))) + (debug-menu-item-var-make-int + s4-14 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) clamp wmt) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) clamp wmt) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 3 + #t + ) + (debug-menu-append-item gp-0 s4-14) + ) + ) + (let ((t9-53 (method-of-type debug-menu-item-var new)) + (a0-54 'debug) + (a1-53 debug-menu-item-var) + ) + "minu" + '*edit-shader* + 80 + (let ((s4-15 (t9-53 a0-54 a1-53))) + (debug-menu-item-var-make-int + s4-15 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) clamp minu) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) clamp minu) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 511 + #t + ) + (debug-menu-append-item gp-0 s4-15) + ) + ) + (let ((t9-56 (method-of-type debug-menu-item-var new)) + (a0-57 'debug) + (a1-56 debug-menu-item-var) + ) + "maxu" + '*edit-shader* + 80 + (let ((s4-16 (t9-56 a0-57 a1-56))) + (debug-menu-item-var-make-int + s4-16 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as float (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (while (nonzero? (the-as uint a1-8)) + (set! (-> (the-as adgif-shader a1-8) clamp maxu) (the-as int arg2)) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (-> (the-as adgif-shader v1-8) clamp maxu) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 511 + #t + ) + (debug-menu-append-item gp-0 s4-16) + ) + ) + (let ((t9-59 (method-of-type debug-menu-item-var new)) + (a0-60 'debug) + (a1-59 debug-menu-item-var) + ) + "minv" + '*edit-shader* + 80 + (let ((s4-17 (t9-59 a0-60 a1-59))) + (debug-menu-item-var-make-int + s4-17 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as + float + (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) + (while (nonzero? (the-as int a1-8)) + (set! (-> (the-as adgif-shader a1-8) clamp) + (logior (logand (-> (the-as adgif-shader a1-8) clamp) (-> (new 'static 'array uint64 1 #xfffffffc00ffffff) 0)) + (shr (shl (the-as int arg2) 54) 30) + ) + ) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (shr (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) clamp))) 30) 54) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 511 + #t + ) + (debug-menu-append-item gp-0 s4-17) + ) + ) + (let ((t9-62 (method-of-type debug-menu-item-var new)) + (a0-63 'debug) + (a1-62 debug-menu-item-var) + ) + "maxv" + '*edit-shader* + 80 + (let ((s4-18 (t9-62 a0-63 a1-62))) + (debug-menu-item-var-make-int + s4-18 + (the-as + (function int debug-menu-msg int int int) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (the-as + float + (cond + (*texture-page-dir* + (let* ((v1-1 (the-as texture-id (-> arg0 value))) + (a0-3 (-> *texture-page-dir* entries (-> v1-1 page) link)) + ) + (cond + (a0-3 + (when (= arg1 (debug-menu-msg press)) + (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) + (while (nonzero? (the-as int a1-8)) + (set! (-> (the-as adgif-shader a1-8) clamp) + (logior (logand (-> (the-as adgif-shader a1-8) clamp) (-> (new 'static 'array uint64 1 #xfffff003ffffffff) 0)) + (shr (shl (the-as int arg2) 54) 20) + ) + ) + (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) + ) + ) + ) + (let ((v1-8 (the-as object (* (-> a0-3 next (-> v1-1 index) shader) 16)))) + (if (nonzero? (the-as uint v1-8)) + (shr (shl (the-as int (the-as adgif-shader (-> (the-as adgif-shader v1-8) clamp))) 20) 54) + arg3 + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + (else + arg3 + ) + ) + ) + ) + ) + 1 + #t + 0 + 511 + #t + ) + (debug-menu-append-item gp-0 s4-18) + ) + ) + s5-0 + ) + ) + ) + ) + +;; definition for function debug-menu-make-instance-menu +(defun debug-menu-make-instance-menu ((arg0 debug-menu-context)) + (let ((t9-0 (method-of-type debug-menu new)) + (a0-1 'debug) + (a1-0 debug-menu) + ) + "Instance menu" + (let ((gp-0 (t9-0 a0-1 a1-0)) + (t9-1 (method-of-type debug-menu-item-submenu new)) + (a0-2 'debug) + (a1-1 debug-menu-item-submenu) + ) + "Instance" + (let ((s5-0 (t9-1 a0-2 a1-1))) + (let ((t9-2 (method-of-type debug-menu new)) + (a0-3 'debug) + (a1-2 debug-menu) + ) + "Instance shrub menu" + (set! *instance-shrub-menu* (t9-2 a0-3 a1-2)) + ) + (let ((t9-3 (method-of-type debug-menu-item-submenu new)) + (a0-4 'debug) + (a1-3 debug-menu-item-submenu) + ) + "Pick Shrub" + (let ((a1-4 (t9-3 a0-4 a1-3))) + (debug-menu-append-item gp-0 a1-4) + ) + ) + (let ((t9-5 (method-of-type debug-menu new)) + (a0-6 'debug) + (a1-5 debug-menu) + ) + "Instance tie menu" + (set! *instance-tie-menu* (t9-5 a0-6 a1-5)) + ) + (let ((t9-6 (method-of-type debug-menu-item-submenu new)) + (a0-7 'debug) + (a1-6 debug-menu-item-submenu) + ) + "Pick Tie" + (let ((a1-7 (t9-6 a0-7 a1-6))) + (debug-menu-append-item gp-0 a1-7) + ) + ) + (let ((t9-8 (method-of-type debug-menu-item-function new)) + (a0-9 'debug) + (a1-8 debug-menu-item-function) + ) + "Refresh" + build-instance-list + (let ((a1-9 (t9-8 a0-9 a1-8))) + (debug-menu-append-item gp-0 a1-9) + ) + ) + (let ((t9-10 (method-of-type debug-menu-item-function new)) + (a0-11 'debug) + (a1-10 debug-menu-item-function) + ) + "Print Info" + print-prototype-list + (let ((a1-11 (t9-10 a0-11 a1-10))) + (debug-menu-append-item gp-0 a1-11) + ) + ) + (let ((t9-12 (method-of-type debug-menu-item-var new)) + (a0-13 'debug) + (a1-12 debug-menu-item-var) + ) + "near" + '*edit-instance* + 80 + (let ((s3-0 (t9-12 a0-13 a1-12))) + (debug-menu-item-var-make-float + s3-0 + (the-as + (function int debug-menu-msg float float float) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (let ((gp-0 (find-instance-by-name (the-as string (-> arg0 value))))) + (cond + (gp-0 + (when (= arg1 (debug-menu-msg press)) + (set! (-> gp-0 dists x) (* 4096.0 arg2)) + (prototype-bucket-recalc-fields gp-0) + ) + (* 0.00024414062 (-> gp-0 dists x)) + ) + (else + (empty) + arg3 + ) + ) + ) + ) + ) + 1.0 + #t + 10.0 + 250.0 + 1 + ) + (debug-menu-append-item gp-0 s3-0) + ) + ) + (let ((t9-15 (method-of-type debug-menu-item-var new)) + (a0-16 'debug) + (a1-15 debug-menu-item-var) + ) + "far" + '*edit-instance* + 80 + (let ((s3-1 (t9-15 a0-16 a1-15))) + (debug-menu-item-var-make-float + s3-1 + (the-as + (function int debug-menu-msg float float float) + (lambda ((arg0 symbol) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (let ((gp-0 (find-instance-by-name (the-as string (-> arg0 value))))) + (cond + (gp-0 + (when (= arg1 (debug-menu-msg press)) + (set! (-> gp-0 dists w) (* 4096.0 arg2)) + (prototype-bucket-recalc-fields gp-0) + ) + (* 0.00024414062 (-> gp-0 dists w)) + ) + (else + (empty) + arg3 + ) + ) + ) + ) + ) + 1.0 + #t + 10.0 + 250.0 + 1 + ) + (debug-menu-append-item gp-0 s3-1) + ) + ) + (let ((t9-18 (method-of-type debug-menu-item-var new)) + (a0-19 'debug) + (a1-18 debug-menu-item-var) + ) + "tie vanish near" + '*edit-instance* + 80 + (let ((s3-2 (t9-18 a0-19 a1-18))) + (debug-menu-item-var-make-float + s3-2 + (the-as (function int debug-menu-msg float float float) dm-float-field-tie-rvanish-func) + 1.0 + #t + 10.0 + 250.0 + 1 + ) + (debug-menu-append-item gp-0 s3-2) + ) + ) + (let ((t9-21 (method-of-type debug-menu-item-var new)) + (a0-22 'debug) + (a1-21 debug-menu-item-var) + ) + "tie vanish far" + '*edit-instance* + 80 + (let ((s3-3 (t9-21 a0-22 a1-21))) + (debug-menu-item-var-make-float + s3-3 + (the-as (function int debug-menu-msg float float float) dm-float-field-tie-vanish-far-func) + 1.0 + #t + 10.0 + 250.0 + 1 + ) + (debug-menu-append-item gp-0 s3-3) + ) + ) + (let ((t9-24 (method-of-type debug-menu-item-flag new)) + (a0-25 'debug) + (a1-24 debug-menu-item-flag) + ) + "invisible" + 1 + dm-edit-instance-toggle-pick-func + (let ((a1-25 (t9-24 a0-25 a1-24))) + (debug-menu-append-item gp-0 a1-25) + ) + ) + (let ((t9-26 (method-of-type debug-menu new)) + (a0-27 'debug) + (a1-26 debug-menu) + ) + "Enable Instance Shrub Menu" + (set! *enable-instance-shrub-menu* (t9-26 a0-27 a1-26)) + ) + (let ((t9-27 (method-of-type debug-menu-item-submenu new)) + (a0-28 'debug) + (a1-27 debug-menu-item-submenu) + ) + "Enable Shrub" + (let ((a1-28 (t9-27 a0-28 a1-27))) + (debug-menu-append-item gp-0 a1-28) + ) + ) + (let ((t9-29 (method-of-type debug-menu new)) + (a0-30 'debug) + (a1-29 debug-menu) + ) + "Enable Instance Tie Menu" + (set! *enable-instance-tie-menu* (t9-29 a0-30 a1-29)) + ) + (let ((t9-30 (method-of-type debug-menu-item-submenu new)) + (a0-31 'debug) + (a1-30 debug-menu-item-submenu) + ) + "Enable Tie" + (let ((a1-31 (t9-30 a0-31 a1-30))) + (debug-menu-append-item gp-0 a1-31) + ) + ) + (let ((t9-32 (method-of-type debug-menu-item-flag new)) + (a0-33 'debug) + (a1-32 debug-menu-item-flag) + ) + "Instance Info" + '*display-instance-info* + dm-boolean-toggle-pick-func + (let ((a1-33 (t9-32 a0-33 a1-32))) + (debug-menu-append-item gp-0 a1-33) + ) + ) + s5-0 + ) + ) + ) + ) + +;; definition for function dm-task-menu-pick-func +(defun dm-task-menu-pick-func ((arg0 game-task) (arg1 debug-menu-msg)) + (let ((gp-0 (/ (the-as int arg0) 8))) + (when (= arg1 (debug-menu-msg press)) + (if (cpad-hold? 0 l1) + (task-node-open! (the-as game-task gp-0)) + (task-node-close! (the-as game-task gp-0)) + ) + ) + (if (and (not (task-node-closed? (the-as game-task gp-0))) (not (task-node-open? (the-as game-task gp-0)))) + (return 'invalid) + ) + (task-node-closed? (the-as game-task gp-0)) + ) + ) + +;; definition for function debug-menu-make-continue-sub-menu +;; INFO: Used lq/sq +(defun debug-menu-make-continue-sub-menu ((arg0 debug-menu-context) (arg1 symbol)) + (local-vars + (sv-16 (function symbol type object object pair)) + (sv-32 symbol) + (sv-48 type) + (sv-64 symbol) + (sv-80 (function symbol type object object pair)) + (sv-96 symbol) + (sv-112 type) + (sv-128 string) + (sv-144 (function symbol type object object pair)) + (sv-160 symbol) + (sv-176 type) + (sv-192 string) + ) + (let ((s4-0 *level-load-list*) + (s5-0 '()) + ) + (while (not (null? s4-0)) + (let ((v1-1 (-> (the-as symbol (car s4-0)) value))) + (when (or (= arg1 'test) (= (-> (the-as level-load-info v1-1) taskname) arg1)) + (let ((s3-0 (-> (the-as level-load-info v1-1) continues))) + (while (not (null? s3-0)) + (let ((v1-2 (car s3-0)) + (a0-5 arg1) + ) + (when (if (= a0-5 'test) + (logtest? (continue-flags cf17) (-> (the-as continue-point v1-2) flags)) + #t + ) + (let ((s2-0 (method-of-type pair new)) + (s1-0 'global) + (s0-0 pair) + ) + (set! sv-16 (method-of-type pair new)) + (set! sv-32 'global) + (set! sv-48 pair) + (set! sv-64 'flag) + (set! sv-80 (method-of-type pair new)) + (set! sv-96 'global) + (set! sv-112 pair) + (set! sv-128 (-> (the-as continue-point v1-2) name)) + (set! sv-144 (method-of-type pair new)) + (set! sv-160 'global) + (set! sv-176 pair) + (set! sv-192 (-> (the-as continue-point v1-2) name)) + (let* ((a3-1 (cons 'dm-current-continue '())) + (a3-2 (sv-144 sv-160 sv-176 sv-192 a3-1)) + (a3-3 (sv-80 sv-96 sv-112 sv-128 a3-2)) + ) + (set! s5-0 (s2-0 s1-0 s0-0 (sv-16 sv-32 sv-48 sv-64 a3-3) s5-0)) + ) + ) + ) + ) + (set! s3-0 (cdr s3-0)) + ) + ) + ) + ) + (set! s4-0 (cdr s4-0)) + ) + (let ((a3-5 '())) + (let ((a2-6 (car s5-0))) + (while (not (null? s5-0)) + (set! a3-5 (cons a2-6 a3-5)) + (set! s5-0 (cdr s5-0)) + (set! a2-6 (car s5-0)) + ) + ) + (cons 'menu (cons (symbol->string arg1) a3-5)) + ) + ) + ) + +;; definition for function debug-menu-make-task-sub-menu +;; INFO: Used lq/sq +;; ERROR: failed type prop at 11: Could not figure out load: (set! a0 (l.wu v1)) +;; INFO: Return type mismatch pair vs debug-menu-node. +(defun debug-menu-make-task-sub-menu ((a0-0 debug-menu-context)) + (local-vars + (v0-0 none) + (v0-1 none) + (v0-2 none) + (v0-3 none) + (v0-4 none) + (v0-5 pair) + (v0-6 pair) + (v1-0 game-info) + (v1-2 int) + (v1-3 int) + (v1-4 uint) + (v1-5 none) + (v1-6 none) + (v1-7 none) + (v1-8 none) + (v1-9 none) + (v1-10 none) + (v1-11 none) + (v1-14 type) + (v1-15 type) + (v1-16 int) + (v1-17 int) + (a0-1 none) + (a0-3 none) + (a0-4 none) + (a0-5 none) + (a0-6 none) + (a0-7 none) + (a0-8 none) + (a0-9 none) + (a0-10 none) + (a0-11 none) + (a0-12 none) + (a0-13 none) + (a0-14 none) + (a0-15 none) + (a0-16 none) + (a0-19 symbol) + (a0-20 symbol) + (a1-0 none) + (a1-1 none) + (a1-2 none) + (a1-3 none) + (a1-5 type) + (a1-6 type) + (a2-0 none) + (a2-1 none) + (a2-2 none) + (a2-3 none) + (a2-5 uint) + (a2-6 symbol) + (a3-0 none) + (a3-5 pair) + (a3-6 pair) + (s0-0 none) + (s1-0 none) + (s1-1 symbol) + (s2-0 none) + (s2-1 type) + (s3-0 int) + (s3-1 symbol) + (s4-0 array) + (s4-1 (function symbol type object object pair)) + (t9-0 none) + (t9-1 none) + (t9-2 none) + (t9-3 none) + (t9-4 none) + (t9-5 (function symbol type object object pair)) + (t9-6 (function symbol type object object pair)) + (gp-0 pair) + (sv-16 none) + (sv-32 none) + (sv-48 none) + (sv-64 none) + (sv-80 none) + (sv-96 none) + (sv-112 none) + (sv-128 none) + (sv-144 none) + (sv-160 none) + (sv-176 none) + (sv-192 none) + ) + "TODO - need to know more about game-info" + (set! gp-0 '()) + (set! v1-0 *game-info*) + (set! s4-0 (-> v1-0 unknown-pad4)) + (set! s3-0 (-> s4-0 length)) + (while (nonzero? s3-0) + (when (begin (set! s3-0 (+ s3-0 -1)) (nonzero? s3-0)) + (when (begin + (set! v1-2 (sll s3-0 2)) + (set! v1-3 (+ v1-2 s4-0)) + (set! v1-4 (l.wu (+ v1-3 12))) + (set! a0-1 (the-as none (l.wu v1-4))) + (= a0-1 a0-0) + ) + (set! a0-3 (the-as none pair)) + (set! s2-0 (the-as none (l.wu (+ a0-3 16)))) + (set! s1-0 (the-as none 'global)) + (set! s0-0 (the-as none pair)) + (set! a0-4 (the-as none pair)) + (set! a0-5 (the-as none (l.wu (+ a0-4 16)))) + (set! sv-16 a0-5) + (set! a0-6 (the-as none 'global)) + (set! sv-32 a0-6) + (set! a0-7 (the-as none pair)) + (set! sv-48 a0-7) + (set! a0-8 (the-as none 'flag)) + (set! sv-64 a0-8) + (set! a0-9 (the-as none pair)) + (set! a0-10 (the-as none (l.wu (+ a0-9 16)))) + (set! sv-80 a0-10) + (set! a0-11 (the-as none 'global)) + (set! sv-96 a0-11) + (set! a0-12 (the-as none pair)) + (set! sv-112 a0-12) + (set! v1-5 (the-as none (l.wu (+ v1-4 8)))) + (set! sv-128 v1-5) + (set! v1-6 (the-as none pair)) + (set! v1-7 (the-as none (l.wu (+ v1-6 16)))) + (set! sv-144 v1-7) + (set! v1-8 (the-as none 'global)) + (set! sv-160 v1-8) + (set! v1-9 (the-as none pair)) + (set! sv-176 v1-9) + (set! v1-10 (the-as none (sll s3-0 3))) + (set! sv-192 v1-10) + (set! v1-11 (the-as none pair)) + (set! t9-0 (the-as none (l.wu (+ v1-11 16)))) + (set! a0-13 (the-as none 'global)) + (set! a1-0 (the-as none pair)) + (set! a2-0 (the-as none 'dm-task-menu-pick-func)) + (set! a3-0 (the-as none '())) + (call!) + (set! a3-1 (the-as none v0-0)) + (set! t9-1 sv-144) + (set! a0-14 sv-160) + (set! a1-1 sv-176) + (set! a2-1 sv-192) + (call!) + (set! a3-2 (the-as none v0-1)) + (set! t9-2 sv-80) + (set! a0-15 sv-96) + (set! a1-2 sv-112) + (set! a2-2 sv-128) + (call!) + (set! a3-3 (the-as none v0-2)) + (set! t9-3 sv-16) + (set! a0-16 sv-32) + (set! a1-3 sv-48) + (set! a2-3 sv-64) + (call!) + (set! a2-4 (the-as none v0-3)) + (set! t9-4 (the-as none s2-0)) + (set! a0-17 (the-as none s1-0)) + (set! a1-4 (the-as none s0-0)) + (set! a3-4 (the-as none gp-0)) + (set! v0-4 (the-as none (call!))) + (set! gp-0 (the-as pair v0-4)) + (set! a0-18 (the-as none gp-0)) + ) + ) + ) + (set! v1-14 pair) + (set! s4-1 (method-of-type v1-14 new)) + (set! s3-1 'global) + (set! s2-1 pair) + (set! s1-1 'menu) + (set! v1-15 pair) + (set! t9-5 (method-of-type v1-15 new)) + (set! a0-19 'global) + (set! a1-5 pair) + (set! v1-16 #xff37) + (set! v1-17 (+ v1-16 a0-0)) + (set! a2-5 (-> (the-as (pointer uint32) v1-17))) + (set! a3-5 gp-0) + (set! v0-5 (call! a0-19 a1-5 a2-5 a3-5)) + (set! a3-6 v0-5) + (set! t9-6 s4-1) + (set! a0-20 s3-1) + (set! a1-6 s2-1) + (set! a2-6 s1-1) + (set! v0-6 (call! a0-20 a1-6 a2-6 a3-6)) + (ret-value v0-6) + ) + +;; definition for function debug-menu-make-task-menu +;; INFO: Used lq/sq +(defun debug-menu-make-task-menu ((arg0 debug-menu-context)) + (local-vars (sv-16 debug-menu-context)) + (let ((t9-0 (method-of-type debug-menu new)) + (a0-1 'debug) + (a1-0 debug-menu) + ) + "Task menu" + (let ((s5-0 (t9-0 a0-1 a1-0)) + (t9-1 (method-of-type debug-menu-item-submenu new)) + (a0-2 'debug) + (a1-1 debug-menu-item-submenu) + ) + "Task" + (let ((s4-0 (t9-1 a0-2 a1-1))) + (let* ((s3-0 '(city + fortress + stadium + palace + castle + ruins + atoll + sewer + strip + mountain + forest + drill + tomb + dig + canyon + consite + under + nest + default + test + ) + ) + (a0-3 (car s3-0)) + ) + (while (not (null? s3-0)) + (let ((s2-0 debug-menu-append-item) + (s1-0 s5-0) + (s0-0 debug-menu-make-from-template) + ) + (set! sv-16 arg0) + (let ((a1-2 (debug-menu-make-task-sub-menu (the-as debug-menu-context a0-3)))) + (s2-0 s1-0 (s0-0 sv-16 (the-as pair a1-2))) + ) + ) + (set! s3-0 (cdr s3-0)) + (set! a0-3 (car s3-0)) + ) + ) + s4-0 + ) + ) + ) + ) + +;; definition for function dm-play-task-with-continue +;; INFO: Return type mismatch int vs none. +(defun dm-play-task-with-continue ((arg0 game-task) (arg1 string)) + (let* ((t9-0 play-task) + (a1-1 'debug) + (a2-0 (cond + ((cpad-hold? 0 l1) + 'pre-play + ) + ((cpad-hold? 0 r1) + 'kiosk + ) + ) + ) + (a1-2 (t9-0 arg0 a1-1 a2-0)) + ) + (if arg1 + (set! a1-2 arg1) + ) + (start 'play (get-continue-by-name *game-info* a1-2)) + ) + (set-master-mode 'game) + 0 + (none) + ) + +;; definition for function dm-play-task +(defun dm-play-task ((arg0 game-task)) + (dm-play-task-with-continue (the-as game-task (/ (the-as int arg0) 8)) (the-as string #f)) + (none) + ) + +;; definition for function dm-play-race +(defun dm-play-race ((arg0 race-selection) (arg1 symbol)) + (let ((s5-0 (the-as string #f)) + (gp-0 0) + ) + (case arg0 + (((race-selection kiera-class3)) + (set! gp-0 43) + (set! s5-0 "stadiumb-record-path") + ) + (((race-selection kiera-class2)) + (set! gp-0 55) + (set! s5-0 "stadiumc-record-path") + ) + (((race-selection kiera-class1)) + (set! gp-0 63) + (set! s5-0 "stadiumd-record-path") + ) + (((race-selection errol)) + (set! gp-0 57) + (set! s5-0 "ctyport-errol-record-path") + ) + (((race-selection bush-class3)) + (set! gp-0 104) + (set! s5-0 "stadiumb-record-path") + ) + (((race-selection bush-class2)) + (set! gp-0 105) + (set! s5-0 "stadiumc-record-path") + ) + (((race-selection bush-class1)) + (set! gp-0 106) + (set! s5-0 "stadiumd-record-path") + ) + (((race-selection bush-errol)) + (set! gp-0 101) + (set! s5-0 "ctyport-errol-record-path") + ) + (((race-selection bush-port)) + (set! gp-0 102) + (set! s5-0 "ctyport-race-record-path") + ) + (((race-selection bush-class3-reverse)) + (set! gp-0 107) + (set! s5-0 "stadiumb-record-path") + ) + (((race-selection bush-class2-reverse)) + (set! gp-0 108) + (set! s5-0 "stadiumc-record-path") + ) + (((race-selection bush-class1-reverse)) + (set! gp-0 109) + (set! s5-0 "stadiumd-record-path") + ) + ) + (if (not arg1) + (set! s5-0 (the-as string #f)) + ) + (format #t "dm-play-race starting task ~d continue ~s~%" gp-0 s5-0) + (if (nonzero? gp-0) + (dm-play-task-with-continue (the-as game-task gp-0) s5-0) + ) + ) + (none) + ) + +;; definition for function debug-menu-make-play-menu +;; INFO: Used lq/sq +;; ERROR: failed type prop at 12: Could not figure out load: (set! a0 (l.wu (+ v1 20))) +;; INFO: Return type mismatch debug-menu-node vs none. +(defun debug-menu-make-play-menu ((a0-0 symbol)) + (local-vars + (v0-0 none) + (v0-1 none) + (v0-2 none) + (v0-3 none) + (v0-4 none) + (v0-5 pair) + (v0-6 pair) + (v0-7 debug-menu-node) + (v1-0 game-info) + (v1-1 array) + (v1-2 int) + (v1-3 int) + (v1-4 uint) + (v1-5 none) + (v1-6 none) + (v1-7 none) + (v1-8 none) + (v1-9 none) + (v1-10 none) + (v1-11 none) + (v1-14 type) + (v1-15 type) + (a0-1 game-info) + (a0-2 array) + (a0-3 none) + (a0-5 none) + (a0-6 none) + (a0-7 none) + (a0-8 none) + (a0-9 none) + (a0-10 none) + (a0-11 none) + (a0-12 none) + (a0-13 none) + (a0-14 none) + (a0-15 none) + (a0-16 none) + (a0-17 none) + (a0-20 symbol) + (a0-21 symbol) + (a0-22 symbol) + (a1-0 none) + (a1-1 none) + (a1-2 none) + (a1-3 none) + (a1-5 type) + (a1-6 type) + (a1-7 pair) + (a2-0 none) + (a2-1 none) + (a2-2 none) + (a2-3 none) + (a2-5 string) + (a2-6 symbol) + (a3-0 none) + (a3-5 pair) + (a3-6 pair) + (s0-0 none) + (s0-1 symbol) + (s1-0 none) + (s1-1 type) + (s2-0 none) + (s2-1 symbol) + (s3-0 none) + (s3-1 (function symbol type object object pair)) + (s4-0 int) + (s4-1 (function debug-menu-context pair debug-menu-node)) + (t9-0 none) + (t9-1 none) + (t9-2 none) + (t9-3 none) + (t9-4 none) + (t9-5 (function symbol type object object pair)) + (t9-6 (function symbol type object object pair)) + (t9-7 (function debug-menu-context pair debug-menu-node)) + (gp-0 pair) + (sv-16 none) + (sv-32 none) + (sv-48 none) + (sv-64 none) + (sv-80 none) + (sv-96 none) + (sv-112 none) + (sv-128 none) + (sv-144 none) + (sv-160 none) + (sv-176 none) + ) + (set! gp-0 '()) + (set! v1-0 *game-info*) + (set! v1-1 (-> v1-0 unknown-pad3)) + (set! s4-0 (-> v1-1 length)) + (while (nonzero? s4-0) + (when (begin + (set! s4-0 (+ s4-0 -1)) + (set! v1-2 (sll s4-0 2)) + (set! a0-1 *game-info*) + (set! a0-2 (-> a0-1 unknown-pad3)) + (set! v1-3 (+ v1-2 a0-2)) + (set! v1-4 (l.wu (+ v1-3 12))) + (set! a0-3 (the-as none (l.wu (+ v1-4 20)))) + a0-3 + ) + (set! a0-5 (the-as none pair)) + (set! s3-0 (the-as none (l.wu (+ a0-5 16)))) + (set! s2-0 (the-as none 'global)) + (set! s1-0 (the-as none pair)) + (set! a0-6 (the-as none pair)) + (set! s0-0 (the-as none (l.wu (+ a0-6 16)))) + (set! a0-7 (the-as none 'global)) + (set! sv-16 a0-7) + (set! a0-8 (the-as none pair)) + (set! sv-32 a0-8) + (set! a0-9 (the-as none 'function)) + (set! sv-48 a0-9) + (set! a0-10 (the-as none pair)) + (set! a0-11 (the-as none (l.wu (+ a0-10 16)))) + (set! sv-64 a0-11) + (set! a0-12 (the-as none 'global)) + (set! sv-80 a0-12) + (set! a0-13 (the-as none pair)) + (set! sv-96 a0-13) + (set! v1-5 (the-as none (l.wu v1-4))) + (set! sv-112 v1-5) + (set! v1-6 (the-as none pair)) + (set! v1-7 (the-as none (l.wu (+ v1-6 16)))) + (set! sv-128 v1-7) + (set! v1-8 (the-as none 'global)) + (set! sv-144 v1-8) + (set! v1-9 (the-as none pair)) + (set! sv-160 v1-9) + (set! v1-10 (the-as none (sll s4-0 3))) + (set! sv-176 v1-10) + (set! v1-11 (the-as none pair)) + (set! t9-0 (the-as none (l.wu (+ v1-11 16)))) + (set! a0-14 (the-as none 'global)) + (set! a1-0 (the-as none pair)) + (set! a2-0 (the-as none 'dm-play-task)) + (set! a3-0 (the-as none '())) + (call!) + (set! a3-1 (the-as none v0-0)) + (set! t9-1 sv-128) + (set! a0-15 sv-144) + (set! a1-1 sv-160) + (set! a2-1 sv-176) + (call!) + (set! a3-2 (the-as none v0-1)) + (set! t9-2 sv-64) + (set! a0-16 sv-80) + (set! a1-2 sv-96) + (set! a2-2 sv-112) + (call!) + (set! a3-3 (the-as none v0-2)) + (set! t9-3 (the-as none s0-0)) + (set! a0-17 sv-16) + (set! a1-3 sv-32) + (set! a2-3 sv-48) + (call!) + (set! a2-4 (the-as none v0-3)) + (set! t9-4 (the-as none s3-0)) + (set! a0-18 (the-as none s2-0)) + (set! a1-4 (the-as none s1-0)) + (set! a3-4 (the-as none gp-0)) + (set! v0-4 (the-as none (call!))) + (set! gp-0 (the-as pair v0-4)) + (set! a0-19 (the-as none gp-0)) + ) + ) + (set! s4-1 debug-menu-make-from-template) + (set! v1-14 pair) + (set! s3-1 (method-of-type v1-14 new)) + (set! s2-1 'global) + (set! s1-1 pair) + (set! s0-1 'menu) + (set! v1-15 pair) + (set! t9-5 (method-of-type v1-15 new)) + (set! a0-20 'global) + (set! a1-5 pair) + (set! a2-5 L6130) + (set! a3-5 gp-0) + (set! v0-5 (call! a0-20 a1-5 a2-5 a3-5)) + (set! a3-6 v0-5) + (set! t9-6 s3-1) + (set! a0-21 s2-1) + (set! a1-6 s1-1) + (set! a2-6 s0-1) + (set! v0-6 (call! a0-21 a1-6 a2-6 a3-6)) + (set! a1-7 v0-6) + (set! t9-7 s4-1) + (set! a0-22 a0-0) + (call! a0-22 a1-7) + (ret-none) + ) + +;; definition for function dm-anim-tester-flag-func +(defun dm-anim-tester-flag-func ((arg0 int) (arg1 debug-menu-msg)) + (when *anim-tester* + (case arg0 + (('at-apply-align) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *anim-tester* 0 debug-flags) (anim-tester-debug-flags at-apply-align)) + ) + (return (logtest? (-> *anim-tester* 0 debug-flags) (anim-tester-debug-flags at-apply-align))) + ) + (('at-show-joint-info) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *anim-tester* 0 debug-flags) (anim-tester-debug-flags at-show-joint-info)) + ) + (return (logtest? (-> *anim-tester* 0 debug-flags) (anim-tester-debug-flags at-show-joint-info))) + ) + ) + ) + #f + ) + +;; definition for function dm-anim-tester-func +(defun dm-anim-tester-func ((arg0 int) (arg1 debug-menu-msg)) + (local-vars (v0-1 symbol)) + (if (not *anim-tester*) + (anim-tester-start) + ) + (when *anim-tester* + (cond + ((= arg0 'at-pick-object) + (send-event (ppointer->process *anim-tester*) 'pick-object) + (set! v0-1 #t) + (set! (-> *debug-menu-context* is-hidden) v0-1) + v0-1 + ) + ((= arg0 'at-pick-joint-anim) + (send-event (ppointer->process *anim-tester*) 'pick-joint-anim) + (set! v0-1 #t) + (set! (-> *debug-menu-context* is-hidden) v0-1) + v0-1 + ) + ) + ) + ) + +;; definition for function dm-pilot-mode +;; INFO: Return type mismatch object vs none. +(defun dm-pilot-mode ((arg0 object)) + "TODO - what is the third arg to target's change-mode?" + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'pilot #f arg0 #t) + (none) + ) + +;; definition for function dm-pilot-race-mode +;; INFO: Return type mismatch object vs none. +(defun dm-pilot-race-mode ((arg0 object)) + "TODO - what is the third arg to target's change-mode?" + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'pilot-race #f arg0 #t) + (none) + ) + +;; definition for function stop-watch-display +(defun stop-watch-display ((arg0 object) (arg1 object)) + (let ((v1-3 (- (-> *display* base-clock frame-counter) (the-as int (-> *game-info* stop-watch-start))))) + (format arg1 "Stop watch ~D:~D:~D~%" (/ v1-3 #x4650) (/ (mod v1-3 #x4650) 300) (/ (* 100 (mod v1-3 300)) 300)) + ) + #f + ) + +;; definition for function debug-menu-context-make-default-menus +;; INFO: Used lq/sq +(defun debug-menu-context-make-default-menus ((arg0 debug-menu-context)) + (local-vars (sv-16 debug-menu-context)) + (let ((t9-0 (method-of-type debug-menu new)) + (a0-1 'debug) + (a1-0 debug-menu) + ) + "Main menu" + (let ((s5-0 (t9-0 a0-1 a1-0))) + (debug-menu-context-set-root-menu arg0 s5-0) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Artist" + (flag "Poly Stats" *stats-poly* dm-boolean-toggle-pick-func) + (menu + "Memory Stats" + (flag "Enable" *stats-memory* dm-boolean-toggle-pick-func) + (flag "Short" *stats-memory-short* dm-boolean-toggle-pick-func) + (flag "Level 0" 0 dm-stats-memory-func) + (flag "Level 1" 1 dm-stats-memory-func) + (flag "Level 2" 2 dm-stats-memory-func) + (flag "Level 3" 3 dm-stats-memory-func) + (flag "Level 4" 4 dm-stats-memory-func) + (flag "Level 5" 5 dm-stats-memory-func) + ) + (flag "All Visible" *artist-all-visible* dm-boolean-toggle-pick-func) + (flag "Flip Visible" *artist-flip-visible* dm-boolean-toggle-pick-func) + (flag "Fix Visible" *artist-fix-visible* dm-boolean-toggle-pick-func) + (flag "Fix Frustum" *artist-fix-frustum* dm-boolean-toggle-pick-func) + (flag "Manual Sample Point" *manual-sample-point* dm-boolean-toggle-pick-func) + (flag "Error Spheres" *artist-error-spheres* dm-boolean-toggle-pick-func) + (flag "Use menu subdiv" *artist-use-menu-subdiv* dm-boolean-toggle-pick-func) + (float-var "Subdiv Close" close dm-subdiv-float 10 1 #t 1 200 1) + (float-var "Subdiv Far" far dm-subdiv-float 10 1 #t 1 200 1) + (function "Target Start" #f (lambda () (start 'debug (get-current-continue-point *game-info*)))) + (function "Target Stop" #f (lambda () (stop 'debug))) + (menu + "Anim Tester" + (int-var "Speed" anim-speed dm-subdiv-int 10 10 #t -300 1000) + (flag "Apply Align" at-apply-align dm-anim-tester-flag-func) + (flag "Show Joint Inf" at-show-joint-info dm-anim-tester-flag-func) + (function "Pick Object" at-pick-object dm-anim-tester-func) + (function "Pick Joint Anim" at-pick-joint-anim dm-anim-tester-func) + (function "Pick Sequence" at-pick-sequence dm-anim-tester-func) + (function "Save Sequences" at-save-sequences dm-anim-tester-func) + ) + (flag "Show Entity Errors" *display-entity-errors* dm-boolean-toggle-pick-func) + (flag "Sprite Info" *display-sprite-info* dm-boolean-toggle-pick-func) + (flag "Sprite Marks" *display-sprite-marks* dm-boolean-toggle-pick-func) + (flag "Sprite Spheres" *display-sprite-spheres* dm-boolean-toggle-pick-func) + (flag "Time of Day" #f dm-time-of-day-pick-func) + (flag "Preload Anims" *preload-spool-anims* dm-boolean-toggle-pick-func) + (function + "Mike F" + #f + (lambda () (debug-actor "drill-crane-14") (send-event (the-as process-tree *debug-actor*) 'die)) + ) + (function + "Editor" + #f + (lambda () + (kill-by-type editable-player *active-pool*) + (process-spawn + editable-player + :init editable-player-init + #f + :name (symbol->string (-> editable-player symbol)) + :to *entity-pool* + ) + (set-master-mode 'game) + (none) + ) + ) + (flag + "Screen shot highres enable" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *screen-shot-work* highres-enable) (not (-> *screen-shot-work* highres-enable))) + ) + (-> *screen-shot-work* highres-enable) + ) + ) + (flag + "Screen shot hud enable" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *screen-shot-work* hud-enable) (not (-> *screen-shot-work* hud-enable))) + ) + (-> *screen-shot-work* hud-enable) + ) + ) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Game" + (function "New Game" #f (lambda () (initialize! *game-info* 'game (the-as game-save #f) (the-as string #f)))) + (function "New Life" #f (lambda () (initialize! *game-info* 'dead (the-as game-save #f) (the-as string #f)))) + (function + "Reset Game" + #f + (lambda () + (set! (-> *game-info* mode) 'debug) + (initialize! *game-info* 'game (the-as game-save #f) (the-as string #f)) + ) + ) + (function "Reset Actors" #f (lambda () (reset-actors 'debug) (none))) + (function "Save Game" #f (lambda () (auto-save-command 'save 0 0 *default-pool* #f) (none))) + (function "Load Game" #f (lambda () (auto-save-command 'restore 0 0 *default-pool* #f) (none))) + (flag "Target" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (if *target* + (stop 'debug) + (start 'debug (get-current-continue-point *game-info*)) + ) + ) + *target* + ) + ) + (flag "Game Mode" play dm-game-mode-pick-func) + (flag "Debug Mode" debug dm-game-mode-pick-func) + (function + "Stop Watch Start" + #f + (lambda () + (remove-by-param0 *debug-engine* stop-watch-display) + (add-connection *debug-engine* *dproc* stop-watch-display *dproc* *stdcon0* #f) + (set! (-> *game-info* stop-watch-start) (the-as uint (-> *display* base-clock frame-counter))) + (set! (-> *game-info* stop-watch-stop) (the-as uint 0)) + (format #t "Stop watch started!~%") + (none) + ) + ) + (function + "Stop Watch Stop" + #f + (lambda () + (remove-by-param0 *debug-engine* stop-watch-display) + (set! (-> *game-info* stop-watch-stop) (the-as uint (-> *display* base-clock frame-counter))) + (let ((v1-7 (- (-> *game-info* stop-watch-stop) (-> *game-info* stop-watch-start)))) + (format + #t + "Stop watch elasped time was ~D:~D:~D~%" + (/ (the-as int v1-7) #x4650) + (/ (mod (the-as int v1-7) #x4650) 300) + (/ (* 100 (mod (the-as int v1-7) 300)) 300) + ) + ) + (none) + ) + ) + (function "Continue Start" #f (lambda () (start 'play (-> *game-info* current-continue)))) + (function "Kiosk Reset" #f (lambda () (auto-save-command 'restore 0 0 *default-pool* #f) (none))) + (menu + "Secrets" + (flag "toggle-beard" 1 dm-game-secret-toggle-pick-func) + (flag "hflip-screen" 2 dm-game-secret-toggle-pick-func) + (flag "endless-ammo" 4 dm-game-secret-toggle-pick-func) + (flag "invulnerable" 8 dm-game-secret-toggle-pick-func) + (flag "endless-dark" 16 dm-game-secret-toggle-pick-func) + (flag "scene-player-1" 32 dm-game-secret-toggle-pick-func) + (flag "scene-player-2" 64 dm-game-secret-toggle-pick-func) + (flag "scene-player-3" 128 dm-game-secret-toggle-pick-func) + (flag "level-select" 256 dm-game-secret-toggle-pick-func) + (flag "scrap-book-1" 512 dm-game-secret-toggle-pick-func) + (flag "scrap-book-2" 1024 dm-game-secret-toggle-pick-func) + (flag "gungame-blue" 4096 dm-game-secret-toggle-pick-func) + (flag "gungame-dark" 8192 dm-game-secret-toggle-pick-func) + (flag "reverse-races" 16384 dm-game-secret-toggle-pick-func) + (flag "hero-mode" 32768 dm-game-secret-toggle-pick-func) + (flag "big-head" 65536 dm-game-secret-toggle-pick-func) + (flag "little-head" 131072 dm-game-secret-toggle-pick-func) + ) + (menu "Continue") + (menu + "Settings" + (float-var + "sfx-volume" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *setting-control* (nonzero? *setting-control*)) + (let ((f0-0 arg2)) + (set! (-> *setting-control* user-default sfx-volume) f0-0) + f0-0 + ) + ) + ) + ((or (not *setting-control*) (zero? *setting-control*)) + 0.0 + ) + (else + (-> *setting-control* user-default sfx-volume) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.01) + #t + 0 + 1 + 0 + ) + (float-var + "ambient-volume" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *setting-control* (nonzero? *setting-control*)) + (let ((f0-0 arg2)) + (set! (-> *setting-control* user-default ambient-volume) f0-0) + f0-0 + ) + ) + ) + ((or (not *setting-control*) (zero? *setting-control*)) + 0.0 + ) + (else + (-> *setting-control* user-default ambient-volume) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.01) + #t + 0 + 1 + 0 + ) + (float-var + "music-volume" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *setting-control* (nonzero? *setting-control*)) + (let ((f0-0 arg2)) + (set! (-> *setting-control* user-default music-volume) f0-0) + f0-0 + ) + ) + ) + ((or (not *setting-control*) (zero? *setting-control*)) + 0.0 + ) + (else + (-> *setting-control* user-default music-volume) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.01) + #t + 0 + 1 + 0 + ) + (float-var + "dialog-volume" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *setting-control* (nonzero? *setting-control*)) + (let ((f0-0 arg2)) + (set! (-> *setting-control* user-default dialog-volume) f0-0) + f0-0 + ) + ) + ) + ((or (not *setting-control*) (zero? *setting-control*)) + 0.0 + ) + (else + (-> *setting-control* user-default dialog-volume) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.01) + #t + 0 + 1 + 0 + ) + (menu + "Language" + (flag "english" 0 dm-setting-language) + (flag "french" 1 dm-setting-language) + (flag "german" 2 dm-setting-language) + (flag "spanish" 3 dm-setting-language) + (flag "italian" 4 dm-setting-language) + (flag "japanese" 5 dm-setting-language) + (flag "korean" 6 dm-setting-language) + (flag "uk-english" 7 dm-setting-language) + ) + (menu + "Subtitle Language" + (flag "english" 0 dm-setting-subtitle-language) + (flag "french" 1 dm-setting-subtitle-language) + (flag "german" 2 dm-setting-subtitle-language) + (flag "spanish" 3 dm-setting-subtitle-language) + (flag "italian" 4 dm-setting-subtitle-language) + (flag "japanese" 5 dm-setting-subtitle-language) + (flag "korean" 6 dm-setting-subtitle-language) + (flag "uk-english" 7 dm-setting-subtitle-language) + ) + (flag + "play-hints " + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default play-hints) (not (-> *setting-control* user-default play-hints))) + ) + (the-as uint (-> *setting-control* user-default play-hints)) + ) + ) + (flag + "subtitle " + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default subtitle) (not (-> *setting-control* user-default subtitle))) + ) + (-> *setting-control* user-default subtitle) + ) + ) + (flag + "vibration" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default vibration) (not (-> *setting-control* user-default vibration))) + ) + (the-as uint (-> *setting-control* user-default vibration)) + ) + ) + (menu + "Stereo Mode" + (flag "mono" 0 dm-setting-stereo-mode) + (flag "stereo" 1 dm-setting-stereo-mode) + (flag "surround" 2 dm-setting-stereo-mode) + ) + (flag + "camera-stick-dir" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default unknowng-symbol-00) + (not (-> *setting-control* user-default unknowng-symbol-00)) + ) + ) + (the-as uint (-> *setting-control* user-default unknowng-symbol-00)) + ) + ) + (flag + "progressive-scan" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default unknown-uint32-00) + (the-as uint (not (-> *setting-control* user-default unknown-uint32-00))) + ) + ) + (-> *setting-control* user-default unknown-uint32-00) + ) + ) + (flag + "border-mode" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (set! (-> *setting-control* user-default border-mode) (not (-> *setting-control* user-default border-mode))) + (set! (-> *level* play?) (-> *setting-control* user-default border-mode)) + ) + (-> *setting-control* user-default border-mode) + ) + ) + ) + (menu + "Features" + (flag "board" 1024 dm-game-feature-toggle-pick-func) + (flag "board-training" 67108864 dm-game-feature-toggle-pick-func) + (flag "carry" 2048 dm-game-feature-toggle-pick-func) + (flag "sidekick" 4096 dm-game-feature-toggle-pick-func) + (flag "darkjak" 8192 dm-game-feature-toggle-pick-func) + (flag "darkjak-bomb0" 4194304 dm-game-feature-toggle-pick-func) + (flag "darkjak-bomb1" 8388608 dm-game-feature-toggle-pick-func) + (flag "darkjak-invinc" 16777216 dm-game-feature-toggle-pick-func) + (flag "darkjak-giant" 33554432 dm-game-feature-toggle-pick-func) + (flag "gun-yellow" 64 dm-game-feature-toggle-pick-func) + (flag "gun-red" 128 dm-game-feature-toggle-pick-func) + (flag "gun-blue" 256 dm-game-feature-toggle-pick-func) + (flag "gun-dark" 512 dm-game-feature-toggle-pick-func) + (flag "gun-upgrade-speed" 16384 dm-game-feature-toggle-pick-func) + (flag "gun-upgrade-ammo" 32768 dm-game-feature-toggle-pick-func) + (flag "gun-upgrade-damage" 65536 dm-game-feature-toggle-pick-func) + (flag "pass-red" 262144 dm-game-feature-toggle-pick-func) + (flag "pass-green" 524288 dm-game-feature-toggle-pick-func) + (flag "pass-yellow" 1048576 dm-game-feature-toggle-pick-func) + ) + ) + ) + ) + (let* ((s4-2 (debug-menu-find-from-template arg0 '("Game" "Continue"))) + (s3-2 + '(city + fortress + stadium + palace + castle + ruins + atoll + sewer + strip + mountain + forest + drill + tomb + dig + canyon + consite + under + nest + default + test + ) + ) + (a1-7 (car s3-2)) + ) + (while (not (null? s3-2)) + (let ((s2-0 debug-menu-append-item) + (s1-0 s4-2) + (s0-0 debug-menu-make-from-template) + ) + (set! sv-16 arg0) + (let ((a1-8 (debug-menu-make-continue-sub-menu (the-as debug-menu-context *game-info*) (the-as symbol a1-7)))) + (s2-0 s1-0 (s0-0 sv-16 a1-8)) + ) + ) + (set! s3-2 (cdr s3-2)) + (set! a1-7 (car s3-2)) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Stats" + (flag "Poly" *stats-poly* dm-boolean-toggle-pick-func) + (flag "Collide" *stats-collide* dm-boolean-toggle-pick-func) + (flag "Bsp" *stats-bsp* dm-boolean-toggle-pick-func) + (flag "Buffer" *stats-buffer* dm-boolean-toggle-pick-func) + (flag "Target" *stats-target* dm-boolean-toggle-pick-func) + (flag "Blerc" *stats-blerc* dm-boolean-toggle-pick-func) + (flag "Profile bars" *stats-profile-bars* dm-boolean-toggle-pick-func) + (flag "Perf" *stats-perf* dm-boolean-toggle-pick-func) + (menu + "Memory Stats" + (flag "Enable" *stats-memory* dm-boolean-toggle-pick-func) + (flag "Short" *stats-memory-short* dm-boolean-toggle-pick-func) + (flag "Level 0" 0 dm-stats-memory-func) + (flag "Level 1" 1 dm-stats-memory-func) + (flag "Level 2" 2 dm-stats-memory-func) + (flag "Level 3" 3 dm-stats-memory-func) + (flag "Level 4" 4 dm-stats-memory-func) + (flag "Level 5" 5 dm-stats-memory-func) + ) + (function + "Print Entity Memory" + #f + (lambda () + (format #t "~%~%========================= Entity Memory =========================~%~%") + (let ((gp-0 (-> *level* level0))) + (inspect (-> gp-0 art-group)) + (dotimes (s5-0 (-> gp-0 art-group art-group-array length)) + (inspect (-> gp-0 art-group art-group-array s5-0)) + ) + ) + #f + ) + ) + (function + "Print Texture Info" + #f + (lambda () + (format #t "~%~%========================= Texture Info =========================~%~%") + (inspect *texture-page-dir*) + ) + ) + (function + "Print Texture Verbose" + #f + (lambda () + (format #t "~%~%========================= Texture Info =========================~%~%") + (texture-page-dir-inspect *texture-page-dir* #t) + (none) + ) + ) + (function + "Print Merc Stats" + #f + (lambda () + (format #t "~%~%========================== Merc Stats ==========================~%~%") + (merc-stats) + (none) + ) + ) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Render" + (menu + "Background" + (flag "Textured" 0 dm-subdiv-draw-func) + (flag "Outline" 1 dm-subdiv-draw-func) + (flag "Gouraud" 2 dm-subdiv-draw-func) + (flag "Hack" 3 dm-subdiv-draw-func) + ) + (menu + "Background Scissor" + (flag "Textured" 0 dm-scissor-subdiv-draw-func) + (flag "Outline" 1 dm-scissor-subdiv-draw-func) + (flag "Gouraud" 2 dm-scissor-subdiv-draw-func) + (flag "Hack" 3 dm-scissor-subdiv-draw-func) + ) + (menu + "Foreground" + (flag "Textured" 0 dm-foreground-subdiv-draw-func) + (flag "Outline" 1 dm-foreground-subdiv-draw-func) + (flag "Gouraud" 2 dm-foreground-subdiv-draw-func) + (flag "Hack" 3 dm-foreground-subdiv-draw-func) + ) + (menu + "Ocean" + (flag "Textured" 0 dm-ocean-subdiv-draw-func) + (flag "Outline" 1 dm-ocean-subdiv-draw-func) + (flag "Gouraud" 2 dm-ocean-subdiv-draw-func) + (flag "Hack" 3 dm-ocean-subdiv-draw-func) + ) + (flag "SKY TEXTURES" 32 dm-texture-user-toggle-pick-func) + (flag "sky" 3 dm-vu1-user-toggle-pick-func) + (flag "ocean" 4 dm-vu1-user-toggle-pick-func) + (flag "ocean-wave" 5 dm-vu1-user-toggle-pick-func) + (flag "TFRAG TIE TEXTURES" #x1 dm-texture-user-toggle-pick-func) + (flag "tfrag" 6 dm-vu1-user-toggle-pick-func) + (flag "tie" 8 dm-vu1-user-toggle-pick-func) + (flag "tie-envmap" 9 dm-vu1-user-toggle-pick-func) + (flag "tie-scissor" 7 dm-vu1-user-toggle-pick-func) + (flag "tie-envmap-scissor" 10 dm-vu1-user-toggle-pick-func) + (flag "tie-vanish" 11 dm-vu1-user-toggle-pick-func) + (flag "SHRUB TEXTURES" #x4 dm-texture-user-toggle-pick-func) + (flag "shrub-near" 16 dm-vu1-user-toggle-pick-func) + (flag "shrubbery" 15 dm-vu1-user-toggle-pick-func) + (flag "shrubbery-vanish" 18 dm-vu1-user-toggle-pick-func) + (flag "billboard" 17 dm-vu1-user-toggle-pick-func) + (flag "ALPHA TEXTURES" 1 dm-texture-user-toggle-pick-func) + (flag "tfrag-trans" 19 dm-vu1-user-toggle-pick-func) + (flag "tie-trans" 21 dm-vu1-user-toggle-pick-func) + (flag "tie-envmap-trans" 22 dm-vu1-user-toggle-pick-func) + (flag "tie-scissor-trans" 20 dm-vu1-user-toggle-pick-func) + (flag "tie-envmap-scissor-trans" 23 dm-vu1-user-toggle-pick-func) + (flag "PRIS TEXTURES" #x2 dm-texture-user-toggle-pick-func) + (flag "merc" 13 dm-vu1-user-toggle-pick-func) + (flag "emerc" 14 dm-vu1-user-toggle-pick-func) + (flag "generic" 12 dm-vu1-user-toggle-pick-func) + (flag "WATER TEXTURES" 2 dm-texture-user-toggle-pick-func) + (flag "tfrag-water" 24 dm-vu1-user-toggle-pick-func) + (flag "tie-water" 26 dm-vu1-user-toggle-pick-func) + (flag "tie-envmap-water" 27 dm-vu1-user-toggle-pick-func) + (flag "tie-scissor-water" 25 dm-vu1-user-toggle-pick-func) + (flag "tie-envmap-scissor-water" 28 dm-vu1-user-toggle-pick-func) + (flag "SPRITE TEXTURES" 8 dm-texture-user-toggle-pick-func) + (flag "sprite" 29 dm-vu1-user-toggle-pick-func) + (flag "shadow" 30 dm-vu1-user-toggle-pick-func) + (flag "shadow-debug" *shadow-debug* dm-boolean-toggle-pick-func) + (flag "depth-cue" 34 dm-vu1-user-toggle-pick-func) + (flag "WARP TEXTURES" 4 dm-texture-user-toggle-pick-func) + (flag "HUD TEXTURES" 16 dm-texture-user-toggle-pick-func) + (flag "all on" #f dm-vu1-user-all-pick-func) + (flag "all off" #f dm-vu1-user-none-pick-func) + (flag "all textures on" #x1ff dm-texture-user-set-pick-func) + (flag "all textures off" 0 dm-texture-user-set-pick-func) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Collision" + (menu + "Collision Renderer" + (flag "On" 0 dm-col-rend-on-func) + (flag "Track Player" 0 dm-col-rend-track-func) + (flag "Track Camera" 1 dm-col-rend-track-func) + (float-var " Dist" #f dm-col-rend-cam-dist 10 1 #t 0 80 1) + (flag "Fixed Pos" 2 dm-col-rend-track-func) + (float-var "Size" #f dm-col-rend-size 10 1 #t 1 20 1) + (flag "Outline" 0 dm-col-rend-outline-func) + (flag "Show Back-faces" 0 dm-col-rend-back-face-func) + (flag "Show Normals" 0 dm-col-rend-normals-func) + (flag "Ghost Hidden" 0 dm-col-rend-ghost-hidden-func) + (menu + "Show Only" + (flag "(board)" 1 dm-col-rend-show-only-set-func) + (flag "(grind)" 2 dm-col-rend-show-only-set-func) + (flag "(grindonly)" 4 dm-col-rend-show-only-set-func) + (flag "melt" 16384 dm-col-rend-show-only-toggle-func) + (flag "noboard" 8 dm-col-rend-show-only-toggle-func) + (flag "nocamera" 16 dm-col-rend-show-only-toggle-func) + (flag "noedge" 32 dm-col-rend-show-only-toggle-func) + (flag "noendlessfall" 64 dm-col-rend-show-only-toggle-func) + (flag "noentity" 128 dm-col-rend-show-only-toggle-func) + (flag "nogrind" 256 dm-col-rend-show-only-toggle-func) + (flag "nojak" 512 dm-col-rend-show-only-toggle-func) + (flag "nolineofsight" 1024 dm-col-rend-show-only-toggle-func) + (flag "nomech" 2048 dm-col-rend-show-only-toggle-func) + (flag "nopilot" 4096 dm-col-rend-show-only-toggle-func) + (flag "noproj" 8192 dm-col-rend-show-only-toggle-func) + (flag "probe" 32768 dm-col-rend-show-only-toggle-func) + (flag "Select All" 49144 dm-col-rend-show-only-set-func) + (flag "Unselect All" 0 dm-col-rend-show-only-set-func) + ) + (menu + "Find" + (flag "background" 1 dm-col-rend-cspec-toggle) + (flag "obstacles" 2 dm-col-rend-cspec-toggle) + (flag "pushers" 4 dm-col-rend-cspec-toggle) + (flag "Jak" 8 dm-col-rend-cspec-toggle) + (flag "other" 16 dm-col-rend-cspec-toggle) + ) + ) + (flag "Collision Cache" *display-collide-cache* dm-boolean-toggle-pick-func) + (flag "Collision Marks" *display-collision-marks* dm-boolean-toggle-pick-func) + (flag "Ground Stats" *display-ground-stats* dm-boolean-toggle-pick-func) + (flag "Hipri Collision Marks" *display-hipri-collision-marks* dm-boolean-toggle-pick-func) + (flag "Edge Collision Marks" *display-edge-collision-marks* dm-boolean-toggle-pick-func) + (flag "Collide Stats" *stats-collide* dm-boolean-toggle-pick-func) + (flag "Render Collision" *display-render-collision* dm-boolean-toggle-pick-func) + (flag "Collide List Boxes" *collide-list-boxes* dm-boolean-toggle-pick-func) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Display" + (flag "Profile" *display-profile* dm-boolean-toggle-pick-func) + (flag "Ticks" *profile-ticks* dm-boolean-toggle-pick-func) + (flag "File Info" *display-file-info* dm-boolean-toggle-pick-func) + (flag "Level Spheres" *display-level-spheres* dm-boolean-toggle-pick-func) + (flag "Camera Marks" *display-camera-marks* dm-boolean-toggle-pick-func) + (flag "Camera Info" *display-camera-info* dm-boolean-toggle-pick-func) + (flag "Geometry Marks" *display-geo-marks* dm-boolean-toggle-pick-func) + (flag "Art Control" *display-art-control* dm-boolean-toggle-pick-func) + (flag "Gui Control" *display-gui-control* dm-boolean-toggle-pick-func) + (flag "Instance Info" *display-instance-info* dm-boolean-toggle-pick-func) + (menu + "strip lines" + (flag "strippable" 1 dm-strip-lines-toggle-pick-func) + (flag "convertible" 2 dm-strip-lines-toggle-pick-func) + (flag "edgeable" 4 dm-strip-lines-toggle-pick-func) + (flag "ordinary" 8 dm-strip-lines-toggle-pick-func) + (flag "color mismatch" 16 dm-strip-lines-toggle-pick-func) + (flag "shader mismatch" 32 dm-strip-lines-toggle-pick-func) + (flag "uv mismatch" 64 dm-strip-lines-toggle-pick-func) + (flag "too big" 128 dm-strip-lines-toggle-pick-func) + (flag "good" 3 dm-strip-lines-set-pick-func) + (flag "bad" 240 dm-strip-lines-set-pick-func) + (flag "all edges" 255 dm-strip-lines-set-pick-func) + (flag "strips" 256 dm-strip-lines-set-pick-func) + (flag "frags" 512 dm-strip-lines-set-pick-func) + (flag "none" 0 dm-strip-lines-set-pick-func) + ) + (menu + "collision mesh" + (flag "wall" 1024 dm-strip-lines-toggle-pick-func) + (flag "ground" 2048 dm-strip-lines-toggle-pick-func) + (flag "all" 3072 dm-strip-lines-set-pick-func) + (flag "none" 0 dm-strip-lines-set-pick-func) + ) + (flag "Texture Distances" *display-texture-distances* dm-boolean-toggle-pick-func) + (flag "Texture Download" *display-texture-download* dm-boolean-toggle-pick-func) + (flag "Level Border" *display-level-border* dm-boolean-toggle-pick-func) + (flag "Split Boxes" *display-split-boxes* dm-boolean-toggle-pick-func) + (flag "Split Box Info" *display-split-box-info* dm-boolean-toggle-pick-func) + (flag "Memcard Info" *display-memcard-info* dm-boolean-toggle-pick-func) + (flag "Trail Graph" *display-trail-graph* dm-boolean-toggle-pick-func) + (flag "Color Bars" *display-color-bars* dm-boolean-toggle-pick-func) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Actor" + (flag "Spawn Actors" *spawn-actors* dm-boolean-toggle-pick-func) + (function "Reset Actors" #f (lambda () (reset-actors 'debug) (none))) + (function "Traffic Start" #f (lambda () + (let ((gp-0 traffic-start)) + (if (valid? gp-0 function (the-as symbol "") #t 0) + (gp-0) + ) + ) + (none) + ) + ) + (function "Traffic Kill" #f (lambda () + (let ((gp-0 traffic-kill)) + (if (valid? gp-0 function (the-as symbol "") #t 0) + (gp-0) + ) + ) + (none) + ) + ) + (menu + "Bot" + (function + "Bot Next" + #f + (lambda () + (send-event (process-by-name "sig-atoll-1" *active-pool*) 'skip) + (send-event (process-by-name "hal-sewer-1" *active-pool*) 'skip) + (send-event (process-by-name "hal-escort-1" *active-pool*) 'skip) + (send-event (process-by-name "squid-2" *active-pool*) 'skip) + (send-event (process-by-name "metalkor-1" *active-pool*) 'skip) + (send-event (process-by-name "sig-under-1" *active-pool*) 'skip) + ) + ) + (menu + "Bot Marks" + (flag "course spots" 1 display-bot-marks-toggle-pick-func) + (flag "task spots" 2 display-bot-marks-toggle-pick-func) + (flag "all on" 3 display-bot-marks-set-pick-func) + (flag "all off" 0 display-bot-marks-set-pick-func) + ) + (function + "Record sig5-cent1-path0" + #f + (lambda () + (set! *bot-record-path* 0) + (dm-play-task-with-continue (game-task under-sig) "cent1-path0-record-path") + (none) + ) + ) + (function + "Record sig5-cent2-path0" + #f + (lambda () + (set! *bot-record-path* 1) + (dm-play-task-with-continue (game-task under-sig) "cent2-path0-record-path") + (none) + ) + ) + ) + (menu + "Actor Compaction" + (flag "off" #f dm-compact-actor-pick-func) + (flag "on" #t dm-compact-actor-pick-func) + (flag "debug" debug dm-compact-actor-pick-func) + ) + (flag "Traffic height map" *display-traffic-height-map* dm-boolean-toggle-pick-func) + (flag "View Anims" *debug-view-anims* dm-boolean-toggle-pick-func) + (flag "Unkillable" *debug-unkillable* dm-boolean-toggle-pick-func) + (flag "Regions" *execute-regions* dm-boolean-toggle-pick-func) + (flag "Region Marks" *display-region-marks* dm-boolean-toggle-pick-func) + (flag "Actor Vis" *vis-actors* dm-boolean-toggle-pick-func) + (flag "Battle Marks" *display-battle-marks* dm-boolean-toggle-pick-func) + (menu + "Hover Marks" + (flag "Nav Network" *display-nav-network* dm-boolean-toggle-pick-func) + (flag "Debug Hover" *debug-hover* dm-boolean-toggle-pick-func) + ) + (flag "Joint Axes" *display-joint-axes* dm-boolean-toggle-pick-func) + (flag "Path Marks" *display-path-marks* dm-boolean-toggle-pick-func) + (flag "Nav Marks" *display-nav-marks* dm-boolean-toggle-pick-func) + (flag "Vol Marks" *display-vol-marks* dm-boolean-toggle-pick-func) + (flag "Collision Marks" *display-collision-marks* dm-boolean-toggle-pick-func) + (menu + "Actor Vis" + (flag "off" #f dm-actor-vis-pick-func) + (flag "box" box dm-actor-vis-pick-func) + (flag "sphere" sphere dm-actor-vis-pick-func) + (flag "all" #t dm-actor-vis-pick-func) + ) + (menu + "Actor Marks" + (flag "off" #f dm-actor-marks-pick-func) + (flag "alive entities" #t dm-actor-marks-pick-func) + (flag "all entities" full dm-actor-marks-pick-func) + (flag "processes" process dm-actor-marks-pick-func) + ) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Target" + (menu + "Mode" + (function "normal" #f (lambda () (send-event *target* 'end-mode))) + (function "racer" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'racer #f) + ) + ) + (function "flut" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'flut #f) + ) + ) + (function "board" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (logior! (-> *game-info* features) (game-feature board)) + (logior! (-> *game-info* debug-features) (game-feature board)) + (send-event *target* 'change-mode 'board #f) + ) + ) + (function "mech" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'mech #f) + ) + ) + (function "gun" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (logior! (-> *game-info* features) (game-feature unk-game-feature-06)) + (logior! (-> *game-info* debug-features) (game-feature unk-game-feature-06)) + (send-event *target* 'change-mode 'gun #f 0) + ) + ) + (function "darkjak" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (logior! (-> *game-info* features) (game-feature darkjak)) + (logior! (-> *game-info* debug-features) (game-feature darkjak)) + (send-event *target* 'change-mode 'darkjak #f 3) + ) + ) + (function "indax" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'indax #f) + ) + ) + ) + (menu + "Pilot Mode" + (function "bikea" #f (lambda () (dm-pilot-mode 0) (none))) + (function "bikeb" #f (lambda () (dm-pilot-mode 1) (none))) + (function "bikec" #f (lambda () (dm-pilot-mode 2) (none))) + (function "crimson-bike" #f (lambda () (dm-pilot-mode 6) (none))) + (function "cara" #f (lambda () (dm-pilot-mode 3) (none))) + (function "carb" #f (lambda () (dm-pilot-mode 4) (none))) + (function "carc" #f (lambda () (dm-pilot-mode 5) (none))) + (function "hellcat" #f (lambda () (dm-pilot-mode 7) (none))) + (function "race-bike-a" #f (lambda () (dm-pilot-race-mode 0) (none))) + (function "race-bike-b" #f (lambda () (dm-pilot-race-mode 1) (none))) + (function "race-bike-c" #f (lambda () (dm-pilot-race-mode 2) (none))) + (function "evantestbike" #f (lambda () (dm-pilot-mode 8) (none))) + (function "test-bike" #f (lambda () (dm-pilot-mode 9) (none))) + (function "test-car" #f (lambda () (dm-pilot-mode 10) (none))) + ) + (flag "Target" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (if *target* + (stop 'debug) + (start 'debug (get-current-continue-point *game-info*)) + ) + ) + *target* + ) + ) + (menu + "Darkjak" + (function + "get all" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (set! (-> *game-info* features) + (logior (game-feature darkjak darkjak-bomb0 darkjak-bomb1 darkjak-invinc darkjak-giant) + (-> *game-info* features) + ) + ) + (set! (-> *game-info* debug-features) + (logior (game-feature darkjak darkjak-bomb0 darkjak-bomb1 darkjak-invinc darkjak-giant) + (-> *game-info* debug-features) + ) + ) + (send-event *target* 'get-pickup 7 #x42c80000) + ) + ) + (function "manual" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (logior! (-> *game-info* features) (game-feature darkjak)) + (logior! (-> *game-info* debug-features) (game-feature darkjak)) + (send-event *target* 'change-mode 'darkjak #f 3) + ) + ) + (function "rapid" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (logior! (-> *game-info* features) (game-feature darkjak)) + (logior! (-> *game-info* debug-features) (game-feature darkjak)) + (send-event *target* 'change-mode 'darkjak #f 2) + ) + ) + (function "bomb0" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'darkjak #f 7) + ) + ) + (function "bomb1" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'darkjak #f 15) + ) + ) + (function "invinc" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'darkjak #f 31) + ) + ) + (function "giant" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'darkjak #f 63) + ) + ) + ) + (menu + "Gun" + (flag "yellow" 2 dm-game-inventory-toggle-pick-func) + (flag "red" 4 dm-game-inventory-toggle-pick-func) + (flag "blue" 8 dm-game-inventory-toggle-pick-func) + (flag "dark" 16 dm-game-inventory-toggle-pick-func) + (flag "gun-upgrade-speed" 16384 dm-game-feature-toggle-pick-func) + (flag "gun-upgrade-ammo" 32768 dm-game-feature-toggle-pick-func) + (flag "gun-upgrade-damage" 65536 dm-game-feature-toggle-pick-func) + ) + (flag "Target Marks" *display-target-marks* dm-boolean-toggle-pick-func) + (flag "Gun Marks" *gun-marks* dm-boolean-toggle-pick-func) + (flag "Target Stats" *stats-target* dm-boolean-toggle-pick-func) + (flag "Sidekick Stats" *display-sidekick-stats* dm-boolean-toggle-pick-func) + (flag "Invulnerable" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (if *target* + (logxor! (-> *target* state-flags) (state-flags sf2)) + ) + ) + (and *target* (logtest? (-> *target* state-flags) (state-flags sf2))) + ) + ) + (flag + "Endless Ammo" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (if *target* + (set! (-> *target* state-flags) (logxor #x10000 (the-as int (-> *target* state-flags)))) + ) + ) + (and *target* (logtest? (state-flags sf16) (-> *target* state-flags))) + ) + ) + (function + "Full Stuff" + #f + (lambda () + (send-event *target* 'get-pickup 18 #x447a0000) + (send-event *target* 'get-pickup 17 #x447a0000) + (send-event *target* 'get-pickup 13 #x447a0000) + (send-event *target* 'get-pickup 14 #x447a0000) + (send-event *target* 'get-pickup 15 #x447a0000) + (send-event *target* 'get-pickup 16 #x447a0000) + (send-event *target* 'get-pickup 7 #x42c80000) + (logior! + (-> *game-info* features) + (game-feature unk-game-feature-06 gun-yellow gun-red gun-blue gun-dark board darkjak) + ) + (let ((v0-7 + (logior (-> *game-info* debug-features) + (game-feature unk-game-feature-06 gun-yellow gun-red gun-blue gun-dark board darkjak) + ) + ) + ) + (set! (-> *game-info* debug-features) v0-7) + v0-7 + ) + ) + ) + (function + "Dump Stuff" + #f + (lambda () + (send-event *target* 'get-pickup 17 -998637568) + (send-event *target* 'get-pickup 13 -998637568) + (send-event *target* 'get-pickup 14 -998637568) + (send-event *target* 'get-pickup 15 -998637568) + (send-event *target* 'get-pickup 16 -998637568) + ) + ) + (function "Trick Mode" #f (lambda () (send-event *target* 'get-pickup 20 #x468ca000))) + (function + "Reset Trans" + #f + (lambda () (when *target* + (position-in-front-of-camera! (target-pos 0) 40960.0 4096.0) + (set! (-> *target* control transv quad) (the-as uint128 0)) + (quaternion-identity! (-> *target* control quat)) + (quaternion-identity! (the-as quaternion (&-> (-> *target* control) unknown-float00))) + (quaternion-identity! (-> *target* control dir-targ)) + ) + ) + ) + (function + "Zero Trans" + #f + (lambda () (when *target* + (set-vector! (-> *target* control trans) 0.0 163840.0 0.0 1.0) + (set! (-> *target* control transv quad) (the-as uint128 0)) + (quaternion-identity! (-> *target* control quat)) + (quaternion-identity! (the-as quaternion (&-> (-> *target* control) unknown-float00))) + (quaternion-identity! (-> *target* control dir-targ)) + ) + ) + ) + (flag "Slow Frame Rate" *slow-frame-rate* dm-boolean-toggle-pick-func) + (function "Print Pos" #f (lambda () + (let ((v1-0 (target-pos 0))) + (format #t "~6,,2m ~6,,2m ~6,,2m~%" (-> v1-0 x) (-> v1-0 y) (-> v1-0 z)) + ) + 0 + ) + ) + (function "Save Continue" #f (lambda () (the-as symbol (if *target* + (trsq->continue-point (-> *target* control)) + ) + ) + ) + ) + (flag "RC Board Controls" *target-rc-board-controls* dm-boolean-toggle-pick-func) + ) + ) + ) + (debug-menu-append-item s5-0 (debug-menu-make-camera-menu arg0)) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Racing" + (flag "Kiera Class 3 (kierac)" 0 dm-select-race-pick-func) + (flag "Kiera Class 2 (kierab)" 1 dm-select-race-pick-func) + (flag "Kiera Class 1 (kieraa)" 2 dm-select-race-pick-func) + (flag "Errol (errol)" 3 dm-select-race-pick-func) + (flag "Bush Class 3" 4 dm-select-race-pick-func) + (flag "Bush Class 2" 5 dm-select-race-pick-func) + (flag "Bush Class 1" 6 dm-select-race-pick-func) + (flag "Bush Class 3R" 9 dm-select-race-pick-func) + (flag "Bush Class 2R" 10 dm-select-race-pick-func) + (flag "Bush Class 1R" 11 dm-select-race-pick-func) + (flag "Bush Errol" 7 dm-select-race-pick-func) + (flag "Bush Port" 8 dm-select-race-pick-func) + (int-var "Select Path" 0 dm-select-race-path 10 1 #t 0 7) + (menu + "Race Marks" + (flag "Path 0 (Red)" 1 display-race-marks-toggle-pick-func) + (flag "Path 1 (Green)" 2 display-race-marks-toggle-pick-func) + (flag "Path 2 (Blue)" 4 display-race-marks-toggle-pick-func) + (flag "Path 3 (Yellow)" 8 display-race-marks-toggle-pick-func) + (flag "Path 4 (Cyan)" 16 display-race-marks-toggle-pick-func) + (flag "Path 5 (Violet)" 32 display-race-marks-toggle-pick-func) + (flag "Path 6 (Orange)" 64 display-race-marks-toggle-pick-func) + (flag "Path 7 (Black)" 128 display-race-marks-toggle-pick-func) + (flag "All Paths On" 255 display-race-marks-set-pick-func) + (flag "All Off" 0 display-race-marks-set-pick-func) + ) + (function + "Record Selected Path" + #f + (lambda () (set! *race-record-path* #t) (dm-play-race *select-race* #t) (none)) + ) + (function "Play Race" #f (lambda () (set! *race-record-path* #f) (dm-play-race *select-race* #f) (none))) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Nav Graph" + (function "Start Editor" #f (lambda () + (if (not (get-nav-graph-editor)) + (run-nav-graph-editor 'test) + ) + (none) + ) + ) + (function "Exit Editor" #f (lambda () + (if (get-nav-graph-editor) + (exit-nav-graph-editor) + ) + (none) + ) + ) + (function "Toggle Plane Mode" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (if a0-0 + ((method-of-object a0-0 nav-graph-editor-method-60)) + ) + ) + (none) + ) + ) + (function "Toggle Hover Mode" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (if a0-0 + ((method-of-object a0-0 nav-graph-editor-method-61)) + ) + ) + (none) + ) + ) + (menu + "Load" + (function "Hover Drillmid" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (when a0-0 + (let ((t9-1 (method-of-object a0-0 nav-graph-editor-method-62))) + 'hover + 'drillmid + (t9-1) + ) + ) + ) + (none) + ) + ) + (function "Hover Forresca" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (when a0-0 + (let ((t9-1 (method-of-object a0-0 nav-graph-editor-method-62))) + 'hover + 'forresca + (t9-1) + ) + ) + ) + (none) + ) + ) + (function "Hover Forest" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (when a0-0 + (let ((t9-1 (method-of-object a0-0 nav-graph-editor-method-62))) + 'hover + 'forest + (t9-1) + ) + ) + ) + (none) + ) + ) + (function "Hover Under" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (when a0-0 + (let ((t9-1 (method-of-object a0-0 nav-graph-editor-method-62))) + 'hover + 'under + (t9-1) + ) + ) + ) + (none) + ) + ) + (function "Traffic" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (when a0-0 + (let ((t9-1 (method-of-object a0-0 nav-graph-editor-method-62))) + 'traffic + (t9-1) + ) + ) + ) + (none) + ) + ) + (function "Minimap" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (when a0-0 + (let ((t9-1 (method-of-object a0-0 nav-graph-editor-method-62))) + 'minimap + (t9-1) + ) + ) + ) + (none) + ) + ) + ) + (function "Save" #f (lambda () + (let ((a0-0 (get-nav-graph-editor))) + (if a0-0 + ((method-of-object a0-0 nav-graph-editor-method-63)) + ) + ) + (none) + ) + ) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Map" + (flag "Record Mode" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *bigmap* recording-flag) (not (-> *bigmap* recording-flag))) + ) + (-> *bigmap* recording-flag) + ) + ) + (function + "Clear map" + #f + (lambda () (let ((v1-1 (process-spawn-function + process + (lambda () (with-pp + (set-master-mode 'game) + (let ((gp-0 (-> pp clock frame-counter))) + (until (>= (- (-> pp clock frame-counter) gp-0) (seconds 0.3)) + (suspend) + ) + ) + (until #f + (format *stdcon* "press x clear map, press circle cancel~%") + (cond + ((cpad-pressed? 0 x) + (initialize *bigmap*) + (return #f) + ) + ((cpad-pressed? 0 circle) + (return #f) + ) + ) + (suspend) + ) + #f + ) + ) + :name (symbol->string (-> process symbol)) + ) + ) + ) + (when v1-1 + (let ((v0-3 (logclear (-> v1-1 0 mask) (process-mask menu)))) + (set! (-> v1-1 0 mask) v0-3) + v0-3 + ) + ) + ) + ) + ) + (flag "Fill in" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *bigmap* fill-flag) (not (-> *bigmap* fill-flag))) + ) + (-> *bigmap* fill-flag) + ) + ) + (function + "Save" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) ((method-of-object *bigmap* bigmap-method-16)) (none)) + ) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Ocean" + (menu + "Ocean Height" + (flag "zero" 1 dm-ocean-height-func) + (flag "far-below" 2 dm-ocean-height-func) + (flag "sewer-start" 3 dm-ocean-height-func) + (flag "sewer-hi" 4 dm-ocean-height-func) + (flag "sewer-med" 5 dm-ocean-height-func) + (flag "sewer-lo" 6 dm-ocean-height-func) + ) + (menu + "Ocean Subdiv" + (flag "Textured" 0 dm-ocean-subdiv-draw-func) + (flag "Outline" 1 dm-ocean-subdiv-draw-func) + (flag "Gouraud" 2 dm-ocean-subdiv-draw-func) + ) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Time of day" + (flag "7am sunrise" 0 dm-time-of-day-func) + (flag "10am morning" 1 dm-time-of-day-func) + (flag "12pm noon" 2 dm-time-of-day-func) + (flag "2pm afternoon" 3 dm-time-of-day-func) + (flag "6pm sunset" 4 dm-time-of-day-func) + (flag "7pm twilight" 5 dm-time-of-day-func) + (flag "11pm evening" 6 dm-time-of-day-func) + (flag "4am green sun" 7 dm-time-of-day-func) + (flag "palette 0" 16 dm-time-of-day-func) + (flag "palette 1" 32 dm-time-of-day-func) + (flag "palette 2" 64 dm-time-of-day-func) + (flag "palette 3" 128 dm-time-of-day-func) + (flag "palette 4" 256 dm-time-of-day-func) + (flag "palette 5" 512 dm-time-of-day-func) + (flag "palette 6" 1024 dm-time-of-day-func) + (flag "palette 7" 2048 dm-time-of-day-func) + (flag "on" #f dm-time-of-day-pick-func) + (flag "Fast" *time-of-day-fast* dm-time-of-day-func2) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Mood" + (flag + "Overide Enable" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *time-of-day-context* overide-enable) (not (-> *time-of-day-context* overide-enable))) + ) + (-> *time-of-day-context* overide-enable) + ) + ) + (menu + "Weather" + (flag + "Overide Weather Enable" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *mood-control* overide-weather-flag) (not (-> *mood-control* overide-weather-flag))) + ) + (-> *mood-control* overide-weather-flag) + ) + ) + (flag + "Display Values" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (set! (-> *mood-control* display-flag) (not (-> *mood-control* display-flag))) + ) + (-> *mood-control* display-flag) + ) + ) + (float-var + "Clouds" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *mood-control* (nonzero? *mood-control*)) + (let ((f0-0 arg2)) + (set! (-> *mood-control* overide cloud) f0-0) + f0-0 + ) + ) + ) + ((or (not *mood-control*) (zero? *mood-control*)) + 0.0 + ) + (else + (-> *mood-control* overide cloud) + ) + ) + ) + 1 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.0) + 0 + ) + (float-var + "Fog" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *mood-control* (nonzero? *mood-control*)) + (let ((f0-0 arg2)) + (set! (-> *mood-control* overide fog) f0-0) + f0-0 + ) + ) + ) + ((or (not *mood-control*) (zero? *mood-control*)) + 0.0 + ) + (else + (-> *mood-control* overide fog) + ) + ) + ) + 1 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.0) + 0 + ) + ) + (menu + "Colors" + (flag "7am sunrise" 0 dm-time-of-day-func) + (flag "10am morning" 1 dm-time-of-day-func) + (flag "12pm noon" 2 dm-time-of-day-func) + (flag "2pm afternoon" 3 dm-time-of-day-func) + (flag "6pm sunset" 4 dm-time-of-day-func) + (flag "7pm twilight" 5 dm-time-of-day-func) + (flag "11pm evening" 6 dm-time-of-day-func) + (flag "4am green sun" 7 dm-time-of-day-func) + (flag "time of day on" #f dm-time-of-day-pick-func) + (float-var + "Ambient Red" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + x + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*)) + 0.0 + ) + (else + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + x + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Ambient Green" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + y + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*)) + 0.0 + ) + (else + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + y + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Ambient Blue" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + z + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*)) + 0.0 + ) + (else + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + z + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Ambient Mult" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + w + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*)) + 0.0 + ) + (else + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + w + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 2 + 0 + ) + (float-var + "Light Red" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + x + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*)) + 0.0 + ) + (else + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + x + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Light Green" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + y + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*)) + 0.0 + ) + (else + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + y + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Light Blue" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + z + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*)) + 0.0 + ) + (else + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + z + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Light Mult" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-color-table* (nonzero? *overide-mood-color-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + w + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-color-table*) (zero? *overide-mood-color-table*)) + 0.0 + ) + (else + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + w + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 2 + 0 + ) + (function + "reset selected time" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (mem-copy! + (the-as + pointer + (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + ) + ) + (the-as + pointer + (-> *mood-control* + mood-color-table + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + ) + ) + 32 + ) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + lgt-color + w + ) + 1.0 + ) + (let ((f0-1 1.0)) + (set! (-> *overide-mood-color-table* + data + (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2)) + amb-color + w + ) + f0-1 + ) + f0-1 + ) + ) + ) + (function + "reset all times" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (mem-copy! + (the-as pointer *overide-mood-color-table*) + (the-as pointer (-> *mood-control* mood-color-table)) + 256 + ) + (dotimes (v1-1 8) + (set! (-> *overide-mood-color-table* data v1-1 lgt-color w) 1.0) + (set! (-> *overide-mood-color-table* data v1-1 amb-color w) 1.0) + ) + (the-as float #f) + ) + ) + ) + (menu + "Fog" + (flag "7am sunrise" 0 dm-time-of-day-func) + (flag "10am morning" 1 dm-time-of-day-func) + (flag "12pm noon" 2 dm-time-of-day-func) + (flag "2pm afternoon" 3 dm-time-of-day-func) + (flag "6pm sunset" 4 dm-time-of-day-func) + (flag "7pm twilight" 5 dm-time-of-day-func) + (flag "11pm evening" 6 dm-time-of-day-func) + (flag "4am green sun" 7 dm-time-of-day-func) + (flag "time of day on" #f dm-time-of-day-pick-func) + (float-var + "Red" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + x + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*)) + 0.0 + ) + (else + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + x + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 1.0) + #t + 0 + 255 + 0 + ) + (float-var + "Green" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + y + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*)) + 0.0 + ) + (else + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + y + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 1.0) + #t + 0 + 255 + 0 + ) + (float-var + "Blue" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + z + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*)) + 0.0 + ) + (else + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + z + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 1.0) + #t + 0 + 255 + 0 + ) + (float-var + "Mult" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + w + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*)) + 0.0 + ) + (else + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + w + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 1 + 0 + ) + (float-var + "Start" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + x + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*)) + 0.0 + ) + (else + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + x + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 1.0) + #t + -1000 + 10000 + 0 + ) + (float-var + "End" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + y + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*)) + 0.0 + ) + (else + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + y + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 1.0) + #t + 0 + 10000 + 0 + ) + (float-var + "Max" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + w + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*)) + 0.0 + ) + (else + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + w + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.5) + #t + 0 + 255 + 0 + ) + (float-var + "Min" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *overide-mood-fog-table* (nonzero? *overide-mood-fog-table*)) + (let ((f0-0 arg2)) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + z + ) + f0-0 + ) + f0-0 + ) + ) + ) + ((or (not *overide-mood-fog-table*) (zero? *overide-mood-fog-table*)) + 0.0 + ) + (else + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + z + ) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.5) + #t + 0 + 255 + 0 + ) + (function + "reset selected time" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (mem-copy! + (the-as + pointer + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + ) + ) + (the-as + pointer + (-> *mood-control* + mood-fog-table + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + ) + ) + 48 + ) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-color + w + ) + 1.0 + ) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + x + ) + (* 0.00024414062 + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + x + ) + ) + ) + (let ((f0-4 + (* 0.00024414062 + (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + y + ) + ) + ) + ) + (set! (-> *overide-mood-fog-table* + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + fog-dists + y + ) + f0-4 + ) + f0-4 + ) + ) + ) + (function + "reset all times" + #f + (lambda () + (mem-copy! (the-as pointer *overide-mood-fog-table*) (the-as pointer (-> *mood-control* mood-fog-table)) 384) + (dotimes (v1-1 8) + (set! (-> *overide-mood-fog-table* data v1-1 fog-color w) 1.0) + (set! (-> *overide-mood-fog-table* data v1-1 fog-dists x) + (* 0.00024414062 (-> *overide-mood-fog-table* data v1-1 fog-dists x)) + ) + (set! (-> *overide-mood-fog-table* data v1-1 fog-dists y) + (* 0.00024414062 (-> *overide-mood-fog-table* data v1-1 fog-dists y)) + ) + ) + #f + ) + ) + ) + (menu + "Palette" + (flag "palette 0" 0 dm-time-of-day-palette-func) + (flag "palette 1" 1 dm-time-of-day-palette-func) + (flag "palette 2" 2 dm-time-of-day-palette-func) + (flag "palette 3" 3 dm-time-of-day-palette-func) + (flag "palette 4" 4 dm-time-of-day-palette-func) + (flag "palette 5" 5 dm-time-of-day-palette-func) + (flag "palette 6" 6 dm-time-of-day-palette-func) + (flag "palette 7" 7 dm-time-of-day-palette-func) + (flag "time of day on" #f dm-time-of-day-pick-func) + (float-var + "Red" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) x) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) x) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Green" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) y) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) y) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Blue" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) z) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) z) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Mult" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) w) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette) w) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 2 + 0 + ) + (function + "reset selected time" + #f + (lambda () (let ((v0-0 (-> *time-of-day-context* times (-> *time-of-day-context* overide-palette)))) + (set! (-> v0-0 x) 1.0) + (set! (-> v0-0 y) 1.0) + (set! (-> v0-0 z) 1.0) + (set! (-> v0-0 w) 1.0) + v0-0 + ) + ) + ) + (function "reset all times" #f (lambda () + (dotimes (v1-0 8) + (set-vector! (-> *time-of-day-context* times v1-0) 1.0 1.0 1.0 1.0) + ) + #f + ) + ) + ) + (menu + "Filter" + (float-var + "Red" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* filter-color x) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* filter-color x) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Green" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* filter-color y) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* filter-color y) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Blue" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* filter-color z) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* filter-color z) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Mult" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* filter-color w) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* filter-color w) + ) + ) + ) + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 2 + 0 + ) + (function "reset filter" #f (lambda () (let ((v0-0 (-> *time-of-day-context* filter-color))) + (set! (-> v0-0 x) 1.0) + (set! (-> v0-0 y) 1.0) + (set! (-> v0-0 z) 1.0) + (set! (-> v0-0 w) 1.0) + (the-as symbol v0-0) + ) + ) + ) + ) + (menu + "Sky" + (float-var + "Cloud Min" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* current-clouds cloud-min) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* current-clouds cloud-min) + ) + ) + ) + 1 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 1 + 0 + ) + (float-var + "Cloud Max" + #f + (lambda ((arg0 object) (arg1 debug-menu-msg) (arg2 float)) + (cond + ((= arg1 (debug-menu-msg press)) + (when (and *time-of-day-context* (nonzero? *time-of-day-context*)) + (let ((f0-0 arg2)) + (set! (-> *time-of-day-context* current-clouds cloud-max) f0-0) + f0-0 + ) + ) + ) + ((or (not *time-of-day-context*) (zero? *time-of-day-context*)) + 0.0 + ) + (else + (-> *time-of-day-context* current-clouds cloud-max) + ) + ) + ) + 1 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 1 + 0 + ) + (function + "reset sky" + #f + (lambda () + (set! (-> *time-of-day-context* current-clouds cloud-min) (-> *mood-control* mood-clouds cloud-min)) + (let ((f0-1 (-> *mood-control* mood-clouds cloud-max))) + (set! (-> *time-of-day-context* current-clouds cloud-max) f0-1) + f0-1 + ) + ) + ) + ) + (function "Print mood tables" #f (lambda () (print-mood-tables) (none))) + (function + "reset everything" + #f + (lambda () + (mem-copy! + (the-as pointer *overide-mood-color-table*) + (the-as pointer (-> *mood-control* mood-color-table)) + 256 + ) + (mem-copy! (the-as pointer *overide-mood-fog-table*) (the-as pointer (-> *mood-control* mood-fog-table)) 384) + (dotimes (v1-2 8) + (set! (-> *overide-mood-color-table* data v1-2 lgt-color w) 1.0) + (set! (-> *overide-mood-color-table* data v1-2 amb-color w) 1.0) + (set! (-> *overide-mood-fog-table* data v1-2 fog-color w) 1.0) + (set! (-> *overide-mood-fog-table* data v1-2 fog-dists x) + (* 0.00024414062 (-> *overide-mood-fog-table* data v1-2 fog-dists x)) + ) + (set! (-> *overide-mood-fog-table* data v1-2 fog-dists y) + (* 0.00024414062 (-> *overide-mood-fog-table* data v1-2 fog-dists y)) + ) + (set-vector! (-> *time-of-day-context* times v1-2) 1.0 1.0 1.0 1.0) + ) + (set-vector! (-> *time-of-day-context* filter-color) 1.0 1.0 1.0 1.0) + (set! (-> *time-of-day-context* current-clouds cloud-min) (-> *mood-control* mood-clouds cloud-min)) + (let ((f0-16 (-> *mood-control* mood-clouds cloud-max))) + (set! (-> *time-of-day-context* current-clouds cloud-max) f0-16) + f0-16 + ) + ) + ) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Sound" + (flag "Effect Debug" *debug-effect-control* dm-boolean-toggle-pick-func) + (flag "Regions" *execute-regions* dm-boolean-toggle-pick-func) + (flag "Region Marks" *display-region-marks* dm-boolean-toggle-pick-func) + (flag "Sound channels" *display-iop-info* dm-boolean-toggle-pick-func) + (function "Reload Banks" #f sound-bank-reload) + (function "List Sounds" #f (lambda () (list-sounds) (none))) + (function "IOP Info" #f (lambda () (loader-test-command (sound-command iop-mem) (the-as uint 0)) (none))) + ) + ) + ) + (debug-menu-append-item s5-0 (debug-menu-make-shader-menu arg0)) + (debug-menu-append-item s5-0 (debug-menu-make-instance-menu arg0)) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Bug Report" + (flag "display" *display-bug-report* dm-boolean-toggle-pick-func) + (flag "screen" *stdcon* dm-bug-report-output-pick-func) + (flag "listener" listener dm-bug-report-output-pick-func) + (flag "file" file-stream dm-bug-report-output-pick-func) + (function "visgood" "visgood" dm-bug-report-report-pick-func) + (function "visbad" "visbad" dm-bug-report-report-pick-func) + (function "collision" "collision" dm-bug-report-report-pick-func) + ) + ) + ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template + arg0 + '(menu + "Scene" + (menu + "Scene Info" + (flag "channel" 1 display-scene-control-toggle-pick-func) + (flag "anim name" 2 display-scene-control-toggle-pick-func) + (flag "dma size" 4 display-scene-control-toggle-pick-func) + (flag "bounds spheres" 8 display-scene-control-toggle-pick-func) + (flag "actors" 16 display-scene-control-toggle-pick-func) + (flag "actor-marks" 32 display-scene-control-toggle-pick-func) + (flag "special fma spheres" 64 display-scene-control-toggle-pick-func) + (flag "all on" 95 display-scene-control-set-pick-func) + (flag "all off" 0 display-scene-control-set-pick-func) + ) + (menu + "city" + (function "city-help-kid-intro" ("ctyslumb-fort" "city-help-kid-intro") dm-scene-load-pick-func) + (function "city-help-kid-resolution" ("ctyslumb-fort" "city-help-kid-resolution") dm-scene-load-pick-func) + (function + "city-intercept-tanker-intro" + ("ctymarkb-tanker" "city-intercept-tanker-intro") + dm-scene-load-pick-func + ) + (function "city-intercept-tanker-res" ("ctymarkb-tanker" "city-intercept-tanker-res") dm-scene-load-pick-func) + (function "city-get-yellow-gun" ("gungame-movie" "city-get-yellow-gun") dm-scene-load-pick-func) + (function "city-get-hoverboard" ("ctyfarma-airlock-movie" "city-get-hoverboard") dm-scene-load-pick-func) + (function "city-get-dark-gun" ("gungame-movie" "city-get-dark-gun") dm-scene-load-pick-func) + (function "city-meet-brutter-res" ("kiosk-start" "city-meet-brutter-res") dm-scene-load-pick-func) + (function "city-save-lurkers-intro" ("kiosk-start" "city-save-lurkers-intro") dm-scene-load-pick-func) + (function + "city-errol-challenge-res" + ("garage-start-class3" "city-errol-challenge-res") + dm-scene-load-pick-func + ) + (function "city-air-train-in-caspad" ("ctyport-air-train" "city-air-train-in-caspad") dm-scene-load-pick-func) + (function "city-air-train-in-nest" ("ctyport-air-train" "city-air-train-in-nest") dm-scene-load-pick-func) + (function "city-air-train-out" ("ctyport-air-train" "city-air-train-out") dm-scene-load-pick-func) + (function + "city-ashelin-drop-off" + ("ctyport-air-train-ashelin" "city-ashelin-drop-off") + dm-scene-load-pick-func + ) + (function + "city-protect-slums-intro" + ("ctyslumc-seal-movie" "city-protect-slums-intro") + dm-scene-load-pick-func + ) + ) + (menu + "atoll" + (function "atoll-1-res" ("atoll-movie" "atoll-1-res") dm-scene-load-pick-func) + (function "atoll-save-ashelin-res-a" ("atoll-movie" "atoll-save-ashelin-res-a") dm-scene-load-pick-func) + (function "atoll-save-ashelin-res-b" ("atoll-movie" "atoll-save-ashelin-res-b") dm-scene-load-pick-func) + (function "atoll-sig-intro" ("atoll-movie" "atoll-sig-intro") dm-scene-load-pick-func) + (function "atoll-sig-tank" ("atoll-movie" "atoll-sig-tank") dm-scene-load-pick-func) + (function "atoll-sniper-a" ("atoll-movie" "atoll-sniper-a") dm-scene-load-pick-func) + (function "atoll-sniper-b" ("atoll-movie" "atoll-sniper-b") dm-scene-load-pick-func) + (function "atoll-sniper-c" ("atoll-movie" "atoll-sniper-c") dm-scene-load-pick-func) + (function "atoll-sniper-d" ("atoll-movie" "atoll-sniper-d") dm-scene-load-pick-func) + (function "atoll-sniper-e" ("atoll-movie" "atoll-sniper-e") dm-scene-load-pick-func) + ) + (menu + "canyon" + (function "canyon-insert-items-intro" ("mountain-movie" "canyon-insert-items-intro") dm-scene-load-pick-func) + (function "canyon-insert-items-res" ("mincan-city" "canyon-insert-items-res") dm-scene-load-pick-func) + ) + (menu + "caspad" + (function "caspad-air-train-in" ("caspad-warp" "caspad-air-train-in") dm-scene-load-pick-func) + (function "caspad-air-train-out" ("caspad-warp" "caspad-air-train-out") dm-scene-load-pick-func) + ) + (menu + "castle" + (function + "castle-krew-boss-fight-intro" + ("casboss-start" "castle-krew-boss-fight-intro") + dm-scene-load-pick-func + ) + (function "castle-krew-boss-fight-res" ("casboss-start" "castle-krew-boss-fight-res") dm-scene-load-pick-func) + ) + (menu + "consite" + (function "consite-find-baron-res" ("consite-start" "consite-find-baron-res") dm-scene-load-pick-func) + ) + (menu + "dig" + (function "dig-find-totem-res" ("dig-totem" "dig-find-totem-res") dm-scene-load-pick-func) + (function "dig-digger-explode" ("dig1-start" "dig-digger-explode") dm-scene-load-pick-func) + ) + (menu + "drill" + (function "drill-top-explode" ("drillmid-checkpoint" "drill-top-explode") dm-scene-load-pick-func) + ) + (menu + "forest" + (function + "forest-protect-samos-intro-b" + ("forest-tree" "forest-protect-samos-intro-b") + dm-scene-load-pick-func + ) + (function "forest-protect-samos-res" ("forest-tree" "forest-protect-samos-res") dm-scene-load-pick-func) + ) + (menu + "fortress" + (function + "fortress-blow-up-ammo-res-a" + ("fordumpc-start" "fortress-blow-up-ammo-res-a") + dm-scene-load-pick-func + ) + (function + "fortress-blow-up-ammo-res-b" + ("fordumpc-explode-movie" "fortress-blow-up-ammo-res-b") + dm-scene-load-pick-func + ) + (function "fortress-save-friends-res" ("prison-start" "fortress-save-friends-res") dm-scene-load-pick-func) + (function + "test-fortress-blow-up-ammo-res-b-a" + ("fordumpc-explode-movie" "test-fortress-blow-up-ammo-res-b-a") + dm-scene-load-pick-func + ) + (function "test-fortress-blast" ("fordumpc-explode-movie" "test-fortress-blast") dm-scene-load-pick-func) + ) + (menu + "hideout" + (function "city-krew-delivery-intro" ("hideout-start" "city-krew-delivery-intro") dm-scene-load-pick-func) + (function + "city-destroy-guard-vehicles-intro" + ("hideout-start" "city-destroy-guard-vehicles-intro") + dm-scene-load-pick-func + ) + (function "ruins-sacred-intro" ("hideout-start" "ruins-sacred-intro") dm-scene-load-pick-func) + (function "ruins-tower-intro" ("ctysluma-tower-intro" "ruins-tower-intro") dm-scene-load-pick-func) + (function "vin-rescue-intro" ("hideout-start" "vin-rescue-intro") dm-scene-load-pick-func) + (function "fortress-2-intro" ("hideout-start" "fortress-2-intro") dm-scene-load-pick-func) + (function "atoll-1-int" ("hideout-start" "atoll-1-int") dm-scene-load-pick-func) + (function "atoll-3-intro" ("hideout-start" "atoll-3-intro") dm-scene-load-pick-func) + (function + "city-shuttle-underground-intro" + ("hideout-start" "city-shuttle-underground-intro") + dm-scene-load-pick-func + ) + (function "city-escort-kid-intro" ("escort-kid-intro" "city-escort-kid-intro") dm-scene-load-pick-func) + (function "city-stop-bomb-bots-intro" ("hideout-start" "city-stop-bomb-bots-intro") dm-scene-load-pick-func) + (function + "forest-catch-metal-heads-intro" + ("hideout-start" "forest-catch-metal-heads-intro") + dm-scene-load-pick-func + ) + (function + "fortress-save-friends-intro-a" + ("hideout-start" "fortress-save-friends-intro-a") + dm-scene-load-pick-func + ) + ) + (menu + "hiphog" + (function "atoll-2-intro" ("hiphog-start" "atoll-2-intro") dm-scene-load-pick-func) + (function "sewer-1-intro" ("hiphog-start" "sewer-1-intro") dm-scene-load-pick-func) + (function "sewer-1-res" ("hiphog-start" "sewer-1-res") dm-scene-load-pick-func) + (function "sewer-2-intro" ("hiphog-start" "sewer-2-intro") dm-scene-load-pick-func) + (function "krew-delivery-res" ("hiphog-start" "krew-delivery-res") dm-scene-load-pick-func) + (function "city-meet-brutter-intro" ("hiphog-start" "city-meet-brutter-intro") dm-scene-load-pick-func) + (function "city-keira-delivery-intro" ("hiphog-start" "city-keira-delivery-intro") dm-scene-load-pick-func) + (function "city-krew-collection-intro" ("hiphog-start" "city-krew-collection-intro") dm-scene-load-pick-func) + (function "city-krew-collection-res" ("hiphog-start" "city-krew-collection-res") dm-scene-load-pick-func) + (function + "forest-hunt-camo-metal-heads-intro" + ("hiphog-start" "forest-hunt-camo-metal-heads-intro") + dm-scene-load-pick-func + ) + (function "sewer-blow-up-statue-intro" ("hiphog-start" "sewer-blow-up-statue-intro") dm-scene-load-pick-func) + (function "city-errol-challenge-intro" ("hiphog-start" "city-errol-challenge-intro") dm-scene-load-pick-func) + (function "city-whack-a-metal-intro" ("hiphog-start" "city-whack-a-metal-intro") dm-scene-load-pick-func) + (function "city-whack-a-metal-res" ("hiphog-start" "city-whack-a-metal-res") dm-scene-load-pick-func) + ) + (menu + "intro/outro" + (function + "intro" + ("village1-start" ("intro-samos-hut" "intro-vortex" "intro-city-square" "intro-prison")) + dm-scene-load-pick-func + ) + (function "intro-samos-hut" ("village1-start" "intro-samos-hut") dm-scene-load-pick-func) + (function "intro-vortex" ("village1-start" "intro-vortex") dm-scene-load-pick-func) + (function "intro-city-square" ("ctyindb-intro-start" "intro-city-square") dm-scene-load-pick-func) + (function "intro-prison" ("prison-intro-start" "intro-prison") dm-scene-load-pick-func) + (function + "outro" + ("nestb-outro" ("outro-nest" "outro-palace" "outro-hiphog" "outro-port")) + dm-scene-load-pick-func + ) + (function "outro-nest" ("nestb-outro" "outro-nest") dm-scene-load-pick-func) + (function "outro-palace" ("throne-outro" "outro-palace") dm-scene-load-pick-func) + (function "outro-hiphog" ("hiphog-outro" "outro-hiphog") dm-scene-load-pick-func) + (function "outro-port" ("ctyport-outro" "outro-port") dm-scene-load-pick-func) + ) + (menu + "mountain" + (function "mtn-step-plat-rocks-a" ("mountain-start" "mtn-step-plat-rocks-a") dm-scene-load-pick-func) + (function "mtn-step-plat-rocks-b" ("mountain-start" "mtn-step-plat-rocks-b") dm-scene-load-pick-func) + (function "mtn-step-plat-rocks-c" ("mountain-start" "mtn-step-plat-rocks-c") dm-scene-load-pick-func) + (function "mtn-plat-buried-rocks-a" ("mountain-start" "mtn-plat-buried-rocks-a") dm-scene-load-pick-func) + (function "mountain-lens-res" ("mountain-start" "mountain-lens-res") dm-scene-load-pick-func) + (function "mountain-shard-res" ("mountain-start" "mountain-shard-res") dm-scene-load-pick-func) + (function "mountain-gear-res" ("mountain-start" "mountain-gear-res") dm-scene-load-pick-func) + ) + (menu + "nest" + (function "nest-break-barrier-res" ("nest-gun" "nest-break-barrier-res") dm-scene-load-pick-func) + (function "nest-air-train-in" ("nest-warp" "nest-air-train-in") dm-scene-load-pick-func) + (function "nest-air-train-out" ("nest-warp" "nest-air-train-out") dm-scene-load-pick-func) + (function "nest-kor-boss-fight-intro-b" ("nestb-boss" "nest-kor-boss-fight-intro-b") dm-scene-load-pick-func) + (function "nest-kor-boss-fight-mid" ("nestb-boss" "nest-kor-boss-fight-mid") dm-scene-load-pick-func) + ) + (menu + "onintent" + (function "mountain-finditems-intro" ("onintent-start" "mountain-finditems-intro") dm-scene-load-pick-func) + (function "dig-find-totem-intro" ("onintent-start" "dig-find-totem-intro") dm-scene-load-pick-func) + (function + "forest-protect-samos-intro-a" + ("onintent-start" "forest-protect-samos-intro-a") + dm-scene-load-pick-func + ) + (function "city-play-onin-game-intro" ("onintent-start" "city-play-onin-game-intro") dm-scene-load-pick-func) + (function "city-play-onin-game-res" ("onintent-start" "city-play-onin-game-res") dm-scene-load-pick-func) + (function + "test-mountain-finditems-intro" + ("onintent-start" "test-mountain-finditems-intro") + dm-scene-load-pick-func + ) + ) + (menu + "oracle" + (function "city-oracle-intro" ("oracle-start" "city-oracle-intro") dm-scene-load-pick-func) + (function "city-oracle-level-0" ("oracle-start" "city-oracle-level-0") dm-scene-load-pick-func) + (function "city-oracle-level-1" ("oracle-start" "city-oracle-level-1") dm-scene-load-pick-func) + (function "city-oracle-level-2" ("oracle-start" "city-oracle-level-2") dm-scene-load-pick-func) + (function "city-oracle-level-3" ("oracle-start" "city-oracle-level-3") dm-scene-load-pick-func) + ) + (menu + "palace" + (function "palace-outside-window-res" ("palroof-throne" "palace-outside-window-res") dm-scene-load-pick-func) + (function + "palace-outside-window-res-b" + ("palroof-boss" "palace-outside-window-res-b") + dm-scene-load-pick-func + ) + (function "palace-boss-res" ("palroof-boss" "palace-boss-res") dm-scene-load-pick-func) + (function "palace-sneak-in-res" ("palroof-throne" "palace-sneak-in-res") dm-scene-load-pick-func) + ) + (menu + "ruins" + (function "ruins-tower-victory" ("ruins-hut" "ruins-tower-victory") dm-scene-load-pick-func) + (function "ruins-sacred-victory" ("ruins-hut" "ruins-sacred-victory") dm-scene-load-pick-func) + (function "ruins-get-to-hut-res" ("ruins-hut" "ruins-get-to-hut-res") dm-scene-load-pick-func) + (function "test-scene" ("ruins-hut" "test-scene") dm-scene-load-pick-func) + ) + (menu + "sewer" + (function "sewer-drain-res" ("sewer-start" "sewer-drain-res") dm-scene-load-pick-func) + (function "sewer-blow-up-statue-res" ("sewesc-start" "sewer-blow-up-statue-res") dm-scene-load-pick-func) + (function "sewer-hosehead" ("sewesc-start" "sewer-hosehead") dm-scene-load-pick-func) + ) + (menu + "stadium" + (function + "city-keira-hover-challenge-intro" + ("garage-start-skate" "city-keira-hover-challenge-intro") + dm-scene-load-pick-func + ) + (function + "city-keira-hover-challenge-res" + ("garage-start-skate" "city-keira-hover-challenge-res") + dm-scene-load-pick-func + ) + (function + "city-class-1-race-intro-a" + ("garage-class3-movie" "city-class-1-race-intro-a") + dm-scene-load-pick-func + ) + (function "city-class-1-race-intro-b" ("stadiumd-start" "city-class-1-race-intro-b") dm-scene-load-pick-func) + (function "city-class-1-race-res" ("stadiumd-start" "city-class-1-race-res") dm-scene-load-pick-func) + (function "city-class-3-race-intro" ("garage-class3-movie" "city-class-3-race-intro") dm-scene-load-pick-func) + (function "city-class-3-race-res" ("garage-class3-movie" "city-class-3-race-res") dm-scene-load-pick-func) + (function "city-put-hoverboard" ("skatea-start" "city-put-hoverboard") dm-scene-load-pick-func) + (function "city-class-2-race-intro" ("garage-class3-movie" "city-class-2-race-intro") dm-scene-load-pick-func) + (function "city-class-2-race-res" ("garage-class3-movie" "city-class-2-race-res") dm-scene-load-pick-func) + (function "city-defend-stadium-intro" ("stadium-blimp" "city-defend-stadium-intro") dm-scene-load-pick-func) + (function "city-defend-stadium-res" ("stadium-blimp" "city-defend-stadium-res") dm-scene-load-pick-func) + ) + (menu + "strip" + (function "crane-victory" ("strip-start" "crane-victory") dm-scene-load-pick-func) + (function "ecowells-victory" ("strip-start" "ecowells-victory") dm-scene-load-pick-func) + (function "vin-rescue" ("strip-start" "vin-rescue") dm-scene-load-pick-func) + (function "test-crane-victory" ("strip-start" "test-crane-victory") dm-scene-load-pick-func) + ) + (menu + "tomb" + (function "tomb-face-tests-intro" ("tombd-start" "tomb-face-tests-intro") dm-scene-load-pick-func) + (function "tomb-boulder-start" ("tomb-boulder" "tomb-boulder-start") dm-scene-load-pick-func) + (function "tomb-spider-scare" ("tomb-boulder-explode" "tomb-spider-scare") dm-scene-load-pick-func) + (function "tomb-unlock-start" ("tomb-water-switch" "tomb-unlock-start") dm-scene-load-pick-func) + (function "tomb-unlock-water" ("tomb-water-switch" "tomb-unlock-water") dm-scene-load-pick-func) + (function "tomb-unlock-poles" ("tomb-poles-switch" "tomb-unlock-poles") dm-scene-load-pick-func) + (function "tomb-boss-open" ("tombboss-start" "tomb-boss-open") dm-scene-load-pick-func) + (function "tomb-boss-intro" ("tombboss-start" "tomb-boss-intro") dm-scene-load-pick-func) + (function "tomb-boss-res" ("tombboss-start" "tomb-boss-res") dm-scene-load-pick-func) + ) + (menu + "under" + (function "under-find-sig-res" ("under-start" "under-find-sig-res") dm-scene-load-pick-func) + (function "under-centipede-one" ("under-start" "under-centipede-one") dm-scene-load-pick-func) + (function "under-centipede-two" ("under-start" "under-centipede-two") dm-scene-load-pick-func) + (function "under-centipede-three" ("under-start" "under-centipede-three") dm-scene-load-pick-func) + (function "under-get-sig-out-res" ("under-start" "under-get-sig-out-res") dm-scene-load-pick-func) + ) + (menu + "vinroom" + (function "crane-intro" ("vinroom-start" "crane-intro") dm-scene-load-pick-func) + (function + "drill-kill-metal-heads-intro" + ("vinroom-start" "drill-kill-metal-heads-intro") + dm-scene-load-pick-func + ) + (function "ecowells-intro" ("vinroom-start" "ecowells-intro") dm-scene-load-pick-func) + (function "city-switch-on-power-intro" ("vinroom-start" "city-switch-on-power-intro") dm-scene-load-pick-func) + (function + "dig-knock-down-scaffolding-intro" + ("vinroom-start" "dig-knock-down-scaffolding-intro") + dm-scene-load-pick-func + ) + (function "drill-destroy-ship-intro" ("vinroom-start" "drill-destroy-ship-intro") dm-scene-load-pick-func) + (function + "drill-destroy-control-tower-intro" + ("vinroom-start" "drill-destroy-control-tower-intro") + dm-scene-load-pick-func + ) + ) + (menu "demo" (function "demo-disk-intro" ("demo-movie" "demo-disk-intro") dm-scene-load-pick-func)) + (menu + "cover-test" + (function "cover-test-1" ("chartest-1" "cover-test-1") dm-scene-load-pick-func) + (function "cover-test-2" ("chartest-1" "cover-test-2") dm-scene-load-pick-func) + ) + ) + ) + ) + (debug-menu-append-item s5-0 (debug-menu-make-task-menu arg0)) + (debug-menu-append-item s5-0 (the-as debug-menu-node (debug-menu-make-play-menu (the-as symbol arg0)))) + ) + ) + arg0 + ) + +;; definition for symbol *popup-menu-context*, type debug-menu-context +(define *popup-menu-context* (new 'debug 'debug-menu-context)) + +;; definition for function popup-menu-context-make-default-menus +(defun popup-menu-context-make-default-menus ((arg0 debug-menu-context)) + (debug-menu-make-from-template + arg0 + '(main-menu + "Popup" + (flag "Cam 1" pad-1 dm-cam-externalize) + (flag "Target" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (if *target* + (stop 'debug) + (start 'debug (get-current-continue-point *game-info*)) + ) + ) + *target* + ) + ) + (menu + "Mode" + (function "normal" #f (lambda () (send-event *target* 'end-mode))) + (function "racer" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'racer #f) + ) + ) + (function "flut" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'flut #f) + ) + ) + (function "board" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (logior! (-> *game-info* features) (game-feature board)) + (logior! (-> *game-info* debug-features) (game-feature board)) + (send-event *target* 'change-mode 'board #f) + ) + ) + (function "mech" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'mech #f) + ) + ) + (function "gun" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (logior! (-> *game-info* features) (game-feature unk-game-feature-06)) + (logior! (-> *game-info* debug-features) (game-feature unk-game-feature-06)) + (send-event *target* 'change-mode 'gun #f 0) + ) + ) + (function "darkjak" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (logior! (-> *game-info* features) (game-feature darkjak)) + (logior! (-> *game-info* debug-features) (game-feature darkjak)) + (send-event *target* 'change-mode 'darkjak #f 3) + ) + ) + (function "indax" #f (lambda () + (if (not *target*) + (start 'debug (get-current-continue-point *game-info*)) + ) + (send-event *target* 'change-mode 'indax #f) + ) + ) + ) + (flag "Game" #f (lambda ((arg0 object) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (let ((v1-3 (-> *game-info* mode))) + (set! (-> *game-info* mode) (cond + ((= v1-3 'play) + 'debug + ) + ((= v1-3 'debug) + 'play + ) + (else + (-> *game-info* mode) + ) + ) + ) + ) + ) + (= (-> *game-info* mode) 'play) + ) + ) + (function "Clean" #f (lambda () + (if (time-of-day-setup #f) + (time-of-day-setup #t) + ) + (play-clean #f) + (none) + ) + ) + (flag "Stats" *stats-target* dm-boolean-toggle-pick-func) + (function "Reset" #f (lambda () (reset-actors 'debug) (none))) + (function "Start" #f (lambda () (start 'play (-> *game-info* current-continue)) (none))) + (function "Editor" #f (lambda () + (kill-by-type editable-player *active-pool*) + (process-spawn + editable-player + :init editable-player-init + #f + :name (symbol->string (-> editable-player symbol)) + :to *entity-pool* + ) + (set-master-mode 'game) + (none) + ) + ) + ) + ) + arg0 + ) + +;; failed to figure out what this is: +(debug-menu-context-make-default-menus *debug-menu-context*) + +;; failed to figure out what this is: +(popup-menu-context-make-default-menus *popup-menu-context*) + +;; definition for function menu-respond-to-pause +(defun menu-respond-to-pause () + (case *master-mode* + (('menu) + (cond + ((and (cpad-hold? 0 l3) (cpad-hold? 0 select)) + (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg activate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + ) + ((and (cpad-hold? 1 start) *editable*) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg activate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + ) + ((and (cpad-hold? 0 l3) (cpad-hold? 0 start)) + (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg activate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + ) + ) + ) + (else + (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + ) + ) + #f + ) + +;; definition for function *menu-hook* +(defun *menu-hook* () + (debug-menus-handler *debug-menu-context*) + (debug-menus-handler *popup-menu-context*) + ) + +) 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 ad3e4482ae..c70566d24b 100644 --- a/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/entity/entity-h_REF.gc @@ -345,11 +345,11 @@ ;; definition of type entity-info (deftype entity-info (basic) - ((ptype type :offset-assert 4) - (package basic :offset-assert 8) - (art-group pair :offset-assert 12) - (pool basic :offset-assert 16) - (heap-size int32 :offset-assert 20) + ((ptype type :offset-assert 4) + (package string :offset-assert 8) + (art-group pair :offset-assert 12) + (pool symbol :offset-assert 16) + (heap-size int32 :offset-assert 20) ) :method-count-assert 9 :size-assert #x18 diff --git a/test/decompiler/reference/jak2/engine/entity/entity-table_REF.gc b/test/decompiler/reference/jak2/engine/entity/entity-table_REF.gc new file mode 100644 index 0000000000..8f632fe724 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/entity/entity-table_REF.gc @@ -0,0 +1,218 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *entity-info*, type (array entity-info) +(define *entity-info* (the-as (array entity-info) (new 'static 'boxed-array :type entity-info + (new 'static 'entity-info + :ptype (type-ref stadium-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref citywide-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctywide-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref tomb-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctyslumb-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctygena-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctyindb-part :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref jellyfish :method-count 167) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x10000 + ) + (new 'static 'entity-info + :ptype (type-ref widow :method-count 47) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x10000 + ) + (new 'static 'entity-info + :ptype (type-ref nav-graph :method-count 47) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref pal-electric-fan :method-count 23) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x6000 + ) + (new 'static 'entity-info + :ptype (type-ref lurker-pipe-lid :method-count 31) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref ctyn-lamp :method-count 31) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref burning-bush :method-count 35) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref sail-boat-a :method-count 179) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref barge :method-count 151) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref propa :method-count 35) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref city-window-a :method-count 179) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref cty-window-a :method-count 179) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref parking-spot :method-count 27) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref security-wall :method-count 27) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref cty-guard-turret :method-count 39) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref cty-fruit-stand :method-count 31) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref fruit-stand :method-count 31) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref torn :method-count 179) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x4000 + ) + (new 'static 'entity-info + :ptype (type-ref neon-baron :method-count 19) + :package "game" + :art-group '() + :pool '*16k-dead-pool* + :heap-size #x10000 + ) + ) + ) + ) + +;; definition for function entity-info-lookup +;; INFO: Return type mismatch basic vs entity-info. +(defun entity-info-lookup ((arg0 type)) + "Given a type, return the [[entity-info]] from [[*entity-info*]] whos type + matches the `ptype` field. Set's `method 13` on said type that returns the `length` + off the [[entity-info]] + + If nothing matches, set `method 13` to `#f` and return `#f`" + (the-as entity-info (cond + ((nonzero? (-> arg0 method-table 13)) + (-> arg0 method-table 13) + ) + (else + (let ((v1-1 *entity-info*)) + (dotimes (a1-0 (-> v1-1 length)) + (when (= arg0 (-> v1-1 a1-0 ptype)) + (set! (-> arg0 method-table 13) (the-as function (-> v1-1 a1-0))) + (return (the-as entity-info (-> v1-1 a1-0))) + ) + ) + ) + (set! (-> arg0 method-table 13) #f) + (the-as basic #f) + ) + ) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/entity/relocate_REF.gc b/test/decompiler/reference/jak2/engine/entity/relocate_REF.gc new file mode 100644 index 0000000000..24d8aef0b0 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/entity/relocate_REF.gc @@ -0,0 +1,421 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 7 of type process +(defmethod relocate process ((obj process) (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) + ) + (&+! (-> obj ppointer 0) arg0) + (let ((v1-5 (-> obj entity))) + (if (and v1-5 (= (-> v1-5 extra process) obj)) + (&+! (-> v1-5 extra process) arg0) + ) + ) + (let ((v1-7 (-> obj connection-list next1))) + (while (the-as connection v1-7) + (let ((a0-14 (-> v1-7 prev1))) + (if (and (>= (the-as int a0-14) (-> *kernel-context* relocating-min)) + (< (the-as int a0-14) (-> *kernel-context* relocating-max)) + ) + (&+! (-> v1-7 prev1) arg0) + ) + ) + (let ((a0-19 (-> (the-as connection v1-7) param1))) + (if (and (>= a0-19 (-> *kernel-context* relocating-min)) (< a0-19 (-> *kernel-context* relocating-max))) + (+! (-> (the-as connection v1-7) param1) arg0) + ) + ) + (let ((a0-24 (-> (the-as connection v1-7) param2))) + (if (and (>= a0-24 (-> *kernel-context* relocating-min)) (< a0-24 (-> *kernel-context* relocating-max))) + (+! (-> (the-as connection v1-7) param2) arg0) + ) + ) + (let ((a0-29 (-> (the-as connection v1-7) param3))) + (if (and (>= a0-29 (-> *kernel-context* relocating-min)) (< a0-29 (-> *kernel-context* relocating-max))) + (+! (-> (the-as connection v1-7) param3) arg0) + ) + ) + (set! v1-7 (-> (the-as connection v1-7) next1)) + ) + ) + (let ((v1-10 (-> obj self))) + (if (and (>= (the-as int v1-10) (-> *kernel-context* relocating-min)) + (< (the-as int v1-10) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj self) arg0) + ) + ) + (let ((v1-15 (-> obj ppointer))) + (if (and (>= (the-as int v1-15) (-> *kernel-context* relocating-min)) + (< (the-as int v1-15) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj ppointer) arg0) + ) + ) + (let ((s4-0 (&+ (-> obj heap-base) 4))) + (while (< (the-as int s4-0) (the-as int (-> obj heap-cur))) + (relocate s4-0 arg0) + (&+! s4-0 (logand -16 (+ (asize-of s4-0) 15))) + ) + ) + (&+! (-> obj main-thread) arg0) + (&+! (-> obj top-thread) arg0) + (&+! (-> obj heap-base) arg0) + (&+! (-> obj heap-cur) arg0) + (&+! (-> obj heap-top) arg0) + (let ((a2-4 (asize-of obj)) + (a1-22 (&-> obj type)) + ) + (cond + ((>= arg0 0) + (qmem-copy->! (&+ a1-22 arg0) a1-22 a2-4) + ) + ((< a2-4 2560) + (qmem-copy<-! (&+ a1-22 arg0) a1-22 a2-4) + ) + (else + (ultimate-memcpy (&+ a1-22 arg0) a1-22 (the-as uint a2-4)) + ) + ) + ) + (set! (-> *kernel-context* relocating-process) #f) + (&+ obj arg0) + ) + +;; definition for method 7 of type cpu-thread +(defmethod relocate cpu-thread ((obj cpu-thread) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type process-drawable +;; INFO: Return type mismatch process vs process-drawable. +(defmethod relocate process-drawable ((obj process-drawable) (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 ((a0-6 (-> obj nav))) + (if (and (nonzero? a0-6) a0-6) + (relocate a0-6 arg0) + ) + ) + (if (nonzero? (-> obj root)) + (&+! (-> obj root) arg0) + ) + (if (nonzero? (-> obj node-list)) + (&+! (-> obj node-list) arg0) + ) + (if (nonzero? (-> obj draw)) + (&+! (-> obj draw) arg0) + ) + (if (nonzero? (-> obj skel)) + (&+! (-> obj skel) arg0) + ) + (if (nonzero? (-> obj align)) + (&+! (-> obj align) arg0) + ) + (if (nonzero? (-> obj path)) + (&+! (-> obj path) arg0) + ) + (if (nonzero? (-> obj vol)) + (&+! (-> obj vol) arg0) + ) + (if (nonzero? (-> obj fact)) + (&+! (-> obj fact) arg0) + ) + (if (nonzero? (-> obj link)) + (&+! (-> obj link) arg0) + ) + (if (nonzero? (-> obj part)) + (&+! (-> obj part) arg0) + ) + (if (nonzero? (-> obj water)) + (&+! (-> obj water) arg0) + ) + (if (nonzero? (-> obj sound)) + (&+! (-> obj sound) arg0) + ) + (if (nonzero? (-> obj carry)) + (&+! (-> obj carry) arg0) + ) + (if (nonzero? (-> obj rbody)) + (&+! (-> obj rbody) arg0) + ) + (the-as process-drawable ((method-of-type process relocate) obj arg0)) + ) + +;; definition for method 7 of type collide-shape +(defmethod relocate collide-shape ((obj collide-shape) (arg0 int)) + (&+! (-> obj process) arg0) + (&+! (-> obj root-prim) arg0) + obj + ) + +;; definition for method 7 of type collide-shape-moving +;; INFO: Return type mismatch collide-shape vs collide-shape-moving. +(defmethod relocate collide-shape-moving ((obj collide-shape-moving) (arg0 int)) + (if (-> obj dynam) + (&+! (-> obj dynam) arg0) + ) + (the-as collide-shape-moving ((method-of-type collide-shape relocate) obj arg0)) + ) + +;; definition for method 7 of type collide-shape-prim +(defmethod relocate collide-shape-prim ((obj collide-shape-prim) (arg0 int)) + (&+! (-> obj cshape) arg0) + obj + ) + +;; definition for method 7 of type collide-shape-prim-group +(defmethod relocate collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 int)) + (&+! (-> obj cshape) arg0) + (set! (-> obj child) (the-as (inline-array collide-shape) (&+ (the-as pointer (-> obj child)) arg0))) + obj + ) + +;; definition for method 7 of type fact-info +(defmethod relocate fact-info ((obj fact-info) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type draw-control +(defmethod relocate draw-control ((obj draw-control) (arg0 int)) + (&+! (-> obj skeleton) arg0) + (&+! (-> obj process) arg0) + (when (-> obj ripple) + (if (-> obj ripple query) + (&+! (-> obj ripple query) arg0) + ) + (&+! (-> obj ripple) arg0) + ) + (let ((v1-14 (-> obj shadow-ctrl))) + (if (and (>= (the-as int v1-14) (-> *kernel-context* relocating-min)) + (< (the-as int v1-14) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj shadow-ctrl) arg0) + ) + ) + obj + ) + +;; definition for method 7 of type joint-control +(defmethod relocate joint-control ((obj joint-control) (arg0 int)) + (if (-> obj effect) + (&+! (-> obj effect) arg0) + ) + (if (-> obj top-anim) + (&+! (-> obj top-anim) arg0) + ) + (+! (-> obj root-channel) arg0) + (countdown (v1-10 (-> obj allocated-length)) + (&+! (-> obj channel v1-10 parent) arg0) + ) + obj + ) + +;; definition for method 7 of type cspace-array +(defmethod relocate cspace-array ((obj cspace-array) (arg0 int)) + (countdown (v1-0 (-> obj length)) + (let ((a2-2 (-> obj data v1-0))) + (if (-> a2-2 parent) + (&+! (-> a2-2 parent) arg0) + ) + (&+! (-> a2-2 bone) arg0) + (let ((a3-6 (-> a2-2 param1))) + (if (and (>= (the-as int a3-6) (-> *kernel-context* relocating-min)) + (< (the-as int a3-6) (-> *kernel-context* relocating-max)) + ) + (&+! (-> a2-2 param1) arg0) + ) + ) + (let ((a3-11 (-> a2-2 param2))) + (if (and (>= (the-as int a3-11) (-> *kernel-context* relocating-min)) + (< (the-as int a3-11) (-> *kernel-context* relocating-max)) + ) + (&+! (-> a2-2 param2) arg0) + ) + ) + ) + ) + obj + ) + +;; definition for method 7 of type path-control +(defmethod relocate path-control ((obj path-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type vol-control +(defmethod relocate vol-control ((obj vol-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type water-control +(defmethod relocate water-control ((obj water-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type actor-link-info +(defmethod relocate actor-link-info ((obj actor-link-info) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type align-control +(defmethod relocate align-control ((obj align-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type joint-mod +(defmethod relocate joint-mod ((obj joint-mod) (arg0 int)) + (&+! (-> obj process) arg0) + (&+! (-> obj joint) arg0) + obj + ) + +;; definition for method 7 of type joint-mod-wheel +(defmethod relocate joint-mod-wheel ((obj joint-mod-wheel) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type joint-mod-ik +(defmethod relocate joint-mod-ik ((obj joint-mod-ik) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type effect-control +(defmethod relocate effect-control ((obj effect-control) (arg0 int)) + (&+! (-> obj process) arg0) + obj + ) + +;; definition for method 7 of type sparticle-launch-control +(defmethod relocate sparticle-launch-control ((obj sparticle-launch-control) (arg0 int)) + (&+! (-> obj proc) arg0) + (countdown (v1-2 (-> obj length)) + (let* ((a0-4 (-> obj data v1-2)) + (a2-0 (-> a0-4 center)) + ) + (if (and (>= (the-as int a2-0) (-> *kernel-context* relocating-min)) + (< (the-as int a2-0) (-> *kernel-context* relocating-max)) + ) + (&+! (-> a0-4 center) arg0) + ) + ) + ) + (forall-particles-with-key + obj + (lambda ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (let ((v1-1 (-> *kernel-context* relocating-offset))) + (set! (-> arg1 key) (the-as sparticle-launch-control (+ (the-as int (-> arg1 key)) v1-1))) + (if (-> arg1 binding) + (set! (-> arg1 binding) (the-as sparticle-launch-state (+ (the-as int (-> arg1 binding)) v1-1))) + ) + ) + 0 + (none) + ) + #t + #t + ) + obj + ) + +;; definition for method 7 of type camera-master +;; INFO: Return type mismatch process vs camera-master. +(defmethod relocate camera-master ((obj camera-master) (arg0 int)) + (if (nonzero? (-> obj water-drip)) + (&+! (-> obj water-drip) arg0) + ) + (the-as camera-master ((method-of-type process relocate) obj arg0)) + ) + +;; definition for method 7 of type time-of-day-proc +;; INFO: Return type mismatch process vs time-of-day-proc. +(defmethod relocate time-of-day-proc ((obj time-of-day-proc) (arg0 int)) + (if (nonzero? (-> obj sun)) + (&+! (-> obj sun) arg0) + ) + (if (nonzero? (-> obj green-sun)) + (&+! (-> obj green-sun) arg0) + ) + (if (nonzero? (-> obj moon)) + (&+! (-> obj moon) arg0) + ) + (the-as time-of-day-proc ((method-of-type process relocate) obj arg0)) + ) + +;; definition for method 7 of type part-tracker +;; INFO: Return type mismatch process vs part-tracker. +(defmethod relocate part-tracker ((obj part-tracker) (arg0 int)) + (if (nonzero? (-> obj root)) + (&+! (-> obj root) arg0) + ) + (if (nonzero? (-> obj part)) + (&+! (-> obj part) arg0) + ) + (the-as part-tracker ((method-of-type process relocate) obj arg0)) + ) + +;; definition for method 7 of type part-spawner +;; INFO: Return type mismatch process vs part-spawner. +(defmethod relocate part-spawner ((obj part-spawner) (arg0 int)) + (if (nonzero? (-> obj root)) + (&+! (-> obj root) arg0) + ) + (if (nonzero? (-> obj part)) + (&+! (-> obj part) arg0) + ) + (if (nonzero? (-> obj sound)) + (&+! (-> obj sound) arg0) + ) + (the-as part-spawner ((method-of-type process relocate) obj arg0)) + ) + +;; definition for method 7 of type lightning-tracker +;; INFO: Return type mismatch process vs lightning-tracker. +(defmethod relocate lightning-tracker ((obj lightning-tracker) (arg0 int)) + (if (nonzero? (-> obj root)) + (&+! (-> obj root) arg0) + ) + (if (nonzero? (-> obj lightning)) + (&+! (-> obj lightning) arg0) + ) + (the-as lightning-tracker ((method-of-type process relocate) obj arg0)) + ) + +;; definition for method 7 of type manipy +;; INFO: Return type mismatch process-drawable vs manipy. +(defmethod relocate manipy ((obj manipy) (arg0 int)) + (if (nonzero? (-> obj joint 0)) + (&+! (-> obj joint 0) arg0) + ) + (if (nonzero? (-> obj joint 1)) + (&+! (-> obj joint 1) arg0) + ) + (if (nonzero? (-> obj joint 2)) + (&+! (-> obj joint 2) arg0) + ) + (if (nonzero? (-> obj joint 3)) + (&+! (-> obj joint 3) arg0) + ) + (the-as manipy ((method-of-type process-drawable relocate) obj arg0)) + ) 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 cf7226266a..8fb7cd8603 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 @@ -239,9 +239,9 @@ (karma float :offset-assert 116) (eco-pill-dark float :offset-assert 120) (eco-pill-dark-total float :offset-assert 124) - (features uint64 :offset-assert 128) - (debug-features uint64 :offset-assert 136) - (secrets uint32 :offset-assert 144) + (features game-feature :offset-assert 128) + (debug-features game-feature :offset-assert 136) + (secrets game-secrets :offset-assert 144) (unknown-pad1 uint32 :offset-assert 148) (purchase-secrets uint32 :offset-assert 152) (unknown-pad2 uint32 :offset-assert 156) @@ -260,9 +260,11 @@ (task-perm-list entity-perm-array :offset-assert 236) (current-continue continue-point :offset-assert 240) (last-continue continue-point :offset-assert 244) - (unknown-pad3 uint32 3 :offset-assert 248) + (unknown-pad3 array :offset-assert 248) + (unknown-pad4 array :offset-assert 252) + (unknown-pad5 array :offset-assert 256) (task-counter uint32 :offset-assert 260) - (unknown-pad4 uint32 :offset-assert 264) + (unknown-pad6 uint32 :offset-assert 264) (level-opened uint8 32 :offset-assert 268) (total-deaths int32 :offset-assert 300) (continue-deaths int32 :offset-assert 304) @@ -331,8 +333,8 @@ (copy-perms-from-level! (_type_ level) none 16) (copy-perms-to-level! (_type_ level) none 17) (game-info-method-18 () none 18) - (game-info-method-19 () none 19) - (game-info-method-20 () none 20) + (get-current-continue-point (_type_) continue-point 19) + (get-continue-by-name (_type_ string) continue-point 20) (set-continue! (_type_ basic) continue-point 21) (game-info-method-22 () none 22) (game-info-method-23 () none 23) diff --git a/test/decompiler/reference/jak2/engine/game/main-h_REF.gc b/test/decompiler/reference/jak2/engine/game/main-h_REF.gc index 624e9d7390..1772b4b39b 100644 --- a/test/decompiler/reference/jak2/engine/game/main-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/main-h_REF.gc @@ -160,8 +160,8 @@ ;; definition for symbol *sync-dma*, type symbol (define *sync-dma* #f) -;; definition for symbol *display-strip-lines*, type int -(define *display-strip-lines* 0) +;; definition for symbol *display-strip-lines*, type strip-lines-controls +(define *display-strip-lines* (the-as strip-lines-controls 0)) ;; definition for symbol *display-battle-marks*, type symbol (define *display-battle-marks* #f) @@ -275,20 +275,20 @@ ) ) -;; definition for symbol *display-scene-control*, type int -(define *display-scene-control* 0) +;; definition for symbol *display-scene-control*, type scene-controls +(define *display-scene-control* (the-as scene-controls 0)) -;; definition for symbol *display-bot-marks*, type int -(define *display-bot-marks* 0) +;; definition for symbol *display-bot-marks*, type bot-marks-controls +(define *display-bot-marks* (the-as bot-marks-controls 0)) -;; definition for symbol *display-race-marks*, type int -(define *display-race-marks* 0) +;; definition for symbol *display-race-marks*, type race-marks-controls +(define *display-race-marks* (the-as race-marks-controls 0)) ;; definition for symbol *race-record-path*, type symbol (define *race-record-path* #f) -;; definition for symbol *select-race*, type int -(define *select-race* 0) +;; definition for symbol *select-race*, type race-selection +(define *select-race* (the-as race-selection 0)) ;; definition for symbol *select-race-path*, type int (define *select-race-path* 0) @@ -296,20 +296,20 @@ ;; definition for symbol *bot-record-path*, type int (define *bot-record-path* -1) -;; definition for symbol *subdivide-draw-mode*, type int -(define *subdivide-draw-mode* 0) +;; definition for symbol *subdivide-draw-mode*, type subdivide-setting +(define *subdivide-draw-mode* (the-as subdivide-setting 0)) -;; definition for symbol *subdivide-scissor-draw-mode*, type int -(define *subdivide-scissor-draw-mode* 0) +;; definition for symbol *subdivide-scissor-draw-mode*, type subdivide-setting +(define *subdivide-scissor-draw-mode* (the-as subdivide-setting 0)) -;; definition for symbol *subdivide-foreground-draw-mode*, type int -(define *subdivide-foreground-draw-mode* 0) +;; definition for symbol *subdivide-foreground-draw-mode*, type subdivide-setting +(define *subdivide-foreground-draw-mode* (the-as subdivide-setting 0)) -;; definition for symbol *subdivide-ocean-draw-mode*, type int -(define *subdivide-ocean-draw-mode* 0) +;; definition for symbol *subdivide-ocean-draw-mode*, type subdivide-setting +(define *subdivide-ocean-draw-mode* (the-as subdivide-setting 0)) -;; definition for symbol *ocean-height-hack*, type int -(define *ocean-height-hack* 0) +;; definition for symbol *ocean-height-hack*, type ocean-height-hack +(define *ocean-height-hack* (the-as ocean-height-hack 0)) ;; definition (perm) for symbol *dproc*, type process (define-perm *dproc* process #f) 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 57d00d5f69..2e6d6c76f9 100644 --- a/test/decompiler/reference/jak2/engine/game/settings-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/settings-h_REF.gc @@ -18,7 +18,7 @@ (ambient (pointer process) :offset-assert 56) (video-mode symbol :offset-assert 60) (aspect-ratio symbol :offset-assert 64) - (unknown-uint32-02 uint32 :offset 68) + (unknown-uint32-00 uint32 :offset 68) (auto-save symbol :offset 72) (bg-r float :offset-assert 76) (bg-g float :offset-assert 80) diff --git a/test/decompiler/reference/jak2/engine/game/settings_REF.gc b/test/decompiler/reference/jak2/engine/game/settings_REF.gc index 8b2d137203..6ed6d9379d 100644 --- a/test/decompiler/reference/jak2/engine/game/settings_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/settings_REF.gc @@ -944,7 +944,7 @@ (set! (-> s5-0 play-hints) (-> s4-0 play-hints)) (set! (-> s5-0 sound-bank-load) (-> s4-0 sound-bank-load)) (set! (-> s5-0 subtitle) (-> s4-0 subtitle)) - (set! (-> s5-0 beard) (if (logtest? (-> *game-info* secrets) 1) + (set! (-> s5-0 beard) (if (logtest? (-> *game-info* secrets) (game-secrets toggle-beard)) (not (-> s4-0 beard)) (-> s4-0 beard) ) @@ -1218,8 +1218,8 @@ (set! (-> s5-0 aspect-ratio) (-> s4-0 aspect-ratio)) (set-aspect-ratio (-> s5-0 aspect-ratio)) ) - (when (!= (-> s5-0 unknown-uint32-02) (-> s4-0 unknown-uint32-02)) - (set! (-> s5-0 unknown-uint32-02) (-> s4-0 unknown-uint32-02)) + (when (!= (-> s5-0 unknown-uint32-00) (-> s4-0 unknown-uint32-00)) + (set! (-> s5-0 unknown-uint32-00) (-> s4-0 unknown-uint32-00)) (set! (-> *video-params* set-video-mode) (the-as basic #t)) ) (when (!= (-> s5-0 video-mode) (-> s4-0 video-mode)) @@ -1234,7 +1234,9 @@ (set! (-> s5-0 unknown-int32-02) (-> s4-0 unknown-int32-02)) (set! (-> *video-params* display-dy) (* (/ (-> s4-0 unknown-int32-02) 2) 2)) ) - (set! (-> *blit-displays-work* horizontal-flip-flag) (the-as basic (logtest? (-> *game-info* secrets) 2))) + (set! (-> *blit-displays-work* horizontal-flip-flag) + (the-as basic (logtest? (-> *game-info* secrets) (game-secrets hflip-screen))) + ) (set! (-> s5-0 allow-blackout) (-> s4-0 allow-blackout)) (set! (-> s5-0 bg-a-speed) (-> s4-0 bg-a-speed)) (set! (-> s5-0 bg-a-force) (-> s4-0 bg-a-force)) @@ -1437,7 +1439,7 @@ (set! (-> gp-0 language) (scf-get-language)) (set! (-> gp-0 subtitle-language) (-> gp-0 language)) (set! (-> gp-0 process-mask) (process-mask execute sleep)) - (set! (-> gp-0 unknown-uint32-02) (the-as uint #f)) + (set! (-> gp-0 unknown-uint32-00) (the-as uint #f)) (set! (-> gp-0 unknown-int32-01) 0) (set! (-> gp-0 unknown-int32-02) 0) (set! (-> gp-0 vibration) @@ -1544,7 +1546,7 @@ (set! (-> s5-0 language) (+ (-> gp-0 language) -1)) (set! (-> s5-0 subtitle-language) (-> gp-0 subtitle-language)) (set! (-> s5-0 aspect-ratio) #f) - (set! (-> s5-0 unknown-uint32-02) (the-as uint #f)) + (set! (-> s5-0 unknown-uint32-00) (the-as uint #f)) (set! (-> s5-0 video-mode) #f) (set! (-> s5-0 music) #f) (set! (-> s5-0 extra-bank) (the-as symbol '())) diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/mood-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/mood-h_REF.gc index 8bdbcec704..ff4ce9a887 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/mood-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/mood-h_REF.gc @@ -506,8 +506,8 @@ (time-until-random mood-weather :inline :offset-assert 80) (time-until-random-min mood-weather :inline :offset-assert 88) (time-until-random-max mood-weather :inline :offset-assert 96) - (display-flag basic :offset-assert 104) - (overide-weather-flag basic :offset-assert 108) + (display-flag symbol :offset-assert 104) + (overide-weather-flag symbol :offset-assert 108) (overide mood-weather :inline :offset-assert 112) (lightning-index int32 :offset-assert 120) (lightning-val int32 :offset-assert 124) diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/mood-tables_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/mood-tables_REF.gc index 16f069cb22..39a7a59499 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/mood-tables_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/mood-tables_REF.gc @@ -879,7 +879,7 @@ (set! (-> arg0 time-until-random-max fog) 72000.0) (set! (-> arg0 overide cloud) 0.25) (set! (-> arg0 overide fog) 0.0) - (set! (-> arg0 overide-weather-flag) (the-as basic #t)) + (set! (-> arg0 overide-weather-flag) #t) (set! (-> arg0 display-flag) #f) (none) ) @@ -889,7 +889,3 @@ ;; failed to figure out what this is: (init-mood-control *mood-control*) - - - - diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day-h_REF.gc index 763fe664e1..81c76fbc80 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day-h_REF.gc @@ -137,31 +137,31 @@ ;; definition of type time-of-day-context (deftype time-of-day-context (basic) - ((interp float 6 :offset-assert 4) - (current-fog mood-fog :inline :offset-assert 32) - (current-sky-color vector :inline :offset-assert 80) - (current-env-color vector :inline :offset-assert 96) - (current-prt-color vector :inline :offset-assert 112) - (current-shadow-color vector :inline :offset-assert 128) - (light-group light-group 8 :inline :offset-assert 144) - (current-clouds mood-clouds :inline :offset-assert 1680) - (times vector 8 :inline :offset-assert 1696) - (title-light-group light-group :inline :offset-assert 1824) - (filter vector :inline :offset-assert 2016) - (filter-color vector :inline :offset-assert 2032) - (time float :offset-assert 2048) - (target-interp float :offset-assert 2052) - (erase-color rgba :offset-assert 2056) - (sky symbol :offset-assert 2060) - (use-camera-other basic :offset-assert 2064) - (title-updated symbol :offset-assert 2068) - (mode uint32 :offset-assert 2072) - (overide-enable basic :offset-assert 2076) - (overide-palette uint32 :offset-assert 2080) - (max-rain float :offset-assert 2084) - (fog-mult float :offset-assert 2088) - (exterior-level basic :offset-assert 2092) - (ocean-alpha float :offset-assert 2096) + ((interp float 6 :offset-assert 4) + (current-fog mood-fog :inline :offset-assert 32) + (current-sky-color vector :inline :offset-assert 80) + (current-env-color vector :inline :offset-assert 96) + (current-prt-color vector :inline :offset-assert 112) + (current-shadow-color vector :inline :offset-assert 128) + (light-group light-group 8 :inline :offset-assert 144) + (current-clouds mood-clouds :inline :offset-assert 1680) + (times vector 8 :inline :offset-assert 1696) + (title-light-group light-group :inline :offset-assert 1824) + (filter vector :inline :offset-assert 2016) + (filter-color vector :inline :offset-assert 2032) + (time float :offset-assert 2048) + (target-interp float :offset-assert 2052) + (erase-color rgba :offset-assert 2056) + (sky symbol :offset-assert 2060) + (use-camera-other basic :offset-assert 2064) + (title-updated symbol :offset-assert 2068) + (mode time-of-day-palette-id :offset-assert 2072) + (overide-enable symbol :offset-assert 2076) + (overide-palette time-of-day-palette-id :offset-assert 2080) + (max-rain float :offset-assert 2084) + (fog-mult float :offset-assert 2088) + (exterior-level basic :offset-assert 2092) + (ocean-alpha float :offset-assert 2096) ) :method-count-assert 9 :size-assert #x834 @@ -236,7 +236,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc index 207d6c3864..47379d8826 100644 --- a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc @@ -869,7 +869,7 @@ :size-assert #x38 :flag-assert #xb00000038 (:methods - (ocean-map-method-9 () none 9) + (set-height! (_type_ float) none 9) (ocean-map-method-10 () none 10) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/sky/sky-data_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sky/sky-data_REF.gc new file mode 100644 index 0000000000..5fcb93da27 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/gfx/sky/sky-data_REF.gc @@ -0,0 +1,740 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *sky-work*, type sky-work +(define *sky-work* + (new 'static 'sky-work + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :draw-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x502b400000008001 #x42421) + ) + :draw-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431) + ) + :fog-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x902a400000008001 #x424242421) + ) + :blend-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431) + ) + :sprite-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x2003400000008001 #x55) + ) + :sprite-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x21 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x21 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x2003400000008010 #x55) + ) + :sun-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -267.0 :y -267.0 :w 1.0) + (new 'static 'vector :x 267.0 :y 267.0) + ) + :green-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -126.0 :y -126.0 :w 1.0) + (new 'static 'vector :x 126.0 :y 126.0) + ) + :moon0-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -357.0 :y -357.0) + (new 'static 'vector :x 357.0 :y 357.0) + ) + :moon1-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -1207.0 :y -1207.0 :w 1.0) + (new 'static 'vector :x 1207.0 :y 1207.0) + ) + :moon2-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -232.0 :y -232.0) + (new 'static 'vector :x 232.0 :y 232.0) + ) + :star-coords (new 'static 'inline-array vector 2 (new 'static 'vector :x -1.5 :y -1.5) (new 'static 'vector :x 1.5 :y 1.5)) + :sun-colors (new 'static 'inline-array vector4w 2 + (new 'static 'vector4w :x #xff :y 64 :w 64) + (new 'static 'vector4w :x #xff :y #xff :z #x80 :w 64) + ) + :green-colors (new 'static 'inline-array vector4w 2 + (new 'static 'vector4w :y #xc4 :w #x80) + (new 'static 'vector4w :x #xc4 :y #xff :z #xff :w #x80) + ) + :moon-colors (new 'static 'inline-array vector4w 3 + (new 'static 'vector4w :x 16 :y 32 :z 64 :w 96) + (new 'static 'vector4w :x 16 :y 32 :z 64 :w 64) + (new 'static 'vector4w :x 80 :y 80 :z 80 :w #x80) + ) + :st-coords (new 'static 'inline-array vector 2 (new 'static 'vector :z 1.0) (new 'static 'vector :x 1.0 :y 1.0 :z 1.0)) + :random (new 'static 'inline-array vector4w 8 + (new 'static 'vector4w :x #x181920 :y #x141516 :z #x101112 :w #x234567) + (new 'static 'vector4w :x #x878237 :y #x48778 :z #x489197 :w #x893830) + (new 'static 'vector4w :x #x24762 :y #x289278 :z #x724781 :w #x712983) + (new 'static 'vector4w :x #x176128 :y #x387487 :z #x780983 :w #x723176) + (new 'static 'vector4w :x #x987239 :y #x699872 :z #x987165 :w #x982397) + (new 'static 'vector4w :x #x723897 :y #x238723 :z #x987293 :w #x102981) + (new 'static 'vector4w :x #x387528 :y #x723099 :z #x140983 :w #x874310) + (new 'static 'vector4w :x #x2387 :y #x129818 :z #x219810 :w #x623790) + ) + :giftag-base (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3002c00000008001 #x412)) + :giftag-haze (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3026c00000008001 #x412)) + :giftag-roof (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x302ec00000008001 #x412)) + :giftag-ocean (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x301ec00000008001 #x412)) + :draw-vortex #f + ) + ) + +;; definition for symbol sky-base-polygons, type (inline-array sky-vertex) +(define sky-base-polygons (new 'static 'inline-array sky-vertex 12 + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + ) + ) + +;; definition for symbol sky-roof-polygons, type (inline-array sky-vertex) +(define sky-roof-polygons (new 'static 'inline-array sky-vertex 12 + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + ) + ) + +;; definition for symbol *cloud-vert-array*, type cloud-vert-array +(define *cloud-vert-array* (new 'static 'cloud-vert-array)) + +;; definition for symbol *cloud-poly*, type (inline-array cloud-vertex) +(define *cloud-poly* (new 'static 'inline-array cloud-vertex 277 + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + (new 'static 'cloud-vertex) + ) + ) + +;; definition for function init-cloud-vert-array +;; INFO: Used lq/sq +(defun init-cloud-vert-array () + (let ((gp-0 *cloud-vert-array*)) + (dotimes (s5-0 10) + (dotimes (s4-0 10) + (let ((s3-0 (-> gp-0 data (+ (* 10 s5-0) s4-0)))) + (set! (-> s3-0 pos x) (* 2.0 (+ -4.5 (the float s4-0)))) + (set! (-> s3-0 pos z) (* 2.0 (+ -4.5 (the float s5-0)))) + (set! (-> s3-0 pos y) + (fmin (cos (* 182.04445 (* 10.0 (-> s3-0 pos x)))) (cos (* 182.04445 (* 10.0 (-> s3-0 pos z))))) + ) + (set-vector! (-> s3-0 stq) (* 0.25 (the float (+ s4-0 -4))) (* 0.25 (the float (+ s5-0 -4))) 1.0 1.0) + (set! (-> s3-0 nrm quad) (-> s3-0 pos quad)) + (set! (-> s3-0 nrm y) (+ 1.0 (-> s3-0 nrm y))) + (vector-normalize! (-> s3-0 nrm) 1.0) + (vector-negate! (-> s3-0 nrm2) (-> s3-0 nrm)) + (cond + ((or (zero? s5-0) (= s5-0 9) (zero? s4-0) (= s4-0 9)) + (set! (-> s3-0 col w) 0.0) + (set! (-> s3-0 col2 w) 0.0) + ) + ((or (= s5-0 1) (= s5-0 8) (= s4-0 1) (= s4-0 8)) + (set! (-> s3-0 col w) 48.0) + (set! (-> s3-0 col2 w) 48.0) + ) + (else + (set! (-> s3-0 col w) 128.0) + (set! (-> s3-0 col2 w) 128.0) + ) + ) + ) + ) + ) + ) + #f + ) + +;; failed to figure out what this is: +(init-cloud-vert-array) + +;; definition for symbol *haze-vert-array*, type haze-vert-array +(define *haze-vert-array* (new 'static 'haze-vert-array)) + +;; definition for symbol *haze-poly*, type (inline-array haze-vertex) +(define *haze-poly* (new 'static 'inline-array haze-vertex 144 + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + (new 'static 'haze-vertex) + ) + ) + +;; definition for function init-haze-vert-array +;; INFO: Used lq/sq +(defun init-haze-vert-array () + (let ((gp-0 *haze-vert-array*)) + (dotimes (s5-0 36) + (let ((s4-0 (-> gp-0 data s5-0))) + (set! (-> s4-0 pos x) (* 9.0 (sin (* 182.04445 (* 10.0 (the float s5-0)))))) + (set! (-> s4-0 pos z) (* 9.0 (cos (* 182.04445 (* 10.0 (the float s5-0)))))) + (set! (-> s4-0 pos y) 0.0) + (set! (-> (the-as cloud-vertex (-> s4-0 nrm)) pos quad) (-> (the-as cloud-vertex (-> s4-0 pos)) pos quad)) + (set! (-> s4-0 nrm y) (+ 1.0 (-> s4-0 nrm y))) + (vector-normalize! (-> s4-0 nrm) 1.0) + ) + ) + ) + #f + ) + +;; failed to figure out what this is: +(init-haze-vert-array) + +;; definition for method 9 of type sky-work +;; INFO: Return type mismatch int vs none. +(defmethod init-sun-data! sky-work ((obj sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float)) + "Sets the sun related upload data - the sun, halo and aurora" + (let ((v1-0 (logand arg0 1))) + (set! (-> obj upload-data sun v1-0 r-sun) arg1) + (set! (-> obj upload-data sun v1-0 r-halo) arg2) + (set! (-> obj upload-data sun v1-0 r-aurora) arg3) + ) + 0 + (none) + ) + +;; definition for method 10 of type sky-work +;; INFO: Return type mismatch int vs none. +(defmethod init-orbit-settings! sky-work ((obj sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float) (arg4 float) (arg5 float) (arg6 float)) + (set! (-> obj orbit arg0 high-noon) arg1) + (set! (-> obj orbit arg0 tilt) (* 0.017453292 arg2)) + (set! (-> obj orbit arg0 rise) (* 0.017453292 arg3)) + (set! (-> obj orbit arg0 dist) arg4) + (set! (-> obj orbit arg0 min-halo) arg5) + (set! (-> obj orbit arg0 max-halo) arg6) + 0 + (none) + ) + +;; definition for function sky-make-sun-data +;; INFO: Return type mismatch int vs none. +(defun sky-make-sun-data ((arg0 sky-work) (arg1 int) (arg2 float)) + "Initialize `upload-data` with [[sky-sun-data]] in [[*sky-work*]]" + (let* ((s4-0 (-> arg0 orbit arg1)) + (s3-0 (the-as sky-sun-data (+ (the-as uint (-> arg0 upload-data)) (* arg1 64)))) + (f0-1 (- arg2 (-> s4-0 high-noon))) + (f30-0 (* 2730.6667 f0-1)) + (f28-0 (* (sin f30-0) (-> s4-0 dist))) + (f30-1 (cos f30-0)) + ) + (let* ((f24-0 (* f30-1 (-> s4-0 dist))) + (f26-0 (* f24-0 (cos-rad (-> s4-0 tilt)))) + (f24-1 (* f24-0 (sin-rad (-> s4-0 tilt)))) + (f22-0 (sin-rad (-> s4-0 rise))) + (f0-10 (cos-rad (-> s4-0 rise))) + ) + (set! (-> s3-0 pos z) (- (+ (* f28-0 f0-10) (* f24-1 f22-0)))) + (set! (-> s3-0 pos y) f26-0) + (set! (-> s3-0 pos x) (- (* f24-1 f0-10) (* f28-0 f22-0))) + ) + (let ((f0-14 (if (< f30-1 0.0) + 0.0 + f30-1 + ) + ) + ) + (set! (-> arg0 upload-data sun arg1 r-aurora) + (+ (* (-> s4-0 min-halo) (- 1.0 f0-14)) (* (-> s4-0 max-halo) f0-14)) + ) + ) + ) + 0 + (none) + ) + +;; definition for function sky-make-moon-data +;; INFO: Return type mismatch int vs none. +(defun sky-make-moon-data ((arg0 sky-work) (arg1 float)) + "Initialize `upload-data` with [[sky-moon-data]] in [[*sky-work*]]" + (let* ((s5-0 (-> arg0 orbit 2)) + (gp-0 (-> arg0 upload-data moon)) + (f0-1 (- arg1 (-> s5-0 high-noon))) + (f28-0 (* 2730.6667 f0-1)) + (f30-0 (* (sin f28-0) (-> s5-0 dist))) + (f26-0 (* (cos f28-0) (-> s5-0 dist))) + (f28-1 (* f26-0 (cos-rad (-> s5-0 tilt)))) + (f26-1 (* f26-0 (sin-rad (-> s5-0 tilt)))) + (f24-0 (sin-rad (-> s5-0 rise))) + (f0-10 (cos-rad (-> s5-0 rise))) + ) + (set! (-> gp-0 pos z) (- (+ (* f30-0 f0-10) (* f26-1 f24-0)))) + (set! (-> gp-0 pos y) f28-1) + (set! (-> gp-0 pos x) (- (* f26-1 f0-10) (* f30-0 f24-0))) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(init-sun-data! *sky-work* 0 60.0 200.0 300.0) + +;; failed to figure out what this is: +(init-sun-data! *sky-work* 1 15.0 20.0 300.0) + +;; failed to figure out what this is: +(init-orbit-settings! *sky-work* 0 12.5 -20.0 90.0 9950.0 300.0 300.0) + +;; failed to figure out what this is: +(init-orbit-settings! *sky-work* 1 4.0 0.0 90.0 9950.0 300.0 300.0) + +;; failed to figure out what this is: +(init-orbit-settings! *sky-work* 2 0.5 -40.0 90.0 9950.0 300.0 300.0) diff --git a/test/decompiler/reference/jak2/engine/gfx/sky/sky-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sky/sky-h_REF.gc index 7957bc7fec..9787b6eacf 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sky/sky-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sky/sky-h_REF.gc @@ -75,8 +75,8 @@ (goto cfg-4) ) (format #t "[~8x] ~A~%" obj 'sky-sun-data) - (format #t "~1Tdata[4] @ #x~X~%" (-> obj data)) - (format #t "~1Tpos: #~%" (-> obj data)) + (format #t "~1Tdata[4] @ #x~X~%" (-> obj pos)) + (format #t "~1Tpos: #~%" (-> obj pos)) (format #t "~1Tr-sun: ~f~%" (-> obj r-sun)) (format #t "~1Tr-halo: ~f~%" (-> obj r-halo)) (format #t "~1Tr-aurora: ~f~%" (-> obj r-aurora)) @@ -165,8 +165,8 @@ (goto cfg-4) ) (format #t "[~8x] ~A~%" obj 'sky-upload-data) - (format #t "~1Tdata[10] @ #x~X~%" (-> obj data)) - (format #t "~1Tsun[2] @ #x~X~%" (-> obj data)) + (format #t "~1Tdata[10] @ #x~X~%" (-> obj sun)) + (format #t "~1Tsun[2] @ #x~X~%" (-> obj sun)) (format #t "~1Tmoon: #~%" (-> obj moon)) (label cfg-4) obj @@ -405,12 +405,12 @@ (moon1-coords vector 2 :inline :offset-assert 320) (moon2-coords vector 2 :inline :offset-assert 352) (star-coords vector 2 :inline :offset-assert 384) - (sun-colors vector 2 :inline :offset-assert 416) - (green-colors vector 2 :inline :offset-assert 448) - (moon-colors vector 3 :inline :offset-assert 480) - (star-colors vector 16 :inline :offset-assert 528) + (sun-colors vector4w 2 :inline :offset-assert 416) + (green-colors vector4w 2 :inline :offset-assert 448) + (moon-colors vector4w 3 :inline :offset-assert 480) + (star-colors vector4w 16 :inline :offset-assert 528) (st-coords vector 2 :inline :offset-assert 784) - (random vector 8 :inline :offset-assert 816) + (random vector4w 8 :inline :offset-assert 816) (giftag-base dma-gif :inline :offset-assert 944) (giftag-haze dma-gif :inline :offset-assert 960) (giftag-roof dma-gif :inline :offset-assert 976) @@ -422,12 +422,12 @@ (off-t uint16 :offset-assert 1062) (orbit sky-orbit 3 :inline :offset-assert 1064) (upload-data sky-upload-data :inline :offset-assert 1168) - (ambi-color vector :inline :offset-assert 1328) - (ambi-color-lower vector :inline :offset-assert 1344) - (sun0-color vector :inline :offset-assert 1360) - (sun1-color vector :inline :offset-assert 1376) - (moon-color vector :inline :offset-assert 1392) - (sun0-color-lower vector :inline :offset-assert 1408) + (ambi-color vector4w :inline :offset-assert 1328) + (ambi-color-lower vector4w :inline :offset-assert 1344) + (sun0-color vector4w :inline :offset-assert 1360) + (sun1-color vector4w :inline :offset-assert 1376) + (moon-color vector4w :inline :offset-assert 1392) + (sun0-color-lower vector4w :inline :offset-assert 1408) (cam-mat matrix :inline :offset-assert 1424) (star-mat matrix :inline :offset-assert 1488) (vec0 vector4w :inline :offset-assert 1552) @@ -442,8 +442,8 @@ :size-assert #x2760 :flag-assert #x2500002760 (:methods - (sky-work-method-9 () none 9) - (sky-work-method-10 () none 10) + (init-sun-data! (_type_ int float float float) none 9) + (init-orbit-settings! (_type_ int float float float float float float) none 10) (sky-work-method-11 () none 11) (sky-work-method-12 () none 12) (sky-work-method-13 () none 13) @@ -531,7 +531,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/gfx/texture/texture-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/texture/texture-h_REF.gc index b30090355d..93be5b40f6 100644 --- a/test/decompiler/reference/jak2/engine/gfx/texture/texture-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/texture/texture-h_REF.gc @@ -338,7 +338,7 @@ ;; definition of type texture-link (deftype texture-link (structure) - ((next shader-ptr :offset-assert 0) + ((next shader-ptr 1 :offset-assert 0) ) :method-count-assert 9 :size-assert #x4 @@ -352,7 +352,7 @@ (goto cfg-4) ) (format #t "[~8x] ~A~%" obj 'texture-link) - (format #t "~1Tnext: #x~X~%" (-> obj next)) + (format #t "~1Tnext: #x~X~%" (-> obj next 0)) (label cfg-4) obj ) diff --git a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc index 385489763c..84a26730ff 100644 --- a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc @@ -429,7 +429,7 @@ (vis-self-index int32 :offset-assert 2440) (vis-adj-index int32 :offset-assert 2444) (vis-buffer uint8 2048 :offset-assert 2448) - (mem-usage-block basic :offset-assert 4496) + (mem-usage-block memory-usage-block :offset-assert 4496) (mem-usage int32 :offset-assert 4500) (code-memory-start pointer :offset-assert 4504) (code-memory-end pointer :offset-assert 4508) @@ -746,9 +746,9 @@ ) (format #t "~1Tdraw-index-map[7] @ #x~X~%" (-> obj draw-index-map)) (format #t "~1Tload-order: ~D~%" (-> obj load-order)) - (format #t "~1Tlevel[7] @ #x~X~%" (-> obj level)) - (format #t "~1Tdata[7] @ #x~X~%" (-> obj level)) - (format #t "~1Tlevel0: ~`level`P~%" (-> obj level)) + (format #t "~1Tlevel[7] @ #x~X~%" (-> obj level0)) + (format #t "~1Tdata[7] @ #x~X~%" (-> obj level0)) + (format #t "~1Tlevel0: ~`level`P~%" (-> obj level0)) (format #t "~1Tlevel1: ~`level`P~%" (-> obj level1)) (format #t "~1Tlevel2: ~`level`P~%" (-> obj level2)) (format #t "~1Tlevel3: ~`level`P~%" (-> obj level3)) @@ -773,85 +773,83 @@ :play? #f :sound-bank (new 'static 'array basic 4 #f #f #f #f) :disk-load-timing? #f - :level (new 'static 'inline-array level 7 - (new 'static 'level - :name #f - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 1 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 2 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 3 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 4 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 5 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name 'default - :index 6 - :status 'reserved - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :bsp #f - :inside-boxes #f - :display? #f - :force-inside? #f - :linking #f - :level-type #f - ) + :level0 (new 'static 'level + :name #f + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level1 (new 'static 'level + :name #f + :index 1 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level2 (new 'static 'level + :name #f + :index 2 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level3 (new 'static 'level + :name #f + :index 3 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level4 (new 'static 'level + :name #f + :index 4 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level5 (new 'static 'level + :name #f + :index 5 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :default-level (new 'static 'level + :name 'default + :index 6 + :status 'reserved + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :bsp #f + :inside-boxes #f + :display? #f + :force-inside? #f + :linking #f + :level-type #f ) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc index f082f506df..ade8421087 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc @@ -464,12 +464,14 @@ ;; definition for function want-to-gun? (defbehavior want-to-gun? process ((arg0 target) (arg1 symbol)) (local-vars (v1-36 symbol)) - (and (logtest? (-> arg0 game features) 32) + (and (logtest? (-> arg0 game features) (game-feature unk-game-feature-06)) (>= (- (-> self clock frame-counter) (-> arg0 gun gun-time)) (seconds 0.1)) (zero? (logand (focus-status fs1 fs6 fs18 fs21 fs22 fs30) (-> arg0 focus-status))) (zero? (logand (surface-flag gun-inactive gun-hide gun-off) (-> arg0 control unknown-surface00 flags))) (zero? (logand (state-flags sf18) (-> arg0 state-flags))) - (logtest? (logand (-> *setting-control* user-current features) 960) (-> arg0 game features)) + (logtest? (the-as game-feature (logand (-> *setting-control* user-current features) 960)) + (-> arg0 game features) + ) (or (zero? (logand (-> arg0 control unknown-surface00 flags) (surface-flag duck))) (can-exit-duck?)) (or (zero? (logand (focus-status fs20) (-> arg0 focus-status))) (-> arg0 pilot gun?)) (or arg1 diff --git a/test/decompiler/reference/jak2/engine/util/capture-h_REF.gc b/test/decompiler/reference/jak2/engine/util/capture-h_REF.gc index 678d3f890d..8250a24f99 100644 --- a/test/decompiler/reference/jak2/engine/util/capture-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/util/capture-h_REF.gc @@ -50,11 +50,11 @@ ;; definition of type screen-shot-work (deftype screen-shot-work (structure) - ((count int16 :offset-assert 0) - (size int16 :offset-assert 2) - (name basic :offset-assert 4) - (highres-enable basic :offset-assert 8) - (hud-enable basic :offset-assert 12) + ((count int16 :offset-assert 0) + (size int16 :offset-assert 2) + (name string :offset-assert 4) + (highres-enable symbol :offset-assert 8) + (hud-enable symbol :offset-assert 12) ) :method-count-assert 9 :size-assert #x10 @@ -99,6 +99,3 @@ 0 ) - - - diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 5757584dbf..14c12b579e 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -45,7 +45,21 @@ "print-game-text", // joint asm "cspace<-parented-transformq-joint!", "(method 11 art-joint-anim-manager)", "make-joint-jump-tables", - + // default menu + // - causes a decompiler hang + "dm-cam-setting-float", + "debug-menu-make-camera-menu", // requires the above, fine on it's own + // - delayed until game-info is better understood + "debug-menu-make-play-menu", + "debug-menu-make-task-sub-menu", + // - weird array accessing pattern, we never fixed it in jak 1 + "all-texture-tweak-adjust", + "debug-menu-make-shader-menu", // requires the above, fine on it's own + // - process-spawn macro issues + "dm-scene-load-pick-func", + "popup-menu-context-make-default-menus", + "debug-menu-context-make-default-menus", + // placeholder "i-hopefully-will-never-exist-dont-add-anything-after-me-please" ],