Compare commits

...
Author SHA1 Message Date
Jordan 21d27233d2 [decompiler] Fix Sound-Effects Extraction on Windows (#4459)
Some of the sound effects in Jak 2 have an * in their name, which is a
forbidden character for a filename on Windows.
This was causing errors with the sound effects extraction. In this PR I
replace forbidden characters with an underscore (_)
in the filenames of extracted sound effects.
2026-11-07 14:18:22 -05:00
Tyler Wilding 75b7f2b3ab d/jx: Part 7 - add fixes to most of the files i deferred in the last PR (#4469) 2026-11-07 14:12:37 -05:00
Alex Anderson f1b3de907c goalc: treat WSA_IO_PENDING as a socket timeout on windows (#4465)
On Windows 11 26H2 (build 26300), goalc drops its connection to the game
after a few seconds idle. After that, every form fails with “Compilation
generated code, but wasn’t supposed to”, and (lt) can’t reconnect.

When a recv hits SO_RCVTIMEO, Windows sometimes reports WSA_IO_PENDING
(997) instead of WSAETIMEDOUT. The socket is still fine, but
socket_timed_out() doesn’t recognize 997, so the listener disconnects.
This change treats it as a timeout too.

Tested as a binary patch on the ArchipelaGOAL v0.5.9 goalc.exe, where it
fixed the issue. I haven’t built this branch from source.

AI disclosure: I used Claude Code to process the logs and diagnose the
issue, the change is my own.
2026-11-03 12:45:58 -05:00
Tyler Wilding 3d20187fd3 d/jx: Part 6 - 135 more files decompiled (#4463)
woo

TODO:
- [x] Update the mips2c stuff because i shuffled some of the methods
that were mips2c'd
- [x] Make the type tests / [x] offline tests pass
- [x] partially revert changes to `gstate`
2026-11-03 01:11:00 -05:00
OpenGOAL BotandOpenGOALBot 33f364db4a CI: Periodic Controller Database Update (#4464)
Updating Controller Database

Co-authored-by: OpenGOALBot <[email protected]>
2026-11-03 01:07:38 -05:00
465 changed files with 243111 additions and 8683 deletions

No files matched your search

+1 -1
View File
@@ -88,7 +88,7 @@ jobs:
ls -l ./out/jak2
ls -l ./out/jak3
set +e
python ./scripts/gsrc/compare-compilation-outputs.py --base "./out/jak1/obj.master,./out/jak2/obj.master,./out/jak3/obj.master" --compare "./out/jak1/obj.pr,./out/jak2/obj.pr,./out/jak3/obj.pr" --markdown
python ./scripts/ci/compare-compilation-outputs.py --base "./out/jak1/obj.master,./out/jak2/obj.master,./out/jak3/obj.master" --compare "./out/jak1/obj.pr,./out/jak2/obj.pr,./out/jak3/obj.pr" --markdown
SCRIPT_EXIT_CODE=$?
cat ./comp-diff-report.md >> $GITHUB_STEP_SUMMARY
if [ "$SCRIPT_EXIT_CODE" -ne 0 ]; then
+1 -1
View File
@@ -43,7 +43,7 @@ jobs:
run: python ./scripts/ci/lint-trailing-whitespace.py
- name: Check for Unresolved Conflicts
run: python ./scripts/gsrc/check-for-conflicts.py
run: python ./scripts/ci/check-for-conflicts.py
- name: Check for Incorrect Asserts
run: python ./scripts/ci/check-for-asserts.py
+25
View File
@@ -93,6 +93,14 @@ jobs:
ref: ${{ needs.validate-author.outputs.sha }}
clean: false
- name: Cleanup Potential Outputs
run: |
rm -r ./ci-artifacts || true
rm -rf ./iso_data/jak1/* || true
rm -rf ./iso_data/jak2/* || true
rm -rf ./iso_data/jak3/* || true
rm -rf ./iso_data/jakx/* || true
- name: Build Binaries
run: |
cmake -B build --preset="Release-linux-clang-static" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
@@ -136,6 +144,16 @@ jobs:
rm -r ./data/iso_data || true
rm -r ./data/decompiler_out || true
# - name: Install Jak X
# run: |
# cd ./ci-artifacts
# ./extractor ~/isos/jak3_ntsc.iso --game jakx --extract --validate --proj-path "$PWD/data"
# ./extractor ~/isos/jak3_ntsc.iso --game jakx --decompile --proj-path "$PWD/data"
# ./extractor ~/isos/jak3_ntsc.iso --game jakx --compile --proj-path "$PWD/data"
# rm -r ./data/out || true
# rm -r ./data/iso_data || true
# rm -r ./data/decompiler_out || true
- name: Cleanup Installation
run: |
rm -r ./ci-artifacts || true
@@ -160,3 +178,10 @@ jobs:
task set-game-jak3
task offline-tests
rm -rf ./iso_data/jak3/*
- name: Run Offline Tests - Jak X
run: |
7z x ~/isos/jakx_ntsc.iso -o./iso_data/jakx -aos
task set-game-jakx
task offline-tests
rm -rf ./iso_data/jakx/*
+3 -8
View File
@@ -141,6 +141,9 @@ tasks:
decomp-file:
cmds:
- '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/{{.DECOMP_CONFIG}}" "./iso_data" "./decompiler_out" --version "{{.DECOMP_CONFIG_VERSION}}" --config-override ''{"decompile_code": true, "levels_extract": false, "allowed_objects": ["{{.FILE}}"]}'''
decomp-files:
cmds:
- '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/{{.DECOMP_CONFIG}}" "./iso_data" "./decompiler_out" --version "{{.DECOMP_CONFIG_VERSION}}" --config-override ''{"decompile_code": true, "levels_extract": false, "allowed_objects": {{.FILES}}}'''
decomp-clean:
cmds:
- '{{.PYTHON}} ./scripts/tasks/clean-decomp.py --game "{{.GAME}}"'
@@ -158,14 +161,6 @@ tasks:
- task: decomp-file
- '{{.PYTHON}} ./scripts/gsrc/update-from-decomp.py --game "{{.GAME}}" --file "{{.FILE}}"'
- task: lint-gsrc-file
copy-common-naming:
cmds:
- '{{.PYTHON}} ./scripts/gsrc/copy-common-naming.py --file "{{.FILE}}" --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler"'
- task: format-json
copy-common-naming-from-refs:
cmds:
- '{{.PYTHON}} ./scripts/gsrc/copy-common-naming.py --update-names-from-refs --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler"'
- task: format-json
# ASSET RIPPING
rip-textures:
cmds:
+2 -1
View File
@@ -176,7 +176,8 @@ bool socket_timed_out() {
return errno == EAGAIN;
#elif _WIN32
auto err = WSAGetLastError();
return err == WSAETIMEDOUT;
// some Windows builds report WSA_IO_PENDING when an SO_RCVTIMEO recv times out
return err == WSAETIMEDOUT || err == WSA_IO_PENDING;
#endif
}
+6 -3
View File
@@ -1013,9 +1013,11 @@ TP_Type LoadVarOp::get_src_type(const TypeState& input,
if (method_id == GOAL_NEW_METHOD) {
return TP_Type::make_non_object_new(method_type, TypeSpec(type_name));
} else if (input_type.kind == TP_Type::Kind::TYPE_OF_TYPE_NO_VIRTUAL) {
return TP_Type::make_non_virtual_method(method_type, TypeSpec(type_name), method_id);
return TP_Type::make_non_virtual_method(method_type, TypeSpec(type_name), method_id,
method_info.name);
} else {
return TP_Type::make_virtual_method(method_type, TypeSpec(type_name), method_id);
return TP_Type::make_virtual_method(method_type, TypeSpec(type_name), method_id,
method_info.name);
}
}
@@ -1028,7 +1030,8 @@ TP_Type LoadVarOp::get_src_type(const TypeState& input,
if (method_id != GOAL_NEW_METHOD && method_id != GOAL_RELOC_METHOD) {
// this can get us the wrong thing for `new` methods. And maybe relocate?
return TP_Type::make_non_virtual_method(
method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id);
method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id,
method_info.name);
}
}
}
File diff suppressed because it is too large. Load diff
+1 -3
View File
@@ -6,9 +6,7 @@
// if you want to filter to only some object names.
// it will make the decompiler much faster.
"allowed_objects": [],
// net-mgr-dme: cfg_builder.cppL32 (irb)
// net-mgr-medius-rooms: cfg_builder.cppL187 (clean_up_return_final)
"banned_objects": ["net-mgr-dme", "net-mgr-medius-rooms"],
"banned_objects": [],
////////////////////////////
// CODE ANALYSIS OPTIONS
////////////////////////////
@@ -7,6 +7,15 @@
[3, "(function int)"],
[4, "(function int)"]
],
"vehicle-debris": [[15, "(function collide-shape-prim none)"]],
"title-obs": [
[7, "(function process-tree symbol)"],
[30, "(function external-art-buffer none)"]
],
"gsound": [
[3, "(function sound-id)"],
[5, "(function none)"]
],
"pov-camera": [
[
7,
@@ -37,12 +46,13 @@
[10, "(function object)"],
[11, "(function object)"],
[12, "(function object)"],
[13, "(function object)"],
[13, "(function int debug-menu-msg object)"],
[14, "(function object)"],
[15, "(function object)"],
[16, "(function object)"],
[17, "(function object)"],
[18, "(function int debug-menu-msg float object)"],
[19, "(function none)"],
[20, "(function object)"],
[21, "(function object)"],
[22, "(function object)"],
@@ -63,7 +73,7 @@
[37, "(function int debug-menu-msg float object)"],
[38, "(function int debug-menu-msg float object)"],
[39, "(function int debug-menu-msg float object)"],
[40, "(function object)"],
[40, "(function int debug-menu-msg float object)"],
[41, "(function object)"],
[42, "(function int debug-menu-msg float object)"],
[43, "(function int debug-menu-msg float object)"],
@@ -230,17 +240,17 @@
[204, "(function int debug-menu-msg float object)"],
[205, "(function int debug-menu-msg float object)"],
[206, "(function int debug-menu-msg float object)"],
[207, "(function int debug-menu-msg float object)"],
[207, "(function symbol debug-menu-msg float float object)"],
[208, "(function symbol debug-menu-msg float float object)"],
[209, "(function int debug-menu-msg float object)"],
[210, "(function symbol debug-menu-msg float object)"],
[210, "(function symbol debug-menu-msg float int object)"],
[211, "(function symbol debug-menu-msg float float object)"],
[212, "(function int debug-menu-msg float object)"],
[213, "(function int debug-menu-msg float object)"],
[214, "(function int debug-menu-msg float object)"],
[212, "(function symbol debug-menu-msg float float object)"],
[213, "(function symbol debug-menu-msg float float object)"],
[214, "(function symbol debug-menu-msg float float object)"],
[215, "(function symbol debug-menu-msg float float object)"],
[216, "(function symbol debug-menu-msg float float object)"],
[217, "(function int debug-menu-msg float object)"],
[217, "(function symbol debug-menu-msg float int object)"],
[218, "(function symbol debug-menu-msg float float object)"],
[219, "(function symbol debug-menu-msg float float object)"],
[220, "(function symbol debug-menu-msg float float object)"],
@@ -263,14 +273,26 @@
[237, "(function symbol debug-menu-msg float float object)"],
[239, "(function symbol debug-menu-msg object)"],
[240, "(function int debug-menu-msg float object)"],
[241, "(function int debug-menu-msg float object)"],
[242, "(function int debug-menu-msg float object)"],
[243, "(function int debug-menu-msg float object)"],
[241, "(function debug-menu debug-menu object)"],
[242, "(function debug-menu debug-menu object)"],
[243, "(function debug-menu debug-menu object)"],
[244, "(function debug-menu debug-menu symbol)"],
[245, "(function debug-menu debug-menu symbol)"],
[246, "(function debug-menu debug-menu symbol)"],
[247, "(function debug-menu debug-menu symbol)"]
],
"main": [
[17, "(function int none)"],
[15, "(function none)"],
[14, "(function none)"],
[13, "(function none)"],
[5, "(function process-tree symbol)"],
[3, "(function symbol :behavior process)"]
],
"memory-usage": [
[2, "(function process-drawable symbol)"],
[3, "(function basic symbol)"]
],
"intro-scenes2": [
[0, "(function none :behavior scene-player)"],
[1, "(function none :behavior scene-player)"]
@@ -425,8 +447,18 @@
[98, "(function none :behavior scene-player)"],
[99, "(function none :behavior scene-player)"]
],
"editable-player": [
[0, "(function object)"],
[3, "(function object int float object)"],
[4, "(function object int symbol)"],
[32, "(function editable editable-region symbol)"],
[33, "(function editable editable-region symbol)"],
[36, "(function editable symbol)"]
],
"joint-mod": [[21, "(function cspace transformq none)"]],
"merc-death": [[3, "(function time-frame :behavior process-drawable)"]],
"editable": [[101, "(function object editable-filter)"]],
"wvehicle-wheel": [[18, "(function collide-shape-prim none)"]],
"trajectory": [[15, "(function trajectory none)"]],
"settings": [
[13, "(function engine-pers connection-pers object object symbol)"],
+79 -23
View File
@@ -19,7 +19,7 @@
"(method 22 level)",
"(method 11 medius-cache)",
"(method 13 race-line)",
"(method 11 collide-mesh)",
"adgif-shader<-texture!",
"symlink2",
"(method 17 bounding-box)",
"quad-copy!",
@@ -34,6 +34,13 @@
"generic-light-proc",
"memcpy",
"dma-count-until-done",
"test-to-from-spr",
"test-from-spr",
"test-to-spr",
"test-seq-read",
"test-worst-read",
"test-seq-write",
"test-worst-write",
"blerc-a-fragment",
"get-current-room-name-and-info"
],
@@ -42,8 +49,13 @@
"ref",
"ref&",
"(method 4 pair)",
// "(method 28 editable)",
"execute-select",
// "(method 29 editable)",
// "(method 25 editable)",
"last",
"member",
"display-loop-main",
"nmember",
"cspace-inspect-tree",
"assoc",
@@ -60,6 +72,7 @@
"delete-car!",
"insert-cons!",
"debug-menu-rebuild",
"(method 8 process-tree)",
"debug-menu-find-from-template",
"debug-menu-render",
"debug-menu-context-select-next-or-prev-item",
@@ -74,9 +87,46 @@
"~0kfrags = ~d~256hfrags/call = ~f~%": 2,
"~0ktris = ~d~256htris/frag = ~f~%": 2,
"~0koutput = ~d~256houtput/call = ~f~%": 2,
"~0knodes = ~d~256hnodes/call = ~f~%": 2
"~0knodes = ~d~256hnodes/call = ~f~%": 2,
"~0K~Name~130HID~+50HVol~+15HPitch~+24HPan~+18HEar~+24HDist~%": 0,
"~130H~5D ~4D ~5D ~4D ~3D ~5,,0M~%": 6,
"music-volume=~220h~f~%": 1,
"dialog-volume=~220h~f~%": 1,
"music-volume-during-speech=~220h~f~%": 1,
"sfx-volume-during-speech=~220h~f~%": 1,
"music-volume-ducked-by-sound=~220h~f~%": 1,
"music-seek-speed=~220h~f~%": 1,
"~%final music-volume: ~220h~f~%": 1,
"final sfx-volume: ~220h~f~%": 1,
"sfx-volume=~220h~f~%": 1
},
"blocks_ending_in_asm_branch": {
"(method 82 vehicle)": [
0, 1, 4, 5, 7, 12, 36, 37, 38, 40, 41, 43, 44, 46, 58, 62, 63, 65, 66, 70,
71, 73, 74, 81, 84, 87, 88, 92, 93, 95, 96, 98, 102, 103, 105, 106, 110,
111, 113, 114, 116, 117, 118, 119, 121, 122, 127
],
"(method 16 sparticle-launch-control)": [
17, 18, 25, 35, 36, 39, 40, 41, 43, 44, 45, 48, 62, 65, 69, 70, 74, 75,
79, 80, 91, 92, 93, 95, 96, 97, 100, 102
],
"(method 13 collide-shape-prim)": [5, 6],
"(method 12 collide-shape-prim-group)": [5, 6],
"(method 40 collide-shape)": [3, 9, 12, 18, 20, 22, 23, 26, 27, 30, 32],
"(method 45 collide-shape)": [33],
"(method 36 collide-shape)": [8, 9],
"(method 15 collide-shape-prim-sphere)": [1, 2, 4],
"(method 18 collide-shape-prim-sphere)": [0, 1, 2, 3, 4],
"upload-vis-bits": [2, 6, 3, 0],
"(method 21 nav-control)": [7, 15, 16, 32, 33, 34, 35, 45, 48],
"(method 19 nav-mesh)": [9, 18, 19, 35, 36, 37, 38, 58, 61, 62, 64, 65, 68],
"(method 41 nav-state)": [8, 9, 10, 11, 18, 19, 21],
"(method 26 grid-hash)": [39, 35, 22, 15],
"(method 16 collide-shape-prim-sphere)": [1, 2],
"(method 17 nav-mesh-editable)": [0, 1, 2, 7, 9, 24, 28, 33],
"load-game-text-info": [20, 21, 22, 24, 25, 26],
"(method 18 mysql-nav-graph)": [0, 1, 2, 3, 4, 7, 9],
"dm-play-task-with-continue": [0, 1, 2, 3, 4, 6],
"(method 18 nav-control)": [11, 12, 19, 20, 31, 34],
"(method 19 nav-control)": [9, 10],
"find-closest-circle-ray-intersection": [0, 4, 15, 16, 17, 18],
@@ -101,12 +151,12 @@
"(method 12 collide-shape-prim-mesh)": [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16
],
"(method 11 collide-mesh)": [2, 4],
"(method 12 collide-mesh-cache)": [0, 1, 2, 3, 4, 5],
"(method 10 collide-mesh)": [2],
"add-debug-line-sphere": [0],
"add-debug-box-with-transform": [0, 3],
"unpack-comp-rle": [1, 3, 5, 6],
"should-push-away-test-mesh": [2, 4],
"unpack-comp-huf": [2, 4, 5, 6, 7, 8, 9],
"unpack-comp-lzo": [
0, 1, 4, 5, 6, 7, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
@@ -122,9 +172,14 @@
"(method 22 collide-cache)": [11, 12, 27, 28]
},
"dynamic_format_arg_counts": {
"(trans auto-idle)": [[265, 1]]
"(trans auto-idle)": [[265, 1]],
"(trans idle nav-mesh-editor)": [[525, 0]],
"locate-sub": [[68, 3]]
},
"mips2c_functions_by_name": [
"get-string-length-asm",
"draw-string3d-asm",
"draw-string-asm-packed",
"collide-do-primitives",
"moving-sphere-triangle-intersect",
"calc-animation-from-spr",
@@ -146,38 +201,39 @@
"draw-large-polygon",
"render-sky-quad",
"render-sky-tri",
"(method 17 sky-work)",
"(method 32 sky-work)",
"(method 31 sky-work)",
// "(method 34 sky-work)", causes mips2c to assert
"(method 29 sky-work)",
"(method 30 sky-work)",
// "(method 35 sky-work)", causes mips2c to assert
"(method 16 sky-work)", // yes
"(method 17 sky-work)", // yes
"(method 28 sky-work)", // yes
"(method 29 sky-work)", // yes
"(method 30 sky-work)", // yes
"(method 32 sky-work)", // yes
"(method 33 sky-work)", // yes
"(method 11 collide-hash)",
"(method 12 collide-hash)",
"fill-bg-using-box-new",
"fill-bg-using-line-sphere-new",
"(method 12 collide-mesh)",
"(method 11 collide-mesh)",
"(method 14 collide-mesh)",
"(method 15 collide-mesh)",
"cspace<-parented-transformq-joint!",
"(method 13 collide-mesh)",
"draw-large-polygon-ocean",
"render-ocean-quad",
"init-ocean-far-regs",
"(method 15 ocean)",
"(method 19 grid-hash)",
"(method 20 grid-hash)",
"(method 21 grid-hash)",
"(method 22 grid-hash)",
"(method 28 sphere-hash)",
"(method 24 grid-hash)",
"(method 35 sphere-hash)", // yes
"(method 31 sphere-hash)", // yes
"(method 34 sphere-hash)", // yes
"(method 35 spatial-hash)", // yes
"(method 40 spatial-hash)", // yes
"(method 38 spatial-hash)", // yes
"(method 34 spatial-hash)", // yes
"(method 32 sphere-hash)",
"(method 31 sphere-hash)",
"(method 34 sphere-hash)",
"(method 30 sphere-hash)",
"(method 37 spatial-hash)",
"(method 34 spatial-hash)",
"(method 38 spatial-hash)",
// "(method 32 spatial-hash)",
// "(method 35 spatial-hash)",
// "(method 36 spatial-hash)",
"(method 10 collide-shape-prim-mesh)",
"(method 10 collide-shape-prim-sphere)",
"(method 10 collide-shape-prim-group)",
@@ -203,7 +259,7 @@
"(method 17 nav-engine)",
"(method 18 nav-engine)",
"(method 21 nav-engine)",
"(method 39 nav-state)",
"(method 39 nav-state)", // yes
"setup-blerc-chains-for-one-fragment",
"blerc-execute",
"ripple-create-wave-table",
@@ -2,6 +2,15 @@
"ambient-h": [["L1", "(inline-array talker-speech-class)", 233]],
"pat-h": [["L1", "(inline-array pat-mode-info)", 4]],
"foreground-h": [["L4", "(pointer bucket-id-16)", 462]],
"tfrag-methods": [
["L92", "(inline-array tfrag-init-data)", 10],
["L93", "(pointer bucket-id)", 12],
["L94", "(pointer bucket-id)", 12],
["L95", "(pointer bucket-id)", 12],
["L96", "(pointer bucket-id)", 12],
["L98", "(pointer bucket-id)", 12],
["L99", "(pointer bucket-id)", 12]
],
"joint-mod": [["L212", "(inline-array vector)", 3]],
"texture-anim-h": [["L1", "(pointer uint8)", 256]],
"process-nettable-h": [["L13", "(pointer uint32)", 95]],
@@ -790,6 +799,8 @@
["L471", "vector"]
],
"sprite-glow": [["L27", "dma-packet"]],
"merc-blend-shape": [["L71", "(pointer int16)", 40]],
"generic-merc": [["L178", "(inline-array invinitdata)", 8]],
"ocean-trans-tables": [
["L1", "(inline-array vector)", 4],
["L2", "(pointer float)", 160],
@@ -865,5 +876,312 @@
["L9", "vector"]
],
"pad": [["L116", "(pointer uint32)", 192]],
"keyboard": [["L273", "(pointer uint32)", 32]]
"keyboard": [["L273", "(pointer uint32)", 32]],
"3d-menu-elements": [
["L283", "uint64", true],
["L282", "uint64", true],
["L216", "vector"]
],
"wcar-bear": [
["L102", "vector"],
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"]
],
"wcar-bobcat": [
["L102", "vector"],
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"]
],
"wcar-cheetah": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"wcar-cougar": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"wcar-daxtermobile": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"wcar-falcon": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"wcar-gila": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"wcar-leopard": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"wcar-mongoose": [
["L104", "vector"],
["L103", "vector"],
["L102", "vector"],
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"]
],
"wcar-panther": [
["L103", "vector"],
["L102", "vector"],
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"]
],
"wcar-possum": [
["L103", "vector"],
["L102", "vector"],
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"]
],
"wcar-snake": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"wcar-tiger": [
["L102", "vector"],
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"]
],
"wcar-wolf": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"wcar-wombat": [
["L101", "vector"],
["L100", "vector"],
["L99", "vector"],
["L98", "vector"],
["L97", "vector"],
["L96", "vector"],
["L95", "vector"]
],
"cam-layout": [
["L893", "uint64", true],
["L899", "uint64", true],
["L898", "uint64", true],
["L892", "uint64", true],
["L895", "uint64", true],
["L894", "uint64", true],
["L897", "uint64", true],
["L896", "uint64", true],
["L802", "rgba", true],
["L800", "rgba", true],
["L798", "rgba", true],
["L796", "rgba", true],
["L794", "rgba", true],
["L792", "rgba", true],
["L889", "uint64", true],
["L785", "vector"],
["L802", "vector4w"],
["L800", "vector4w"],
["L798", "vector4w"],
["L796", "vector4w"],
["L794", "vector4w"],
["L792", "vector4w"]
],
"cam-states-dbg": [
["L60", "vector"],
["L59", "vector"]
],
"coliseum-obs": [
["L18", "vector"],
["L17", "vector"]
],
"garage-obs": [
["L110", "vector"],
["L111", "vector"]
],
"kras-obs": [["L148", "attack-info"]],
"peak-obs": [["L90", "attack-info"]],
"snow-obs": [
["L16", "vector"],
["L15", "vector"]
],
"title-obs": [
["L226", "uint64", true],
["L226", "handle-wrapper"]
],
"loader": [
["L1450", "uint64", true],
["L1450", "uint64", true],
["L1229", "string"]
],
"hud": [["L145", "vector"]],
"lobby-net-h": [
["L110", "(pointer uint32)", 84],
["L114", "(pointer uint32)", 3840],
["L115", "(pointer uint32)", 3840],
["L116", "(pointer uint32)", 3840],
["L117", "(pointer uint32)", 64],
["L146", "uint64", true],
["L148", "uint64", true],
["L147", "uint64", true],
["L145", "uint64", true],
["L144", "uint64", true],
["L119", "uint64", true]
],
"default-menu": [
["L6893", "uint64", true],
["L6899", "uint64", true],
["L6236", "attack-info"],
["L6242", "attack-info"],
["L6896", "uint64", true],
["L6894", "uint64", true],
["L6895", "uint64", true],
["L6898", "uint64", true],
["L6897", "uint64", true]
],
"collide-cache": [["L220", "vector"]],
"collide-shape": [
["L323", "vector"],
["L321", "vector"],
["L314", "attack-info"]
],
"mood-funcs": [
["L52", "uint64", true],
["L53", "uint64", true]
],
"mood-funcs2": [["L47", "uint64", true]],
"ocean": [["L137", "(pointer bucket-id)", 2]],
"texture-anim-tables": [
["L163", "uint64", true],
["L152", "uint64", true],
["L151", "uint64", true],
["L150", "uint64", true]
],
"main": [["L564", "(pointer time-frame)", 2]],
"net-mgr-muis": [
["L83", "(pointer int32)", 32],
["L82", "(pointer int32)", 32],
["L81", "(pointer int32)", 32]
],
"nav-graph-editor": [
["L480", "vector"],
["L479", "vector"],
["L478", "vector"],
["L477", "vector"],
["L476", "vector"],
["L475", "vector"],
["L474", "vector"],
["L473", "vector"]
],
"nav-mesh-editor": [
["L567", "uint64", true],
["L511", "(inline-array triangulation-vert)", 256],
["L510", "(inline-array triangulation-vert)", 256],
["L562", "(pointer int32)", 1024],
["L564", "uint64", true],
["L563", "(inline-array vector)", 1024]
],
"lightning": [
["L93", "uint64", true],
["L93", "vector4w"]
],
"editable-player": [
["L1515", "(inline-array vector4w)", 4],
["L1551", "uint64", true]
],
"editable": [
["L748", "rgba", true],
["L749", "rgba", true],
["L750", "rgba", true],
["L751", "rgba", true],
["L752", "rgba", true],
["L753", "rgba", true],
["L754", "rgba", true],
["L755", "rgba", true],
["L756", "rgba", true],
["L757", "rgba", true],
["L747", "uint64", true],
["L705", "vector"]
],
"net-mgr-medius-rooms": [["L128", "(pointer uint8)", 128]],
"net-mgr-playback": [["L59", "(inline-array vector4ub)", 128]],
"net-mgr-sysmsg": [["L9", "(pointer int32)", 256]],
"rigid-body-surface": [["L1", "(inline-array rigid-body-surface)", 8]],
"vehicle-reticle": [
["L343", "rgba", true],
["L342", "rgba", true]
],
"wvehicle-states": [
["L160", "vector"],
["L159", "vector"]
],
"menumap-part": [["L197", "(pointer rgba)", 8]],
"wvehicle-weapons-part": [["L142", "(pointer rgba)", 8]],
"font": [["L474", "uint64", true]],
"vehicle-net": [["L152", "(pointer int32)", 6]],
"sky-tng": [
["L134", "uint64", true],
["L130", "uint64", true],
["L133", "uint64", true],
["L132", "uint64", true],
["L131", "uint64", true],
["L129", "vector"],
["L128", "vector"],
["L127", "vector"]
]
}
@@ -99,7 +99,7 @@
"spt-func-rocket": [[16, "vector"]],
"(method 115 wcar-base)": [
[16, "matrix"],
[64, "collide-query"]
[64, "wcar-added-stack-type1"]
],
"(method 41 nav-mesh)": [
[16, "vector"],
@@ -317,17 +317,539 @@
"(method 19 nav-control)": [[16, "nav-control-cfs-work"]],
"circle-tangent-directions": [[48, "vector"]],
"(method 40 nav-state)": [
[128, "vector"],
[144, "vector"]
[128, ["inline-array", "vector", 1]],
[144, ["inline-array", "vector", 2]]
],
"(method 53 nav-state)": [
[16, "vector"],
[32, "nav-route-portal"],
[80, ["inline-array", "vector", 3]],
[192, "matrix"],
[224, "nav-route-portal"]
],
"(method 53 nav-state)": [[16, "vector"]],
"(method 9 nav-control)": [[16, "vector"]],
"(method 16 debris-group)": [
[64, "vector"],
[32, "vector"]
],
"debris-group-init-by-other": [[16, "vector"]],
"merc-blend-shape": [[16, ["array", "int16", 128]]],
"add-debug-flat-triangle-noclip": [[16, ["inline-array", "vector4w", 9]]],
"(trans idle keyboard-control)": [[16, "symbol"]], // ?
"update-stuff": [[16, "quaternion"]]
"update-stuff": [[16, "quaternion"]],
"activate-bar": [[16, "vector"]],
"(method 10 collide-mesh)": [[16, "oot-work"]],
"camera-teleport-to-location": [[16, "matrix"]],
"camera-teleport-to-entity": [[16, "matrix"]],
"init-for-transform": [
[16, "matrix"],
[80, "matrix"],
[192, "vector"]
],
"should-push-away-test-mesh": [[16, "oot-work"]],
"(method 115 v-bear)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-bobcat)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-cheetah)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-drone)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-falcon)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"clmf-pos-rot": [[112, "matrix"]],
"(method 9 actor-hash-buckets)": [
[16, ["inline-array", "vector", 2]],
[48, ["inline-array", "vector", 2]]
],
"(method 115 v-wombat)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-wolf)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-tiger)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-snake)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-possum)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-panther)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-mongoose)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-leopard)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-gila)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-daxtermobile)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"(method 115 v-cougar)": [
[16, "quaternion"],
[32, ["inline-array", "quaternion", 2]]
],
"cam-layout-entity-info": [[208, "vector"]],
"(code cam-point-watch)": [[16, "vector"]],
"cam-mouse-input": [[64, "vector"]],
"add-a-bunch": [[16, "vector"]],
"projectile-bounce-falling-post": [[16, "collide-query"]],
"(method 69 projectile)": [[16, "collide-query"]],
"projectile-update-velocity-add-gravity": [[16, "vector"]],
"projectile-update-velocity-space-wars": [
[16, "vector"],
[64, "vector"]
],
"(method 71 construction-object)": [[80, "cquery-with-pad"]],
"(method 18 ragdoll)": [[16, "collide-query"]],
"(event idle can-leaves-floor)": [[16, ["inline-array", "matrix", 1]]],
"(enter dropped ctf-flag)": [
[16, "task-arrow-params"],
[80, "vector"]
],
"flag-fall": [[560, "vector"]],
"(exit carried ctf-flag)": [[16, "event-message-block"]],
"(enter idle ctf-flag)": [[80, "vector"]],
"(method 45 jungle-stone-snake-head)": [
[16, "vector"],
[32, "vector"]
],
"spawn-flame": [[16, "jungle-obs-stack-var0"]],
"(post idle kras-fireworks-ship-a)": [[16, ["inline-array", "vector", 1]]],
"(method 23 mysql-nav-graph)": [[16, ["inline-array", "vector", 5]]],
"(post idle wm-fireworks-ship)": [[16, ["inline-array", "vector", 1]]],
"(code explode peak-snowball)": [[32, "quaternion"]],
"(method 71 peak-snowball)": [
[16, "vector"],
[32, ["inline-array", "collide-query", 1]]
],
"(method 10 visvol-edit-info)": [
[16, "vector"],
[32, "vector"]
],
"(method 9 camera-facing-quad)": [[16, "camera-facing-quad-stackvar0"]],
"(method 16 collide-cache)": [[16, "collide-puls-work"]],
"test-closest-pt-in-triangle": [
[16, "vector"],
[32, "vector"],
[48, "vector"]
],
"(method 14 collide-cache)": [[16, "bounding-box"]],
"(method 20 collide-cache)": [[16, "matrix"]],
"col-rend-draw": [[16, "matrix"]],
"(method 63 collide-shape-moving)": [[48, "vector"]],
"cshape-reaction-default": [[16, "vector"]],
"(method 10 editable-plane)": [[16, ["inline-array", "vector", 4]]],
"(method 13 editable-plane)": [[64, ["inline-array", "vector", 4]]],
"(method 10 editable-face)": [[16, ["inline-array", "vector", 6]]],
"(method 31 editable-face)": [
[16, ["inline-array", "vector", 6]],
[112, ["inline-array", "vector", 6]],
[240, ["array", "editable-point", 6]],
[304, "matrix"]
],
"(method 14 editable-face)": [
[64, ["inline-array", "vector", 4]],
[208, ["inline-array", "vector", 6]],
[304, ["inline-array", "vector", 6]],
[416, "vector"],
[448, "vector"]
],
"(method 13 editable-face)": [[64, ["inline-array", "vector", 6]]],
"(method 37 editable-face)": [[16, ["inline-array", "vector", 6]]],
"(method 13 editable-array)": [
[96, "vector"],
[160, "vector"]
],
"cshape-reaction-update-state": [
[16, "vector"],
[32, "vector"]
],
"(method 70 wvehicle)": [[32, "update-engine-mix-state-work"]],
"find-nearest-focusable": [[48, "vector"]],
"(method 55 joint-exploder)": [[16, "bounding-box"]],
"(method 53 ocean)": [[16, "vector"]],
"(method 47 ocean)": [[16, "vector"]],
"(method 40 ocean)": [[16, "vector"]],
"(method 29 ocean)": [[16, "vector"]],
"(method 30 ocean)": [
[16, "vector"],
[32, "vector"]
],
"(method 54 ocean)": [
[16, "vector"],
[32, "vector"]
],
"(method 55 ocean)": [
[16, "vector"],
[32, "vector"]
],
"(method 56 ocean)": [
[16, "vector"],
[32, "vector"]
],
"(method 57 ocean)": [
[16, "vector"],
[32, "vector"]
],
"(method 13 ocean)": [[16, "vector"]],
"update-camera": [[16, "camera-free-floating-move-info"]],
"(method 92 construction-object)": [[16, "sprite-glow-data"]],
"(code getting-universe-information net-mgr)": [
[16, "medius-server-world-status-response"]
],
"camera-slave-debug": [
[48, "matrix"],
[144, "vector"]
],
"cam-layout-save-interesting": [[16, "vector"]],
"cam-layout-save-align": [[16, "vector"]],
"cam-layout-save-pivot": [[16, "vector"]],
"cam-layout-entity-volume-info-create": [
[32, "vector"],
[48, "vector"],
[64, "vector"],
[80, "vector"],
[96, "vector"],
[128, "vector"],
[144, "vector"]
],
"(method 59 nav-graph-editor)": [[16, "nav-poly"]],
"(method 32 nav-graph-editor)": [[16, ["inline-array", "vector", 4]]],
"(method 33 nav-graph-editor)": [
[16, "vector"],
[32, "vector"]
],
"(method 30 nav-graph-editor)": [
[32, "vector"],
[48, ["inline-array", "vector", 2]],
[112, "vector"],
[128, "vector"],
[144, "vector"]
],
"(method 36 nav-graph-editor)": [[16, ["inline-array", "vector", 4]]],
"(method 38 nav-graph-editor)": [
[80, "vector"],
[656, "nav-poly"],
[880, ["inline-array", "vector", 4]]
],
"(method 50 nav-graph-editor)": [
[16, "vector"],
[32, "vector"]
],
"(method 48 nav-graph-editor)": [
[48, "vector"],
[96, "vector"],
[128, "vector"]
],
"(method 14 nav-mesh-editable)": [
[16, ["inline-array", "vector", 4]],
[80, ["inline-array", "vector", 4]]
],
"(method 34 nav-graph-editor)": [
[16, "vector"],
[48, ["inline-array", "vector", 2]]
],
"(post draw-closest-minimap nav-graph-editor)": [
[64, ["inline-array", "vector", 4]]
],
"update-height": [[16, "vector"]],
"snap-level-navmesh": [
[16, "vector"],
[64, "vector"]
],
"(method 12 nav-mesh-editable)": [[32, "vector"]],
"(method 15 nav-mesh-editable)": [[16, "vector"]],
"(method 16 nav-mesh-editable)": [
[16, "vector"],
[48, "vector"]
],
"(method 10 nav-mesh-poly)": [
[16, "vector"],
[32, "vector"],
[48, "vector"],
[64, "vector"],
[80, "vector"],
[96, "vector"],
[112, "vector"],
[128, "vector"]
],
"(method 52 nav-mesh-editor)": [[80, "vector"]],
"(trans idle nav-mesh-editor)": [[16, "event-message-block"]],
"(method 25 grid-hash)": [
[16, "grid-hash-box"],
[32, "grid-hash-box"],
[48, "vector"],
[64, "vector"]
],
"(method 26 grid-hash)": [[16, "vector"]],
"(method 11 grid-hash)": [
[16, "vector"],
[32, "vector"]
],
"(method 13 grid-hash)": [[16, "sphere"]],
"(method 22 editable)": [
[16, "vector"],
[32, "vector"]
],
"(method 14 editable-point)": [
[32, "vector"],
[48, "vector"],
[80, ["inline-array", "vector", 4]]
],
"execute-mouse-move": [
[16, "vector"],
[32, "vector"],
[48, "vector"],
[64, "vector"],
[80, "vector"],
[112, "vector"]
],
"insert-wall": [[32, ["array", "int32", 2]]],
"insert-box": [[32, ["array", "int32", 8]]],
"(method 21 editable-entity)": [[80, "vector"]],
"(method 51 editable-player)": [[16, "vector"]],
"update-manipulator-position": [[16, "vector"]],
"(code playing-playback-game net-mgr)": [
[16, "event-message-block"],
[96, "mem-buffer"]
],
"texture-anim-layer-draw": [
[16, "matrix"],
[80, "matrix"],
[144, "matrix"],
[208, "matrix"]
],
"handle-sys-msg": [[96, "medius-chat-fwd-message"]],
"real-fog-texture-anim-func": [
[16, "vector"],
[32, "vector"]
],
"(method 220 wvehicle)": [
[16, "vector"],
[32, ["inline-array", "vector", 3]]
],
"wv-player-post-move-update": [[16, "event-message-block"]],
"(method 133 wvehicle)": [[16, "vector"]],
"(method 87 vehicle-wheel)": [[16, "rigid-body-move-work"]],
"(method 68 wvehicle)": [
[16, "vector"],
[32, "vector"]
],
"(method 229 wvehicle)": [[16, "matrix"]],
"player-wait-control-hook": [[16, "vehicle-controls"]],
"(enter explode wvehicle)": [
[16, "event-message-block"],
[96, ["inline-array", "vector", 2]]
],
"(post explode wvehicle)": [
[16, "vector"],
[32, "vector"]
],
"(enter explode-into-nothing wvehicle)": [[16, "explosion-init-params"]],
"(method 235 wvehicle)": [[32, ["inline-array", "vector", 3]]],
"(method 234 wvehicle)": [
[32, ["inline-array", "vector", 3]],
[80, "vector"],
[96, "vector4s-3"]
],
"spt-func-birth-on-height-die-drip-sewer": [
[16, "vector"],
[32, "vector"]
],
"spt-func-birth-on-die4": [
[16, "vector"],
[32, "vector"]
],
"spt-func-birth-on-die3": [
[16, "vector"],
[32, "vector"]
],
"spt-func-birth-on-die2": [
[16, "vector"],
[32, "vector"]
],
"spt-func-birth-on-die1": [
[16, "vector"],
[32, "vector"]
],
"spt-func-birth-on-height-die-drops": [
[16, "vector"],
[32, "vector"]
],
"part-jungle-bird10-path": [
[80, "vector"],
[96, "vector"]
],
"part-jungle-bird9-path": [[80, "vector"]],
"spt-func-birth-on-pop": [[16, "vector"]],
"spt-func-birth-on-height-die": [[16, "vector"]],
"spt-func-birth-on-height-die-drip": [
[16, "vector"],
[32, "vector"]
],
"(method 16 nav-link-search-info)": [
[16, "vector"],
[48, "vector"]
],
"(method 41 nav-control)": [
[16, "vector"],
[48, ["inline-array", "vector", 2]]
],
"(method 11 nav-control)": [[16, "nav-poly"]],
"(method 51 nav-state)": [[16, "nav-ray"]],
"(method 54 nav-state)": [[112, "nav-ray"]],
"(method 11 nav-state)": [
[16, "vector"],
[32, "vector"]
],
"(method 24 nav-state)": [[16, ["inline-array", "vector", 2]]],
"(method 28 nav-state)": [[208, "vector"]],
"(method 34 nav-state)": [[16, ["inline-array", "vector", 2]]],
"(method 31 nav-state)": [[112, "nav-ray"]],
"(method 32 nav-state)": [[16, "nav-control-cfs-work"]],
"(method 37 nav-state)": [[16, ["inline-array", "vector", 2]]],
"(anon-function 9 nav-control)": [[16, ["inline-array", "vector", 2]]],
"(anon-function 4 nav-control)": [[16, ["inline-array", "vector", 2]]],
"(method 19 nav-mesh)": [[16, "nav-ray"]],
"(method 21 nav-control)": [[16, "nav-ray"]],
"(post idle peak-snowball)": [
[48, "peak-obs-stackvar0"],
[128, ["inline-array", "vector", 3]]
],
"(method 17 peak-snowball)": [[48, "peak-obs-stackvar0"]],
"(method 71 coli-atlas-globe)": [
[16, ["inline-array", "collide-query", 1]],
[560, ["inline-array", "vector", 3]]
],
"(method 82 coli-atlas-globe)": [
[16, "rigid-body-impact"],
[96, "vector"]
],
"(method 80 coli-atlas-globe)": [[32, "peak-obs-stackvar0"]],
"(method 45 kras-pump-break)": [
[16, "vector"],
[32, "vector"]
],
"(method 52 palm-tree)": [
[16, "vector"],
[32, "desarena-obs-stackvar0"]
],
"(method 55 palm-tree)": [[16, "vector"]],
"(event vibrate palm-tree)": [[16, "vector"]],
"(event idle palm-tree)": [[16, "vector"]],
"part-menumap-bird1-path": [[80, "vector"]],
"part-menumap-bird2-path": [[80, "vector"]],
"part-menumap-bird3-path": [[80, "vector"]],
"part-menumap-bird4-path": [[80, "vector"]],
"part-menumap-bird5-path": [[80, "vector"]],
"part-menumap-bird6-path": [[80, "vector"]],
"part-menumap-bird7-path": [[80, "vector"]],
"part-menumap-bird8-path": [[80, "vector"]],
"part-menumap-bird9-path": [[80, "vector"]],
"part-menumap-bird10-path": [[80, "vector"]],
"spt-func-menumap-rocket": [[16, "vector"]],
"spt-func-menumap-birth-on-die4": [
[16, "vector"],
[32, "vector"]
],
"spt-func-menumap-birth-on-die3": [
[16, "vector"],
[32, "vector"]
],
"spt-func-menumap-birth-on-die2": [
[16, "vector"],
[32, "vector"]
],
"spt-func-menumap-birth-on-die1": [
[16, "vector"],
[32, "vector"]
],
"birth-func-vws-adopt-velocity": [[16, "vector"]],
"check-scorp-shell-level1": [[16, "vector"]],
"check-scorp-shell-level2": [[16, "vector"]],
"update-engine-mix-state": [[32, "vehicle-wheel-init-params"]],
"(method 52 garage-turntable)": [
[32, "vector"],
[48, "vector"],
[64, "vector"],
[80, ["inline-array", "vector", 18]]
],
"(enter explode kras-pump-break-proxy)": [[16, "event-message-block"]],
"(method 249 wvehicle)": [[16, "race-line-query-info"]],
"(method 65 vehicle-debris)": [[16, "vehicle-hardpoint-info"]],
"(method 87 vehicle-debris)": [[16, ["inline-array", "collide-query", 1]]],
"(method 185 vehicle)": [[16, "vector"]],
"(method 136 vehicle)": [[16, ["inline-array", "vector", 2]]],
"test-vehicle-weapon": [[16, "event-message-block"]],
"sound-name->string": [[16, ["array", "uint8", 16]]],
"string->sound-name": [[16, ["array", "sound-name", 1]]],
"vehicle-draw-thruster": [[16, "vehicle-thruster-work"]],
"(method 45 collide-shape)": [[16, "do-push-aways-work"]],
"(method 50 collide-shape)": [
[32, "vector"],
[48, "vector"]
],
"(method 18 collide-shape-prim-mesh)": [[16, "collide-tri-result"]],
"(method 18 collide-shape-prim-sphere)": [
[48, ["inline-array", "vector", 6]]
],
"(method 65 collide-shape-moving)": [[576, ["inline-array", "vector", 2]]],
"(anon-function 5 gsound)": [
[16, ["array", "symbol", 4]],
[32, ["array", "symbol", 4]]
],
"doppler-pitch-shift": [[16, ["inline-array", "vector", 2]]],
"(method 113 vehicle)": [[16, "vehicle-stack-type3"]],
"(code target-intro)": [[16, "vector"]],
"particle-adgif-callback": [[16, ["inline-array", "vector", 4]]],
"sp-adjust-launch": [[16, "matrix"]],
"sp-launch-particles-death": [[16, "matrix"]],
"sp-relaunch-setup-fields": [[16, "matrix"]],
"sparticle-rotate-to-vel-3d": [[16, "vector"]],
"sparticle-respawn-heights": [[16, "vector"]],
"sparticle-respawn-timer": [[16, "vector"]],
"sparticle-3d-rotate-xz-to-camera": [[16, "vector"]],
"spt-func-relative-pos": [
[16, "vector"],
[32, "vector"],
[48, "vector"],
[64, "matrix"],
[128, "matrix"],
[192, "matrix"]
],
"spt-func-turn-to-vel-radial": [[16, "vector"]],
"(method 54 collectoid-draw)": [[16, ["inline-array", "vector", 2]]],
"drop-collectoids": [[16, "net-powerup-spawn-params"]],
"(method 15 sparticle-launch-control)": [[16, "sphere"]],
"execute-part-engine": [[112, "matrix"]],
"(method 17 collide-shape-prim-mesh)": [[16, "collide-tri-result"]],
"update-time-of-day": [[16, "vector"]]
}
File diff suppressed because it is too large. Load diff
+11 -2
View File
@@ -215,6 +215,16 @@ std::string remove_trailing_spaces(const std::string& in) {
}
return short_name;
}
// List of characters that cannot occur in filenames on some platforms.
const std::set<char> banned_chars = {'<', '>', ':', '"', '/', '\\', '|', '?', '*', '^'};
std::string sanitize_name(const std::string& in) {
auto copy = remove_trailing_spaces(in);
for (auto& ch : copy) {
if (banned_chars.contains(ch))
ch = '_';
}
return copy;
}
struct AudioFileInfo {
std::string filename;
@@ -346,7 +356,6 @@ void process_music(const fs::path& output_path, const fs::path& input_dir) {
if (mus_name == "TWEAKVAL")
continue;
std::vector<std::string> sfx_names;
const size_t bank_offset = find_bank_offset(data); // Find where the music bank starts
if (bank_offset == SIZE_MAX) {
lg::error("'{}' is not a valid .MUS bank.", mus_name);
@@ -443,7 +452,7 @@ void process_sfx(const fs::path& output_path, const fs::path& input_dir) {
else
name = "sound" + std::to_string(sound_index);
auto file_name = fmt::format("{}.wav", remove_trailing_spaces(name));
auto file_name = fmt::format("{}.wav", sanitize_name(name));
write_wave_file(left_samples, right_samples, snd::SAMPLE_RATE, output_folder / file_name);
audio_len += left_samples.size() / (float)snd::SAMPLE_RATE;
+6 -4
View File
@@ -2044,8 +2044,8 @@ bool load_var_op_determine_type(types2::Type& type_out,
return true;
} else if (input_type.kind == TP_Type::Kind::TYPE_OF_TYPE_NO_VIRTUAL) {
// normal non-virtual method access
type_out.type =
TP_Type::make_non_virtual_method(method_type, TypeSpec(type_name), method_id);
type_out.type = TP_Type::make_non_virtual_method(method_type, TypeSpec(type_name),
method_id, method_info.name);
return true;
} else {
// normal virtual method access.
@@ -2071,7 +2071,8 @@ bool load_var_op_determine_type(types2::Type& type_out,
}
}
// nope
type_out.type = TP_Type::make_virtual_method(method_type, TypeSpec(type_name), method_id);
type_out.type = TP_Type::make_virtual_method(method_type, TypeSpec(type_name), method_id,
method_info.name);
return true;
}
}
@@ -2095,7 +2096,8 @@ bool load_var_op_determine_type(types2::Type& type_out,
if (method_id != GOAL_NEW_METHOD && method_id != GOAL_RELOC_METHOD) {
// this can get us the wrong thing for `new` methods. And maybe relocate?
type_out.type = TP_Type::make_non_virtual_method(
method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id);
method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id,
method_info.name);
return true;
}
}
+4 -2
View File
@@ -66,9 +66,11 @@ std::string TP_Type::print() const {
case Kind::DYNAMIC_METHOD_ACCESS:
return fmt::format("<dynamic-method-access>");
case Kind::VIRTUAL_METHOD:
return fmt::format("<vmethod {}>", m_ts.print());
return fmt::format("<vmethod({}:{}) {}>", m_method_id,
m_method_name.empty() ? "?" : m_method_name, m_ts.print());
case Kind::NON_VIRTUAL_METHOD:
return fmt::format("<method {}>", m_ts.print());
return fmt::format("<method({}:{}) {}>", m_method_id,
m_method_name.empty() ? "?" : m_method_name, m_ts.print());
case Kind::LEFT_SHIFTED_BITFIELD:
if (m_pcpyud) {
return fmt::format("(<{}> << {}) :u", m_ts.print(), m_int);
+9 -2
View File
@@ -137,23 +137,27 @@ class TP_Type {
static TP_Type make_virtual_method(const TypeSpec& method_type,
const TypeSpec& obj_type,
int method_id) {
int method_id,
const std::string& method_name = {}) {
TP_Type result;
result.kind = Kind::VIRTUAL_METHOD;
result.m_ts = method_type;
result.m_method_from_type = obj_type;
result.m_method_id = method_id;
result.m_method_name = method_name;
return result;
}
static TP_Type make_non_virtual_method(const TypeSpec& method_type,
const TypeSpec& obj_type,
int method_id) {
int method_id,
const std::string& method_name = {}) {
TP_Type result;
result.kind = Kind::NON_VIRTUAL_METHOD;
result.m_method_from_type = obj_type;
result.m_ts = method_type;
result.m_method_id = method_id;
result.m_method_name = method_name;
return result;
}
@@ -468,6 +472,8 @@ class TP_Type {
return m_method_id;
}
const std::string& method_name() const { return m_method_name; }
bool flipped_add_order() const {
ASSERT(kind == Kind::OBJECT_PLUS_PRODUCT_WITH_CONSTANT);
return m_flipped_order;
@@ -482,6 +488,7 @@ class TP_Type {
TypeSpec m_ts;
TypeSpec m_method_from_type; // hack, also stores sum type.
int m_method_id = -1;
std::string m_method_name;
std::string m_str;
int64_t m_int = 0;
bool m_pcpyud = false; // have we extracted the top doubleword of a bitfield?
+2
View File
@@ -1073,6 +1073,8 @@ const std::unordered_map<
}},
{GameVersion::JakX,
{
{"actor-hash-bucket",
{{"data", ArrayFieldDecompMeta(TypeSpec("actor-cshape-ptr"), 16)}}},
{"ocean-near-indices",
{{"data", ArrayFieldDecompMeta(TypeSpec("ocean-near-index"), 32)}}},
{"ocean-mid-masks", {{"data", ArrayFieldDecompMeta(TypeSpec("ocean-mid-mask"), 8)}}},
+3
View File
@@ -1387,6 +1387,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
030000008f0e00000800000010010000,Gasia PlayStation Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
030000006f0e0000b20200000f010000,PDP Xbox One Controller,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,
03000000451300000010000010010000,Genius Maxfire Grandias 12,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
03000000f025000021c1000010010000,Gioteck PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
03000000f0250000c283000010010000,Gioteck VX2 PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
@@ -1738,6 +1739,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
03000000321500000b10000011010000,Razer Wolverine PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Linux,
0300000032150000140a000001010000,Razer Wolverine Ultimate Xbox,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
0300000032150000290a000001010000,Razer Wolverine V2 Xbox,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,
030000000d0f0000c100000010010000,Retro Bit Legacy16,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,guide:b12,leftshoulder:b4,lefttrigger:b6,misc1:b13,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
03000000790000001100000010010000,Retro Controller,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,lefttrigger:b7,rightshoulder:b4,righttrigger:b5,start:b9,x:b0,y:b3,platform:Linux,
03000000632500007805000011010000,Retro Fighters D6,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
@@ -1849,6 +1851,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
05000000f51000008f01000001000000,Turtle Beach Rematch Nintendo Switch Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
03000000100800000100000010010000,Twin PlayStation Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
03000000c0160000e105000010010000,Ultimate Atari Fight Stick,a:b1,b:b2,back:b9,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,rightshoulder:b4,righttrigger:b5,start:b8,x:b0,y:b3,platform:Linux,
030000006f0e00001211000010010000,Unico MVS Mini Pad,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b9,x:b2,y:b3,platform:Linux,
03000000151900005678000010010000,Uniplay U6,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
03000000790000000600000007010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Linux,
+418 -179
View File
@@ -1,181 +1,3 @@
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_12_collide_mesh {
struct Cache {
void* fake_scratchpad_data; // *fake-scratchpad-data*
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// nop // sll r0, r0, 0
get_fake_spad_addr2(t0, cache.fake_scratchpad_data, 0, c);// lui t0, 28672
c->lwu(v1, 8, a0); // lwu v1, 8(a0)
// nop // sll r0, r0, 0
c->lwu(a3, 12, a0); // lwu a3, 12(a0)
bc = c->sgpr64(v1) == 0; // beq v1, r0, L7
c->lqc2(vf1, 0, a2); // lqc2 vf1, 0(a2)
if (bc) {goto block_3;} // branch non-likely
// nop // sll r0, r0, 0
c->lqc2(vf2, 16, a2); // lqc2 vf2, 16(a2)
c->daddiu(t0, t0, -64); // daddiu t0, t0, -64
c->lqc2(vf3, 32, a2); // lqc2 vf3, 32(a2)
// nop // sll r0, r0, 0
c->lqc2(vf4, 48, a2); // lqc2 vf4, 48(a2)
// nop // sll r0, r0, 0
c->lqc2(vf5, 0, a3); // lqc2 vf5, 0(a3)
// nop // sll r0, r0, 0
c->lqc2(vf6, 16, a3); // lqc2 vf6, 16(a3)
// nop // sll r0, r0, 0
c->lqc2(vf7, 32, a3); // lqc2 vf7, 32(a3)
// nop // sll r0, r0, 0
c->lqc2(vf8, 48, a3); // lqc2 vf8, 48(a3)
block_2:
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->daddiu(a3, a3, 64); // daddiu a3, a3, 64
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf5); // vmaddax.xyzw acc, vf1, vf5
c->daddiu(t0, t0, 64); // daddiu t0, t0, 64
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf5); // vmadday.xyzw acc, vf2, vf5
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf9, vf3, vf5); // vmaddz.xyzw vf9, vf3, vf5
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf5, 0, a3); // lqc2 vf5, 0(a3)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf6); // vmaddax.xyzw acc, vf1, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf6); // vmadday.xyzw acc, vf2, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf10, vf3, vf6); // vmaddz.xyzw vf10, vf3, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf6, 16, a3); // lqc2 vf6, 16(a3)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf7); // vmaddax.xyzw acc, vf1, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf7); // vmadday.xyzw acc, vf2, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf11, vf3, vf7); // vmaddz.xyzw vf11, vf3, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf7, 32, a3); // lqc2 vf7, 32(a3)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf8); // vmaddax.xyzw acc, vf1, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf8); // vmadday.xyzw acc, vf2, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf12, vf3, vf8); // vmaddz.xyzw vf12, vf3, vf8
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lqc2(vf8, 48, a3); // lqc2 vf8, 48(a3)
c->daddiu(v1, v1, -4); // daddiu v1, v1, -4
c->sqc2(vf9, 0, t0); // sqc2 vf9, 0(t0)
// nop // sll r0, r0, 0
c->sqc2(vf10, 16, t0); // sqc2 vf10, 16(t0)
// nop // sll r0, r0, 0
c->sqc2(vf11, 32, t0); // sqc2 vf11, 32(t0)
bc = ((s64)c->sgpr64(v1)) > 0; // bgtz v1, L6
c->sqc2(vf12, 48, t0); // sqc2 vf12, 48(t0)
if (bc) {goto block_2;} // branch non-likely
block_3:
c->daddiu(v1, a0, 28); // daddiu v1, a0, 28
// nop // sll r0, r0, 0
get_fake_spad_addr2(a2, cache.fake_scratchpad_data, 0, c);// lui a2, 28672
c->lwu(a0, 4, a0); // lwu a0, 4(a0)
bc = c->sgpr64(a0) == 0; // beq a0, r0, L9
c->lbu(t0, 0, v1); // lbu t0, 0(v1)
if (bc) {goto block_6;} // branch non-likely
c->daddiu(a1, a1, -96); // daddiu a1, a1, -96
c->lbu(a3, 1, v1); // lbu a3, 1(v1)
c->dsll(t0, t0, 4); // dsll t0, t0, 4
c->lbu(t2, 2, v1); // lbu t2, 2(v1)
c->dsll(t1, a3, 4); // dsll t1, a3, 4
c->lwu(a3, 4, v1); // lwu a3, 4(v1)
c->dsll(t2, t2, 4); // dsll t2, t2, 4
c->daddu(t0, t0, a2); // daddu t0, t0, a2
c->daddu(t1, t1, a2); // daddu t1, t1, a2
c->daddu(t2, t2, a2); // daddu t2, t2, a2
block_5:
c->daddiu(a0, a0, -1); // daddiu a0, a0, -1
c->lqc2(vf1, 0, t0); // lqc2 vf1, 0(t0)
c->daddiu(v1, v1, 8); // daddiu v1, v1, 8
c->lqc2(vf2, 0, t1); // lqc2 vf2, 0(t1)
c->daddiu(a1, a1, 96); // daddiu a1, a1, 96
c->lqc2(vf3, 0, t2); // lqc2 vf3, 0(t2)
c->vsub(DEST::xyzw, vf4, vf2, vf1); // vsub.xyzw vf4, vf2, vf1
c->sqc2(vf1, 0, a1); // sqc2 vf1, 0(a1)
c->vmini(DEST::xyzw, vf8, vf1, vf2); // vmini.xyzw vf8, vf1, vf2
c->sqc2(vf2, 16, a1); // sqc2 vf2, 16(a1)
c->vsub(DEST::xyzw, vf5, vf3, vf1); // vsub.xyzw vf5, vf3, vf1
c->sqc2(vf3, 32, a1); // sqc2 vf3, 32(a1)
c->vmax(DEST::xyzw, vf9, vf1, vf2); // vmax.xyzw vf9, vf1, vf2
c->lbu(t1, 0, v1); // lbu t1, 0(v1)
c->vopmula(vf4, vf5); // vopmula.xyz acc, vf4, vf5
c->lbu(t2, 1, v1); // lbu t2, 1(v1)
c->vopmsub(vf6, vf5, vf4); // vopmsub.xyz vf6, vf5, vf4
c->lbu(t0, 2, v1); // lbu t0, 2(v1)
c->vmul(DEST::xyzw, vf7, vf6, vf6); // vmul.xyzw vf7, vf6, vf6
// nop // sll r0, r0, 0
c->vmini(DEST::xyzw, vf8, vf8, vf3); // vmini.xyzw vf8, vf8, vf3
c->dsll(t1, t1, 4); // dsll t1, t1, 4
c->vmax(DEST::xyzw, vf9, vf9, vf3); // vmax.xyzw vf9, vf9, vf3
c->dsll(t2, t2, 4); // dsll t2, t2, 4
c->vmula_bc(DEST::w, BC::x, vf0, vf7); // vmulax.w acc, vf0, vf7
c->dsll(t3, t0, 4); // dsll t3, t0, 4
c->vmadda_bc(DEST::w, BC::y, vf0, vf7); // vmadday.w acc, vf0, vf7
c->daddu(t0, t1, a2); // daddu t0, t1, a2
c->vmadd_bc(DEST::w, BC::z, vf7, vf0, vf7); // vmaddz.w vf7, vf0, vf7
c->daddu(t1, t2, a2); // daddu t1, t2, a2
c->vrsqrt(vf0, BC::w, vf7, BC::w); // vrsqrt Q, vf0.w, vf7.w
c->daddu(t2, t3, a2); // daddu t2, t3, a2
c->vftoi0(DEST::xyzw, vf8, vf8); // vftoi0.xyzw vf8, vf8
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf9, vf9); // vftoi0.xyzw vf9, vf9
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->sqc2(vf8, 64, a1); // sqc2 vf8, 64(a1)
c->vwaitq(); // vwaitq
c->sqc2(vf9, 80, a1); // sqc2 vf9, 80(a1)
c->vmulq(DEST::xyz, vf6, vf6); // vmulq.xyz vf6, vf6, Q
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->sqc2(vf6, 48, a1); // sqc2 vf6, 48(a1)
// nop // sll r0, r0, 0
c->sw(a3, 60, a1); // sw a3, 60(a1)
bc = c->sgpr64(a0) != 0; // bne a0, r0, L8
c->lwu(a3, 4, v1); // lwu a3, 4(v1)
if (bc) {goto block_5;} // branch non-likely
block_6:
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
//jr ra // jr ra
c->daddu(sp, sp, r0); // daddu sp, sp, r0
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c();
gLinkedFunctionTable.reg("(method 12 collide-mesh)", execute, 512);
}
} // namespace method_12_collide_mesh
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
@@ -483,4 +305,421 @@ void link() {
}
} // namespace method_14_collide_mesh
} // namespace Mips2C
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_11_collide_mesh {
struct Cache {
void* closest_pt_in_triangle; // closest-pt-in-triangle
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -160); // daddiu sp, sp, -160
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s1, 64, sp); // sq s1, 64(sp)
c->sq(s2, 80, sp); // sq s2, 80(sp)
c->sq(s3, 96, sp); // sq s3, 96(sp)
c->sq(s4, 112, sp); // sq s4, 112(sp)
c->sq(s5, 128, sp); // sq s5, 128(sp)
c->sq(gp, 144, sp); // sq gp, 144(sp)
c->mov64(gp, a2); // or gp, a2, r0
c->mov64(s5, a3); // or s5, a3, r0
c->mov64(s3, t0); // or s3, t0, r0
c->daddiu(s4, sp, 16); // daddiu s4, sp, 16
c->lui(v1, 17141); // lui v1, 17141
c->ori(v1, v1, 49807); // ori v1, v1, 49807
// nop // sll r0, r0, 0
c->mov64(s2, a1); // or s2, a1, r0
c->lqc2(vf3, 0, s5); // lqc2 vf3, 0(s5)
c->mov128_vf_gpr(vf14, v1); // qmtc2.i vf14, v1
c->lwu(s1, 4, a0); // lwu s1, 4(a0)
c->vadd_bc(DEST::w, BC::x, vf3, vf3, vf14); // vaddx.w vf3, vf3, vf14
// nop // sll r0, r0, 0
c->vsub_bc(DEST::xyzw, BC::w, vf12, vf3, vf3); // vsubw.xyzw vf12, vf3, vf3
// nop // sll r0, r0, 0
c->vadd_bc(DEST::xyzw, BC::w, vf13, vf3, vf3); // vaddw.xyzw vf13, vf3, vf3
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf12, vf12); // vftoi0.xyzw vf12, vf12
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf13, vf13); // vftoi0.xyzw vf13, vf13
// nop // sll r0, r0, 0
c->mov128_gpr_vf(v1, vf12); // qmfc2.i v1, vf12
c->sqc2(vf12, 16, s4); // sqc2 vf12, 16(s4)
c->mov128_gpr_vf(a0, vf13); // qmfc2.i a0, vf13
c->sqc2(vf13, 32, s4); // sqc2 vf13, 32(s4)
block_1:
bc = c->sgpr64(s1) == 0; // beq s1, r0, L34
c->lwu(a2, 60, s2); // lwu a2, 60(s2)
if (bc) {goto block_14;} // branch non-likely
c->addiu(a3, r0, 896); // addiu a3, r0, 896
c->addiu(a1, r0, 0); // addiu a1, r0, 0
c->and_(a2, a2, a3); // and a2, a2, a3
c->addiu(a3, r0, 256); // addiu a3, r0, 256
bc = c->sgpr64(a2) == c->sgpr64(a1); // beq a2, a1, L32
c->daddiu(s1, s1, -1); // daddiu s1, s1, -1
if (bc) {goto block_5;} // branch non-likely
if (((s64)c->sgpr64(a2)) != ((s64)c->sgpr64(a3))) {// bnel a2, a3, L31
c->daddiu(s2, s2, 96); // daddiu s2, s2, 96
goto block_1;
}
block_5:
// nop // sll r0, r0, 0
c->lq(a2, 64, s2); // lq a2, 64(s2)
// nop // sll r0, r0, 0
c->lq(a1, 80, s2); // lq a1, 80(s2)
c->pcgtw(a2, a2, a0); // pcgtw a2, a2, a0
c->mfc1(r0, f31); // mfc1 r0, f31
c->pcgtw(a1, v1, a1); // pcgtw a1, v1, a1
c->mfc1(r0, f31); // mfc1 r0, f31
c->por(a1, a2, a1); // por a1, a2, a1
// nop // sll r0, r0, 0
c->ppach(a1, r0, a1); // ppach a1, r0, a1
c->mfc1(r0, f31); // mfc1 r0, f31
c->dsll(a1, a1, 16); // dsll a1, a1, 16
// nop // sll r0, r0, 0
if (((s64)c->sgpr64(a1)) != ((s64)0)) { // bnel a1, r0, L31
c->daddiu(s2, s2, 96); // daddiu s2, s2, 96
goto block_1;
}
block_7:
c->load_symbol2(t9, cache.closest_pt_in_triangle);// lw t9, closest-pt-in-triangle(s7)
c->daddu(a0, r0, s4); // daddu a0, r0, s4
c->mov64(a1, s5); // or a1, s5, r0
c->daddu(a2, r0, s2); // daddu a2, r0, s2
c->daddiu(a3, s2, 48); // daddiu a3, s2, 48
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->lqc2(vf2, 0, s4); // lqc2 vf2, 0(s4)
c->lqc2(vf3, 0, s5); // lqc2 vf3, 0(s5)
c->lqc2(vf1, 48, s2); // lqc2 vf1, 48(s2)
c->lq(v1, 16, s4); // lq v1, 16(s4)
c->lq(a0, 32, s4); // lq a0, 32(s4)
c->vsub(DEST::xyzw, vf4, vf3, vf2); // vsub.xyzw vf4, vf3, vf2
c->lwu(a1, 60, s2); // lwu a1, 60(s2)
c->vmul(DEST::xyzw, vf5, vf4, vf1); // vmul.xyzw vf5, vf4, vf1
c->lqc2(vf7, 0, s2); // lqc2 vf7, 0(s2)
c->vmul(DEST::xyzw, vf6, vf4, vf4); // vmul.xyzw vf6, vf4, vf4
c->lqc2(vf8, 16, s2); // lqc2 vf8, 16(s2)
c->vmove(DEST::w, vf1, vf0); // vmove.w vf1, vf0
c->lqc2(vf9, 32, s2); // lqc2 vf9, 32(s2)
c->vadd_bc(DEST::y, BC::x, vf5, vf5, vf5); // vaddx.y vf5, vf5, vf5
c->daddiu(s2, s2, 96); // daddiu s2, s2, 96
c->vadd_bc(DEST::x, BC::y, vf6, vf6, vf6); // vaddy.x vf6, vf6, vf6
c->mtc1(f5, s3); // mtc1 f5, s3
c->vadd_bc(DEST::y, BC::z, vf5, vf5, vf5); // vaddz.y vf5, vf5, vf5
c->lui(a2, 17141); // lui a2, 17141
c->ori(a2, a2, 49807); // ori a2, a2, 49807
c->mtc1(f3, a2); // mtc1 f3, a2
c->vadd_bc(DEST::x, BC::z, vf6, vf6, vf6); // vaddz.x vf6, vf6, vf6
c->lui(a2, -15232); // lui a2, -15232
c->mtc1(f4, a2); // mtc1 f4, a2
c->vsqrt(vf6, BC::x); // vsqrt Q, vf6.x
c->mov128_gpr_vf(a2, vf5); // qmfc2.i a2, vf5
c->vwaitq(); // vwaitq
c->lwc1(f1, 12, s5); // lwc1 f1, 12(s5)
c->vaddq(DEST::x, vf6, vf0); // vaddq.x vf6, vf0, Q
c->vmove(DEST::xyzw, vf10, vf6); // vmove.xyzw vf10, vf6
if (((s64)c->sgpr64(a2)) < 0) { // bltzl a2, L33
c->vsub(DEST::xyzw, vf10, vf0, vf10); // vsub.xyzw vf10, vf0, vf10
goto block_9;
}
block_9:
c->mov128_gpr_vf(a2, vf10); // qmfc2.i a2, vf10
c->mtc1(f2, a2); // mtc1 f2, a2
c->subs(f2, f2, f1); // sub.s f2, f2, f1
cop1_bc = c->fprs[f5] < c->fprs[f2]; // c.lt.s f5, f2
bc = cop1_bc; // bc1t L31
c->vdiv(vf0, BC::w, vf6, BC::x); // vdiv Q, vf0.w, vf6.x
if (bc) {goto block_1;} // branch non-likely
cop1_bc = c->fprs[f3] <= c->fprs[f2]; // c.le.s f3, f2
bc = cop1_bc; // bc1t L31
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
cop1_bc = c->fprs[f2] <= c->fprs[f4]; // c.le.s f2, f4
bc = cop1_bc; // bc1t L31
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->vwaitq(); // vwaitq
// nop // sll r0, r0, 0
c->vmulq(DEST::xyzw, vf11, vf4); // vmulq.xyzw vf11, vf4, Q
c->lui(a2, 16180); // lui a2, 16180
c->ori(a2, a2, 65012); // ori a2, a2, 65012
c->mtc1(f6, a2); // mtc1 f6, a2
c->vmul(DEST::xyzw, vf5, vf11, vf1); // vmul.xyzw vf5, vf11, vf1
c->vadd_bc(DEST::x, BC::y, vf5, vf5, vf5); // vaddy.x vf5, vf5, vf5
c->vadd_bc(DEST::x, BC::z, vf5, vf5, vf5); // vaddz.x vf5, vf5, vf5
c->mov128_gpr_vf(a2, vf5); // qmfc2.i a2, vf5
c->mtc1(f7, a2); // mtc1 f7, a2
cop1_bc = c->fprs[f7] < c->fprs[f6]; // c.lt.s f7, f6
bc = cop1_bc; // bc1t L31
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->mfc1(s3, f2); // mfc1 s3, f2
c->sqc2(vf7, 0, gp); // sqc2 vf7, 0(gp)
c->sqc2(vf8, 16, gp); // sqc2 vf8, 16(gp)
c->sqc2(vf9, 32, gp); // sqc2 vf9, 32(gp)
c->sqc2(vf2, 48, gp); // sqc2 vf2, 48(gp)
c->sqc2(vf1, 64, gp); // sqc2 vf1, 64(gp)
//beq r0, r0, L31 // beq r0, r0, L31
c->sw(a1, 80, gp); // sw a1, 80(gp)
goto block_1; // branch always
block_14:
c->mov64(v0, s3); // or v0, s3, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 144, sp); // lq gp, 144(sp)
c->lq(s5, 128, sp); // lq s5, 128(sp)
c->lq(s4, 112, sp); // lq s4, 112(sp)
c->lq(s3, 96, sp); // lq s3, 96(sp)
c->lq(s2, 80, sp); // lq s2, 80(sp)
c->lq(s1, 64, sp); // lq s1, 64(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 160); // daddiu sp, sp, 160
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.closest_pt_in_triangle = intern_from_c(-1, 0, "closest-pt-in-triangle").c();
gLinkedFunctionTable.reg("(method 11 collide-mesh)", execute, 256);
}
} // namespace method_11_collide_mesh
} // namespace Mips2C
// add method_11_collide_mesh::link to the link callback table for the object file.
// FWD DEC:
namespace method_11_collide_mesh { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_13_collide_mesh {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lwu(v1, 12, a0); // lwu v1, 12(a0)
// nop // sll r0, r0, 0
c->lwu(a0, 8, a0); // lwu a0, 8(a0)
// nop // sll r0, r0, 0
c->lqc2(vf1, 0, a1); // lqc2 vf1, 0(a1)
// nop // sll r0, r0, 0
c->lqc2(vf2, 16, a1); // lqc2 vf2, 16(a1)
// nop // sll r0, r0, 0
c->lqc2(vf3, 32, a1); // lqc2 vf3, 32(a1)
// nop // sll r0, r0, 0
c->lqc2(vf4, 48, a1); // lqc2 vf4, 48(a1)
// nop // sll r0, r0, 0
c->lqc2(vf5, 0, v1); // lqc2 vf5, 0(v1)
// nop // sll r0, r0, 0
c->lqc2(vf6, 16, v1); // lqc2 vf6, 16(v1)
// nop // sll r0, r0, 0
c->lqc2(vf7, 32, v1); // lqc2 vf7, 32(v1)
// nop // sll r0, r0, 0
c->lqc2(vf8, 48, v1); // lqc2 vf8, 48(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf9, 64, v1); // lqc2 vf9, 64(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf5); // vmaddax.xyzw acc, vf1, vf5
c->lqc2(vf10, 80, v1); // lqc2 vf10, 80(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf5); // vmadday.xyzw acc, vf2, vf5
c->lqc2(vf11, 96, v1); // lqc2 vf11, 96(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf3, vf5); // vmaddz.xyzw vf5, vf3, vf5
c->lqc2(vf12, 112, v1); // lqc2 vf12, 112(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf6); // vmaddax.xyzw acc, vf1, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf6); // vmadday.xyzw acc, vf2, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf6, vf3, vf6); // vmaddz.xyzw vf6, vf3, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf7); // vmaddax.xyzw acc, vf1, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf7); // vmadday.xyzw acc, vf2, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf7, vf3, vf7); // vmaddz.xyzw vf7, vf3, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf8); // vmaddax.xyzw acc, vf1, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf8); // vmadday.xyzw acc, vf2, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf8, vf3, vf8); // vmaddz.xyzw vf8, vf3, vf8
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf13, vf5); // vftoi0.xyzw vf13, vf5
c->sqc2(vf5, 0, a2); // sqc2 vf5, 0(a2)
c->vftoi0(DEST::xyzw, vf14, vf6); // vftoi0.xyzw vf14, vf6
c->sqc2(vf6, 32, a2); // sqc2 vf6, 32(a2)
c->vftoi0(DEST::xyzw, vf15, vf7); // vftoi0.xyzw vf15, vf7
c->sqc2(vf7, 64, a2); // sqc2 vf7, 64(a2)
c->vftoi0(DEST::xyzw, vf16, vf8); // vftoi0.xyzw vf16, vf8
c->sqc2(vf8, 96, a2); // sqc2 vf8, 96(a2)
// nop // sll r0, r0, 0
c->sqc2(vf13, 16, a2); // sqc2 vf13, 16(a2)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf14, 48, a2); // sqc2 vf14, 48(a2)
c->daddiu(v1, v1, 128); // daddiu v1, v1, 128
c->sqc2(vf15, 80, a2); // sqc2 vf15, 80(a2)
bc = ((s64)c->sgpr64(a0)) <= 0; // blez a0, L25
c->sqc2(vf16, 112, a2); // sqc2 vf16, 112(a2)
if (bc) {goto block_3;} // branch non-likely
block_1:
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf5, 0, v1); // lqc2 vf5, 0(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf9); // vmaddax.xyzw acc, vf1, vf9
c->lqc2(vf6, 16, v1); // lqc2 vf6, 16(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf9); // vmadday.xyzw acc, vf2, vf9
c->lqc2(vf7, 32, v1); // lqc2 vf7, 32(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf9, vf3, vf9); // vmaddz.xyzw vf9, vf3, vf9
c->lqc2(vf8, 48, v1); // lqc2 vf8, 48(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf10); // vmaddax.xyzw acc, vf1, vf10
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf10); // vmadday.xyzw acc, vf2, vf10
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf10, vf3, vf10); // vmaddz.xyzw vf10, vf3, vf10
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf11); // vmaddax.xyzw acc, vf1, vf11
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf11); // vmadday.xyzw acc, vf2, vf11
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf11, vf3, vf11); // vmaddz.xyzw vf11, vf3, vf11
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf12); // vmaddax.xyzw acc, vf1, vf12
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf12); // vmadday.xyzw acc, vf2, vf12
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf12, vf3, vf12); // vmaddz.xyzw vf12, vf3, vf12
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf17, vf9); // vftoi0.xyzw vf17, vf9
c->sqc2(vf9, 128, a2); // sqc2 vf9, 128(a2)
c->vftoi0(DEST::xyzw, vf18, vf10); // vftoi0.xyzw vf18, vf10
c->sqc2(vf10, 160, a2); // sqc2 vf10, 160(a2)
c->vftoi0(DEST::xyzw, vf19, vf11); // vftoi0.xyzw vf19, vf11
c->sqc2(vf11, 192, a2); // sqc2 vf11, 192(a2)
c->vftoi0(DEST::xyzw, vf20, vf12); // vftoi0.xyzw vf20, vf12
c->sqc2(vf12, 224, a2); // sqc2 vf12, 224(a2)
// nop // sll r0, r0, 0
c->sqc2(vf17, 144, a2); // sqc2 vf17, 144(a2)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf18, 176, a2); // sqc2 vf18, 176(a2)
// nop // sll r0, r0, 0
c->sqc2(vf19, 208, a2); // sqc2 vf19, 208(a2)
bc = ((s64)c->sgpr64(a0)) <= 0; // blez a0, L25
c->sqc2(vf20, 240, a2); // sqc2 vf20, 240(a2)
if (bc) {goto block_3;} // branch non-likely
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->lqc2(vf9, 64, v1); // lqc2 vf9, 64(v1)
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf5); // vmaddax.xyzw acc, vf1, vf5
c->lqc2(vf10, 80, v1); // lqc2 vf10, 80(v1)
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf5); // vmadday.xyzw acc, vf2, vf5
c->lqc2(vf11, 96, v1); // lqc2 vf11, 96(v1)
c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf3, vf5); // vmaddz.xyzw vf5, vf3, vf5
c->lqc2(vf12, 112, v1); // lqc2 vf12, 112(v1)
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
c->daddiu(a2, a2, 256); // daddiu a2, a2, 256
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf6); // vmaddax.xyzw acc, vf1, vf6
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf6); // vmadday.xyzw acc, vf2, vf6
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf6, vf3, vf6); // vmaddz.xyzw vf6, vf3, vf6
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf7); // vmaddax.xyzw acc, vf1, vf7
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf7); // vmadday.xyzw acc, vf2, vf7
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf7, vf3, vf7); // vmaddz.xyzw vf7, vf3, vf7
// nop // sll r0, r0, 0
c->vmula_bc(DEST::xyzw, BC::w, vf4, vf0); // vmulaw.xyzw acc, vf4, vf0
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf8); // vmaddax.xyzw acc, vf1, vf8
// nop // sll r0, r0, 0
c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf8); // vmadday.xyzw acc, vf2, vf8
// nop // sll r0, r0, 0
c->vmadd_bc(DEST::xyzw, BC::z, vf8, vf3, vf8); // vmaddz.xyzw vf8, vf3, vf8
// nop // sll r0, r0, 0
c->vftoi0(DEST::xyzw, vf13, vf5); // vftoi0.xyzw vf13, vf5
c->sqc2(vf5, 0, a2); // sqc2 vf5, 0(a2)
c->vftoi0(DEST::xyzw, vf14, vf6); // vftoi0.xyzw vf14, vf6
c->sqc2(vf6, 32, a2); // sqc2 vf6, 32(a2)
c->vftoi0(DEST::xyzw, vf15, vf7); // vftoi0.xyzw vf15, vf7
c->sqc2(vf7, 64, a2); // sqc2 vf7, 64(a2)
c->vftoi0(DEST::xyzw, vf16, vf8); // vftoi0.xyzw vf16, vf8
c->sqc2(vf8, 96, a2); // sqc2 vf8, 96(a2)
// nop // sll r0, r0, 0
c->sqc2(vf13, 16, a2); // sqc2 vf13, 16(a2)
c->daddiu(a0, a0, -4); // daddiu a0, a0, -4
c->sqc2(vf14, 48, a2); // sqc2 vf14, 48(a2)
c->daddiu(v1, v1, 128); // daddiu v1, v1, 128
c->sqc2(vf15, 80, a2); // sqc2 vf15, 80(a2)
bc = ((s64)c->sgpr64(a0)) > 0; // bgtz a0, L24
c->sqc2(vf16, 112, a2); // sqc2 vf16, 112(a2)
if (bc) {goto block_1;} // branch non-likely
block_3:
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
//jr ra // jr ra
c->daddu(sp, sp, r0); // daddu sp, sp, r0
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
gLinkedFunctionTable.reg("(method 13 collide-mesh)", execute, 256);
}
} // namespace method_13_collide_mesh
} // namespace Mips2C
// add method_13_collide_mesh::link to the link callback table for the object file.
// FWD DEC:
namespace method_13_collide_mesh { extern void link(); }
+108 -196
View File
@@ -4,206 +4,121 @@
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace calc_animation_from_spr {
struct Cache {
void* fake_scratchpad_data; // *fake-scratchpad-data*
void* clear_frame_accumulator; // clear-frame-accumulator
void* decompress_fixed_data_to_accumulator; // decompress-fixed-data-to-accumulator
void* decompress_frame_data_pair_to_accumulator; // decompress-frame-data-pair-to-accumulator
void* decompress_frame_data_to_accumulator; // decompress-frame-data-to-accumulator
void* normalize_frame_quaternions; // normalize-frame-quaternions
} cache;
namespace cspace_parented_transformq_joint {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->mov64(v1, a1); // or v1, a1, r0
c->daddiu(sp, sp, -192); // daddiu sp, sp, -192
c->sq(s0, 0, sp); // sq s0, 0(sp)
c->sq(s1, 16, sp); // sq s1, 16(sp)
c->sq(s2, 32, sp); // sq s2, 32(sp)
c->sq(s3, 48, sp); // sq s3, 48(sp)
c->sq(s4, 64, sp); // sq s4, 64(sp)
c->sq(s5, 80, sp); // sq s5, 80(sp)
c->sq(s6, 96, sp); // sq s6, 96(sp)
c->sq(t8, 112, sp); // sq t8, 112(sp)
c->sq(t9, 128, sp); // sq t9, 128(sp)
c->sq(gp, 144, sp); // sq gp, 144(sp)
c->sq(fp, 160, sp); // sq fp, 160(sp)
c->sq(ra, 176, sp); // sq ra, 176(sp)
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
c->mov128_vf_gpr(vf15, r0); // qmtc2.i vf15, r0
c->sw(a1, 0, sp); // sw a1, 0(sp)
get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672
c->lw(s1, 2384, v1); // lw s1, 2384(v1)
c->daddiu(t7, v1, 1808); // daddiu t7, v1, 1808
c->lui(s0, 4096); // lui s0, 4096
c->daddiu(t1, v1, 7328); // daddiu t1, v1, 7328
bc = c->sgpr64(s1) == 0; // beq s1, r0, L20
c->ori(s0, s0, 54272); // ori s0, s0, 54272
if (bc) {goto block_12;} // branch non-likely
c->lw(t2, 0, t7); // lw t2, 0(t7)
c->addiu(t3, r0, 7392); // addiu t3, r0, 7392
c->lw(t4, 4, t7); // lw t4, 4(t7)
c->addiu(v1, r0, 256); // addiu v1, r0, 256
c->sw(t2, 16, s0); // sw t2, 16(s0)
c->vadd_bc(DEST::xyzw, BC::w, vf14, vf15, vf0); // vaddw.xyzw vf14, vf15, vf0
c->sw(t3, 128, s0); // sw t3, 128(s0)
// nop // sll r0, r0, 0
c->sw(t4, 32, s0); // sw t4, 32(s0)
// Unknown instr: sync.l
c->sw(v1, 0, s0); // sw v1, 0(s0)
// Unknown instr: sync.l
c->load_symbol2(t9, cache.clear_frame_accumulator);// lw t9, clear-frame-accumulator(s7)
c->vadd(DEST::yz, vf14, vf14, vf14); // vadd.yz vf14, vf14, vf14
c->lw(s2, 0, sp); // lw s2, 0(sp)
// nop // sll r0, r0, 0
call_addr = c->gprs[t9].du32[0]; // function call:
c->vadd(DEST::yz, vf14, vf14, vf14); // vadd.yz vf14, vf14, vf14
c->jalr(call_addr); // jalr ra, t9
block_2:
c->lw(v1, 0, s0); // lw v1, 0(s0)
// nop // sll r0, r0, 0
c->andi(v1, v1, 256); // andi v1, v1, 256
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
bc = c->sgpr64(v1) != 0; // bne v1, r0, L16
c->lw(a3, 0, a0); // lw a3, 0(a0)
c->lui(v1, 16256); // lui v1, 16256
c->lqc2(vf5, 16, a1); // lqc2 vf5, 16(a1)
c->mtc1(f0, v1); // mtc1 f0, v1
c->lw(t0, 16, a3); // lw t0, 16(a3)
// nop // sll r0, r0, 0
c->lw(a2, 16, a0); // lw a2, 16(a0)
c->vadd(DEST::xyzw, vf6, vf5, vf5); // vadd.xyzw vf6, vf5, vf5
c->lwc1(f1, 64, t0); // lwc1 f1, 64(t0)
c->vadd_bc(DEST::x, BC::w, vf2, vf0, vf5); // vaddw.x vf2, vf0, vf5
c->lqc2(vf15, 0, a1); // lqc2 vf15, 0(a1)
c->vadd_bc(DEST::y, BC::z, vf2, vf0, vf5); // vaddz.y vf2, vf0, vf5
c->lqc2(vf1, 32, a1); // lqc2 vf1, 32(a1)
c->divs(f4, f0, f1); // div.s f4, f0, f1
c->lqc2(vf7, 0, t0); // lqc2 vf7, 0(t0)
c->vsub_bc(DEST::z, BC::y, vf2, vf0, vf5); // vsuby.z vf2, vf0, vf5
c->lqc2(vf8, 16, t0); // lqc2 vf8, 16(t0)
c->vsub_bc(DEST::w, BC::w, vf2, vf0, vf0); // vsubw.w vf2, vf0, vf0
c->lqc2(vf9, 32, t0); // lqc2 vf9, 32(t0)
c->vsub_bc(DEST::x, BC::z, vf3, vf0, vf5); // vsubz.x vf3, vf0, vf5
c->lqc2(vf10, 48, t0); // lqc2 vf10, 48(t0)
c->vadd_bc(DEST::y, BC::w, vf3, vf0, vf5); // vaddw.y vf3, vf0, vf5
c->lwc1(f2, 68, t0); // lwc1 f2, 68(t0)
c->vadd_bc(DEST::z, BC::x, vf3, vf0, vf5); // vaddx.z vf3, vf0, vf5
c->sqc2(vf1, 64, a2); // sqc2 vf1, 64(a2)
c->vsub_bc(DEST::w, BC::w, vf3, vf0, vf0); // vsubw.w vf3, vf0, vf0
c->lwc1(f3, 72, t0); // lwc1 f3, 72(t0)
c->vadd_bc(DEST::x, BC::y, vf4, vf0, vf5); // vaddy.x vf4, vf0, vf5
c->lw(v1, 76, t0); // lw v1, 76(t0)
c->vsub_bc(DEST::y, BC::x, vf4, vf0, vf5); // vsubx.y vf4, vf0, vf5
c->mfc1(t1, f4); // mfc1 t1, f4
c->vadd_bc(DEST::z, BC::w, vf4, vf0, vf5); // vaddw.z vf4, vf0, vf5
c->divs(f4, f0, f2); // div.s f4, f0, f2
c->vsub_bc(DEST::w, BC::w, vf4, vf0, vf0); // vsubw.w vf4, vf0, vf0
c->vopmula(vf6, vf2); // vopmula.xyz acc, vf6, vf2
c->vopmsub(vf2, vf2, vf6); // vopmsub.xyz vf2, vf2, vf6
c->vopmula(vf6, vf3); // vopmula.xyz acc, vf6, vf3
c->vopmsub(vf3, vf3, vf6); // vopmsub.xyz vf3, vf3, vf6
c->vopmula(vf6, vf4); // vopmula.xyz acc, vf6, vf4
c->vopmsub(vf4, vf4, vf6); // vopmsub.xyz vf4, vf4, vf6
c->vadd_bc(DEST::x, BC::w, vf2, vf2, vf0); // vaddw.x vf2, vf2, vf0
c->vadd_bc(DEST::y, BC::w, vf3, vf3, vf0); // vaddw.y vf3, vf3, vf0
c->vadd_bc(DEST::z, BC::w, vf4, vf4, vf0); // vaddw.z vf4, vf4, vf0
c->mfc1(t2, f4); // mfc1 t2, f4
bc = c->sgpr64(v1) != 0; // bne v1, r0, L64
c->divs(f4, f0, f3); // div.s f4, f0, f3
if (bc) {goto block_2;} // branch non-likely
c->lw(t2, 8, t7); // lw t2, 8(t7)
c->addiu(t3, r0, 9600); // addiu t3, r0, 9600
c->lw(t4, 12, t7); // lw t4, 12(t7)
c->addiu(v1, r0, 256); // addiu v1, r0, 256
c->sw(t2, 16, s0); // sw t2, 16(s0)
// nop // sll r0, r0, 0
c->sw(t3, 128, s0); // sw t3, 128(s0)
// nop // sll r0, r0, 0
c->sw(t4, 32, s0); // sw t4, 32(s0)
// Unknown instr: sync.l
c->sw(v1, 0, s0); // sw v1, 0(s0)
// Unknown instr: sync.l
c->lw(a2, 16, t7); // lw a2, 16(t7)
get_fake_spad_addr2(a1, cache.fake_scratchpad_data, 0, c);// lui a1, 28672
c->load_symbol2(t9, cache.decompress_fixed_data_to_accumulator);// lw t9, decompress-fixed-data-to-accumulator(s7)
c->daddiu(a1, a1, 7392); // daddiu a1, a1, 7392
call_addr = c->gprs[t9].du32[0]; // function call:
c->daddiu(s1, s1, -1); // daddiu s1, s1, -1
c->jalr(call_addr); // jalr ra, t9
block_4:
c->lw(v1, 0, s0); // lw v1, 0(s0)
// nop // sll r0, r0, 0
c->andi(v1, v1, 256); // andi v1, v1, 256
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
bc = c->sgpr64(v1) != 0; // bne v1, r0, L17
// nop // sll r0, r0, 0
if (bc) {goto block_4;} // branch non-likely
bc = c->sgpr64(s1) == 0; // beq s1, r0, L18
// nop // sll r0, r0, 0
if (bc) {goto block_7;} // branch non-likely
c->lw(t2, 24, t7); // lw t2, 24(t7)
c->addiu(t3, r0, 7392); // addiu t3, r0, 7392
c->lw(t4, 28, t7); // lw t4, 28(t7)
c->addiu(v1, r0, 256); // addiu v1, r0, 256
c->sw(t2, 16, s0); // sw t2, 16(s0)
// nop // sll r0, r0, 0
c->sw(t3, 128, s0); // sw t3, 128(s0)
// nop // sll r0, r0, 0
c->sw(t4, 32, s0); // sw t4, 32(s0)
// Unknown instr: sync.l
c->sw(v1, 0, s0); // sw v1, 0(s0)
// Unknown instr: sync.l
block_7:
c->lw(t0, 20, t7); // lw t0, 20(t7)
get_fake_spad_addr2(a1, cache.fake_scratchpad_data, 0, c);// lui a1, 28672
c->lw(a2, 16, t7); // lw a2, 16(t7)
c->daddiu(a1, a1, 9600); // daddiu a1, a1, 9600
bc = c->sgpr64(t0) == 0; // beq t0, r0, L19
// nop // sll r0, r0, 0
if (bc) {goto block_10;} // branch non-likely
c->lw(a3, 12, t7); // lw a3, 12(t7)
// nop // sll r0, r0, 0
c->load_symbol2(t9, cache.decompress_frame_data_pair_to_accumulator);// lw t9, decompress-frame-data-pair-to-accumulator(s7)
// nop // sll r0, r0, 0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(a3, a3, 3); // sll a3, a3, 3
c->jalr(call_addr); // jalr ra, t9
bc = c->sgpr64(s1) != 0; // bne s1, r0, L16
c->daddiu(t7, t7, 24); // daddiu t7, t7, 24
if (bc) {goto block_2;} // branch non-likely
c->load_symbol2(t9, cache.normalize_frame_quaternions);// lw t9, normalize-frame-quaternions(s7)
// nop // sll r0, r0, 0
c->lw(s2, 0, sp); // lw s2, 0(sp)
// nop // sll r0, r0, 0
call_addr = c->gprs[t9].du32[0]; // function call:
// nop // sll r0, r0, 0
c->jalr(call_addr); // jalr ra, t9
c->daddiu(sp, sp, 16); // daddiu sp, sp, 16
// nop // sll r0, r0, 0
c->lq(s0, 0, sp); // lq s0, 0(sp)
c->lq(s1, 16, sp); // lq s1, 16(sp)
c->lq(s2, 32, sp); // lq s2, 32(sp)
c->lq(s3, 48, sp); // lq s3, 48(sp)
c->lq(s4, 64, sp); // lq s4, 64(sp)
c->lq(s5, 80, sp); // lq s5, 80(sp)
c->lq(s6, 96, sp); // lq s6, 96(sp)
c->lq(t8, 112, sp); // lq t8, 112(sp)
c->lq(t9, 128, sp); // lq t9, 128(sp)
c->lq(gp, 144, sp); // lq gp, 144(sp)
c->lq(ra, 176, sp); // lq ra, 176(sp)
c->lq(fp, 160, sp); // lq fp, 160(sp)
c->vmul_bc(DEST::xyzw, BC::x, vf2, vf2, vf1); // vmulx.xyzw vf2, vf2, vf1
c->vmul_bc(DEST::xyzw, BC::y, vf3, vf3, vf1); // vmuly.xyzw vf3, vf3, vf1
c->vmul_bc(DEST::xyzw, BC::z, vf4, vf4, vf1); // vmulz.xyzw vf4, vf4, vf1
c->vmula_bc(DEST::xyzw, BC::x, vf7, vf2); // vmulax.xyzw acc, vf7, vf2
c->vmadda_bc(DEST::xyzw, BC::y, vf8, vf2); // vmadday.xyzw acc, vf8, vf2
c->vmadda_bc(DEST::xyzw, BC::z, vf9, vf2); // vmaddaz.xyzw acc, vf9, vf2
c->vmadd_bc(DEST::xyzw, BC::w, vf11, vf10, vf2); // vmaddw.xyzw vf11, vf10, vf2
c->vmula_bc(DEST::xyzw, BC::x, vf7, vf3); // vmulax.xyzw acc, vf7, vf3
c->vmadda_bc(DEST::xyzw, BC::y, vf8, vf3); // vmadday.xyzw acc, vf8, vf3
c->vmadda_bc(DEST::xyzw, BC::z, vf9, vf3); // vmaddaz.xyzw acc, vf9, vf3
c->vmadd_bc(DEST::xyzw, BC::w, vf12, vf10, vf3); // vmaddw.xyzw vf12, vf10, vf3
c->vmula_bc(DEST::xyzw, BC::x, vf7, vf4); // vmulax.xyzw acc, vf7, vf4
c->vmadda_bc(DEST::xyzw, BC::y, vf8, vf4); // vmadday.xyzw acc, vf8, vf4
c->vmadda_bc(DEST::xyzw, BC::z, vf9, vf4); // vmaddaz.xyzw acc, vf9, vf4
c->vmadd_bc(DEST::xyzw, BC::w, vf13, vf10, vf4); // vmaddw.xyzw vf13, vf10, vf4
c->vmula_bc(DEST::xyzw, BC::x, vf7, vf15); // vmulax.xyzw acc, vf7, vf15
c->vmadda_bc(DEST::xyzw, BC::y, vf8, vf15); // vmadday.xyzw acc, vf8, vf15
c->vmadda_bc(DEST::xyzw, BC::z, vf9, vf15); // vmaddaz.xyzw acc, vf9, vf15
c->vmadd_bc(DEST::xyzw, BC::w, vf14, vf10, vf0); // vmaddw.xyzw vf14, vf10, vf0
c->sqc2(vf11, 0, a2); // sqc2 vf11, 0(a2)
c->sqc2(vf12, 16, a2); // sqc2 vf12, 16(a2)
c->sqc2(vf13, 32, a2); // sqc2 vf13, 32(a2)
c->sqc2(vf14, 48, a2); // sqc2 vf14, 48(a2)
//jr ra // jr ra
c->daddiu(sp, sp, 192); // daddiu sp, sp, 192
// nop // sll r0, r0, 0
goto end_of_function; // return
block_10:
c->load_symbol2(t9, cache.decompress_frame_data_to_accumulator);// lw t9, decompress-frame-data-to-accumulator(s7)
// nop // sll r0, r0, 0
call_addr = c->gprs[t9].du32[0]; // function call:
// nop // sll r0, r0, 0
c->jalr(call_addr); // jalr ra, t9
bc = c->sgpr64(s1) != 0; // bne s1, r0, L16
c->daddiu(t7, t7, 24); // daddiu t7, t7, 24
if (bc) {goto block_2;} // branch non-likely
c->load_symbol2(t9, cache.normalize_frame_quaternions);// lw t9, normalize-frame-quaternions(s7)
// nop // sll r0, r0, 0
c->lw(s2, 0, sp); // lw s2, 0(sp)
// nop // sll r0, r0, 0
call_addr = c->gprs[t9].du32[0]; // function call:
// nop // sll r0, r0, 0
c->jalr(call_addr); // jalr ra, t9
block_12:
c->daddiu(sp, sp, 16); // daddiu sp, sp, 16
// nop // sll r0, r0, 0
c->lq(s0, 0, sp); // lq s0, 0(sp)
c->lq(s1, 16, sp); // lq s1, 16(sp)
c->lq(s2, 32, sp); // lq s2, 32(sp)
c->lq(s3, 48, sp); // lq s3, 48(sp)
c->lq(s4, 64, sp); // lq s4, 64(sp)
c->lq(s5, 80, sp); // lq s5, 80(sp)
c->lq(s6, 96, sp); // lq s6, 96(sp)
c->lq(t8, 112, sp); // lq t8, 112(sp)
c->lq(t9, 128, sp); // lq t9, 128(sp)
c->lq(gp, 144, sp); // lq gp, 144(sp)
c->lq(ra, 176, sp); // lq ra, 176(sp)
c->lq(fp, 160, sp); // lq fp, 160(sp)
block_2:
c->pextlw(t1, t2, t1); // pextlw t1, t2, t1
c->vmul_bc(DEST::xyzw, BC::x, vf2, vf2, vf1); // vmulx.xyzw vf2, vf2, vf1
c->vmul_bc(DEST::xyzw, BC::y, vf3, vf3, vf1); // vmuly.xyzw vf3, vf3, vf1
c->vmul_bc(DEST::xyzw, BC::z, vf4, vf4, vf1); // vmulz.xyzw vf4, vf4, vf1
c->mfc1(t3, f4); // mfc1 t3, f4
c->pcpyld(t1, t3, t1); // pcpyld t1, t3, t1
c->mov128_vf_gpr(vf16, t1); // qmtc2.i vf16, t1
c->vmul(DEST::xyzw, vf2, vf2, vf16); // vmul.xyzw vf2, vf2, vf16
c->vmul(DEST::xyzw, vf3, vf3, vf16); // vmul.xyzw vf3, vf3, vf16
c->vmul(DEST::xyzw, vf4, vf4, vf16); // vmul.xyzw vf4, vf4, vf16
c->vmula_bc(DEST::xyzw, BC::x, vf7, vf2); // vmulax.xyzw acc, vf7, vf2
c->vmadda_bc(DEST::xyzw, BC::y, vf8, vf2); // vmadday.xyzw acc, vf8, vf2
c->vmadda_bc(DEST::xyzw, BC::z, vf9, vf2); // vmaddaz.xyzw acc, vf9, vf2
c->vmadd_bc(DEST::xyzw, BC::w, vf11, vf10, vf2); // vmaddw.xyzw vf11, vf10, vf2
c->vmula_bc(DEST::xyzw, BC::x, vf7, vf3); // vmulax.xyzw acc, vf7, vf3
c->vmadda_bc(DEST::xyzw, BC::y, vf8, vf3); // vmadday.xyzw acc, vf8, vf3
c->vmadda_bc(DEST::xyzw, BC::z, vf9, vf3); // vmaddaz.xyzw acc, vf9, vf3
c->vmadd_bc(DEST::xyzw, BC::w, vf12, vf10, vf3); // vmaddw.xyzw vf12, vf10, vf3
c->vmula_bc(DEST::xyzw, BC::x, vf7, vf4); // vmulax.xyzw acc, vf7, vf4
c->vmadda_bc(DEST::xyzw, BC::y, vf8, vf4); // vmadday.xyzw acc, vf8, vf4
c->vmadda_bc(DEST::xyzw, BC::z, vf9, vf4); // vmaddaz.xyzw acc, vf9, vf4
c->vmadd_bc(DEST::xyzw, BC::w, vf13, vf10, vf4); // vmaddw.xyzw vf13, vf10, vf4
c->vmula_bc(DEST::xyzw, BC::x, vf7, vf15); // vmulax.xyzw acc, vf7, vf15
c->vmadda_bc(DEST::xyzw, BC::y, vf8, vf15); // vmadday.xyzw acc, vf8, vf15
c->vmadda_bc(DEST::xyzw, BC::z, vf9, vf15); // vmaddaz.xyzw acc, vf9, vf15
c->vmadd_bc(DEST::xyzw, BC::w, vf14, vf10, vf0); // vmaddw.xyzw vf14, vf10, vf0
c->sqc2(vf11, 0, a2); // sqc2 vf11, 0(a2)
c->sqc2(vf12, 16, a2); // sqc2 vf12, 16(a2)
c->sqc2(vf13, 32, a2); // sqc2 vf13, 32(a2)
c->sqc2(vf14, 48, a2); // sqc2 vf14, 48(a2)
//jr ra // jr ra
c->daddiu(sp, sp, 192); // daddiu sp, sp, 192
// nop // sll r0, r0, 0
goto end_of_function; // return
//jr ra // jr ra
@@ -218,14 +133,11 @@ end_of_function:
}
void link() {
cache.fake_scratchpad_data = intern_from_c(-1, 0, "*fake-scratchpad-data*").c();
cache.clear_frame_accumulator = intern_from_c(-1, 0, "clear-frame-accumulator").c();
cache.decompress_fixed_data_to_accumulator = intern_from_c(-1, 0, "decompress-fixed-data-to-accumulator").c();
cache.decompress_frame_data_pair_to_accumulator = intern_from_c(-1, 0, "decompress-frame-data-pair-to-accumulator").c();
cache.decompress_frame_data_to_accumulator = intern_from_c(-1, 0, "decompress-frame-data-to-accumulator").c();
cache.normalize_frame_quaternions = intern_from_c(-1, 0, "normalize-frame-quaternions").c();
gLinkedFunctionTable.reg("calc-animation-from-spr", execute, 512);
gLinkedFunctionTable.reg("cspace<-parented-transformq-joint!", execute, 256);
}
} // namespace calc_animation_from_spr
} // namespace Mips2C
} // namespace cspace_parented_transformq_joint
} // namespace Mips2C
// add cspace_parented_transformq_joint::link to the link callback table for the object file.
// FWD DEC:
namespace cspace_parented_transformq_joint { extern void link(); }
+504 -158
View File
@@ -342,153 +342,9 @@ void link() {
} // namespace method_32_sky_work
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_31_sky_work {
struct Cache {
void* z_vector; // *z-vector*
void* vector_normalize; // vector-normalize!
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -80); // daddiu sp, sp, -80
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s4, 32, sp); // sq s4, 32(sp)
c->sq(s5, 48, sp); // sq s5, 48(sp)
c->sq(gp, 64, sp); // sq gp, 64(sp)
c->mov64(gp, a0); // or gp, a0, r0
c->mov64(s4, a1); // or s4, a1, r0
c->mov64(s5, a2); // or s5, a2, r0
c->daddiu(v1, s4, 32); // daddiu v1, s4, 32
c->mov64(a0, s5); // or a0, s5, r0
c->lq(a0, 0, a0); // lq a0, 0(a0)
c->sq(a0, 0, v1); // sq a0, 0(v1)
c->load_symbol2(t9, cache.vector_normalize); // lw t9, vector-normalize!(s7)
c->daddiu(a0, s4, 32); // daddiu a0, s4, 32
c->lui(a1, 16256); // lui a1, 16256
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->daddu(a1, r0, s4); // daddu a1, r0, s4
c->load_symbol2(v1, cache.z_vector); // lw v1, *z-vector*(s7)
c->daddiu(a0, s4, 32); // daddiu a0, s4, 32
c->lqc2(vf1, 0, v1); // lqc2 vf1, 0(v1)
c->lqc2(vf2, 0, a0); // lqc2 vf2, 0(a0)
c->vopmula(vf1, vf2); // vopmula.xyz acc, vf1, vf2
c->vopmsub(vf3, vf2, vf1); // vopmsub.xyz vf3, vf2, vf1
c->sqc2(vf3, 0, a1); // sqc2 vf3, 0(a1)
c->load_symbol2(t9, cache.vector_normalize); // lw t9, vector-normalize!(s7)
c->daddu(a0, r0, s4); // daddu a0, r0, s4
c->lui(a1, 16256); // lui a1, 16256
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->daddiu(a1, s4, 16); // daddiu a1, s4, 16
c->daddiu(v1, s4, 32); // daddiu v1, s4, 32
c->daddu(a0, r0, s4); // daddu a0, r0, s4
c->lqc2(vf1, 0, v1); // lqc2 vf1, 0(v1)
c->lqc2(vf2, 0, a0); // lqc2 vf2, 0(a0)
c->vopmula(vf1, vf2); // vopmula.xyz acc, vf1, vf2
c->vopmsub(vf3, vf2, vf1); // vopmsub.xyz vf3, vf2, vf1
c->sqc2(vf3, 0, a1); // sqc2 vf3, 0(a1)
c->load_symbol2(t9, cache.vector_normalize); // lw t9, vector-normalize!(s7)
c->daddiu(a0, s4, 16); // daddiu a0, s4, 16
c->lui(a1, 16256); // lui a1, 16256
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->daddiu(s4, sp, 16); // daddiu s4, sp, 16
c->mov64(v1, s4); // or v1, s4, r0
c->lq(a0, 0, s5); // lq a0, 0(s5)
c->sq(a0, 0, v1); // sq a0, 0(v1)
c->load_symbol2(t9, cache.vector_normalize); // lw t9, vector-normalize!(s7)
c->mov64(a0, s4); // or a0, s4, r0
c->lui(a1, -16512); // lui a1, -16512
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->mtc1(f0, r0); // mtc1 f0, r0
c->lui(v1, 16256); // lui v1, 16256
c->mtc1(f1, v1); // mtc1 f1, v1
c->lui(v1, 16800); // lui v1, 16800
c->mtc1(f2, v1); // mtc1 f2, v1
c->lui(v1, 15692); // lui v1, 15692
c->ori(v1, v1, 52429); // ori v1, v1, 52429
c->mtc1(f3, v1); // mtc1 f3, v1
c->lwc1(f4, 4, s4); // lwc1 f4, 4(s4)
c->adds(f3, f3, f4); // add.s f3, f3, f4
c->muls(f2, f2, f3); // mul.s f2, f2, f3
c->mins(f1, f1, f2); // min.s f1, f1, f2
c->maxs(f0, f0, f1); // max.s f0, f0, f1
c->addiu(v1, r0, 0); // addiu v1, r0, 0
//beq r0, r0, L43 // beq r0, r0, L43
// nop // sll r0, r0, 0
goto block_2; // branch always
block_1:
c->lui(a0, 17152); // lui a0, 17152
c->mtc1(f1, a0); // mtc1 f1, a0
c->lui(a0, 16640); // lui a0, 16640
c->mtc1(f2, a0); // mtc1 f2, a0
c->mtc1(f3, v1); // mtc1 f3, v1
c->cvtsw(f3, f3); // cvt.s.w f3, f3
c->muls(f2, f2, f3); // mul.s f2, f2, f3
c->subs(f1, f1, f2); // sub.s f1, f1, f2
c->muls(f1, f1, f0); // mul.s f1, f1, f0
c->dsll(a0, v1, 4); // dsll a0, v1, 4
c->daddiu(a0, a0, 528); // daddiu a0, a0, 528
c->daddu(a0, a0, gp); // daddu a0, a0, gp
c->cvtws(f2, f1); // cvt.w.s f2, f1
c->swc1(f2, 0, a0); // swc1 f2, 0(a0)
c->cvtws(f2, f1); // cvt.w.s f2, f1
c->swc1(f2, 4, a0); // swc1 f2, 4(a0)
c->cvtws(f1, f1); // cvt.w.s f1, f1
c->swc1(f1, 8, a0); // swc1 f1, 8(a0)
c->addiu(a1, r0, 128); // addiu a1, r0, 128
c->sw(a1, 12, a0); // sw a1, 12(a0)
c->daddiu(v1, v1, 1); // daddiu v1, v1, 1
block_2:
c->slti(a0, v1, 16); // slti a0, v1, 16
bc = c->sgpr64(a0) != 0; // bne a0, r0, L42
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->mov64(v1, s7); // or v1, s7, r0
c->mov64(v1, s7); // or v1, s7, r0
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 64, sp); // lq gp, 64(sp)
c->lq(s5, 48, sp); // lq s5, 48(sp)
c->lq(s4, 32, sp); // lq s4, 32(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 80); // daddiu sp, sp, 80
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.z_vector = intern_from_c(-1, 0, "*z-vector*").c();
cache.vector_normalize = intern_from_c(-1, 0, "vector-normalize!").c();
gLinkedFunctionTable.reg("(method 31 sky-work)", execute, 256);
}
} // namespace method_31_sky_work
} // namespace Mips2C
// add method_32_sky_work::link to the link callback table for the object file.
// FWD DEC:
namespace method_32_sky_work { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
@@ -497,7 +353,7 @@ using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_30_sky_work {
struct Cache {
// TODO FIX - void* adgif_shader<_texture_simple; // adgif-shader<-texture-simple!
void* adgif_shader_texture_simple; // adgif-shader<-texture-simple!
void* lookup_texture_by_id_fast; // lookup-texture-by-id-fast
} cache;
@@ -686,7 +542,7 @@ block_15:
c->lq(v1, 16, gp); // lq v1, 16(gp)
c->sq(v1, 16, s5); // sq v1, 16(s5)
c->daddiu(s4, s5, 32); // daddiu s4, s5, 32
// TODO - fix c->load_symbol2(t9, cache.adgif_shader<_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7)
c->load_symbol2(t9, cache.adgif_shader_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7)
c->mov64(a0, s4); // or a0, s4, r0
c->lwu(a1, 16, sp); // lwu a1, 16(sp)
call_addr = c->gprs[t9].du32[0]; // function call:
@@ -699,7 +555,7 @@ block_15:
c->lq(v1, 16, gp); // lq v1, 16(gp)
c->sq(v1, 352, s5); // sq v1, 352(s5)
c->daddiu(s5, s5, 368); // daddiu s5, s5, 368
// TODO FIX - c->load_symbol2(t9, cache.adgif_shader<_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7)
c->load_symbol2(t9, cache.adgif_shader_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7)
c->mov64(a0, s5); // or a0, s5, r0
c->lwu(a1, 20, sp); // lwu a1, 20(sp)
call_addr = c->gprs[t9].du32[0]; // function call:
@@ -730,14 +586,16 @@ end_of_function:
}
void link() {
// TODO FIX - cache.adgif_shader<_texture_simple = intern_from_c(-1, 0, "adgif-shader<-texture-simple!").c();
cache.adgif_shader_texture_simple = intern_from_c(-1, 0, "adgif-shader<-texture-simple!").c();
cache.lookup_texture_by_id_fast = intern_from_c(-1, 0, "lookup-texture-by-id-fast").c();
gLinkedFunctionTable.reg("(method 30 sky-work)", execute, 256);
}
} // namespace method_30_sky_work
} // namespace Mips2C
// add method_30_sky_work::link to the link callback table for the object file.
// FWD DEC:
namespace method_30_sky_work { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
@@ -746,7 +604,7 @@ using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_29_sky_work {
struct Cache {
// TODO - fix void* adgif_shader<_texture_simple; // adgif-shader<-texture-simple!
void* adgif_shader_texture_simple; // adgif-shader<-texture-simple!
void* lookup_texture_by_id_fast; // lookup-texture-by-id-fast
} cache;
@@ -890,7 +748,7 @@ block_12:
c->lq(a0, 16, gp); // lq a0, 16(gp)
c->sq(a0, 16, v1); // sq a0, 16(v1)
c->daddiu(s5, v1, 32); // daddiu s5, v1, 32
// TODO fix - c->load_symbol2(t9, cache.adgif_shader<_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7)
c->load_symbol2(t9, cache.adgif_shader_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7)
c->mov64(a0, s5); // or a0, s5, r0
c->lwu(a1, 16, sp); // lwu a1, 16(sp)
call_addr = c->gprs[t9].du32[0]; // function call:
@@ -921,14 +779,16 @@ end_of_function:
}
void link() {
// TODO - fix cache.adgif_shader<_texture_simple = intern_from_c(-1, 0, "adgif-shader<-texture-simple!").c();
cache.adgif_shader_texture_simple = intern_from_c(-1, 0, "adgif-shader<-texture-simple!").c();
cache.lookup_texture_by_id_fast = intern_from_c(-1, 0, "lookup-texture-by-id-fast").c();
gLinkedFunctionTable.reg("(method 29 sky-work)", execute, 256);
}
} // namespace method_29_sky_work
} // namespace Mips2C
// add method_29_sky_work::link to the link callback table for the object file.
// FWD DEC:
namespace method_29_sky_work { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
@@ -983,7 +843,9 @@ void link() {
} // namespace method_17_sky_work
} // namespace Mips2C
// add method_17_sky_work::link to the link callback table for the object file.
// FWD DEC:
namespace method_17_sky_work { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
@@ -1804,4 +1666,488 @@ void link() {
}
} // namespace set_tex_offset
} // namespace Mips2C
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_16_sky_work {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -32); // daddiu sp, sp, -32
c->lwu(a2, 176, a1); // lwu a2, 176(a1)
c->daddiu(v1, sp, 16); // daddiu v1, sp, 16
c->sq(r0, 0, v1); // sq r0, 0(v1)
c->daddiu(a1, a0, 1472); // daddiu a1, a0, 1472
c->mov64(a3, v1); // or a3, v1, r0
c->daddiu(t0, a2, 812); // daddiu t0, a2, 812
c->lq(t0, 0, t0); // lq t0, 0(t0)
c->sq(t0, 0, a3); // sq t0, 0(a3)
c->mtc1(f0, r0); // mtc1 f0, r0
c->lwc1(f1, 928, a2); // lwc1 f1, 928(a2)
cop1_bc = c->fprs[f0] < c->fprs[f1]; // c.lt.s f0, f1
bc = !cop1_bc; // bc1f L87
// nop // sll r0, r0, 0
if (bc) {goto block_2;} // branch non-likely
c->lui(a3, 16256); // lui a3, 16256
c->mtc1(f0, a3); // mtc1 f0, a3
c->lwc1(f1, 4, v1); // lwc1 f1, 4(v1)
c->adds(f0, f0, f1); // add.s f0, f0, f1
c->swc1(f0, 4, v1); // swc1 f0, 4(v1)
c->mfc1(a3, f0); // mfc1 a3, f0
//beq r0, r0, L88 // beq r0, r0, L88
// nop // sll r0, r0, 0
goto block_3; // branch always
block_2:
c->lui(a3, -16512); // lui a3, -16512
c->mtc1(f0, a3); // mtc1 f0, a3
c->lwc1(f1, 4, v1); // lwc1 f1, 4(v1)
c->adds(f0, f0, f1); // add.s f0, f0, f1
c->swc1(f0, 4, v1); // swc1 f0, 4(v1)
c->mfc1(a3, f0); // mfc1 a3, f0
block_3:
c->daddiu(a3, a0, 1024); // daddiu a3, a0, 1024
c->lwc1(f0, 908, a2); // lwc1 f0, 908(a2)
c->swc1(f0, 0, a3); // swc1 f0, 0(a3)
c->lwc1(f0, 128, a2); // lwc1 f0, 128(a2)
c->swc1(f0, 4, a3); // swc1 f0, 4(a3)
c->lwc1(f0, 124, a2); // lwc1 f0, 124(a2)
c->swc1(f0, 8, a3); // swc1 f0, 8(a3)
c->lui(t0, 16256); // lui t0, 16256
c->mtc1(f0, t0); // mtc1 f0, t0
c->swc1(f0, 12, a3); // swc1 f0, 12(a3)
c->lqc2(vf31, 0, a1); // lqc2 vf31, 0(a1)
c->lqc2(vf30, 16, a1); // lqc2 vf30, 16(a1)
c->lqc2(vf29, 32, a1); // lqc2 vf29, 32(a1)
c->lqc2(vf28, 48, a1); // lqc2 vf28, 48(a1)
c->lqc2(vf14, 780, a2); // lqc2 vf14, 780(a2)
c->lqc2(vf26, 796, a2); // lqc2 vf26, 796(a2)
c->lqc2(vf25, 0, v1); // lqc2 vf25, 0(v1)
c->lqc2(vf13, 1024, a0); // lqc2 vf13, 1024(a0)
c->vmul(DEST::xyzw, vf31, vf31, vf14); // vmul.xyzw vf31, vf31, vf14
c->vmul(DEST::xyzw, vf30, vf30, vf14); // vmul.xyzw vf30, vf30, vf14
c->vmul(DEST::xyzw, vf29, vf29, vf14); // vmul.xyzw vf29, vf29, vf14
c->vmul(DEST::xyzw, vf28, vf28, vf14); // vmul.xyzw vf28, vf28, vf14
c->vmove(DEST::z, vf25, vf0); // vmove.z vf25, vf0
c->vmove(DEST::xyzw, vf24, vf0); // vmove.xyzw vf24, vf0
c->vmove(DEST::xyzw, vf23, vf0); // vmove.xyzw vf23, vf0
c->mov128_gpr_vf(v1, vf23); // qmfc2.i v1, vf23
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
//jr ra // jr ra
c->daddiu(sp, sp, 32); // daddiu sp, sp, 32
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
gLinkedFunctionTable.reg("(method 16 sky-work)", execute, 256);
}
} // namespace method_16_sky_work
} // namespace Mips2C
// add method_16_sky_work::link to the link callback table for the object file.
// FWD DEC:
namespace method_16_sky_work { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_28_sky_work {
struct Cache {
void* adgif_shader_texture_simple; // adgif-shader<-texture-simple!
void* lookup_texture_by_id_fast; // lookup-texture-by-id-fast
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -64); // daddiu sp, sp, -64
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s5, 32, sp); // sq s5, 32(sp)
c->sq(gp, 48, sp); // sq gp, 48(sp)
c->mov64(gp, a0); // or gp, a0, r0
c->mov64(s5, a2); // or s5, a2, r0
c->sw(a1, 1916, gp); // sw a1, 1916(gp)
c->load_symbol2(t9, cache.lookup_texture_by_id_fast);// lw t9, lookup-texture-by-id-fast(s7)
c->lui(v1, 128); // lui v1, 128
c->ori(a0, v1, 2304); // ori a0, v1, 2304
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->sw(v0, 16, sp); // sw v0, 16(sp)
c->lwu(v1, 16, sp); // lwu v1, 16(sp)
bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L56
c->mov64(v1, s7); // or v1, s7, r0
if (bc) {goto block_14;} // branch non-likely
c->lqc2(vf15, 1184, gp); // lqc2 vf15, 1184(gp)
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf15); // vmulax.xyzw acc, vf31, vf15
c->lqc2(vf1, 224, gp); // lqc2 vf1, 224(gp)
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf15); // vmadday.xyzw acc, vf30, vf15
c->lqc2(vf4, 240, gp); // lqc2 vf4, 240(gp)
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf15); // vmaddaz.xyzw acc, vf29, vf15
c->lqc2(vf2, 784, gp); // lqc2 vf2, 784(gp)
c->vmadd_bc(DEST::xyzw, BC::w, vf15, vf28, vf0); // vmaddw.xyzw vf15, vf28, vf0
// nop // sll r0, r0, 0
c->vmul(DEST::xyzw, vf16, vf15, vf14); // vmul.xyzw vf16, vf15, vf14
c->lqc2(vf5, 800, gp); // lqc2 vf5, 800(gp)
c->vdiv(vf0, BC::w, vf16, BC::w); // vdiv Q, vf0.w, vf16.w
c->lqc2(vf8, 32, gp); // lqc2 vf8, 32(gp)
c->lqc2(vf11, 48, gp); // lqc2 vf11, 48(gp)
c->lqc2(vf3, 416, gp); // lqc2 vf3, 416(gp)
c->lqc2(vf6, 432, gp); // lqc2 vf6, 432(gp)
c->vwaitq(); // vwaitq
c->vmulq(DEST::xyz, vf15, vf15); // vmulq.xyz vf15, vf15, Q
c->vmulq(DEST::xyzw, vf16, vf26); // vmulq.xyzw vf16, vf26, Q
c->vmul_bc(DEST::xyzw, BC::w, vf1, vf1, vf16); // vmulw.xyzw vf1, vf1, vf16
c->vmul_bc(DEST::xyzw, BC::w, vf4, vf4, vf16); // vmulw.xyzw vf4, vf4, vf16
c->vadd(DEST::xyzw, vf15, vf15, vf25); // vadd.xyzw vf15, vf15, vf25
c->vadd(DEST::xyz, vf1, vf1, vf15); // vadd.xyz vf1, vf1, vf15
c->vadd(DEST::xyz, vf4, vf4, vf15); // vadd.xyz vf4, vf4, vf15
c->vftoi4(DEST::xyz, vf1, vf1); // vftoi4.xyz vf1, vf1
c->vftoi4(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4
c->sqc2(vf1, 1600, gp); // sqc2 vf1, 1600(gp)
c->sqc2(vf4, 1616, gp); // sqc2 vf4, 1616(gp)
c->lw(v1, 1612, gp); // lw v1, 1612(gp)
c->mtc1(f0, v1); // mtc1 f0, v1
c->mtc1(f1, r0); // mtc1 f1, r0
cop1_bc = c->fprs[f0] < c->fprs[f1]; // c.lt.s f0, f1
bc = !cop1_bc; // bc1f L54
c->daddiu(v1, s7, 4); // daddiu v1, s7, 4
if (bc) {goto block_3;} // branch non-likely
c->mov64(v1, s7); // or v1, s7, r0
block_3:
if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(v1))) {// beql s7, v1, L55
c->mov64(v1, v1); // or v1, v1, r0
goto block_12;
}
block_5:
c->lw(v1, 1600, gp); // lw v1, 1600(gp)
c->lw(a0, 556, s5); // lw a0, 556(s5)
c->dsll(a0, a0, 4); // dsll a0, a0, 4
c->slt(v1, v1, a0); // slt v1, v1, a0
c->daddiu(a0, s7, 4); // daddiu a0, s7, 4
c->movz(a0, s7, v1); // movz a0, s7, v1
if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(a0))) {// beql s7, a0, L55
c->mov64(v1, a0); // or v1, a0, r0
goto block_12;
}
block_7:
c->lw(v1, 1604, gp); // lw v1, 1604(gp)
c->lw(a0, 560, s5); // lw a0, 560(s5)
c->dsll(a0, a0, 4); // dsll a0, a0, 4
c->slt(v1, v1, a0); // slt v1, v1, a0
c->daddiu(a0, s7, 4); // daddiu a0, s7, 4
c->movz(a0, s7, v1); // movz a0, s7, v1
if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(a0))) {// beql s7, a0, L55
c->mov64(v1, a0); // or v1, a0, r0
goto block_12;
}
block_9:
c->addiu(v1, r0, 28672); // addiu v1, r0, 28672
c->lw(a0, 1616, gp); // lw a0, 1616(gp)
c->slt(v1, v1, a0); // slt v1, v1, a0
c->daddiu(a0, s7, 4); // daddiu a0, s7, 4
c->movz(a0, s7, v1); // movz a0, s7, v1
if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(a0))) {// beql s7, a0, L55
c->mov64(v1, a0); // or v1, a0, r0
goto block_12;
}
block_11:
c->addiu(v1, r0, 29440); // addiu v1, r0, 29440
c->lw(a0, 1620, gp); // lw a0, 1620(gp)
c->slt(a0, v1, a0); // slt a0, v1, a0
c->daddiu(v1, s7, 4); // daddiu v1, s7, 4
c->movz(v1, s7, a0); // movz v1, s7, a0
block_12:
bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L56
c->mov64(v1, s7); // or v1, s7, r0
if (bc) {goto block_14;} // branch non-likely
c->lwu(v1, 1916, gp); // lwu v1, 1916(gp)
c->lwu(t0, 4, v1); // lwu t0, 4(v1)
c->vsub(DEST::z, vf1, vf0, vf0); // vsub.z vf1, vf0, vf0
c->vsub(DEST::z, vf4, vf0, vf0); // vsub.z vf4, vf0, vf0
c->sqc2(vf8, 112, t0); // sqc2 vf8, 112(t0)
c->sqc2(vf11, 128, t0); // sqc2 vf11, 128(t0)
c->sqc2(vf3, 144, t0); // sqc2 vf3, 144(t0)
c->sqc2(vf2, 160, t0); // sqc2 vf2, 160(t0)
c->sqc2(vf1, 176, t0); // sqc2 vf1, 176(t0)
c->sqc2(vf5, 192, t0); // sqc2 vf5, 192(t0)
c->sqc2(vf4, 208, t0); // sqc2 vf4, 208(t0)
c->sqc2(vf8, 224, t0); // sqc2 vf8, 224(t0)
c->sqc2(vf11, 240, t0); // sqc2 vf11, 240(t0)
c->sqc2(vf6, 256, t0); // sqc2 vf6, 256(t0)
c->sqc2(vf2, 272, t0); // sqc2 vf2, 272(t0)
c->sqc2(vf1, 288, t0); // sqc2 vf1, 288(t0)
c->sqc2(vf5, 304, t0); // sqc2 vf5, 304(t0)
c->sqc2(vf4, 320, t0); // sqc2 vf4, 320(t0)
c->lwu(v1, 1916, gp); // lwu v1, 1916(gp)
c->lwu(v1, 4, v1); // lwu v1, 4(v1)
c->lq(a0, 0, gp); // lq a0, 0(gp)
c->sq(a0, 0, v1); // sq a0, 0(v1)
c->lq(a0, 16, gp); // lq a0, 16(gp)
c->sq(a0, 16, v1); // sq a0, 16(v1)
c->daddiu(s5, v1, 32); // daddiu s5, v1, 32
c->load_symbol2(t9, cache.adgif_shader_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7)
c->mov64(a0, s5); // or a0, s5, r0
c->lwu(a1, 16, sp); // lwu a1, 16(sp)
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->addiu(v1, r0, 72); // addiu v1, r0, 72
c->sd(v1, 64, s5); // sd v1, 64(s5)
c->lwu(v1, 1916, gp); // lwu v1, 1916(gp)
c->lwu(v1, 4, v1); // lwu v1, 4(v1)
c->daddiu(v1, v1, 336); // daddiu v1, v1, 336
c->lwu(a0, 1916, gp); // lwu a0, 1916(gp)
c->sw(v1, 4, a0); // sw v1, 4(a0)
block_14:
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 48, sp); // lq gp, 48(sp)
c->lq(s5, 32, sp); // lq s5, 32(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 64); // daddiu sp, sp, 64
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.adgif_shader_texture_simple = intern_from_c(-1, 0, "adgif-shader<-texture-simple!").c();
cache.lookup_texture_by_id_fast = intern_from_c(-1, 0, "lookup-texture-by-id-fast").c();
gLinkedFunctionTable.reg("(method 28 sky-work)", execute, 256);
}
} // namespace method_28_sky_work
} // namespace Mips2C
// add method_28_sky_work::link to the link callback table for the object file.
// FWD DEC:
namespace method_28_sky_work { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_33_sky_work {
struct Cache {
void* adgif_shader_texture_simple; // adgif-shader<-texture-simple!
void* lookup_texture_by_id_fast; // lookup-texture-by-id-fast
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -64); // daddiu sp, sp, -64
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s4, 16, sp); // sq s4, 16(sp)
c->sq(s5, 32, sp); // sq s5, 32(sp)
c->sq(gp, 48, sp); // sq gp, 48(sp)
c->mov64(gp, a0); // or gp, a0, r0
c->mov64(s5, a2); // or s5, a2, r0
c->sw(a1, 1916, gp); // sw a1, 1916(gp)
c->load_symbol2(t9, cache.lookup_texture_by_id_fast);// lw t9, lookup-texture-by-id-fast(s7)
c->lui(v1, 128); // lui v1, 128
c->ori(a0, v1, 2560); // ori a0, v1, 2560
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->mov64(a1, v0); // or a1, v0, r0
bc = c->sgpr64(s7) == c->sgpr64(a1); // beq s7, a1, L31
c->mov64(t0, s7); // or t0, s7, r0
if (bc) {goto block_14;} // branch non-likely
c->lwu(v1, 1916, gp); // lwu v1, 1916(gp)
c->lwu(v1, 4, v1); // lwu v1, 4(v1)
c->lq(a0, 0, gp); // lq a0, 0(gp)
c->sq(a0, 0, v1); // sq a0, 0(v1)
c->lq(a0, 16, gp); // lq a0, 16(gp)
c->sq(a0, 16, v1); // sq a0, 16(v1)
c->daddiu(s4, v1, 32); // daddiu s4, v1, 32
c->load_symbol2(t9, cache.adgif_shader_texture_simple);// lw t9, adgif-shader<-texture-simple!(s7)
c->mov64(a0, s4); // or a0, s4, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->addiu(v1, r0, 72); // addiu v1, r0, 72
c->sd(v1, 64, s4); // sd v1, 64(s4)
c->lwu(v1, 1916, gp); // lwu v1, 1916(gp)
c->lwu(v1, 4, v1); // lwu v1, 4(v1)
c->daddiu(v1, v1, 112); // daddiu v1, v1, 112
c->lwu(a0, 1916, gp); // lwu a0, 1916(gp)
c->sw(v1, 4, a0); // sw v1, 4(a0)
c->lwu(v1, 1916, gp); // lwu v1, 1916(gp)
c->lwu(t0, 4, v1); // lwu t0, 4(v1)
c->mov64(v1, gp); // or v1, gp, r0
c->addiu(a1, r0, 0); // addiu a1, r0, 0
c->lqc2(vf2, 784, gp); // lqc2 vf2, 784(gp)
c->lqc2(vf5, 800, gp); // lqc2 vf5, 800(gp)
c->lqc2(vf8, 32, gp); // lqc2 vf8, 32(gp)
c->lqc2(vf11, 48, gp); // lqc2 vf11, 48(gp)
c->addiu(a0, r0, 0); // addiu a0, r0, 0
//beq r0, r0, L30 // beq r0, r0, L30
// nop // sll r0, r0, 0
goto block_12; // branch always
block_2:
c->lqc2(vf15, 1920, v1); // lqc2 vf15, 1920(v1)
c->daddiu(v1, v1, 16); // daddiu v1, v1, 16
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf15); // vmulax.xyzw acc, vf31, vf15
c->lqc2(vf1, 384, gp); // lqc2 vf1, 384(gp)
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf15); // vmadday.xyzw acc, vf30, vf15
c->lqc2(vf4, 400, gp); // lqc2 vf4, 400(gp)
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf15); // vmaddaz.xyzw acc, vf29, vf15
c->daddu(a2, gp, a1); // daddu a2, gp, a1
c->vmadd_bc(DEST::xyzw, BC::w, vf15, vf28, vf0); // vmaddw.xyzw vf15, vf28, vf0
// nop // sll r0, r0, 0
c->vmul(DEST::xyzw, vf16, vf15, vf14); // vmul.xyzw vf16, vf15, vf14
c->lqc2(vf3, 528, a2); // lqc2 vf3, 528(a2)
c->vdiv(vf0, BC::w, vf16, BC::w); // vdiv Q, vf0.w, vf16.w
c->daddiu(a1, a1, 16); // daddiu a1, a1, 16
c->vwaitq(); // vwaitq
c->andi(a1, a1, 255); // andi a1, a1, 255
c->vmulq(DEST::xyz, vf15, vf15); // vmulq.xyz vf15, vf15, Q
c->vadd(DEST::xyzw, vf15, vf15, vf25); // vadd.xyzw vf15, vf15, vf25
c->vadd(DEST::xyz, vf1, vf1, vf15); // vadd.xyz vf1, vf1, vf15
c->vadd(DEST::xyz, vf4, vf4, vf15); // vadd.xyz vf4, vf4, vf15
c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1
c->vftoi4(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4
c->sqc2(vf1, 1600, gp); // sqc2 vf1, 1600(gp)
c->sqc2(vf4, 1616, gp); // sqc2 vf4, 1616(gp)
c->lw(a2, 1600, gp); // lw a2, 1600(gp)
c->lw(a3, 556, s5); // lw a3, 556(s5)
c->dsll(a3, a3, 4); // dsll a3, a3, 4
c->slt(a2, a2, a3); // slt a2, a2, a3
c->daddiu(a3, s7, 4); // daddiu a3, s7, 4
c->movz(a3, s7, a2); // movz a3, s7, a2
if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(a3))) {// beql s7, a3, L28
c->mov64(a2, a3); // or a2, a3, r0
goto block_9;
}
block_4:
c->lw(a2, 1604, gp); // lw a2, 1604(gp)
c->lw(a3, 560, s5); // lw a3, 560(s5)
c->dsll(a3, a3, 4); // dsll a3, a3, 4
c->slt(a2, a2, a3); // slt a2, a2, a3
c->daddiu(a3, s7, 4); // daddiu a3, s7, 4
c->movz(a3, s7, a2); // movz a3, s7, a2
if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(a3))) {// beql s7, a3, L28
c->mov64(a2, a3); // or a2, a3, r0
goto block_9;
}
block_6:
c->addiu(a2, r0, 28672); // addiu a2, r0, 28672
c->lw(a3, 1616, gp); // lw a3, 1616(gp)
c->slt(a2, a2, a3); // slt a2, a2, a3
c->daddiu(a3, s7, 4); // daddiu a3, s7, 4
c->movz(a3, s7, a2); // movz a3, s7, a2
if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(a3))) {// beql s7, a3, L28
c->mov64(a2, a3); // or a2, a3, r0
goto block_9;
}
block_8:
c->addiu(a2, r0, 29440); // addiu a2, r0, 29440
c->lw(a3, 1620, gp); // lw a3, 1620(gp)
c->slt(a3, a2, a3); // slt a3, a2, a3
c->daddiu(a2, s7, 4); // daddiu a2, s7, 4
c->movz(a2, s7, a3); // movz a2, s7, a3
block_9:
bc = c->sgpr64(s7) == c->sgpr64(a2); // beq s7, a2, L29
c->mov64(a2, s7); // or a2, s7, r0
if (bc) {goto block_11;} // branch non-likely
c->vsub(DEST::z, vf1, vf0, vf0); // vsub.z vf1, vf0, vf0
c->vsub(DEST::z, vf4, vf0, vf0); // vsub.z vf4, vf0, vf0
c->sqc2(vf8, 0, t0); // sqc2 vf8, 0(t0)
c->sqc2(vf11, 16, t0); // sqc2 vf11, 16(t0)
c->sqc2(vf3, 32, t0); // sqc2 vf3, 32(t0)
c->sqc2(vf2, 48, t0); // sqc2 vf2, 48(t0)
c->sqc2(vf1, 64, t0); // sqc2 vf1, 64(t0)
c->sqc2(vf5, 80, t0); // sqc2 vf5, 80(t0)
c->sqc2(vf4, 96, t0); // sqc2 vf4, 96(t0)
c->daddiu(t0, t0, 112); // daddiu t0, t0, 112
c->mov64(a2, t0); // or a2, t0, r0
block_11:
c->daddiu(a0, a0, 1); // daddiu a0, a0, 1
block_12:
c->slti(a2, a0, 512); // slti a2, a0, 512
bc = c->sgpr64(a2) != 0; // bne a2, r0, L27
// nop // sll r0, r0, 0
if (bc) {goto block_2;} // branch non-likely
c->mov64(v1, s7); // or v1, s7, r0
c->mov64(v1, s7); // or v1, s7, r0
c->lwu(v1, 1916, gp); // lwu v1, 1916(gp)
c->sw(t0, 4, v1); // sw t0, 4(v1)
block_14:
c->mov64(v1, t0); // or v1, t0, r0
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 48, sp); // lq gp, 48(sp)
c->lq(s5, 32, sp); // lq s5, 32(sp)
c->lq(s4, 16, sp); // lq s4, 16(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 64); // daddiu sp, sp, 64
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.adgif_shader_texture_simple = intern_from_c(-1, 0, "adgif-shader<-texture-simple!").c();
cache.lookup_texture_by_id_fast = intern_from_c(-1, 0, "lookup-texture-by-id-fast").c();
gLinkedFunctionTable.reg("(method 33 sky-work)", execute, 256);
}
} // namespace method_33_sky_work
} // namespace Mips2C
// add method_33_sky_work::link to the link callback table for the object file.
// FWD DEC:
namespace method_33_sky_work { extern void link(); }
+506 -467
View File
@@ -1,353 +1,3 @@
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_19_grid_hash {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -32); // daddiu sp, sp, -32
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(gp, 16, sp); // sq gp, 16(sp)
c->addiu(v1, r0, 0); // addiu v1, r0, 0
//beq r0, r0, L235 // beq r0, r0, L235
// nop // sll r0, r0, 0
goto block_2; // branch always
block_1:
c->daddu(a3, v1, a0); // daddu a3, v1, a0
c->lb(a3, 24, a3); // lb a3, 24(a3)
c->daddu(t0, v1, a2); // daddu t0, v1, a2
c->sb(a3, 0, t0); // sb a3, 0(t0)
c->addiu(a3, r0, -1); // addiu a3, r0, -1
c->daddu(t0, v1, a2); // daddu t0, v1, a2
c->sb(a3, 3, t0); // sb a3, 3(t0)
c->daddiu(v1, v1, 1); // daddiu v1, v1, 1
block_2:
c->slti(a3, v1, 3); // slti a3, v1, 3
bc = c->sgpr64(a3) != 0; // bne a3, r0, L234
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->mov64(v1, s7); // or v1, s7, r0
c->mov64(v1, s7); // or v1, s7, r0
c->lh(v1, 10, a0); // lh v1, 10(a0)
c->lb(a3, 24, a0); // lb a3, 24(a0)
c->mult3(a3, a3, v1); // mult3 a3, a3, v1
c->lb(t0, 26, a0); // lb t0, 26(a0)
c->mult3(t0, t0, a3); // mult3 t0, t0, a3
c->lb(t1, 24, a0); // lb t1, 24(a0)
c->lb(t2, 26, a0); // lb t2, 26(a0)
c->lb(t3, 25, a0); // lb t3, 25(a0)
c->dsra(t4, a1, 3); // dsra t4, a1, 3
c->daddu(t4, r0, t4); // daddu t4, r0, t4
c->lwu(a0, 28, a0); // lwu a0, 28(a0)
c->daddu(a0, t4, a0); // daddu a0, t4, a0
c->addiu(t4, r0, 1); // addiu t4, r0, 1
c->andi(a1, a1, 7); // andi a1, a1, 7
if (((s64)c->sgpr64(a1)) >= 0) { // bgezl a1, L236
c->dsllv(a1, t4, a1); // dsllv a1, t4, a1
goto block_6;
}
block_5:
c->dsubu(a1, r0, a1); // dsubu a1, r0, a1
c->dsrav(a1, t4, a1); // dsrav a1, t4, a1
block_6:
c->addiu(t4, r0, 0); // addiu t4, r0, 0
//beq r0, r0, L243 // beq r0, r0, L243
// nop // sll r0, r0, 0
goto block_16; // branch always
block_7:
c->mov64(t5, a0); // or t5, a0, r0
c->addiu(t6, r0, 0); // addiu t6, r0, 0
//beq r0, r0, L242 // beq r0, r0, L242
// nop // sll r0, r0, 0
goto block_14; // branch always
block_8:
c->mov64(t7, t5); // or t7, t5, r0
c->addiu(t8, r0, 0); // addiu t8, r0, 0
//beq r0, r0, L241 // beq r0, r0, L241
// nop // sll r0, r0, 0
goto block_12; // branch always
block_9:
c->lbu(t9, 0, t7); // lbu t9, 0(t7)
c->and_(t9, t9, a1); // and t9, t9, a1
bc = c->sgpr64(t9) == 0; // beq t9, r0, L240
c->mov64(t9, s7); // or t9, s7, r0
if (bc) {goto block_11;} // branch non-likely
c->lb(t9, 0, a2); // lb t9, 0(a2)
c->mov64(t9, t9); // or t9, t9, r0
c->mov64(ra, t8); // or ra, t8, r0
c->slt(gp, t9, ra); // slt gp, t9, ra
c->movz(t9, ra, gp); // movz t9, ra, gp
c->sb(t9, 0, a2); // sb t9, 0(a2)
c->lb(t9, 1, a2); // lb t9, 1(a2)
c->mov64(t9, t9); // or t9, t9, r0
c->mov64(ra, t4); // or ra, t4, r0
c->slt(gp, t9, ra); // slt gp, t9, ra
c->movz(t9, ra, gp); // movz t9, ra, gp
c->sb(t9, 1, a2); // sb t9, 1(a2)
c->lb(t9, 2, a2); // lb t9, 2(a2)
c->mov64(t9, t9); // or t9, t9, r0
c->mov64(ra, t6); // or ra, t6, r0
c->slt(gp, t9, ra); // slt gp, t9, ra
c->movz(t9, ra, gp); // movz t9, ra, gp
c->sb(t9, 2, a2); // sb t9, 2(a2)
c->lb(t9, 3, a2); // lb t9, 3(a2)
c->mov64(t9, t9); // or t9, t9, r0
c->mov64(ra, t8); // or ra, t8, r0
c->slt(gp, t9, ra); // slt gp, t9, ra
c->movn(t9, ra, gp); // movn t9, ra, gp
c->sb(t9, 3, a2); // sb t9, 3(a2)
c->lb(t9, 4, a2); // lb t9, 4(a2)
c->mov64(t9, t9); // or t9, t9, r0
c->mov64(ra, t4); // or ra, t4, r0
c->slt(gp, t9, ra); // slt gp, t9, ra
c->movn(t9, ra, gp); // movn t9, ra, gp
c->sb(t9, 4, a2); // sb t9, 4(a2)
c->lb(t9, 5, a2); // lb t9, 5(a2)
c->mov64(gp, t9); // or gp, t9, r0
c->mov64(t9, t6); // or t9, t6, r0
c->slt(ra, gp, t9); // slt ra, gp, t9
c->movn(gp, t9, ra); // movn gp, t9, ra
c->sb(gp, 5, a2); // sb gp, 5(a2)
block_11:
c->daddu(t7, t7, v1); // daddu t7, t7, v1
c->daddiu(t8, t8, 1); // daddiu t8, t8, 1
block_12:
c->slt(t9, t8, t1); // slt t9, t8, t1
bc = c->sgpr64(t9) != 0; // bne t9, r0, L239
// nop // sll r0, r0, 0
if (bc) {goto block_9;} // branch non-likely
c->mov64(t7, s7); // or t7, s7, r0
c->mov64(t7, s7); // or t7, s7, r0
c->daddu(t5, t5, a3); // daddu t5, t5, a3
c->daddiu(t6, t6, 1); // daddiu t6, t6, 1
block_14:
c->slt(t7, t6, t2); // slt t7, t6, t2
bc = c->sgpr64(t7) != 0; // bne t7, r0, L238
// nop // sll r0, r0, 0
if (bc) {goto block_8;} // branch non-likely
c->mov64(t5, s7); // or t5, s7, r0
c->mov64(t5, s7); // or t5, s7, r0
c->daddu(a0, a0, t0); // daddu a0, a0, t0
c->daddiu(t4, t4, 1); // daddiu t4, t4, 1
block_16:
c->slt(t5, t4, t3); // slt t5, t4, t3
bc = c->sgpr64(t5) != 0; // bne t5, r0, L237
// nop // sll r0, r0, 0
if (bc) {goto block_7;} // branch non-likely
c->mov64(v1, s7); // or v1, s7, r0
c->mov64(v1, s7); // or v1, s7, r0
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 16, sp); // lq gp, 16(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 32); // daddiu sp, sp, 32
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
gLinkedFunctionTable.reg("(method 19 grid-hash)", execute, 256);
}
} // namespace method_19_grid_hash
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_38_spatial_hash {
struct Cache {
void* perf_stats; // *perf-stats*
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -112); // daddiu sp, sp, -112
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s3, 48, sp); // sq s3, 48(sp)
c->sq(s4, 64, sp); // sq s4, 64(sp)
c->sq(s5, 80, sp); // sq s5, 80(sp)
c->sq(gp, 96, sp); // sq gp, 96(sp)
c->mov64(s5, a0); // or s5, a0, r0
c->mov64(gp, a1); // or gp, a1, r0
c->mov64(s4, a2); // or s4, a2, r0
c->mov64(s3, a3); // or s3, a3, r0
c->load_symbol2(v1, cache.perf_stats); // lw v1, *perf-stats*(s7)
c->daddiu(v1, v1, 116); // daddiu v1, v1, 116
c->gprs[v1].du64[0] = 0; // or v1, r0, r0
c->mov64(a0, s5); // or a0, s5, r0
c->lwu(v1, -4, a0); // lwu v1, -4(a0)
c->lwu(t9, 112, v1); // lwu t9, 112(v1)
c->daddiu(a1, s5, 4); // daddiu a1, s5, 4
c->mov64(a2, gp); // or a2, gp, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->mov64(v1, v0); // or v1, v0, r0
c->lwu(v1, 0, s5); // lwu v1, 0(s5)
c->daddiu(v1, v1, 12); // daddiu v1, v1, 12
c->sw(v1, 16, sp); // sw v1, 16(sp)
c->mov64(a0, s5); // or a0, s5, r0
c->lwu(v1, -4, a0); // lwu v1, -4(a0)
c->lwu(t9, 104, v1); // lwu t9, 104(v1)
c->daddiu(a1, s5, 4); // daddiu a1, s5, 4
c->lwu(a2, 16, sp); // lwu a2, 16(sp)
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->mov64(v1, v0); // or v1, v0, r0
c->sd(r0, 24, sp); // sd r0, 24(sp)
c->sw(s5, 32, sp); // sw s5, 32(sp)
c->sw(s4, 36, sp); // sw s4, 36(sp)
c->sd(s3, 40, sp); // sd s3, 40(sp)
c->lwu(v1, 32, sp); // lwu v1, 32(sp)
c->lh(v1, 10, v1); // lh v1, 10(v1)
c->lwu(a0, 16, sp); // lwu a0, 16(sp)
c->gprs[a1].du64[0] = 0; // or a1, r0, r0
// nop // sll r0, r0, 0
block_1:
c->dsll(a2, a1, 3); // dsll a2, a1, 3
c->lbu(a3, 0, a0); // lbu a3, 0(a0)
bc = c->sgpr64(a3) == 0; // beq a3, r0, L27
// nop // sll r0, r0, 0
if (bc) {goto block_7;} // branch non-likely
block_2:
c->andi(t0, a3, 1); // andi t0, a3, 1
// nop // sll r0, r0, 0
bc = c->sgpr64(t0) == 0; // beq t0, r0, L26
// nop // sll r0, r0, 0
if (bc) {goto block_6;} // branch non-likely
c->lwu(t0, 32, sp); // lwu t0, 32(sp)
c->lwu(t0, 84, t0); // lwu t0, 84(t0)
c->dsll(t1, a2, 4); // dsll t1, a2, 4
c->daddu(t0, t0, t1); // daddu t0, t0, t1
c->mov64(t1, gp); // or t1, gp, r0
c->mov64(t2, t0); // or t2, t0, r0
c->lqc2(vf2, 0, t1); // lqc2 vf2, 0(t1)
c->lqc2(vf3, 0, t2); // lqc2 vf3, 0(t2)
c->vsub(DEST::xyzw, vf1, vf3, vf2); // vsub.xyzw vf1, vf3, vf2
c->vmul(DEST::xyzw, vf1, vf1, vf1); // vmul.xyzw vf1, vf1, vf1
c->vadd_bc(DEST::x, BC::y, vf1, vf1, vf1); // vaddy.x vf1, vf1, vf1
c->vadd_bc(DEST::x, BC::z, vf1, vf1, vf1); // vaddz.x vf1, vf1, vf1
c->mov128_gpr_vf(t1, vf1); // qmfc2.i t1, vf1
c->mtc1(f0, t1); // mtc1 f0, t1
c->lwc1(f1, 12, gp); // lwc1 f1, 12(gp)
c->lwc1(f2, 12, t0); // lwc1 f2, 12(t0)
c->adds(f1, f1, f2); // add.s f1, f1, f2
c->muls(f1, f1, f1); // mul.s f1, f1, f1
c->mfc1(t0, f1); // mfc1 t0, f1
c->mtc1(f1, t0); // mtc1 f1, t0
cop1_bc = c->fprs[f0] < c->fprs[f1]; // c.lt.s f0, f1
bc = !cop1_bc; // bc1f L26
c->mov64(t0, s7); // or t0, s7, r0
if (bc) {goto block_6;} // branch non-likely
c->ld(t0, 24, sp); // ld t0, 24(sp)
c->ld(t1, 40, sp); // ld t1, 40(sp)
c->slt(t0, t0, t1); // slt t0, t0, t1
bc = c->sgpr64(t0) == 0; // beq t0, r0, L26
c->mov64(t0, s7); // or t0, s7, r0
if (bc) {goto block_6;} // branch non-likely
c->dsll(t0, a2, 4); // dsll t0, a2, 4
c->lwu(t1, 32, sp); // lwu t1, 32(sp)
c->lwu(t1, 100, t1); // lwu t1, 100(t1)
c->daddu(t0, t0, t1); // daddu t0, t0, t1
c->lwu(t0, 0, t0); // lwu t0, 0(t0)
c->lwu(t1, 36, sp); // lwu t1, 36(sp)
c->ld(t2, 24, sp); // ld t2, 24(sp)
c->dsll(t2, t2, 2); // dsll t2, t2, 2
c->daddu(t1, t1, t2); // daddu t1, t1, t2
c->sw(t0, 0, t1); // sw t0, 0(t1)
c->ld(t0, 24, sp); // ld t0, 24(sp)
c->daddiu(t0, t0, 1); // daddiu t0, t0, 1
c->sd(t0, 24, sp); // sd t0, 24(sp)
// nop // sll r0, r0, 0
block_6:
c->dsra(a3, a3, 1); // dsra a3, a3, 1
// nop // sll r0, r0, 0
bc = c->sgpr64(a3) != 0; // bne a3, r0, L25
c->daddiu(a2, a2, 1); // daddiu a2, a2, 1
if (bc) {goto block_2;} // branch non-likely
block_7:
c->daddiu(a1, a1, 1); // daddiu a1, a1, 1
c->daddiu(a0, a0, 1); // daddiu a0, a0, 1
c->slt(a2, a1, v1); // slt a2, a1, v1
// nop // sll r0, r0, 0
bc = c->sgpr64(a2) != 0; // bne a2, r0, L24
// nop // sll r0, r0, 0
if (bc) {goto block_1;} // branch non-likely
c->load_symbol2(v1, cache.perf_stats); // lw v1, *perf-stats*(s7)
c->daddiu(v1, v1, 116); // daddiu v1, v1, 116
c->gprs[v1].du64[0] = 0; // or v1, r0, r0
c->ld(v0, 24, sp); // ld v0, 24(sp)
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 96, sp); // lq gp, 96(sp)
c->lq(s5, 80, sp); // lq s5, 80(sp)
c->lq(s4, 64, sp); // lq s4, 64(sp)
c->lq(s3, 48, sp); // lq s3, 48(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 112); // daddiu sp, sp, 112
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.perf_stats = intern_from_c(-1, 0, "*perf-stats*").c();
gLinkedFunctionTable.reg("(method 38 spatial-hash)", execute, 512);
}
} // namespace method_38_spatial_hash
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
@@ -663,7 +313,9 @@ void link() {
} // namespace method_35_spatial_hash
} // namespace Mips2C
// add method_35_spatial_hash::link to the link callback table for the object file.
// FWD DEC:
namespace method_35_spatial_hash { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
@@ -708,121 +360,6 @@ void link() {
} // namespace method_33_sphere_hash
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_28_sphere_hash {
struct Cache {
void* mem_copy; // mem-copy!
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -64); // daddiu sp, sp, -64
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s4, 16, sp); // sq s4, 16(sp)
c->sq(s5, 32, sp); // sq s5, 32(sp)
c->sq(gp, 48, sp); // sq gp, 48(sp)
c->mov64(s5, a0); // or s5, a0, r0
c->mov64(s4, a1); // or s4, a1, r0
c->lh(gp, 56, s5); // lh gp, 56(s5)
c->lh(v1, 88, s5); // lh v1, 88(s5)
c->slt(v1, gp, v1); // slt v1, gp, v1
bc = c->sgpr64(v1) == 0; // beq v1, r0, L96
// nop // sll r0, r0, 0
if (bc) {goto block_5;} // branch non-likely
c->lwu(v1, 84, s5); // lwu v1, 84(s5)
c->dsll(a0, gp, 4); // dsll a0, gp, 4
c->daddu(a0, v1, a0); // daddu a0, v1, a0
c->load_symbol2(t9, cache.mem_copy); // lw t9, mem-copy!(s7)
c->mov64(a1, s4); // or a1, s4, r0
c->addiu(a2, r0, 16); // addiu a2, r0, 16
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->addiu(v1, r0, 0); // addiu v1, r0, 0
//beq r0, r0, L95 // beq r0, r0, L95
// nop // sll r0, r0, 0
goto block_3; // branch always
block_2:
c->dsll(a0, v1, 2); // dsll a0, v1, 2
c->daddu(a0, a0, s5); // daddu a0, a0, s5
c->lwc1(f0, 32, a0); // lwc1 f0, 32(a0)
c->dsll(a0, v1, 2); // dsll a0, v1, 2
c->daddu(a0, a0, s4); // daddu a0, a0, s4
c->lwc1(f1, 0, a0); // lwc1 f1, 0(a0)
c->lwc1(f2, 12, s4); // lwc1 f2, 12(s4)
c->subs(f1, f1, f2); // sub.s f1, f1, f2
c->mins(f0, f0, f1); // min.s f0, f0, f1
c->dsll(a0, v1, 2); // dsll a0, v1, 2
c->daddu(a0, a0, s5); // daddu a0, a0, s5
c->swc1(f0, 32, a0); // swc1 f0, 32(a0)
c->dsll(a0, v1, 2); // dsll a0, v1, 2
c->daddu(a0, a0, s5); // daddu a0, a0, s5
c->lwc1(f0, 44, a0); // lwc1 f0, 44(a0)
c->dsll(a0, v1, 2); // dsll a0, v1, 2
c->daddu(a0, a0, s4); // daddu a0, a0, s4
c->lwc1(f1, 0, a0); // lwc1 f1, 0(a0)
c->lwc1(f2, 12, s4); // lwc1 f2, 12(s4)
c->adds(f1, f1, f2); // add.s f1, f1, f2
c->maxs(f0, f0, f1); // max.s f0, f0, f1
c->dsll(a0, v1, 2); // dsll a0, v1, 2
c->daddu(a0, a0, s5); // daddu a0, a0, s5
c->swc1(f0, 44, a0); // swc1 f0, 44(a0)
c->daddiu(v1, v1, 1); // daddiu v1, v1, 1
block_3:
c->slti(a0, v1, 3); // slti a0, v1, 3
bc = c->sgpr64(a0) != 0; // bne a0, r0, L94
// nop // sll r0, r0, 0
if (bc) {goto block_2;} // branch non-likely
c->mov64(v1, s7); // or v1, s7, r0
c->mov64(v1, s7); // or v1, s7, r0
c->lh(v1, 56, s5); // lh v1, 56(s5)
c->daddiu(v1, v1, 1); // daddiu v1, v1, 1
c->sh(v1, 56, s5); // sh v1, 56(s5)
//beq r0, r0, L97 // beq r0, r0, L97
// nop // sll r0, r0, 0
goto block_6; // branch always
block_5:
c->addiu(gp, r0, -1); // addiu gp, r0, -1
c->mov64(v1, gp); // or v1, gp, r0
block_6:
c->mov64(v0, gp); // or v0, gp, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 48, sp); // lq gp, 48(sp)
c->lq(s5, 32, sp); // lq s5, 32(sp)
c->lq(s4, 16, sp); // lq s4, 16(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 64); // daddiu sp, sp, 64
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.mem_copy = intern_from_c(-1, 0, "mem-copy!").c();
gLinkedFunctionTable.reg("(method 28 sphere-hash)", execute, 256);
}
} // namespace method_28_sphere_hash
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
@@ -1224,4 +761,506 @@ void link() {
}
} // namespace method_20_grid_hash
} // namespace Mips2C
} // namespace Mips2C
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_21_grid_hash {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->lh(v1, 10, a0); // lh v1, 10(a0)
c->lb(a3, 24, a0); // lb a3, 24(a0)
c->mult3(a3, a3, v1); // mult3 a3, a3, v1
c->lb(t0, 26, a0); // lb t0, 26(a0)
c->mult3(t0, t0, a3); // mult3 t0, t0, a3
c->addiu(t1, r0, 1); // addiu t1, r0, 1
c->lb(t2, 0, a1); // lb t2, 0(a1)
c->dsubu(t1, t1, t2); // dsubu t1, t1, t2
c->lb(t2, 3, a1); // lb t2, 3(a1)
c->daddu(t1, t1, t2); // daddu t1, t1, t2
c->addiu(t2, r0, 1); // addiu t2, r0, 1
c->lb(t3, 2, a1); // lb t3, 2(a1)
c->dsubu(t2, t2, t3); // dsubu t2, t2, t3
c->lb(t3, 5, a1); // lb t3, 5(a1)
c->daddu(t2, t2, t3); // daddu t2, t2, t3
c->addiu(t3, r0, 1); // addiu t3, r0, 1
c->lb(t4, 1, a1); // lb t4, 1(a1)
c->dsubu(t3, t3, t4); // dsubu t3, t3, t4
c->lb(t4, 4, a1); // lb t4, 4(a1)
c->daddu(t3, t3, t4); // daddu t3, t3, t4
c->lb(t4, 0, a1); // lb t4, 0(a1)
c->mult3(t4, t4, v1); // mult3 t4, t4, v1
c->lb(t5, 1, a1); // lb t5, 1(a1)
c->mult3(t5, t5, t0); // mult3 t5, t5, t0
c->daddu(t4, t4, t5); // daddu t4, t4, t5
c->lb(a1, 2, a1); // lb a1, 2(a1)
c->mult3(a1, a1, a3); // mult3 a1, a1, a3
c->daddu(a1, t4, a1); // daddu a1, t4, a1
c->dsra(t4, a2, 3); // dsra t4, a2, 3
c->daddu(a1, a1, t4); // daddu a1, a1, t4
c->daddu(a1, r0, a1); // daddu a1, r0, a1
c->lwu(a0, 28, a0); // lwu a0, 28(a0)
c->daddu(a0, a1, a0); // daddu a0, a1, a0
c->addiu(a1, r0, 1); // addiu a1, r0, 1
c->andi(a2, a2, 7); // andi a2, a2, 7
if (((s64)c->sgpr64(a2)) >= 0) { // bgezl a2, L185
c->dsllv(a1, a1, a2); // dsllv a1, a1, a2
goto block_3;
}
block_2:
c->dsubu(a2, r0, a2); // dsubu a2, r0, a2
c->dsrav(a1, a1, a2); // dsrav a1, a1, a2
block_3:
c->nor(a1, a1, r0); // nor a1, a1, r0
c->mov64(a2, t3); // or a2, t3, r0
block_4:
c->mov64(t3, t2); // or t3, t2, r0
c->mov64(t4, a0); // or t4, a0, r0
block_5:
c->mov64(t5, t1); // or t5, t1, r0
c->mov64(t6, t4); // or t6, t4, r0
block_6:
// nop // sll r0, r0, 0
c->lbu(t7, 0, t6); // lbu t7, 0(t6)
// nop // sll r0, r0, 0
c->and_(t7, t7, a1); // and t7, t7, a1
c->daddiu(t5, t5, -1); // daddiu t5, t5, -1
c->sb(t7, 0, t6); // sb t7, 0(t6)
bc = c->sgpr64(t5) != 0; // bne t5, r0, L188
c->daddu(t6, t6, v1); // daddu t6, t6, v1
if (bc) {goto block_6;} // branch non-likely
c->daddiu(t3, t3, -1); // daddiu t3, t3, -1
// nop // sll r0, r0, 0
bc = c->sgpr64(t3) != 0; // bne t3, r0, L187
c->daddu(t4, t4, a3); // daddu t4, t4, a3
if (bc) {goto block_5;} // branch non-likely
c->daddiu(a2, a2, -1); // daddiu a2, a2, -1
// nop // sll r0, r0, 0
bc = c->sgpr64(a2) != 0; // bne a2, r0, L186
c->daddu(a0, a0, t0); // daddu a0, a0, t0
if (bc) {goto block_4;} // branch non-likely
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
//jr ra // jr ra
c->daddu(sp, sp, r0); // daddu sp, sp, r0
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
gLinkedFunctionTable.reg("(method 21 grid-hash)", execute, 256);
}
} // namespace method_21_grid_hash
} // namespace Mips2C
// add method_21_grid_hash::link to the link callback table for the object file.
// FWD DEC:
namespace method_21_grid_hash { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_24_grid_hash {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lq(v1, 0, a2); // lq v1, 0(a2)
c->mov128_vf_gpr(vf1, v1); // qmtc2.i vf1, v1
c->lq(v1, 12, a0); // lq v1, 12(a0)
c->mov128_vf_gpr(vf5, v1); // qmtc2.i vf5, v1
c->vsub_bc(DEST::xyzw, BC::w, vf3, vf1, vf1); // vsubw.xyzw vf3, vf1, vf1
c->vadd_bc(DEST::xyzw, BC::w, vf2, vf1, vf1); // vaddw.xyzw vf2, vf1, vf1
c->lq(v1, 28, a0); // lq v1, 28(a0)
c->mov128_vf_gpr(vf4, v1); // qmtc2.i vf4, v1
c->vmr32(DEST::xyzw, vf4, vf4); // vmr32.xyzw vf4, vf4
c->vsub(DEST::xyzw, vf6, vf3, vf4); // vsub.xyzw vf6, vf3, vf4
c->vsub(DEST::xyzw, vf7, vf2, vf4); // vsub.xyzw vf7, vf2, vf4
c->vmul(DEST::xyzw, vf6, vf6, vf5); // vmul.xyzw vf6, vf6, vf5
c->vmul(DEST::xyzw, vf7, vf7, vf5); // vmul.xyzw vf7, vf7, vf5
c->vftoi0(DEST::xyz, vf6, vf6); // vftoi0.xyz vf6, vf6
c->vftoi0(DEST::xyz, vf7, vf7); // vftoi0.xyz vf7, vf7
c->nor(v1, r0, r0); // nor v1, r0, r0
c->lw(a0, 24, a0); // lw a0, 24(a0)
c->sll(a2, a0, 8); // sll a2, a0, 8
c->lui(a0, 1); // lui a0, 1
c->srl(a2, a2, 8); // srl a2, a2, 8
c->ori(a0, a0, 257); // ori a0, a0, 257
c->dsubu(a0, a2, a0); // dsubu a0, a2, a0
// nop // sll r0, r0, 0
c->pextlb(a0, r0, a0); // pextlb a0, r0, a0
// nop // sll r0, r0, 0
c->pextlh(a0, r0, a0); // pextlh a0, r0, a0
// nop // sll r0, r0, 0
c->mov128_gpr_vf(a3, vf6); // qmfc2.i a3, vf6
c->mov128_gpr_vf(a2, vf7); // qmfc2.i a2, vf7
c->pmaxw(a3, a3, r0); // pmaxw a3, a3, r0
c->pmaxw(a2, a2, r0); // pmaxw a2, a2, r0
c->pminw(a3, a3, a0); // pminw a3, a3, a0
c->pminw(a0, a2, a0); // pminw a0, a2, a0
c->ppach(a2, r0, a3); // ppach a2, r0, a3
c->ppach(a3, r0, a0); // ppach a3, r0, a0
c->ppacb(a0, r0, a2); // ppacb a0, r0, a2
c->ppacb(a2, r0, a3); // ppacb a2, r0, a3
c->dsll(a2, a2, 24); // dsll a2, a2, 24
c->or_(a0, a0, a2); // or a0, a0, a2
c->dsll32(v1, v1, 16); // dsll32 v1, v1, 16
c->ld(a2, 0, a1); // ld a2, 0(a1)
c->and_(v1, a2, v1); // and v1, a2, v1
c->or_(v1, v1, a0); // or v1, v1, a0
c->sd(v1, 0, a1); // sd v1, 0(a1)
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
//jr ra // jr ra
c->daddu(sp, sp, r0); // daddu sp, sp, r0
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
gLinkedFunctionTable.reg("(method 24 grid-hash)", execute, 256);
}
} // namespace method_24_grid_hash
} // namespace Mips2C
// add method_24_grid_hash::link to the link callback table for the object file.
// FWD DEC:
namespace method_24_grid_hash { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_35_sphere_hash {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -48); // daddiu sp, sp, -48
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s5, 16, sp); // sq s5, 16(sp)
c->sq(gp, 32, sp); // sq gp, 32(sp)
c->mov64(s5, a0); // or s5, a0, r0
c->mov64(gp, a2); // or gp, a2, r0
c->mov64(a0, s5); // or a0, s5, r0
c->lwu(v1, -4, a0); // lwu v1, -4(a0)
c->lwu(t9, 112, v1); // lwu t9, 112(v1)
c->daddiu(v1, s5, 4); // daddiu v1, s5, 4
c->mov64(a2, a1); // or a2, a1, r0
c->mov64(a1, v1); // or a1, v1, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->mov64(v1, v0); // or v1, v0, r0
c->mov64(t0, s5); // or t0, s5, r0
c->daddiu(t1, s5, 4); // daddiu t1, s5, 4
c->lh(v1, 10, t0); // lh v1, 10(t0)
c->lb(a0, 24, t0); // lb a0, 24(t0)
c->mult3(a0, a0, v1); // mult3 a0, a0, v1
c->lb(a1, 26, t0); // lb a1, 26(t0)
c->mult3(a1, a1, a0); // mult3 a1, a1, a0
c->addiu(a2, r0, 1); // addiu a2, r0, 1
c->lb(a3, 0, t1); // lb a3, 0(t1)
c->dsubu(a2, a2, a3); // dsubu a2, a2, a3
c->lb(a3, 3, t1); // lb a3, 3(t1)
c->daddu(a2, a2, a3); // daddu a2, a2, a3
c->addiu(a3, r0, 1); // addiu a3, r0, 1
c->lb(t2, 2, t1); // lb t2, 2(t1)
c->dsubu(a3, a3, t2); // dsubu a3, a3, t2
c->lb(t2, 5, t1); // lb t2, 5(t1)
c->daddu(a3, a3, t2); // daddu a3, a3, t2
c->addiu(t2, r0, 1); // addiu t2, r0, 1
c->lb(t3, 1, t1); // lb t3, 1(t1)
c->dsubu(t2, t2, t3); // dsubu t2, t2, t3
c->lb(t3, 4, t1); // lb t3, 4(t1)
c->daddu(t2, t2, t3); // daddu t2, t2, t3
c->lb(t3, 0, t1); // lb t3, 0(t1)
c->mult3(t3, t3, v1); // mult3 t3, t3, v1
c->lb(t4, 1, t1); // lb t4, 1(t1)
c->mult3(t4, t4, a1); // mult3 t4, t4, a1
c->daddu(t3, t3, t4); // daddu t3, t3, t4
c->lb(t1, 2, t1); // lb t1, 2(t1)
c->mult3(t1, t1, a0); // mult3 t1, t1, a0
c->daddu(t1, t3, t1); // daddu t1, t3, t1
c->dsra(t3, gp, 3); // dsra t3, gp, 3
c->daddu(t1, t1, t3); // daddu t1, t1, t3
c->daddu(t1, r0, t1); // daddu t1, r0, t1
c->lwu(t0, 28, t0); // lwu t0, 28(t0)
c->daddu(t0, t1, t0); // daddu t0, t1, t0
c->addiu(t1, r0, 1); // addiu t1, r0, 1
c->andi(t3, gp, 7); // andi t3, gp, 7
if (((s64)c->sgpr64(t3)) >= 0) { // bgezl t3, L84
c->dsllv(t1, t1, t3); // dsllv t1, t1, t3
goto block_3;
}
block_2:
c->dsubu(t3, r0, t3); // dsubu t3, r0, t3
c->dsrav(t1, t1, t3); // dsrav t1, t1, t3
block_3:
c->nor(t1, t1, r0); // nor t1, t1, r0
c->mov64(t2, t2); // or t2, t2, r0
// nop // sll r0, r0, 0
block_4:
c->mov64(t3, a3); // or t3, a3, r0
c->mov64(t4, t0); // or t4, t0, r0
block_5:
c->mov64(t5, a2); // or t5, a2, r0
c->mov64(t6, t4); // or t6, t4, r0
block_6:
// nop // sll r0, r0, 0
c->lbu(t7, 0, t6); // lbu t7, 0(t6)
// nop // sll r0, r0, 0
c->and_(t7, t7, t1); // and t7, t7, t1
c->daddiu(t5, t5, -1); // daddiu t5, t5, -1
c->sb(t7, 0, t6); // sb t7, 0(t6)
bc = c->sgpr64(t5) != 0; // bne t5, r0, L87
c->daddu(t6, t6, v1); // daddu t6, t6, v1
if (bc) {goto block_6;} // branch non-likely
c->daddiu(t3, t3, -1); // daddiu t3, t3, -1
// nop // sll r0, r0, 0
bc = c->sgpr64(t3) != 0; // bne t3, r0, L86
c->daddu(t4, t4, a0); // daddu t4, t4, a0
if (bc) {goto block_5;} // branch non-likely
c->daddiu(t2, t2, -1); // daddiu t2, t2, -1
// nop // sll r0, r0, 0
bc = c->sgpr64(t2) != 0; // bne t2, r0, L85
c->daddu(t0, t0, a1); // daddu t0, t0, a1
if (bc) {goto block_4;} // branch non-likely
c->gprs[v1].du64[0] = 0; // or v1, r0, r0
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 32, sp); // lq gp, 32(sp)
c->lq(s5, 16, sp); // lq s5, 16(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 48); // daddiu sp, sp, 48
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
gLinkedFunctionTable.reg("(method 35 sphere-hash)", execute, 256);
}
} // namespace method_35_sphere_hash
} // namespace Mips2C
// add method_35_sphere_hash::link to the link callback table for the object file.
// FWD DEC:
namespace method_35_sphere_hash { extern void link(); }
//--------------------------MIPS2C---------------------
// clang-format off
#include "game/mips2c/mips2c_private.h"
#include "game/kernel/jakx/kscheme.h"
using ::jakx::intern_from_c;
namespace Mips2C::jakx {
namespace method_40_spatial_hash {
struct Cache {
void* mem_copy; // mem-copy!
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -96); // daddiu sp, sp, -96
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s2, 16, sp); // sq s2, 16(sp)
c->sq(s3, 32, sp); // sq s3, 32(sp)
c->sq(s4, 48, sp); // sq s4, 48(sp)
c->sq(s5, 64, sp); // sq s5, 64(sp)
c->sq(gp, 80, sp); // sq gp, 80(sp)
c->mov64(s5, a0); // or s5, a0, r0
c->mov64(s4, a2); // or s4, a2, r0
c->lh(gp, 56, s5); // lh gp, 56(s5)
c->lh(v1, 88, s5); // lh v1, 88(s5)
c->slt(v1, gp, v1); // slt v1, gp, v1
bc = c->sgpr64(v1) == 0; // beq v1, r0, L33
// nop // sll r0, r0, 0
if (bc) {goto block_11;} // branch non-likely
c->lwu(v1, 84, s5); // lwu v1, 84(s5)
c->dsll(a0, gp, 4); // dsll a0, gp, 4
c->daddu(s3, v1, a0); // daddu s3, v1, a0
c->lwu(v1, 100, s5); // lwu v1, 100(s5)
c->dsll(a0, gp, 4); // dsll a0, gp, 4
c->daddu(s2, v1, a0); // daddu s2, v1, a0
c->load_symbol2(t9, cache.mem_copy); // lw t9, mem-copy!(s7)
c->mov64(a0, s3); // or a0, s3, r0
c->addiu(a2, r0, 16); // addiu a2, r0, 16
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->sw(s4, 0, s2); // sw s4, 0(s2)
c->mov64(a0, s5); // or a0, s5, r0
c->lwu(v1, -4, a0); // lwu v1, -4(a0)
c->lwu(t9, 112, v1); // lwu t9, 112(v1)
c->daddiu(a1, s5, 4); // daddiu a1, s5, 4
c->mov64(a2, s3); // or a2, s3, r0
call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
c->jalr(call_addr); // jalr ra, t9
c->mov64(v1, v0); // or v1, v0, r0
c->mov64(t1, s5); // or t1, s5, r0
c->daddiu(t2, s5, 4); // daddiu t2, s5, 4
c->mov64(a3, gp); // or a3, gp, r0
c->lh(v1, 10, t1); // lh v1, 10(t1)
c->lb(a0, 24, t1); // lb a0, 24(t1)
c->mult3(a0, a0, v1); // mult3 a0, a0, v1
c->lb(a1, 26, t1); // lb a1, 26(t1)
c->mult3(a1, a1, a0); // mult3 a1, a1, a0
c->addiu(a2, r0, 1); // addiu a2, r0, 1
c->lb(t0, 0, t2); // lb t0, 0(t2)
c->dsubu(a2, a2, t0); // dsubu a2, a2, t0
c->lb(t0, 3, t2); // lb t0, 3(t2)
c->daddu(a2, a2, t0); // daddu a2, a2, t0
c->addiu(t0, r0, 1); // addiu t0, r0, 1
c->lb(t3, 2, t2); // lb t3, 2(t2)
c->dsubu(t0, t0, t3); // dsubu t0, t0, t3
c->lb(t3, 5, t2); // lb t3, 5(t2)
c->daddu(t0, t0, t3); // daddu t0, t0, t3
c->addiu(t3, r0, 1); // addiu t3, r0, 1
c->lb(t4, 1, t2); // lb t4, 1(t2)
c->dsubu(t3, t3, t4); // dsubu t3, t3, t4
c->lb(t4, 4, t2); // lb t4, 4(t2)
c->daddu(t3, t3, t4); // daddu t3, t3, t4
c->lb(t4, 0, t2); // lb t4, 0(t2)
c->mult3(t4, t4, v1); // mult3 t4, t4, v1
c->lb(t5, 1, t2); // lb t5, 1(t2)
c->mult3(t5, t5, a1); // mult3 t5, t5, a1
c->daddu(t4, t4, t5); // daddu t4, t4, t5
c->lb(t2, 2, t2); // lb t2, 2(t2)
c->mult3(t2, t2, a0); // mult3 t2, t2, a0
c->daddu(t2, t4, t2); // daddu t2, t4, t2
c->dsra(t4, a3, 3); // dsra t4, a3, 3
c->daddu(t2, t2, t4); // daddu t2, t2, t4
c->daddu(t2, r0, t2); // daddu t2, r0, t2
c->lwu(t1, 28, t1); // lwu t1, 28(t1)
c->daddu(t1, t2, t1); // daddu t1, t2, t1
c->addiu(t2, r0, 1); // addiu t2, r0, 1
c->andi(a3, a3, 7); // andi a3, a3, 7
if (((s64)c->sgpr64(a3)) >= 0) { // bgezl a3, L29
c->dsllv(a3, t2, a3); // dsllv a3, t2, a3
goto block_4;
}
block_3:
c->dsubu(a3, r0, a3); // dsubu a3, r0, a3
c->dsrav(a3, t2, a3); // dsrav a3, t2, a3
block_4:
c->mov64(t2, t3); // or t2, t3, r0
block_5:
c->mov64(t3, t0); // or t3, t0, r0
c->mov64(t4, t1); // or t4, t1, r0
block_6:
c->mov64(t5, a2); // or t5, a2, r0
c->mov64(t6, t4); // or t6, t4, r0
block_7:
// nop // sll r0, r0, 0
c->lbu(t7, 0, t6); // lbu t7, 0(t6)
// nop // sll r0, r0, 0
c->or_(t7, t7, a3); // or t7, t7, a3
c->daddiu(t5, t5, -1); // daddiu t5, t5, -1
c->sb(t7, 0, t6); // sb t7, 0(t6)
bc = c->sgpr64(t5) != 0; // bne t5, r0, L32
c->daddu(t6, t6, v1); // daddu t6, t6, v1
if (bc) {goto block_7;} // branch non-likely
c->daddiu(t3, t3, -1); // daddiu t3, t3, -1
// nop // sll r0, r0, 0
bc = c->sgpr64(t3) != 0; // bne t3, r0, L31
c->daddu(t4, t4, a0); // daddu t4, t4, a0
if (bc) {goto block_6;} // branch non-likely
c->daddiu(t2, t2, -1); // daddiu t2, t2, -1
// nop // sll r0, r0, 0
bc = c->sgpr64(t2) != 0; // bne t2, r0, L30
c->daddu(t1, t1, a1); // daddu t1, t1, a1
if (bc) {goto block_5;} // branch non-likely
c->gprs[v1].du64[0] = 0; // or v1, r0, r0
c->lh(v1, 56, s5); // lh v1, 56(s5)
c->daddiu(v1, v1, 1); // daddiu v1, v1, 1
c->sh(v1, 56, s5); // sh v1, 56(s5)
//beq r0, r0, L34 // beq r0, r0, L34
// nop // sll r0, r0, 0
goto block_12; // branch always
block_11:
c->addiu(gp, r0, -1); // addiu gp, r0, -1
c->mov64(v1, gp); // or v1, gp, r0
block_12:
c->mov64(v0, gp); // or v0, gp, r0
c->ld(ra, 0, sp); // ld ra, 0(sp)
c->lq(gp, 80, sp); // lq gp, 80(sp)
c->lq(s5, 64, sp); // lq s5, 64(sp)
c->lq(s4, 48, sp); // lq s4, 48(sp)
c->lq(s3, 32, sp); // lq s3, 32(sp)
c->lq(s2, 16, sp); // lq s2, 16(sp)
//jr ra // jr ra
c->daddiu(sp, sp, 96); // daddiu sp, sp, 96
goto end_of_function; // return
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
end_of_function:
return c->gprs[v0].du64[0];
}
void link() {
cache.mem_copy = intern_from_c(-1, 0, "mem-copy!").c();
gLinkedFunctionTable.reg("(method 40 spatial-hash)", execute, 256);
}
} // namespace method_40_spatial_hash
} // namespace Mips2C
// add method_40_spatial_hash::link to the link callback table for the object file.
// FWD DEC:
namespace method_40_spatial_hash { extern void link(); }
+26 -65
View File
@@ -414,23 +414,17 @@ namespace init_boundary_regs { extern void link(); }
namespace draw_boundary_polygon { extern void link(); }
namespace render_boundary_quad { extern void link(); }
namespace render_boundary_tri { extern void link(); }
// namespace set_sky_vf27 { extern void link(); }
namespace generic_light_proc { extern void link(); }
namespace generic_envmap_proc { extern void link(); }
// namespace generic_prepare_dma_double { extern void link(); }
namespace generic_prepare_dma_single { extern void link(); }
namespace generic_warp_source_proc { extern void link(); }
namespace generic_warp_dest_proc { extern void link(); }
namespace generic_warp_dest { extern void link(); }
namespace generic_warp_envmap_dest { extern void link(); }
namespace generic_no_light_proc { extern void link(); }
// namespace method_9_font_work { extern void link(); }
// namespace draw_string_asm { extern void link(); }
// namespace get_string_length { extern void link(); }
namespace adgif_shader_texture_with_update { extern void link(); }
namespace moving_sphere_triangle_intersect { extern void link(); }
namespace collide_do_primitives { extern void link(); }
// namespace cspace_parented_transformq_joint { extern void link(); }
namespace foreground_check_longest_edge_asm { extern void link(); }
namespace foreground_merc { extern void link(); }
namespace foreground_generic_merc { extern void link(); }
@@ -440,9 +434,7 @@ namespace method_11_collide_hash { extern void link(); }
namespace method_12_collide_hash { extern void link(); }
namespace fill_bg_using_box_new { extern void link(); }
namespace fill_bg_using_line_sphere_new { extern void link(); }
namespace method_12_collide_mesh { extern void link(); }
namespace method_14_collide_mesh { extern void link(); }
// namespace method_15_collide_mesh { extern void link(); }
namespace method_10_collide_shape_prim_mesh { extern void link(); }
namespace method_10_collide_shape_prim_sphere { extern void link(); }
namespace method_10_collide_shape_prim_group { extern void link(); }
@@ -454,20 +446,11 @@ namespace method_10_collide_cache_prim { extern void link(); }
namespace method_17_collide_cache { extern void link(); }
namespace method_9_collide_puss_work { extern void link(); }
namespace method_10_collide_puss_work { extern void link(); }
// namespace method_18_grid_hash { extern void link(); }
namespace method_19_grid_hash { extern void link(); }
namespace method_20_grid_hash { extern void link(); }
namespace method_22_grid_hash { extern void link(); }
namespace method_28_sphere_hash { extern void link(); }
// namespace method_32_sphere_hash { extern void link(); }
// namespace method_29_sphere_hash { extern void link(); }
namespace method_30_sphere_hash { extern void link(); }
// namespace method_31_sphere_hash { extern void link(); }
// namespace method_32_spatial_hash { extern void link(); }
// namespace method_38_spatial_hash { extern void link(); }
namespace method_35_spatial_hash { extern void link(); }
namespace method_36_spatial_hash { extern void link(); }
namespace method_34_spatial_hash { extern void link(); }
namespace sparticle_motion_blur { extern void link(); }
namespace sp_launch_particles_var { extern void link(); }
namespace particle_adgif { extern void link(); }
@@ -490,9 +473,6 @@ namespace ripple_matrix_scale { extern void link(); }
namespace ripple_apply_wave_table { extern void link(); }
namespace ripple_create_wave_table { extern void link(); }
namespace ripple_execute_init { extern void link(); }
// namespace method_14_ocean { extern void link(); }
// namespace method_15_ocean { extern void link(); }
// namespace method_16_ocean { extern void link(); }
namespace init_ocean_far_regs { extern void link(); }
namespace draw_large_polygon_ocean { extern void link(); }
namespace render_ocean_quad { extern void link(); }
@@ -511,11 +491,7 @@ namespace render_sky_tri { extern void link(); }
namespace method_17_sky_work { extern void link(); }
namespace method_29_sky_work { extern void link(); }
namespace method_30_sky_work { extern void link(); }
namespace method_31_sky_work { extern void link(); }
// namespace method_34_sky_work { extern void link(); }
// namespace method_35_sky_work { extern void link(); }
namespace method_32_sky_work { extern void link(); }
// namespace set_sky_vf23_value { extern void link(); }
namespace shadow_xform_verts { extern void link(); }
namespace shadow_calc_dual_verts { extern void link(); }
namespace shadow_scissor_edges { extern void link(); }
@@ -533,7 +509,16 @@ namespace shadow_add_single_tris { extern void link(); }
namespace shadow_add_double_tris { extern void link(); }
namespace shadow_execute { extern void link(); }
namespace method_21_cloth_system { extern void link(); }
}
namespace method_16_sky_work { extern void link(); }
namespace method_28_sky_work { extern void link(); }
namespace method_33_sky_work { extern void link(); }
namespace method_11_collide_mesh { extern void link(); }
namespace method_13_collide_mesh { extern void link(); }
namespace method_21_grid_hash { extern void link(); }
namespace method_24_grid_hash { extern void link(); }
namespace method_35_sphere_hash { extern void link(); }
namespace method_40_spatial_hash { extern void link(); }
namespace cspace_parented_transformq_joint { extern void link(); }}
// clang-format on
LinkedFunctionTable gLinkedFunctionTable;
@@ -801,27 +786,20 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
jakx::light_hash_count_items::link, jakx::light_hash_add_items::link}},
{"debug",
{
jakx::debug_line_clip::link, jakx::init_boundary_regs::link,
jakx::draw_boundary_polygon::link, jakx::render_boundary_quad::link,
// jakx::render_boundary_tri::link, jakx::set_sky_vf27::link
jakx::debug_line_clip::link,
jakx::init_boundary_regs::link,
jakx::draw_boundary_polygon::link,
jakx::render_boundary_quad::link,
}},
{"generic-effect",
{jakx::generic_light_proc::link, jakx::generic_envmap_proc::link,
// jakx::generic_prepare_dma_double::link,
jakx::generic_prepare_dma_single::link, jakx::generic_warp_source_proc::link,
jakx::generic_warp_dest_proc::link, jakx::generic_warp_dest::link,
jakx::generic_warp_envmap_dest::link, jakx::generic_no_light_proc::link}},
// {"font",
// {jakx::method_9_font_work::link,
// jakx::draw_string_asm::link,
// jakx::get_string_length::link}},
{"texture", {jakx::adgif_shader_texture_with_update::link}},
{"collide-func",
{jakx::moving_sphere_triangle_intersect::link, jakx::collide_do_primitives::link}},
{"joint",
{
// jakx::cspace_parented_transformq_joint::link
}},
{"joint", {jakx::cspace_parented_transformq_joint::link}},
{"foreground",
{jakx::foreground_check_longest_edge_asm::link, jakx::foreground_generic_merc::link,
jakx::foreground_merc::link, jakx::foreground_draw_hud::link}},
@@ -830,9 +808,8 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
{jakx::method_11_collide_hash::link, jakx::method_12_collide_hash::link,
jakx::fill_bg_using_box_new::link, jakx::fill_bg_using_line_sphere_new::link}},
{"collide-mesh",
{jakx::method_12_collide_mesh::link, jakx::method_14_collide_mesh::link,
// jakx::method_15_collide_mesh::link,
jakx::method_10_collide_shape_prim_mesh::link}},
{jakx::method_14_collide_mesh::link, jakx::method_10_collide_shape_prim_mesh::link,
jakx::method_11_collide_mesh::link, jakx::method_13_collide_mesh::link}},
{"collide-cache",
{jakx::method_10_collide_shape_prim_mesh::link,
jakx::method_10_collide_shape_prim_sphere::link,
@@ -843,19 +820,11 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
jakx::method_10_collide_cache_prim::link, jakx::method_17_collide_cache::link,
jakx::method_9_collide_puss_work::link, jakx::method_10_collide_puss_work::link}},
{"spatial-hash",
{
// jakx::method_18_grid_hash::link,
jakx::method_19_grid_hash::link, jakx::method_20_grid_hash::link,
jakx::method_22_grid_hash::link, jakx::method_28_sphere_hash::link,
// jakx::method_32_sphere_hash::link,
// jakx::method_29_sphere_hash::link,
jakx::method_30_sphere_hash::link,
// jakx::method_31_sphere_hash::link,
// jakx::method_32_spatial_hash::link,
// jakx::method_38_spatial_hash::link,
jakx::method_35_spatial_hash::link, jakx::method_36_spatial_hash::link,
// jakx::method_34_spatial_hash::link
}},
{jakx::method_20_grid_hash::link, jakx::method_22_grid_hash::link,
jakx::method_30_sphere_hash::link, jakx::method_36_spatial_hash::link,
jakx::method_21_grid_hash::link, jakx::method_24_grid_hash::link,
jakx::method_35_sphere_hash::link, jakx::method_35_spatial_hash::link,
jakx::method_40_spatial_hash::link}},
{"sparticle-launcher",
{jakx::sparticle_motion_blur::link, jakx::sp_launch_particles_var::link,
jakx::particle_adgif::link, jakx::sp_init_fields::link}},
@@ -872,12 +841,7 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
{"ripple",
{jakx::ripple_matrix_scale::link, jakx::ripple_apply_wave_table::link,
jakx::ripple_create_wave_table::link, jakx::ripple_execute_init::link}},
{"ocean-vu0",
{
// jakx::method_14_ocean::link,
// jakx::method_15_ocean::link,
// jakx::method_16_ocean::link
}},
{"ocean-vu0", {}},
{"ocean",
{jakx::init_ocean_far_regs::link, jakx::draw_large_polygon_ocean::link,
jakx::render_ocean_quad::link}},
@@ -889,12 +853,9 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
{"sky-tng",
{jakx::set_tex_offset::link, jakx::render_sky_quad::link, jakx::render_sky_tri::link,
jakx::method_17_sky_work::link, jakx::method_29_sky_work::link,
jakx::method_30_sky_work::link, jakx::method_31_sky_work::link,
// jakx::method_34_sky_work::link,
// jakx::method_35_sky_work::link,
jakx::method_32_sky_work::link,
// jakx::set_sky_vf23_value::link,
jakx::draw_large_polygon::link}},
jakx::method_30_sky_work::link, jakx::method_32_sky_work::link,
jakx::draw_large_polygon::link, jakx::method_16_sky_work::link,
jakx::method_28_sky_work::link, jakx::method_33_sky_work::link}},
{"shadow-cpu",
{jakx::shadow_xform_verts::link, jakx::shadow_execute::link,
jakx::shadow_calc_dual_verts::link, jakx::shadow_scissor_edges::link,
+1
View File
@@ -1195,6 +1195,7 @@
(ocean-method-88 this s4-1)
)
(draw-ocean-texture this s4-1 (the-as int (-> this verts)))
;; og:preserve-this
; (ocean-method-89 this s4-1)
(init-buffer! this s4-1)
(if (-> this far-on)
@@ -873,6 +873,7 @@
((-> s1-0 func) s3-0 s1-0)
)
(if (and (= (-> s0-0 psm) (gs-psm ct32)) (< (the-as uint 1) (-> s0-0 num-mips)))
;; og:preserve-this
(texture-anim-draw-mips s3-0 s0-0)
)
(when (not (paused?))
+18 -16
View File
@@ -400,21 +400,23 @@
)
(deftype vehicle-spawn-params (structure)
((behavior uint64)
(nav-mesh nav-mesh)
(position vector :inline)
(rotation quaternion :inline)
(velocity vector :inline)
(handle handle)
(handle-parent handle)
(user-data uint32)
(entity basic)
(flags uint32)
(player-id int8)
(level-slot int8)
(driver-type driver-type)
(driver-slot int8)
(impact-callback function)
(proc process)
((behavior uint64)
(nav-mesh nav-mesh)
(position vector :inline)
(rotation quaternion :inline)
(velocity vector :inline)
(handle handle)
(handle-parent handle)
(user-data uint32)
(entity entity)
(flags uint32)
(player-id int8)
(level-slot int8)
(level-slot-unsigned uint8 :overlay-at level-slot)
(driver-type driver-type)
(driver-slot uint8)
(driver-slot-unsigned int8 :overlay-at driver-slot)
(impact-callback function)
(proc process)
)
)
+813 -16
View File
@@ -7,23 +7,820 @@
;; DECOMP BEGINS
(deftype joint-exploder-static-joint-params (structure)
((joint-index int16 :offset-assert 0)
(parent-joint-index int16 :offset-assert 2)
(deftype joint-exploder-tuning (structure)
((explosion uint64)
(duration uint64)
(gravity float)
(rot-speed float)
(bounds-inflate float)
(max-probes uint8)
(max-probe-width float)
(max-probe-height float)
(max-probe-depth float)
(max-y-offset float)
(friction float)
(fountain-rand-transv-lo vector :inline)
(fountain-rand-transv-hi vector :inline)
(away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo)
(away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi data 0))
(away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi data 1))
(away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi data 2))
(away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi data 3))
(hit-xz-reaction float)
(hit-y-reaction float)
)
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
(:methods
(new (symbol type uint) _type_)
)
)
(deftype joint-exploder-static-params (basic)
((joints (array joint-exploder-static-joint-params) :offset-assert 4) ;; guessed by decompiler
(collide-spec collide-spec :offset-assert 8) ;; guessed by decompiler
(art-level symbol :offset-assert 12) ;; guessed by decompiler
(collide-sound uint16 :offset-assert 16) ;; sound-name
(collide-sound-interval uint64 :offset-assert 24) ;; time-frame
(deftype joint-exploder-static-joint-params (structure)
((joint-index int16)
(parent-joint-index int16)
)
:method-count-assert 9
:size-assert #x20
:flag-assert #x900000020
)
)
(deftype joint-exploder-static-params (basic)
((joints (array joint-exploder-static-joint-params))
(collide-spec collide-spec)
(art-level symbol)
(collide-sound uint16)
(collide-sound-interval uint64)
)
)
(deftype joint-exploder-joint (structure)
((next int16)
(prev int16)
(joint-index int16)
(mat matrix :inline)
(rmat matrix :inline)
(update-rmat matrix :inline)
(transv vector :inline)
(prev-pos vector :inline)
)
)
(deftype joint-exploder-joints (basic)
((num-joints int32)
(joint joint-exploder-joint :inline :dynamic)
)
(:methods
(new (symbol type joint-exploder-static-params) _type_)
)
)
(deftype joint-exploder-list (structure)
((head int32)
(pre-moved? symbol)
(bbox-valid? symbol)
(probeless? symbol)
(bbox bounding-box :inline)
)
)
(deftype joint-exploder-list-array (inline-array-class)
((data joint-exploder-list :inline :dynamic)
)
)
(set! (-> joint-exploder-list-array heap-base) (the-as uint 48))
(deftype joint-exploder (process-drawable)
((parent (pointer process-drawable) :override)
(die-if-below-y float)
(die-if-beyond-xz-dist-sqrd float)
(joints joint-exploder-joints)
(static-params joint-exploder-static-params)
(anim art-joint-anim)
(scale-vector vector :inline)
(tuning joint-exploder-tuning :inline)
(lists joint-exploder-list-array)
(last-colsound-time uint64)
)
(:methods
(add-joint-to-list (_type_ joint-exploder-list int) int)
(update-bbox-for-joint (_type_ joint-exploder-list joint-exploder-joint) none)
(do-collision-response (_type_ joint-exploder-list) none)
(init-joint-list (_type_) none)
(remove-from-list-and-reset (_type_ joint-exploder-list int) int)
(final-adjust (_type_ joint-exploder-list int) int)
(integrate-and-kill (_type_ joint-exploder-list) none)
(remove-joint-from-list (_type_ joint-exploder-list int) int)
(adjust-bbox-for-limits-along-axis (_type_ joint-exploder-list int) joint-exploder-list)
(adjust-bbox-for-limits (_type_ joint-exploder-list) none)
)
(:states
joint-exploder-shatter
)
)
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this joint-exploder-joints))
(the-as int (+ (-> this type size) (* 240 (-> this num-joints))))
)
(defmethod new joint-exploder-joints ((allocation symbol) (type-to-make type) (arg0 joint-exploder-static-params))
(let* ((gp-0 (-> arg0 joints length))
(v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 240 gp-0)))))
)
(set! (-> v0-0 num-joints) gp-0)
v0-0
)
)
(defun joint-exploder-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control))
(let ((s4-0 (the-as joint-exploder (-> arg0 process))))
(let ((s3-0 (-> s4-0 joints)))
(countdown (s2-0 (-> s3-0 num-joints))
(let* ((v1-3 (-> s3-0 joint s2-0))
(a0-5 (-> arg1 data (-> v1-3 joint-index) bone transform))
)
(matrix*! a0-5 (-> v1-3 rmat) (-> v1-3 mat))
)
)
)
(let ((s4-1 (-> s4-0 scale-vector)))
(countdown (s3-1 (-> arg1 length))
(let ((a2-2 (-> arg1 data s3-1 bone transform)))
(scale-matrix! a2-2 s4-1 a2-2)
)
)
)
)
(let ((s4-2 (new-stack-matrix0))
(f30-0 (-> arg0 bounds w))
)
(matrix-4x4-inverse! s4-2 (-> arg1 data 0 bone transform))
(set! (-> arg0 bounds w) 1.0)
(vector-matrix*! (-> arg0 bounds) (-> arg0 bounds) s4-2)
(set! (-> arg0 bounds w) f30-0)
)
0
(none)
)
(defmethod remove-from-list-and-reset ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
"Remove a joint from the list and clear its transform"
(let ((v0-0 (remove-joint-from-list this arg0 arg1)))
(let* ((v1-1 (-> this joints))
(v1-2 (-> v1-1 joint arg1))
)
(set! (-> v1-2 mat rvec quad) (the-as uint128 0))
(set! (-> v1-2 mat uvec quad) (the-as uint128 0))
(set! (-> v1-2 mat fvec quad) (the-as uint128 0))
(set! (-> v1-2 mat trans quad) (-> this root trans quad))
)
v0-0
)
)
(defmethod remove-joint-from-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
"Remove a joint from the linked list and invalidate the bbox."
(let* ((v1-0 (-> this joints))
(a2-1 (-> v1-0 joint arg1))
(a0-4 (-> a2-1 prev))
(v0-0 (-> a2-1 next))
)
(cond
((>= a0-4 0)
(set! (-> v1-0 joint a0-4 next) v0-0)
(if (>= v0-0 0)
(set! (-> v1-0 joint v0-0 prev) a0-4)
)
)
(else
(set! (-> arg0 head) v0-0)
(cond
((>= v0-0 0)
(let ((v1-2 (-> v1-0 joint v0-0)))
(set! (-> v1-2 prev) -1)
)
)
(else
(set! (-> arg0 bbox-valid?) #f)
)
)
)
)
v0-0
)
)
(defmethod add-joint-to-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
"Add a joint to the given linked list of joints."
(let* ((v1-0 (-> this joints))
(a3-0 (-> v1-0 joint arg1))
(a0-4 (-> arg0 head))
)
(set! (-> arg0 head) arg1)
(set! (-> a3-0 prev) -1)
(set! (-> a3-0 next) a0-4)
(when (>= a0-4 0)
(set! (-> v1-0 joint a0-4 prev) arg1)
arg1
)
)
)
(defmethod update-bbox-for-joint ((this joint-exploder) (arg0 joint-exploder-list) (arg1 joint-exploder-joint))
"Update the bounding box to include the joint"
(let ((a1-1 (-> arg1 mat trans)))
(cond
((-> arg0 bbox-valid?)
(add-point! (-> arg0 bbox) a1-1)
)
(else
(set! (-> arg0 bbox-valid?) #t)
(set! (-> arg0 bbox min quad) (-> a1-1 quad))
(set! (-> arg0 bbox max quad) (-> a1-1 quad))
)
)
)
(add-point! (-> arg0 bbox) (-> arg1 prev-pos))
(none)
)
;; WARN: Return type mismatch object vs joint-exploder-list.
(defmethod adjust-bbox-for-limits-along-axis ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
(let ((s4-0 (the-as object #f)))
(let ((v1-0 1))
(until (= v1-0 (+ (-> this tuning max-probes) 1))
(let ((a0-4 (-> this lists data v1-0)))
(when (< (-> a0-4 head) 0)
(set! s4-0 a0-4)
(goto cfg-6)
)
)
(+! v1-0 1)
)
)
(label cfg-6)
(cond
((the-as joint-exploder-list s4-0)
(set! (-> (the-as joint-exploder-list s4-0) pre-moved?) #t)
(set! (-> (the-as joint-exploder-list s4-0) bbox-valid?) #f)
)
(else
(set! s4-0 (-> this lists data))
)
)
(set! (-> arg0 bbox-valid?) #f)
(let ((s2-0 (-> this joints))
(sv-32 (-> arg0 head))
(s1-0 0)
(s0-0 0)
)
(let ((v1-8 arg1))
(cond
((zero? v1-8)
(let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x)))))
(while (>= sv-32 0)
(let ((sv-48 (-> s2-0 joint sv-32)))
(cond
((>= (-> sv-48 mat trans x) f30-0)
(let ((sv-16 (remove-joint-from-list this arg0 sv-32)))
(add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32)
(set! sv-32 sv-16)
)
(update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-48)
(+! s0-0 1)
)
(else
(update-bbox-for-joint this arg0 sv-48)
(set! sv-32 (-> sv-48 next))
(+! s1-0 1)
)
)
)
)
)
)
((= v1-8 1)
(let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y)))))
(while (>= sv-32 0)
(let ((sv-80 (-> s2-0 joint sv-32)))
(cond
((>= (-> sv-80 mat trans y) f30-1)
(let ((sv-64 (remove-joint-from-list this arg0 sv-32)))
(add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32)
(set! sv-32 sv-64)
)
(update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-80)
(+! s0-0 1)
)
(else
(update-bbox-for-joint this arg0 sv-80)
(set! sv-32 (-> sv-80 next))
(+! s1-0 1)
)
)
)
)
)
)
((= v1-8 2)
(let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z)))))
(while (>= sv-32 0)
(let ((sv-112 (-> s2-0 joint sv-32)))
(cond
((>= (-> sv-112 mat trans z) f30-2)
(let ((sv-96 (remove-joint-from-list this arg0 sv-32)))
(add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32)
(set! sv-32 sv-96)
)
(update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-112)
(+! s0-0 1)
)
(else
(update-bbox-for-joint this arg0 sv-112)
(set! sv-32 (-> sv-112 next))
(+! s1-0 1)
)
)
)
)
)
)
)
)
(cond
((zero? s0-0)
(final-adjust this arg0 arg1)
)
((zero? s1-0)
(if (not (-> (the-as joint-exploder-list s4-0) probeless?))
(final-adjust this (the-as joint-exploder-list s4-0) arg1)
)
)
)
)
(the-as joint-exploder-list s4-0)
)
)
;; WARN: Return type mismatch symbol vs int.
(defmethod final-adjust ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
(set! (-> arg0 bbox-valid?) #f)
(let ((s3-0 (-> this joints))
(s2-0 (-> arg0 head))
)
(while (>= s2-0 0)
(let ((sv-80 (-> s3-0 joint s2-0))
(s1-0 (new 'stack-no-clear 'bounding-box))
(s0-0 (-> arg0 bbox-valid?))
)
(set! (-> s1-0 min quad) (-> arg0 bbox min quad))
(set! (-> s1-0 max quad) (-> arg0 bbox max quad))
(update-bbox-for-joint this arg0 sv-80)
(let* ((v1-7 arg1)
(v1-8 (cond
((zero? v1-7)
(< (-> this tuning max-probe-width) (- (-> arg0 bbox max x) (-> arg0 bbox min x)))
)
((= v1-7 1)
(< (-> this tuning max-probe-height) (- (-> arg0 bbox max y) (-> arg0 bbox min y)))
)
((= v1-7 2)
(< (-> this tuning max-probe-depth) (- (-> arg0 bbox max z) (-> arg0 bbox min z)))
)
)
)
)
(set! s2-0 (cond
(v1-8
(let ((sv-48 (remove-joint-from-list this arg0 s2-0))
(sv-64 (-> this lists data))
)
(add-joint-to-list this (-> sv-64 0) s2-0)
(set! s2-0 sv-48)
(update-bbox-for-joint this (-> sv-64 0) sv-80)
)
(set! (-> arg0 bbox-valid?) s0-0)
(set! (-> arg0 bbox min quad) (-> s1-0 min quad))
(set! (-> arg0 bbox max quad) (-> s1-0 max quad))
s2-0
)
(else
(-> sv-80 next)
)
)
)
)
)
)
)
(the-as int #f)
)
(defmethod adjust-bbox-for-limits ((this joint-exploder) (arg0 joint-exploder-list))
(when (and (-> arg0 bbox-valid?) (>= (-> arg0 head) 0) (not (-> arg0 probeless?)))
(let ((a2-0 -1))
(cond
((< (-> this tuning max-probe-width) (- (-> arg0 bbox max x) (-> arg0 bbox min x)))
(set! a2-0 0)
)
((< (-> this tuning max-probe-height) (- (-> arg0 bbox max y) (-> arg0 bbox min y)))
(set! a2-0 1)
)
((< (-> this tuning max-probe-depth) (- (-> arg0 bbox max z) (-> arg0 bbox min z)))
(set! a2-0 2)
)
)
(when (>= a2-0 0)
(let ((a1-2 (adjust-bbox-for-limits-along-axis this arg0 a2-0)))
(if (not (-> a1-2 probeless?))
(adjust-bbox-for-limits this a1-2)
)
)
(adjust-bbox-for-limits this arg0)
)
)
)
0
(none)
)
(defmethod integrate-and-kill ((this joint-exploder) (arg0 joint-exploder-list))
(local-vars (v1-8 float))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(set! (-> arg0 bbox-valid?) #f)
(set! (-> arg0 pre-moved?) #t)
(let ((s4-0 (-> this joints))
(f30-0 (* (-> this tuning gravity) (seconds-per-frame)))
(s3-0 (-> arg0 head))
)
(while (>= s3-0 0)
(let* ((s2-0 (-> s4-0 joint s3-0))
(s1-0 (-> s2-0 mat trans))
)
(set! (-> s2-0 prev-pos quad) (-> s1-0 quad))
(+! (-> s2-0 transv y) f30-0)
(when (< 0.0 (-> this tuning friction))
(.lvf vf1 (&-> (-> s2-0 transv) quad))
(.add.w.vf.x vf2 vf0 vf0)
(.mul.vf vf1 vf1 vf1)
(.mul.x.vf.x acc vf2 vf1)
(.add.mul.y.vf.x acc vf2 vf1 acc)
(.add.mul.z.vf.x vf1 vf2 vf1 acc)
(.mov v1-8 vf1)
(let* ((f0-4 v1-8)
(f1-5 (* 0.00001 (seconds-per-frame) (-> this tuning friction) f0-4))
(f0-6 (- (sqrtf f0-4) f1-5))
)
(if (< f0-6 0.0)
(set! f0-6 0.0)
)
(vector-normalize! (-> s2-0 transv) f0-6)
)
)
(vector-v+! s1-0 s1-0 (-> s2-0 transv))
(matrix*! (-> s2-0 rmat) (-> s2-0 rmat) (-> s2-0 update-rmat))
(cond
((or (< (-> s1-0 y) (-> this die-if-below-y))
(< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans)))
)
(set! s3-0 (remove-from-list-and-reset this arg0 s3-0))
)
(else
(update-bbox-for-joint this arg0 s2-0)
(set! s3-0 (-> s2-0 next))
)
)
)
)
)
0
(none)
)
)
(defmethod do-collision-response ((this joint-exploder) (arg0 joint-exploder-list))
(let ((s5-0 (new 'stack-no-clear 'collide-query)))
(set! (-> s5-0 collide-with) (-> this static-params collide-spec))
(set! (-> s5-0 ignore-process0) this)
(set! (-> s5-0 ignore-process1) #f)
(set! (-> s5-0 ignore-pat)
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
)
(set! (-> s5-0 action-mask) (collide-action solid))
(set! (-> s5-0 nav-mesh) #f)
(mem-copy! (the-as pointer (-> s5-0 bbox)) (the-as pointer (-> arg0 bbox)) 32)
(fill-using-bounding-box *collide-cache* s5-0)
)
(let ((s5-1 (-> this joints))
(v1-6 (-> arg0 head))
)
(while (>= v1-6 0)
(let ((s4-1 (-> s5-1 joint v1-6)))
(let ((s3-0 (-> s4-1 mat trans))
(s2-0 (new 'stack-no-clear 'collide-query))
)
(vector-! (-> s2-0 move-dist) s3-0 (-> s4-1 prev-pos))
(set! (-> s2-0 start-pos quad) (-> s4-1 prev-pos quad))
(let ((v1-11 s2-0))
(set! (-> v1-11 radius) 40.96)
(set! (-> v1-11 collide-with) (-> this static-params collide-spec))
(set! (-> v1-11 ignore-process0) #f)
(set! (-> v1-11 ignore-process1) #f)
(set! (-> v1-11 ignore-pat)
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
)
(set! (-> v1-11 action-mask) (collide-action solid))
(set! (-> v1-11 nav-mesh) #f)
)
(when (>= (collide-cache-method-16 *collide-cache* s2-0) 0.0)
(set! (-> s3-0 quad) (-> s2-0 best-other-tri intersect quad))
(let* ((v1-16 (-> s4-1 transv))
(f28-0 (sqrtf (+ (* (-> v1-16 x) (-> v1-16 x)) (* (-> v1-16 z) (-> v1-16 z)))))
)
(vector-reflect! (-> s4-1 transv) (-> s4-1 transv) (-> s2-0 best-other-tri normal))
(let ((f30-0 (-> s4-1 transv y)))
(set! (-> s4-1 transv y) 0.0)
(vector-normalize! (-> s4-1 transv) (* f28-0 (-> this tuning hit-xz-reaction)))
(set! (-> s4-1 transv y) (* f30-0 (-> this tuning hit-y-reaction)))
)
)
(let ((v1-20 (-> this static-params collide-sound)))
(when (and v1-20 (nonzero? v1-20) (< (the-as time-frame (-> this static-params collide-sound-interval))
(- (current-time) (the-as int (-> this last-colsound-time)))
)
)
(let ((v1-23 (make-sound-instance (-> *sound-info* v1-20) 0 #f)))
(cond
(v1-23
(set! (-> v1-23 trans quad) (-> s4-1 mat trans quad))
(logior! (-> v1-23 flags) 96)
(-> v1-23 id)
)
(else
0
)
)
)
(set! (-> this last-colsound-time) (the-as uint (current-time)))
)
)
(+! (-> s3-0 y) (* 40.96 (-> s2-0 best-other-tri normal y)))
(set! (-> s3-0 w) 1.0)
(matrix-lerp! (-> s4-1 update-rmat) (-> s4-1 update-rmat) *identity-matrix* 0.5)
)
)
(set! v1-6 (-> s4-1 next))
)
)
)
0
(none)
)
(defstate joint-exploder-shatter (joint-exploder)
:enter (behavior ()
(set-time! (-> self state-time))
)
:trans (behavior ()
(let* ((f1-0 (the float (- (current-time) (-> self state-time))))
(f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration)))))
(f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration))))))
(f1-3 (fmax 0.0001 f1-2))
(f0-3 (fmax 0.0001 f0-2))
)
(set-vector! (-> self scale-vector) f0-3 f1-3 f0-3 1.0)
)
(dotimes (v1-11 (the-as int (+ (-> self tuning max-probes) 1)))
(set! (-> self lists data v1-11 pre-moved?) #f)
)
(dotimes (gp-0 (the-as int (+ (-> self tuning max-probes) 1)))
(let ((s5-0 (-> self lists data gp-0)))
(when (>= (-> s5-0 head) 0)
(when (not (-> s5-0 pre-moved?))
(integrate-and-kill self s5-0)
(if (nonzero? gp-0)
(adjust-bbox-for-limits self s5-0)
)
)
)
)
)
(let ((gp-1 (new 'stack-no-clear 'bounding-box)))
(let ((v1-31 (-> self root trans)))
(set! (-> gp-1 min quad) (-> v1-31 quad))
(set! (-> gp-1 max quad) (-> v1-31 quad))
)
(dotimes (s5-1 (the-as int (+ (-> self tuning max-probes) 1)))
(let ((s4-0 (-> self lists data s5-1)))
(if (-> s4-0 bbox-valid?)
(add-box! gp-1 (-> s4-0 bbox))
)
(if (nonzero? s5-1)
(do-collision-response self s4-0)
)
)
)
(let ((s5-2 (-> self draw bounds)))
(vector-average! s5-2 (-> gp-1 min) (-> gp-1 max))
(set! (-> s5-2 w) (+ (vector-vector-distance s5-2 (-> gp-1 max)) (-> self tuning bounds-inflate)))
)
)
0
)
:code (behavior ()
(set-time! (-> self state-time))
(until (time-elapsed? (-> self state-time) (the-as time-frame (-> self tuning duration)))
(suspend)
(ja :num! (loop!))
)
)
:post ja-post
)
(defmethod init-joint-list ((this joint-exploder))
(let ((gp-0 (-> this joints)))
(dotimes (s4-0 (-> gp-0 num-joints))
(let ((v1-2 (-> this static-params joints s4-0))
(s3-0 (-> gp-0 joint s4-0))
)
(let ((a0-6 (-> v1-2 parent-joint-index)))
(set! (-> s3-0 prev) (+ s4-0 -1))
(set! (-> s3-0 next) (+ s4-0 1))
(set! (-> s3-0 joint-index) (-> v1-2 joint-index))
(cond
((>= a0-6 0)
(if (zero? a0-6)
(set! a0-6 (-> v1-2 joint-index))
)
(let ((a3-0 (-> this parent 0 node-list data a0-6 bone transform)))
(matrix-copy! (-> s3-0 mat) a3-0)
)
(matrix-identity! (-> s3-0 rmat))
)
(else
(let ((a3-2 (-> this node-list data (-> v1-2 joint-index) bone transform)))
(matrix-copy! (-> s3-0 mat) a3-2)
)
(matrix-identity! (-> s3-0 rmat))
)
)
)
(case (-> this tuning explosion)
((1)
(vector-! (-> s3-0 transv) (-> s3-0 mat trans) (-> this tuning fountain-rand-transv-lo))
(vector-normalize!
(-> s3-0 transv)
(rand-vu-float-range (-> this tuning fountain-rand-transv-hi x) (-> this tuning fountain-rand-transv-hi y))
)
(+! (-> s3-0 transv y)
(rand-vu-float-range (-> this tuning fountain-rand-transv-hi z) (-> this tuning fountain-rand-transv-hi w))
)
(set! (-> s3-0 transv w) 1.0)
)
(else
(let ((s0-0 (-> this tuning fountain-rand-transv-lo))
(s1-1 (-> this tuning fountain-rand-transv-hi))
)
(set-vector!
(-> s3-0 transv)
(rand-vu-float-range (-> s0-0 x) (-> s1-1 x))
(rand-vu-float-range (-> s0-0 y) (-> s1-1 y))
(rand-vu-float-range (-> s0-0 z) (-> s1-1 z))
1.0
)
)
)
)
(let ((s2-3 (new 'stack-no-clear 'vector))
(s1-2 (new 'stack-no-clear 'quaternion))
)
(rand-vu-sphere-point-uniform! s2-3 1.0)
(vector-normalize! s2-3 1.0)
(quaternion-vector-angle! s1-2 s2-3 (* 182.04445 (-> this tuning rot-speed)))
(quaternion->matrix (-> s3-0 update-rmat) s1-2)
)
)
)
(when (nonzero? (-> gp-0 num-joints))
(let ((v1-31 (-> gp-0 joint (+ (-> gp-0 num-joints) -1))))
(set! (-> v1-31 next) -1)
)
(let ((v1-33 (-> this lists data 1)))
(set! (-> v1-33 head) 0)
(let ((s5-1 (-> v1-33 bbox)))
(let ((v1-34 (-> gp-0 joint 0 mat trans)))
(set! (-> s5-1 min quad) (-> v1-34 quad))
(set! (-> s5-1 max quad) (-> v1-34 quad))
)
(dotimes (s4-1 (-> gp-0 num-joints))
(add-point! s5-1 (-> gp-0 joint s4-1 mat trans))
)
)
)
)
)
0
(none)
)
;; WARN: Return type mismatch process-drawable vs joint-exploder.
(defmethod relocate ((this joint-exploder) (offset int))
(if (nonzero? (-> this joints))
(&+! (-> this joints) offset)
)
(if (nonzero? (-> this lists))
(&+! (-> this lists) offset)
)
(the-as joint-exploder ((method-of-type process-drawable relocate) this offset))
)
(defbehavior joint-exploder-init-by-other joint-exploder ((arg0 skeleton-group) (arg1 int) (arg2 joint-exploder-tuning) (arg3 joint-exploder-static-params))
(set! (-> self static-params) arg3)
(set! (-> self die-if-beyond-xz-dist-sqrd) 10485760000.0)
(mem-copy! (the-as pointer (-> self tuning)) (the-as pointer arg2) 104)
(set! (-> self joints) (new 'process 'joint-exploder-joints arg3))
(set! (-> self lists)
(new 'process 'joint-exploder-list-array (the-as int (+ (-> self tuning max-probes) 1)))
)
(dotimes (v1-4 (the-as int (+ (-> self tuning max-probes) 1)))
(let ((a0-7 (-> self lists data v1-4)))
(set! (-> a0-7 head) -1)
(set! (-> a0-7 bbox-valid?) #f)
(set! (-> a0-7 pre-moved?) #f)
(set! (-> a0-7 probeless?) #f)
)
)
(let ((v1-8 (-> self lists data)))
(set! (-> v1-8 0 probeless?) #t)
)
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> self parent 0 root trans quad))
(quaternion-copy! (the-as quaternion (-> self root rot)) (the-as quaternion (-> self parent 0 root rot)))
(set! (-> self root scale quad) (-> self parent 0 root scale quad))
(when (-> arg3 art-level)
(let ((a1-8 (entity-actor-from-level-name (-> arg3 art-level))))
(if a1-8
(process-entity-set! self a1-8)
)
)
)
(process-drawable-method-42 self arg0 0)
(logior! (-> self skel status) (joint-control-status sync-math))
(set! (-> self anim) (the-as art-joint-anim (-> self draw art-group data arg1)))
(ja-channel-set! 1)
(ja :group! (-> self anim) :num! min)
(ja-post)
(init-joint-list self)
(set! (-> self die-if-below-y) (- (-> self root trans y) (-> arg2 max-y-offset)))
(set! (-> self skel postbind-function) joint-exploder-joint-callback)
(set! (-> self last-colsound-time) (the-as uint 0))
(go joint-exploder-shatter)
)
;; WARN: Return type mismatch structure vs joint-exploder-tuning.
(defmethod new joint-exploder-tuning ((allocation symbol) (type-to-make type) (arg0 uint))
(let ((t9-0 (method-of-type structure new))
(v1-1 type-to-make)
)
(-> type-to-make size)
(let ((v0-0 (t9-0 allocation v1-1)))
(set! (-> (the-as joint-exploder-tuning v0-0) explosion) arg0)
(set! (-> (the-as joint-exploder-tuning v0-0) duration) (the-as uint 600))
(set! (-> (the-as joint-exploder-tuning v0-0) gravity) -286720.0)
(set! (-> (the-as joint-exploder-tuning v0-0) max-y-offset) 102400.0)
(set! (-> (the-as joint-exploder-tuning v0-0) rot-speed) 8.4)
(set! (-> (the-as joint-exploder-tuning v0-0) friction) 0.0)
(set! (-> (the-as joint-exploder-tuning v0-0) bounds-inflate) 16384.0)
(set! (-> (the-as joint-exploder-tuning v0-0) max-probe-width) 20480.0)
(set! (-> (the-as joint-exploder-tuning v0-0) max-probe-height) 24576.0)
(set! (-> (the-as joint-exploder-tuning v0-0) max-probe-depth) 20480.0)
(set! (-> (the-as joint-exploder-tuning v0-0) max-probes) (the-as uint 4))
(set! (-> (the-as joint-exploder-tuning v0-0) hit-xz-reaction) 0.75)
(set! (-> (the-as joint-exploder-tuning v0-0) hit-y-reaction) 0.7)
(cond
((zero? arg0)
(set-vector! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-lo) -81920.0 20480.0 -81920.0 1.0)
(set-vector! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0)
)
((= arg0 1)
(vector-reset! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-lo))
(set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi x) 49152.0)
(set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi y) 163840.0)
(set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi z) 20480.0)
(set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi w) 61440.0)
)
)
(the-as joint-exploder-tuning v0-0)
)
)
)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -9,3 +9,225 @@
;; DECOMP BEGINS
(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(vector-float*! arg0 (-> (view-get-active-math-camera) inv-camera-rot fvec) arg1)
(vector+float*! arg0 arg0 (-> (view-get-active-math-camera) inv-camera-rot uvec) arg2)
(let ((s4-4 arg0))
(let ((s5-1 arg0)
(v1-2 (-> (view-get-active-math-camera) trans))
)
(.lvf vf4 (&-> s5-1 quad))
(.lvf vf5 (&-> v1-2 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> s4-4 quad) vf6)
)
arg0
)
)
(defun position-in-front-of-screen! ((arg0 vector) (arg1 float) (arg2 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s3-1 (vector-negate! (new 'stack-no-clear 'vector) (-> (view-get-active-math-camera) inv-camera-rot fvec)))
(s4-2
(vector-float*! (new 'stack-no-clear 'vector) (-> (view-get-active-math-camera) inv-camera-rot fvec) arg1)
)
)
(let ((s1-0 s4-2))
(let ((s2-1 s4-2)
(v1-1 (-> (view-get-active-math-camera) trans))
)
(.lvf vf4 (&-> s2-1 quad))
(.lvf vf5 (&-> v1-1 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> s1-0 quad) vf6)
)
(reverse-transform-point! arg0 s4-2 s3-1 arg2)
)
arg0
)
)
(defun matrix-local->world ((arg0 symbol) (arg1 symbol))
(if arg0
(-> (view-get-active-math-camera) inv-camera-rot-smooth)
(-> (view-get-active-math-camera) inv-camera-rot)
)
)
(defun matrix-world->local ((arg0 symbol) (arg1 object))
(-> (view-get-active-math-camera) camera-rot)
)
(define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector)))
(define-perm *camera-dummy-velocity* vector (vector-reset! (new 'global 'vector)))
;; WARN: Return type mismatch object vs vector.
(defun camera-pos ()
(the-as vector (cond
((view-get-active-camera-combiner)
(-> (view-get-active-camera-combiner) stack)
)
((view-get-active-math-camera)
(-> (view-get-active-math-camera) trans)
)
(else
*camera-dummy-vector*
)
)
)
)
(defun camera-vel ()
(local-vars (at-0 int))
(with-pp
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(cond
((view-get-active-camera-combiner)
(let ((gp-0 *camera-dummy-velocity*))
(.lvf vf1 (&-> (-> (the-as camera-combiner (view-get-active-camera-combiner)) velocity) quad))
(let ((f0-0 (-> pp clock frames-per-second)))
(.mov at-0 f0-0)
)
(.mov vf2 at-0)
(.mov.vf.w vf1 vf0)
(.mul.x.vf.xyz vf1 vf1 vf2)
(.svf (&-> gp-0 quad) vf1)
gp-0
)
)
(else
(vector-reset! *camera-dummy-velocity*)
)
)
)
)
)
(defun math-camera-pos ()
(-> (view-get-active-math-camera) trans)
)
(defun math-camera-nearest-dist-sq ((arg0 vector))
(let ((s5-0 (the-as math-camera #f))
(f30-0 10000000000.0)
)
(dotimes (s4-0 *view-count*)
(let ((s3-0 (view-get-math-camera s4-0)))
(when s3-0
(let* ((a1-0 (-> s3-0 trans))
(f0-0 (vector-vector-distance-squared arg0 a1-0))
)
(when (or (< f0-0 f30-0) (not s5-0))
(set! f30-0 f0-0)
(set! s5-0 s3-0)
)
)
)
)
)
f30-0
)
)
(defun math-camera-nearest ((arg0 vector))
(let ((gp-0 (the-as math-camera #f)))
(let ((f30-0 10000000000.0))
(dotimes (s4-0 *view-count*)
(let ((s3-0 (view-get-math-camera s4-0)))
(when s3-0
(let* ((a1-0 (-> s3-0 trans))
(f0-0 (vector-vector-distance-squared arg0 a1-0))
)
(when (or (< f0-0 f30-0) (not gp-0))
(set! f30-0 f0-0)
(set! gp-0 s3-0)
)
)
)
)
)
)
gp-0
)
)
(defun math-camera-nearest-matrix ((arg0 vector))
(-> (math-camera-nearest arg0) inv-camera-rot)
)
(defun math-camera-nearest-dist ((arg0 vector))
(sqrtf (math-camera-nearest-dist-sq arg0))
)
;; WARN: Return type mismatch object vs matrix.
(defun camera-matrix ()
(the-as matrix (if (view-get-active-camera-combiner)
(&-> (view-get-active-camera-combiner) stack 16)
(-> (view-get-active-math-camera) inv-camera-rot)
)
)
)
(defun math-camera-matrix ()
(-> (view-get-active-math-camera) inv-camera-rot)
)
(defun camera-angle ()
(let ((f30-0 (-> (view-get-active-math-camera) camera-rot rvec x))
(f0-0 (-> (view-get-active-math-camera) camera-rot rvec z))
)
(atan f0-0 f30-0)
)
)
;; WARN: Return type mismatch object vs symbol.
(defbehavior camera-teleport-to-entity process ((arg0 entity-actor))
(let ((gp-0 (new 'stack-no-clear 'matrix)))
(set! (-> gp-0 rvec quad) (-> arg0 extra trans quad))
(quaternion-copy! (the-as quaternion (-> gp-0 uvec)) (-> arg0 quat))
(vector-identity! (-> gp-0 fvec))
(the-as symbol (send-event (view-get-active-camera) 'teleport-to-transformq gp-0))
)
)
(defun camera-teleport-to-entity-named ((arg0 string))
(let ((a0-3 (as-type (entity-by-name arg0) entity-actor)))
(if a0-3
(camera-teleport-to-entity (the-as entity-actor a0-3))
(format #t "sorry, couldn't find an actor named '~S'~%" arg0)
)
)
0
(none)
)
(defun camera-teleport-to-location ((arg0 float) (arg1 float) (arg2 float))
(let ((gp-0 (new 'stack-no-clear 'matrix)))
(set-vector! (-> gp-0 rvec) (* 4096.0 arg0) (* 4096.0 arg1) (* 4096.0 arg2) 1.0)
(quaternion-identity! (the-as quaternion (-> gp-0 uvec)))
(vector-identity! (-> gp-0 fvec))
(send-event (view-get-active-camera) 'teleport-to-transformq gp-0)
)
0
(none)
)
File diff suppressed because it is too large. Load diff
@@ -7,3 +7,433 @@
;; DECOMP BEGINS
(deftype cam-point-watch-bank (basic)
((speed float)
(rot-speed degrees)
)
)
(define *CAM_POINT_WATCH-bank* (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6)))
(defstate cam-point-watch (camera-slave)
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('teleport)
#f
)
(else
(cam-standard-event-handler proc argc message block)
)
)
)
:enter (behavior ()
(when (not (-> self enter-has-run))
(set! (-> self pivot-rad) 40960.0)
(set! (-> self blend-from-type) (camera-blend-from-type unknown-1))
(set! (-> self blend-to-type) (camera-blend-to-type unknown-1))
)
)
:code (behavior ()
(until #f
(let ((s5-0 (new-stack-vector0))
(gp-0 (new-stack-vector0))
)
(when (not (logtest? (-> (the-as camera-master (view-get-active-camera)) settings master-options)
(cam-master-options IGNORE_ANALOG)
)
)
(let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads (view-get-active-index) leftx)) 128.0 48.0 110.0 -1.0))
(f30-0 (analog-input (the-as int (-> *cpad-list* cpads (view-get-active-index) lefty)) 128.0 48.0 110.0 -1.0))
(f26-0
(analog-input (the-as int (-> *cpad-list* cpads (view-get-active-index) rightx)) 128.0 48.0 110.0 -1.0)
)
(f0-0 (analog-input (the-as int (-> *cpad-list* cpads (view-get-active-index) righty)) 128.0 48.0 110.0 -1.0))
)
(cond
((cpad-hold? (-> *CAMERA-bank* joypad) r2)
(set! (-> s5-0 y) (- (-> s5-0 y) (* (/ (-> *CAM_POINT_WATCH-bank* rot-speed) 5) (- f26-0))))
(set! (-> s5-0 x) (- (-> s5-0 x) (* (/ (-> *CAM_POINT_WATCH-bank* rot-speed) 5) (- f0-0))))
(+! (-> gp-0 x) (* (/ (-> *CAM_POINT_WATCH-bank* speed) 5) f28-0))
(+! (-> gp-0 z) (* (/ (-> *CAM_POINT_WATCH-bank* speed) 5) f30-0))
)
(else
(set! (-> s5-0 y) (- (-> s5-0 y) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))))
(set! (-> s5-0 x) (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))))
(+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
(+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0))
)
)
)
(let ((s4-4 (new-stack-vector0)))
(let ((s3-0 (new-stack-matrix0)))
(matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x)))
(vector-matrix*! s4-4 (-> self tracking inv-mat fvec) s3-0)
(matrix-axis-angle! s3-0 (the-as vector (&-> (view-get-active-camera) stack 160)) (- (-> s5-0 y)))
(vector-matrix*! s4-4 s4-4 s3-0)
)
(forward-down->inv-matrix
(-> self tracking inv-mat)
s4-4
(the-as vector (&-> (view-get-active-camera) stack 160))
)
)
(set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z)))
(if (< (-> self pivot-rad) 4096.0)
(set! (-> self pivot-rad) 4096.0)
)
(set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0)
(vector-matrix*! (-> self trans) gp-0 (-> self tracking inv-mat))
)
)
(suspend)
0
)
#f
)
)
(deftype cam-free-bank (basic)
((speed float)
(rot-speed degrees)
)
)
(define *CAM_FREE-bank* (new 'static 'cam-free-bank :speed 3000.0 :rot-speed (degrees 1)))
(defun cam-mouse-input ((arg0 camera-master) (arg1 matrix) (arg2 vector) (arg3 vector))
(with-pp
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((s1-0 (new 'stack-no-clear 'vector)))
(vector-! s1-0 (-> *mouse* pos 0) (-> *mouse* pos 1))
(if (< (-> (the-as camera-master (view-get-active-camera)) interest-dist) 409.6)
(set! (-> (the-as camera-master (view-get-active-camera)) interest-dist) 409.6)
)
(let ((s2-0 (new 'stack-no-clear 'vector))
(s0-0 (new 'stack-no-clear 'vector))
)
(let ((sv-224 (new 'stack-no-clear 'vector)))
0.0
(let ((sv-208 sv-224))
(let ((sv-176 (-> (view-get-active-math-camera) trans)))
(let ((sv-192 (-> arg1 fvec)))
(let ((v1-10 (-> (the-as camera-master (view-get-active-camera)) interest-dist)))
(.mov vf7 v1-10)
)
(.lvf vf5 (&-> sv-192 quad))
)
(.lvf vf4 (&-> sv-176 quad))
)
(.add.x.vf.w vf6 vf0 vf0)
(.mul.x.vf.xyz acc vf5 vf7)
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
(.svf (&-> sv-208 quad) vf6)
)
(let ((sv-240 s2-0))
(.lvf vf4 (&-> (-> (view-get-active-math-camera) trans) quad))
(.lvf vf5 (&-> sv-224 quad))
(.mov.vf.w vf6 vf0)
(.sub.vf.xyz vf6 vf4 vf5)
(.svf (&-> sv-240 quad) vf6)
)
)
(vector-length s2-0)
(cond
((mouse-hold? left)
(let ((f30-1 (* 72.81778 (-> *mouse* speedy)))
(f28-0 (* -72.81778 (-> *mouse* speedx)))
)
(let ((a2-2 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> arg1 rvec) f30-1)))
(vector-orient-by-quat! s0-0 s2-0 a2-2)
)
(let ((a2-4 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* f28-0)))
(vector-orient-by-quat! s0-0 s0-0 a2-4)
)
(vector-! s0-0 s0-0 s2-0)
(vector-matrix*! s0-0 s0-0 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) arg1))
(+! (-> arg3 x) (-> s0-0 x))
(+! (-> arg3 y) (-> s0-0 y))
(+! (-> arg3 z) (-> s0-0 z))
(+! (-> arg2 x) f30-1)
(set! (-> arg2 y) (+ (-> arg2 y) f28-0))
)
)
((mouse-hold? right)
(+! (-> arg3 z) (* (-> s1-0 x) (-> *CAM_FREE-bank* speed)))
(set! (-> (the-as camera-master (view-get-active-camera)) interest-dist)
(- (-> (the-as camera-master (view-get-active-camera)) interest-dist)
(* (-> *CAM_FREE-bank* speed) (-> s1-0 x))
)
)
(if (< (-> (the-as camera-master (view-get-active-camera)) interest-dist) 409.6)
(set! (-> (the-as camera-master (view-get-active-camera)) interest-dist) 409.6)
)
(when (< -8192.0 (vector-dot (-> arg1 fvec) s2-0))
(let ((s5-1 (new 'static 'vector :w 1.0)))
(let ((v1-41 s5-1))
(let ((a0-13 (-> arg0 settings mouse-tumble-point)))
(let ((a1-9 (-> arg1 fvec)))
(let ((a2-7 8192.0))
(.mov vf7 a2-7)
)
(.lvf vf5 (&-> a1-9 quad))
)
(.lvf vf4 (&-> a0-13 quad))
)
(.add.x.vf.w vf6 vf0 vf0)
(.mul.x.vf.xyz acc vf5 vf7)
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
(.svf (&-> v1-41 quad) vf6)
)
(cam-reconnect
*setting-control*
(view-get-active-index)
pp
(the-as time-frame 'mouse-tumble-point)
'abs
s5-1
0.0
)
)
)
)
((mouse-hold? middle)
(+! (-> arg3 x) (* (-> s1-0 x) (-> *CAM_FREE-bank* speed)))
(+! (-> arg3 y) (* (-> s1-0 y) (-> *CAM_FREE-bank* speed)))
(new 'static 'vector :w 1.0)
#f
)
)
)
)
)
)
)
(defun cam-free-floating-input ((arg0 camera-master) (arg1 cam-rotation-tracker) (arg2 vector) (arg3 vector) (arg4 symbol) (arg5 int))
(with-pp
(when (view-get-active-camera)
(if (-> arg0 settings mouse-input)
(cam-mouse-input arg0 (-> arg1 inv-mat) arg2 arg3)
)
(let ((s2-1 (and (-> arg0 settings cpad1-skip-buttons) (= arg5 1)))
(f30-0 (-> *CAM_FREE-bank* speed))
)
(if *camera-turbo-free*
(set! f30-0 (* 10.0 f30-0))
)
(cond
((logtest? (-> (the-as camera-master (view-get-active-camera)) settings master-options)
(cam-master-options IGNORE_ANALOG)
)
)
((cpad-hold? arg5 r2)
(when (logtest? (-> (the-as camera-master (view-get-active-camera)) settings master-options)
(cam-master-options READ_BUTTONS)
)
(if (cpad-hold? arg5 r1)
(+! (-> arg3 y)
(+ (/ f30-0 5) (analog-input (the-as int (-> *cpad-list* cpads arg5 abutton 9)) 0.0 32.0 230.0 (/ f30-0 5)))
)
)
)
(when (logtest? (-> (the-as camera-master (view-get-active-camera)) settings master-options)
(cam-master-options READ_BUTTONS)
)
(if (cpad-hold? arg5 l1)
(set! (-> arg3 y)
(- (-> arg3 y)
(+ (/ f30-0 5) (analog-input (the-as int (-> *cpad-list* cpads arg5 abutton 8)) 0.0 32.0 230.0 (/ f30-0 5)))
)
)
)
)
)
(else
(when (logtest? (-> (the-as camera-master (view-get-active-camera)) settings master-options)
(cam-master-options READ_BUTTONS)
)
(if (cpad-hold? arg5 r1)
(+! (-> arg3 y)
(+ f30-0 (analog-input (the-as int (-> *cpad-list* cpads arg5 abutton 9)) 0.0 32.0 230.0 f30-0))
)
)
)
(when (logtest? (-> (the-as camera-master (view-get-active-camera)) settings master-options)
(cam-master-options READ_BUTTONS)
)
(if (cpad-hold? arg5 l1)
(set! (-> arg3 y)
(- (-> arg3 y)
(+ f30-0 (analog-input (the-as int (-> *cpad-list* cpads arg5 abutton 8)) 0.0 32.0 230.0 f30-0))
)
)
)
)
)
)
(when (not (logtest? (-> (the-as camera-master (view-get-active-camera)) settings master-options)
(cam-master-options IGNORE_ANALOG)
)
)
(let ((f26-2 (analog-input (the-as int (-> *cpad-list* cpads arg5 leftx)) 128.0 48.0 110.0 -1.0))
(f28-4 (analog-input (the-as int (-> *cpad-list* cpads arg5 lefty)) 128.0 48.0 110.0 -1.0))
(f24-0 (analog-input (the-as int (-> *cpad-list* cpads arg5 rightx)) 128.0 48.0 110.0 -1.0))
(f0-19 (analog-input (the-as int (-> *cpad-list* cpads arg5 righty)) 128.0 48.0 110.0 -1.0))
)
(cond
((and (not s2-1) (cpad-hold? arg5 r2))
(cond
((cpad-hold? arg5 l2)
(set! (-> arg2 y) (- (-> arg2 y) (* (/ (-> *CAM_FREE-bank* rot-speed) 2) (- f24-0))))
(set! (-> arg2 x) (- (-> arg2 x) (* (/ (-> *CAM_FREE-bank* rot-speed) 2) (- f0-19))))
)
(else
(set! (-> arg2 y) (- (-> arg2 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed))))
(set! (-> arg2 x) (- (-> arg2 x) (* (- f0-19) (-> *CAM_FREE-bank* rot-speed))))
)
)
(+! (-> arg3 x) (* (/ f30-0 5) f26-2))
(+! (-> arg3 z) (* (/ f30-0 5) f28-4))
)
((and (not s2-1) (cpad-hold? arg5 l2))
(+! (-> arg3 x) (* f26-2 f30-0))
(+! (-> arg3 y) (* f0-19 f30-0))
(+! (-> arg3 z) (* f28-4 f30-0))
)
(else
(set! (-> arg2 y) (- (-> arg2 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0))))
(set! (-> arg2 x) (- (-> arg2 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f0-19))))
(+! (-> arg3 x) (* 2.0 f30-0 f26-2))
(+! (-> arg3 z) (* 2.0 f30-0 f28-4))
)
)
)
)
)
(when (not (-> arg0 settings mouse-input))
(vector-float*! arg2 arg2 (-> pp clock time-adjust-ratio))
(vector-float*! arg3 arg3 (-> pp clock time-adjust-ratio))
)
)
)
)
(deftype camera-free-floating-move-info (structure)
((rv vector :inline)
(tv vector :inline)
(up vector :inline)
(tm matrix :inline)
)
)
(defun cam-free-floating-move ((arg0 camera-master) (arg1 cam-rotation-tracker) (arg2 vector) (arg3 vector) (arg4 int))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(if (logtest? (-> *cpad-list* cpads arg4 valid) 128)
(return (the-as vector #f))
)
(if (= *master-mode* 'menu)
(return (the-as vector #f))
)
(let ((s3-0 (new 'stack 'camera-free-floating-move-info)))
(cam-free-floating-input arg0 arg1 (-> s3-0 rv) (-> s3-0 tv) (not arg3) arg4)
(vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) (-> arg1 inv-mat))
(cond
(arg3
(matrix-axis-angle! (-> s3-0 tm) arg3 (-> s3-0 rv y))
(matrix*! (-> arg1 inv-mat) (-> arg1 inv-mat) (-> s3-0 tm))
(cond
((< (vector-dot (-> arg1 inv-mat uvec) arg3) 0.0)
(forward-down->inv-matrix (-> arg1 inv-mat) (-> arg1 inv-mat fvec) arg3)
)
(else
(vector-negate! (-> s3-0 up) arg3)
(forward-down->inv-matrix (-> arg1 inv-mat) (-> arg1 inv-mat fvec) (-> s3-0 up))
)
)
)
(else
(matrix-axis-angle! (-> s3-0 tm) (-> arg1 inv-mat uvec) (- (-> s3-0 rv y)))
(matrix*! (-> arg1 inv-mat) (-> arg1 inv-mat) (-> s3-0 tm))
)
)
(matrix-axis-angle! (-> s3-0 tm) (-> arg1 inv-mat rvec) (- (-> s3-0 rv x)))
(matrix*! (-> arg1 inv-mat) (-> arg1 inv-mat) (-> s3-0 tm))
(matrix-axis-angle! (-> s3-0 tm) (-> arg1 inv-mat fvec) (- (-> s3-0 rv z)))
(matrix*! (-> arg1 inv-mat) (-> arg1 inv-mat) (-> s3-0 tm))
(let ((v0-0 arg2))
(let ((v1-16 (-> s3-0 tv)))
(.lvf vf4 (&-> arg2 quad))
(.lvf vf5 (&-> v1-16 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> v0-0 quad) vf6)
v0-0
)
)
)
)
(defstate cam-free-floating (camera-slave)
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('teleport)
#f
)
(else
(cam-standard-event-handler proc argc message block)
)
)
)
:enter (behavior ()
(when (not (-> self enter-has-run))
(set! (-> self blend-from-type) (camera-blend-from-type unknown-1))
(set! (-> self blend-to-type) (camera-blend-to-type unknown-1))
(send-event (view-get-active-camera-combiner) 'stop-tracking)
)
)
:code (behavior ()
(until #f
(let ((gp-0 (&-> (view-get-active-camera) stack 160)))
(if (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))
(set! gp-0 (the-as (pointer uint8) #f))
)
(when (not (-> (the-as camera-master (view-get-active-camera)) settings mouse-input))
(if *amy-cam*
(matrix-rotate-y! (-> self tracking inv-mat) 32768.0)
)
(cam-free-floating-move
(the-as camera-master (view-get-active-camera))
(-> self tracking)
(-> self trans)
(the-as vector gp-0)
(view-get-active-index)
)
(when *amy-cam*
(matrix-rotate-y! (-> self tracking inv-mat) 32768.0)
(let ((a1-4 (matrix-rotate-x! (new 'stack-no-clear 'matrix) 16384.0)))
(matrix*! (-> self tracking inv-mat) a1-4 (-> self tracking inv-mat))
)
)
)
)
(suspend)
)
#f
)
)
+616
View File
@@ -5,5 +5,621 @@
;; name in dgo: cam-update
;; dgos: ENGINE, GAME
(define-extern cam-free-floating-move (function camera-master cam-rotation-tracker vector vector int vector))
(define-extern shrub-make-perspective-matrix (function matrix matrix matrix))
(deftype camera-free-floating-move-info (structure)
((rv vector :inline :offset-assert 0)
(tv vector :inline :offset-assert 16)
(up vector :inline :offset-assert 32)
(tm matrix :inline :offset-assert 48)
)
:method-count-assert 9
:size-assert #x70
:flag-assert #x900000070
)
;; DECOMP BEGINS
(defun plane-from-points ((arg0 (inline-array plane)) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 int))
(let ((s4-0 (new 'stack-no-clear 'vector)))
(vector-cross! s4-0 arg1 arg2)
(vector-normalize! s4-0 1.0)
(set! (-> s4-0 w) (vector-dot s4-0 arg3))
(set! (-> (&-> arg0 0 data arg4) 0) (-> s4-0 x))
(set! (-> (&-> arg0 0 data arg4) 4) (-> s4-0 y))
(set! (-> (&-> arg0 0 data arg4) 8) (-> s4-0 z))
(set! (-> (&-> arg0 0 data arg4) 12) (-> s4-0 w))
)
)
(defun set-point ((arg0 vector) (arg1 float) (arg2 float) (arg3 float))
(set! (-> arg0 x) arg1)
(set! (-> arg0 y) arg2)
(set! (-> arg0 z) arg3)
(set! (-> arg0 w) 1.0)
)
(defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float) (arg3 matrix))
(when (not *artist-fix-frustum*)
(let ((s5-0 (new 'stack 'view-frustum)))
(let* ((v1-2 *viewport-array*)
(v1-3 (-> v1-2 data (-> v1-2 current-viewport-index)))
(f1-0 (-> v1-3 ratio-x))
(f0-0 (-> v1-3 ratio-y))
(f30-0 (* arg2 f1-0 (-> arg0 x-ratio) (-> arg0 d)))
(f26-0 (* arg2 f0-0 (-> arg0 y-ratio) (-> arg0 d)))
(f28-0 (* arg2 f1-0 (-> arg0 x-ratio) (-> arg0 f)))
(f24-0 (* arg2 f0-0 (-> arg0 y-ratio) (-> arg0 f)))
)
(set-point (-> s5-0 hither-top-left) (- f30-0) f26-0 (-> arg0 d))
(set-point (-> s5-0 hither-top-right) f30-0 f26-0 (-> arg0 d))
(set-point (-> s5-0 hither-bottom-left) (- f30-0) (- f26-0) (-> arg0 d))
(set-point (-> s5-0 hither-bottom-right) f30-0 (- f26-0) (-> arg0 d))
(set-point (-> s5-0 yon-top-left) (- f28-0) f24-0 (-> arg0 f))
(set-point (-> s5-0 yon-top-right) f28-0 f24-0 (-> arg0 f))
(set-point (-> s5-0 yon-bottom-left) (- f28-0) (- f24-0) (-> arg0 f))
(set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f))
)
(vector-matrix*! (-> s5-0 hither-top-left) (-> s5-0 hither-top-left) arg3)
(vector-matrix*! (-> s5-0 hither-top-right) (-> s5-0 hither-top-right) arg3)
(vector-matrix*! (-> s5-0 hither-bottom-left) (-> s5-0 hither-bottom-left) arg3)
(vector-matrix*! (-> s5-0 hither-bottom-right) (-> s5-0 hither-bottom-right) arg3)
(vector-matrix*! (-> s5-0 yon-top-left) (-> s5-0 yon-top-left) arg3)
(vector-matrix*! (-> s5-0 yon-top-right) (-> s5-0 yon-top-right) arg3)
(vector-matrix*! (-> s5-0 yon-bottom-left) (-> s5-0 yon-bottom-left) arg3)
(vector-matrix*! (-> s5-0 yon-bottom-right) (-> s5-0 yon-bottom-right) arg3)
(when (= arg2 1.0)
(let* ((v1-6 *viewport-array*)
(v1-7 (-> v1-6 data (-> v1-6 current-viewport-index)))
)
(vector-! (-> v1-7 fog-corner 0) (-> s5-0 yon-top-left) (-> arg3 trans))
(vector-! (-> v1-7 fog-corner 1) (-> s5-0 yon-top-right) (-> arg3 trans))
(vector-! (-> v1-7 fog-corner 2) (-> s5-0 yon-bottom-left) (-> arg3 trans))
(vector-! (-> v1-7 fog-corner 3) (-> s5-0 yon-bottom-right) (-> arg3 trans))
)
)
(let ((s2-1 (new-stack-vector0))
(s3-1 (new-stack-vector0))
(s1-0 (new-stack-vector0))
(s0-0 (new-stack-vector0))
)
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
(let ((sv-240 (new 'stack-no-clear 'vector)))
(set! (-> sv-240 quad) (the-as uint128 0))
(set! (-> sv-240 quad) (-> arg3 trans quad))
(vector-! s2-1 (-> s5-0 yon-top-left) sv-240)
(vector-! s3-1 (-> s5-0 yon-top-right) sv-240)
(vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240)
(vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240)
(plane-from-points arg1 s2-1 s1-0 sv-240 0)
(plane-from-points arg1 s0-0 s3-1 sv-240 1)
(plane-from-points arg1 s3-1 s2-1 sv-240 2)
(plane-from-points arg1 s1-0 s0-0 sv-240 3)
)
)
)
)
)
(define *update-leaf-when-outside-bsp* #t)
(defun update-visible ((arg0 math-camera) (arg1 int))
(local-vars (s2-0 level-vis-info))
(when (not *artist-fix-visible*)
(dotimes (s4-0 (-> *level* length))
(let ((v1-5 (-> *level* level s4-0)))
(when (= (-> v1-5 status) 'active)
(if (and (nonzero? (-> v1-5 bsp nodes)) (or *update-leaf-when-outside-bsp* (-> v1-5 inside-boxes?)))
(bsp-camera-asm (-> v1-5 bsp) (-> arg0 trans) arg1)
)
)
)
)
(dotimes (s5-1 (-> *level* length))
(let ((s4-1 (-> *level* level s5-1)))
(when (= (-> s4-1 status) 'active)
(let ((s3-0 (/ (+ (-> s4-1 bsp visible-list-length) 15) 16)))
(set! (-> s4-1 all-visible?) (if (-> s4-1 all-visible?)
(-> s4-1 all-visible?)
#t
)
)
(cond
((or (not (-> s4-1 force-all-visible?)) (-> s4-1 inside-boxes?))
(cond
((or *artist-all-visible* (not (-> s4-1 vis-info 0)))
(quad-copy! (-> s4-1 vis-bits arg1) (-> s4-1 bsp all-visible-list) s3-0)
(if (= (-> s4-1 all-visible?) 'loading)
(set! (-> s4-1 all-visible?) #t)
)
)
((begin
(set! s2-0 (-> s4-1 vis-info (-> s4-1 vis-self-index)))
(let ((v1-34 #f))
(when (and s2-0 (-> s2-0 from-bsp))
(set! v1-34 (logtest? (vis-info-flag vis-valid) (-> s2-0 flags)))
(if (< (-> s2-0 length) (-> s2-0 from-bsp unknown-bsp-1 arg1))
(set! v1-34 #f)
)
)
v1-34
)
)
(if (!= (-> s4-1 all-visible?) 'loading)
(set! (-> s4-1 all-visible?) #f)
)
(when (update-vis! s4-1 s2-0 (-> s2-0 ramdisk) (the-as (pointer uint8) (-> s2-0 string-block)) arg1)
(countdown (v1-42 8)
(let ((a1-9 (-> s4-1 vis-info v1-42)))
(when a1-9
(if (!= a1-9 s2-0)
(set! (-> a1-9 current-vis-string arg1) (the-as uint -1))
)
)
)
)
(set! (-> s4-1 all-visible?) #f)
)
)
((and (= (-> s4-1 all-visible?) 'loading) (-> *level* play?))
)
(else
(quad-copy! (-> s4-1 vis-bits 0) (-> s4-1 bsp all-visible-list) s3-0)
(quad-copy! (-> s4-1 vis-bits 1) (-> s4-1 bsp all-visible-list) s3-0)
)
)
)
(else
(quad-copy! (-> s4-1 vis-bits arg1) (-> s4-1 bsp all-visible-list) s3-0)
)
)
)
)
)
)
)
(let ((s5-2 0))
(if (and *artist-fix-visible* (cpad-pressed? 0 r2))
(set! *fix-visible-level-mask* (logand (+ *fix-visible-level-mask* 1) 127))
)
(dotimes (s4-2 6)
(let ((s3-1 (-> *level* level s4-2)))
(when (or (= (-> s3-1 status) 'active) (= (-> s3-1 status) 'reserved))
(cond
((or *artist-fix-visible* *stats-bsp*)
(set! (-> s3-1 render?) (not (logtest? *fix-visible-level-mask* (ash 1 (-> s3-1 index)))))
(format
*stdcon*
"~0kleaf-index ~8S ~C = ~d node ~d ~S ~S~%"
(-> s3-1 name)
(if (not (logtest? *fix-visible-level-mask* (ash 1 (-> s3-1 index))))
88
32
)
(-> s3-1 bsp unknown-bsp-1 arg1)
(-> s3-1 bsp unknown-bsp-2 arg1)
(if (zero? (-> s3-1 bsp unknown-bsp-3 arg1))
"front"
"back"
)
(if (nonzero? (-> s3-1 bsp unknown-bsp-4 arg1))
"outside"
""
)
)
)
(else
(set! (-> s3-1 render?) #t)
)
)
(when (and *artist-fix-visible* (not (logtest? *fix-visible-level-mask* (ash 1 (-> s3-1 index)))))
(let ((s2-1 (-> s3-1 bsp unknown-bsp-1 arg1))
(s1-0 (-> s3-1 bsp vis-spheres))
)
(-> s3-1 bsp vis-spheres-length)
(when (nonzero? s1-0)
(dotimes (s0-0 (-> s1-0 length))
(let* ((v1-105 (the int (-> s1-0 data s0-0 w)))
(a0-49 (abs v1-105))
)
(when (= a0-49 s2-1)
(if (>= v1-105 0)
(add-debug-sphere #t (bucket-id bucket793) (-> s1-0 data s0-0) (meters 1) (new 'static 'rgba :b #xff :a #x80))
(add-debug-sphere #t (bucket-id bucket793) (-> s1-0 data s0-0) (meters 1) (new 'static 'rgba :r #xff :a #x80))
)
)
)
)
)
)
(when (nonzero? (-> s3-1 bsp nodes))
(let ((v1-119 (-> s3-1 bsp nodes (-> s3-1 bsp unknown-bsp-2 arg1)))
(a2-16 (new 'stack-no-clear 'vector))
)
(set! (-> a2-16 quad) (-> s3-1 bsp bsp-offset quad))
(let ((a3-6 (new 'stack-no-clear 'vector)))
(set! (-> a3-6 quad) (-> s3-1 bsp bsp-offset quad))
(cond
((zero? (-> s3-1 bsp unknown-bsp-3 arg1))
(+! (-> a2-16 x) (the float (* (-> v1-119 front-box-min x) (the int (-> s3-1 bsp bsp-scale x)))))
(+! (-> a2-16 y) (the float (* (-> v1-119 front-box-min y) (the int (-> s3-1 bsp bsp-scale y)))))
(+! (-> a2-16 z) (the float (* (-> v1-119 front-box-min z) (the int (-> s3-1 bsp bsp-scale z)))))
(+! (-> a3-6 x) (the float (* (-> v1-119 front-box-max x) (the int (-> s3-1 bsp bsp-scale x)))))
(+! (-> a3-6 y) (the float (* (-> v1-119 front-box-max y) (the int (-> s3-1 bsp bsp-scale y)))))
(+! (-> a3-6 z) (the float (* (-> v1-119 front-box-max z) (the int (-> s3-1 bsp bsp-scale z)))))
)
(else
(+! (-> a2-16 x) (the float (* (-> v1-119 back-box-min x) (the int (-> s3-1 bsp bsp-scale x)))))
(+! (-> a2-16 y) (the float (* (-> v1-119 back-box-min y) (the int (-> s3-1 bsp bsp-scale y)))))
(+! (-> a2-16 z) (the float (* (-> v1-119 back-box-min z) (the int (-> s3-1 bsp bsp-scale z)))))
(+! (-> a3-6 x) (the float (* (-> v1-119 back-box-max x) (the int (-> s3-1 bsp bsp-scale x)))))
(+! (-> a3-6 y) (the float (* (-> v1-119 back-box-max y) (the int (-> s3-1 bsp bsp-scale y)))))
(+! (-> a3-6 z) (the float (* (-> v1-119 back-box-max z) (the int (-> s3-1 bsp bsp-scale z)))))
)
)
(add-debug-box #t (bucket-id bucket793) a2-16 a3-6 (new 'static 'rgba :g #xff :b #xff :a #x80))
)
)
)
)
(+! s5-2 1)
)
)
)
)
#f
)
(define *save-camera-inv-rot* (new 'global 'matrix))
(matrix-identity! *save-camera-inv-rot*)
(defun move-camera-from-pad ((arg0 math-camera))
(let ((s4-0 *external-cam-mode*)
(s5-0 0)
)
(cond
((= s4-0 'locked)
(set! s4-0 #f)
)
((= s4-0 'pad-1)
(set! s5-0 1)
)
((not (view-get-active-camera-combiner))
(set! s4-0 'pad-0)
)
)
(when s4-0
(let ((s4-2
(vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0))
)
)
(if (= (vector-length s4-2) 0.0)
(set! (-> s4-2 y) -1.0)
)
(if (logtest? *external-cam-options* (external-cam-option allow-z))
(set! s4-2 (the-as vector #f))
)
(cam-free-floating-move
(the-as camera-master (view-get-active-camera))
(the-as cam-rotation-tracker *save-camera-inv-rot*)
(-> arg0 trans)
s4-2
s5-0
)
)
)
)
(matrix-copy! (-> (view-get-active-math-camera) inv-camera-rot) *save-camera-inv-rot*)
arg0
)
(defun external-cam-reset! ()
(when (not (movie?))
(vector-reset! (-> (view-get-active-math-camera) trans))
(matrix-identity! (-> (view-get-active-math-camera) inv-camera-rot))
(when (view-get-active-camera-combiner)
(matrix-copy!
(-> (view-get-active-math-camera) inv-camera-rot)
(-> (the-as camera-combiner (view-get-active-camera-combiner)) inv-camera-rot)
)
(set! (-> (view-get-active-math-camera) trans quad)
(-> (the-as vector (-> (view-get-active-camera-combiner) stack)) quad)
)
)
)
0
(none)
)
(define *start-timer* (the-as int #f))
(define *timer-value* 0)
(define *start-pos* (new 'global 'vector))
(defun update-camera ()
(with-pp
(let ((gp-0 (view-get-active-math-camera)))
(view-push-context (if *debug-split-screen*
0
(view-get-active-index)
)
)
(matrix-copy! (-> gp-0 prev-inv-camera-rot) (-> gp-0 inv-camera-rot))
(set! (-> gp-0 prev-trans quad) (-> gp-0 trans quad))
(when *start-timer*
(when (= *timer-value* 180)
(format
#t
"Player pos = ~F ~F ~F~%"
(-> (the-as target (view-get-active-target)) root trans x)
(-> (the-as target (view-get-active-target)) root trans y)
(-> (the-as target (view-get-active-target)) root trans z)
)
(set! (-> *start-pos* quad) (-> (the-as target (view-get-active-target)) root trans quad))
)
(when (= *timer-value* 480)
(format
#t
"Player pos = ~F ~F ~F~%"
(-> (the-as target (view-get-active-target)) root trans x)
(-> (the-as target (view-get-active-target)) root trans y)
(-> (the-as target (view-get-active-target)) root trans z)
)
(format
#t
"Dist = ~F~%"
(* 0.00024414062
(vector-vector-xz-distance (-> (the-as target (view-get-active-target)) root trans) *start-pos*)
)
)
(set! *start-timer* (the-as int #f))
)
(if (< 179 *timer-value*)
(format *stdcon* "~%~%Time = ~D~%" *timer-value*)
)
(set! *timer-value* (+ *timer-value* 1))
)
(when (not *start-timer*)
(set! *timer-value* 0)
0
)
(update-math-camera
gp-0
(-> *setting-control* user-current video-mode)
(-> *video-params* aspect-ratio)
(-> gp-0 fov)
)
(cond
((or (= *master-mode* 'pause) (= *master-mode* 'freeze) (= *master-mode* 'progress) *progress-process*)
)
((>= *camera-look-through-other* 2)
(set! *camera-look-through-other* 1)
)
((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu))
(set! *camera-look-through-other* 0)
0
)
)
(let ((s5-5 (new 'stack-no-clear 'camera-free-floating-move-info)))
(let ((s4-3 (-> pp clock)))
(set! (-> pp clock) (-> *display* camera-clock))
(cond
((zero? (view-get-active-index))
(set! (-> s5-5 tm trans y) (update! *camera-smush-control*))
(set! (-> s5-5 tm trans x) (update! *camera-smush-control-horizontal*))
(set! (-> s5-5 tm trans z) (update! *camera-smush-control-into*))
)
(else
(set! (-> s5-5 tm trans y) (update! *camera-smush-control-2*))
(set! (-> s5-5 tm trans x) (update! *camera-smush-control-horizontal-2*))
(set! (-> s5-5 tm trans z) (update! *camera-smush-control-into-2*))
)
)
(set! (-> pp clock) s4-3)
)
(quaternion-identity! (the-as quaternion (-> s5-5 tm fvec)))
(quaternion-rotate-local-x!
(the-as quaternion (-> s5-5 tm fvec))
(the-as quaternion (-> s5-5 tm fvec))
(-> s5-5 tm trans y)
)
(quaternion-rotate-local-y!
(the-as quaternion (-> s5-5 tm fvec))
(the-as quaternion (-> s5-5 tm fvec))
(-> s5-5 tm trans x)
)
(quaternion-rotate-local-z!
(the-as quaternion (-> s5-5 tm fvec))
(the-as quaternion (-> s5-5 tm fvec))
(-> s5-5 tm trans z)
)
(quaternion->matrix (the-as matrix (-> s5-5 tv)) (the-as quaternion (-> s5-5 tm fvec)))
(cond
(*external-cam-mode*
(move-camera-from-pad gp-0)
)
((nonzero? *camera-look-through-other*)
(set! (-> gp-0 fov) (-> *camera-other-fov* data))
(set! (-> gp-0 trans quad) (-> *camera-other-trans* quad))
(matrix*! (-> gp-0 inv-camera-rot) (the-as matrix (-> s5-5 tv)) *camera-other-matrix*)
(matrix-copy! *save-camera-inv-rot* (-> gp-0 inv-camera-rot))
)
((and (view-get-active-camera-combiner) (not *external-cam-mode*))
(set! (-> gp-0 fov) (-> (the-as camera-combiner (view-get-active-camera-combiner)) fov))
(set! (-> gp-0 trans quad) (-> (the-as vector (-> (view-get-active-camera-combiner) stack)) quad))
(matrix*!
(-> gp-0 inv-camera-rot)
(the-as matrix (-> s5-5 tv))
(the-as matrix (&-> (view-get-active-camera-combiner) stack 16))
)
(matrix-copy! *save-camera-inv-rot* (-> gp-0 inv-camera-rot))
)
((view-get-active-camera)
(move-camera-from-pad gp-0)
)
)
)
(matrix-transpose! (-> gp-0 camera-rot) (-> gp-0 inv-camera-rot))
(if (< 0.0 (-> gp-0 smooth-t))
(set! (-> gp-0 smooth-t) (- (-> gp-0 smooth-t) (-> gp-0 smooth-step)))
)
(cond
((< 0.0 (-> gp-0 smooth-t))
(let ((s5-7 (new-stack-quaternion0)))
(matrix->quaternion s5-7 (-> gp-0 inv-camera-rot))
(quaternion-slerp! s5-7 s5-7 (-> gp-0 inv-camera-rot-smooth-from) (-> gp-0 smooth-t))
(quaternion->matrix (-> gp-0 inv-camera-rot-smooth) s5-7)
)
)
(else
(matrix-copy! (-> gp-0 inv-camera-rot-smooth) (-> gp-0 inv-camera-rot))
)
)
(when (and (!= *master-mode* 'menu) *display-camera-info*)
(format *stdcon* "~0k")
(when (view-get-active-target)
(let ((v1-87 (target-pos 0)))
(format *stdcon* "targ pos ~M ~M ~M~%" (-> v1-87 x) (-> v1-87 y) (-> v1-87 z))
)
)
(format
*stdcon*
"cam pos ~7,,1m ~7,,1m ~7,,1m fov ~R~%"
(-> gp-0 trans x)
(-> gp-0 trans y)
(-> gp-0 trans z)
(-> gp-0 fov)
)
(format
*stdcon*
"cam vel ~7,,1M ~7,,1M ~7,,1M~%"
(* (-> (the-as camera-combiner (view-get-active-camera-combiner)) velocity x) (-> pp clock frames-per-second))
(* (-> (the-as camera-combiner (view-get-active-camera-combiner)) velocity y) (-> pp clock frames-per-second))
(* (-> (the-as camera-combiner (view-get-active-camera-combiner)) velocity z) (-> pp clock frames-per-second))
)
(let ((v1-92 (-> (the-as camera-master (view-get-active-camera)) settings)))
(format
*stdcon*
"string info min-l ~M max-l ~M min-h ~M max-h ~M~%"
(-> v1-92 string-min-length)
(-> v1-92 string-max-length)
(-> v1-92 string-min-height)
(-> v1-92 string-max-height)
)
)
)
(if (zero? (-> gp-0 reset))
(matrix-copy! (-> gp-0 prev-camera-temp) (-> gp-0 camera-temp))
)
(let ((s3-5 (-> gp-0 camera-temp))
(s2-4 (-> gp-0 camera-rot))
(s5-9 (-> gp-0 inv-camera-rot))
(s4-7 (-> gp-0 trans))
)
(let ((s1-3 (new-stack-vector0)))
(set! (-> s1-3 x) (- (-> s4-7 x)))
(set! (-> s1-3 y) (- (-> s4-7 y)))
(set! (-> s1-3 z) (- (-> s4-7 z)))
(set! (-> s1-3 w) 1.0)
(vector-matrix*! s1-3 s1-3 s2-4)
(set! (-> s2-4 trans quad) (-> s1-3 quad))
)
(matrix*! s3-5 s2-4 (-> gp-0 perspective))
(set! (-> s5-9 trans quad) (-> s4-7 quad))
)
(when (nonzero? (-> gp-0 reset))
(matrix-copy! (-> gp-0 prev-camera-temp) (-> gp-0 camera-temp))
(set! (-> gp-0 reset) 0)
0
)
(let ((f1-6 (-> gp-0 fog-min))
(f0-50 (-> gp-0 fog-max))
)
(let ((f2-0 (-> gp-0 d)))
(set! (-> *instance-tie-work* hmge-d x) f1-6)
(set! (-> *instance-tie-work* hmge-d y) f0-50)
(set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0))
(set! (-> *instance-tie-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w)))
(let ((v1-109 (-> gp-0 hvdf-off quad)))
(set! (-> *instance-tie-work* hvdf-offset quad) v1-109)
)
(set! (-> *instance-shrub-work* hmge-d x) f1-6)
(set! (-> *instance-shrub-work* hmge-d y) f0-50)
(set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0))
(set! (-> *instance-shrub-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w)))
(set! (-> *instance-shrub-work* billboard-const x) (/ (-> gp-0 x-pix) (* f2-0 (-> gp-0 x-ratio))))
(set! (-> *instance-shrub-work* billboard-const y) (/ (-> gp-0 y-pix) (* f2-0 (-> gp-0 y-ratio))))
)
(set! (-> *instance-shrub-work* billboard-const z) f1-6)
(set! (-> *instance-shrub-work* billboard-const w) f0-50)
)
(set! (-> *instance-shrub-work* constants w) (the-as float (-> gp-0 vis-gifs 0)))
(let ((a0-58 (-> gp-0 hvdf-off quad)))
(set! (-> *instance-shrub-work* hvdf-offset quad) a0-58)
)
(update-view-planes gp-0 (-> gp-0 plane) 1.0 (-> gp-0 inv-camera-rot))
(update-view-planes gp-0 (-> gp-0 guard-plane) 2.0 (-> gp-0 inv-camera-rot))
(shrub-make-perspective-matrix (-> gp-0 shrub-mat) (-> gp-0 camera-temp))
(update-visible gp-0 (the-as int (-> *viewport-array* current-viewport-index)))
(when (-> *time-of-day-context* use-camera-other)
(let ((s4-8 (-> gp-0 camera-rot))
(s0-0 (-> gp-0 camera-rot-other-sky))
(s5-11 (-> gp-0 camera-rot-other-sprite))
(s3-6 (-> gp-0 camera-rot-other))
(s2-5 (-> gp-0 inv-camera-rot-other))
(s1-4 (-> gp-0 camera-temp-other))
)
(quaternion->matrix s0-0 (-> gp-0 quat-other))
(mem-copy! (the-as pointer s5-11) (the-as pointer s0-0) 64)
(set! (-> s5-11 trans quad) (-> gp-0 trans-other quad))
(set! (-> s5-11 trans w) 1.0)
(matrix*! s3-6 s5-11 s4-8)
(matrix-inverse-of-rot-trans! s2-5 s3-6)
(matrix*! s1-4 s3-6 (-> gp-0 perspective))
(update-view-planes gp-0 (-> gp-0 plane-other) 1.0 s2-5)
(update-view-planes gp-0 (-> gp-0 guard-plane-other) 2.0 s2-5)
(shrub-make-perspective-matrix (-> gp-0 shrub-mat-other) s1-4)
)
)
)
(view-pop-context)
#f
)
)
(defun-debug move-level-by-name ((arg0 symbol) (arg1 float) (arg2 float) (arg3 float))
(let ((v1-1 (level-get *level* arg0)))
(when v1-1
(logior! (-> v1-1 info level-flags) (level-flags use-camera-other))
(let ((v0-1 (-> (view-get-active-math-camera) trans-other)))
(set! (-> v0-1 x) (* 4096.0 arg1))
(set! (-> v0-1 y) (* 4096.0 arg2))
(set! (-> v0-1 z) (* 4096.0 arg3))
(set! (-> v0-1 w) 1.0)
v0-1
)
)
)
)
(defun execute-cam-post-hook-engine ()
(let* ((gp-0 *cam-post-hook-engine*)
(s5-0 (-> gp-0 alive-list next0))
(s4-0 (-> s5-0 next0))
)
(while (!= s5-0 (-> gp-0 alive-list-end))
((the-as (function object object object object object) (-> (the-as connection s5-0) param0))
(get-process (the-as connection s5-0))
(-> (the-as connection s5-0) param1)
(-> (the-as connection s5-0) param2)
(-> (the-as connection s5-0) param2)
)
(set! s5-0 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
+1
View File
@@ -443,6 +443,7 @@
cam-fixed
cam-fixed-read-entity
cam-free-floating
cam-point-watch
cam-spline
cam-standoff
cam-standoff-read-entity
@@ -106,18 +106,18 @@ It is not useful for ollision queries against a specific foreground object, like
)
(:methods
(new (symbol type int int) _type_)
(collide-cache-method-9 () none)
(debug-draw (_type_) none)
(fill-and-probe-using-line-sphere (_type_ collide-query) float)
(collide-cache-method-11 () none)
(fill-and-probe-using-spheres (_type_ collide-query) symbol)
(fill-using-bounding-box (_type_ collide-query) none)
(collide-cache-method-13 (_type_ collide-query) none)
(collide-cache-method-14 () none)
(collide-cache-method-15 () none)
(fill-using-line-sphere (_type_ collide-query) none)
(fill-using-spheres (_type_ collide-query) none)
(reset (_type_) none)
(collide-cache-method-16 (_type_ collide-query) float)
(collide-cache-method-17 () none)
(collide-cache-method-18 () none)
(collide-cache-method-19 () none)
(collide-cache-method-20 () none)
(probe-using-spheres (_type_ collide-query) symbol)
(fill-from-bg (_type_ (function collide-hash int collide-list collide-query int) (function collide-cache collide-list collide-query none) collide-query) none)
(fill-from-fg-boxes (_type_) none)
(fill-from-fg-line-sphere (_type_ collide-query) none)
(collide-cache-method-21 () none)
(collide-cache-method-22 (_type_ nav-mesh) none)
(fill-from-nav-mesh (_type_ collide-query) none)
@@ -7,3 +7,256 @@
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(defmethod debug-draw ((this collide-cache))
(debug-reset-prim-buffer)
(let ((s5-0 (the-as object (-> this tris vertex))))
(countdown (s4-0 (-> this num-tris))
(let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> (the-as collide-cache-tri s5-0) pat mode) color) a 64)))
(add-debug-flat-triangle
#t
(bucket-id bucket785)
(-> (the-as collide-cache-tri s5-0) vertex 0)
(-> (the-as collide-cache-tri s5-0) vertex 1)
(-> (the-as collide-cache-tri s5-0) vertex 2)
t1-0
)
)
(set! s5-0 (&+ (the-as collide-cache-tri s5-0) 64))
)
)
(let ((s5-1 (the-as structure (-> this prims 0 prim-core))))
(countdown (s4-1 (-> this num-prims))
(when (= (-> (the-as collide-cache-prim s5-1) prim-core prim-type) -1)
(let ((t0-1
(copy-and-set-field
(-> *pat-mode-info*
(-> (the-as collide-shape-prim-sphere (-> (the-as collide-shape-prim s5-1) prim-core action)) pat mode)
color
)
a
64
)
)
)
(add-debug-sphere
#t
(bucket-id bucket785)
(-> (the-as collide-cache-prim s5-1) prim-core world-sphere)
(-> (the-as collide-cache-prim s5-1) prim-core world-sphere w)
t0-1
)
)
)
(set! s5-1 (&+ (the-as collide-cache-prim s5-1) 48))
)
)
(print-collide-cache-tri-count this)
0
(none)
)
(deftype col-rend-filter (structure)
((show-pat uint32)
(show-pat-mask uint32)
)
)
;; WARN: Return type mismatch symbol vs none.
(defun col-rend-draw ((arg0 col-rend) (arg1 col-rend-filter))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s4-0 (new 'stack-no-clear 'matrix)))
(set! (-> s4-0 rvec quad) (-> (math-camera-matrix) fvec quad))
(vector-normalize! (-> s4-0 rvec) 1.0)
(debug-reset-prim-buffer)
(let ((s3-1 (the-as collide-cache-tri (-> *collide-cache* tris vertex))))
(countdown (s2-0 (-> *collide-cache* num-tris))
(vector-3pt-cross! (-> s4-0 uvec) (-> s3-1 vertex 0) (-> s3-1 vertex 1) (-> s3-1 vertex 2))
(vector-normalize! (-> s4-0 uvec) 1.0)
(when (or (-> arg0 show-back-faces?) (>= 0.0 (vector-dot (-> s4-0 rvec) (-> s4-0 uvec))))
(let ((v1-10 (-> s3-1 pat)))
(cond
((= (-> arg1 show-pat) (logand v1-10 (-> arg1 show-pat-mask)))
(let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-10 mode) color) a 64)))
(add-debug-flat-triangle
#t
(bucket-id bucket785)
(-> s3-1 vertex 0)
(-> s3-1 vertex 1)
(-> s3-1 vertex 2)
t1-0
)
)
(if (-> arg0 outline?)
(add-debug-outline-triangle
#t
(bucket-id bucket785)
(-> s3-1 vertex 0)
(-> s3-1 vertex 1)
(-> s3-1 vertex 2)
(new 'static 'rgba :r #x10 :g #x10 :b #x10 :a #x80)
)
)
(when (-> arg0 show-normals?)
(let ((a1-7 (-> s4-0 fvec)))
(let ((v1-23 (-> s3-1 vertex))
(a0-13 (-> s3-1 vertex 1))
)
(.lvf vf4 (&-> v1-23 0 quad))
(.lvf vf5 (&-> a0-13 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> a1-7 quad) vf6)
)
(let ((a1-8 (-> s4-0 fvec)))
(let ((v1-24 (-> s4-0 fvec))
(a0-14 (-> s3-1 vertex 2))
)
(.lvf vf4 (&-> v1-24 quad))
(.lvf vf5 (&-> a0-14 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> a1-8 quad) vf6)
)
(vector-float/! (-> s4-0 fvec) (-> s4-0 fvec) 3.0)
(add-debug-vector
#t
(bucket-id bucket785)
(-> s4-0 fvec)
(-> s4-0 uvec)
(meters 0.75)
(new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
)
)
)
((-> arg0 ghost-hidden?)
(add-debug-flat-triangle
#t
(bucket-id bucket785)
(-> s3-1 vertex 0)
(-> s3-1 vertex 1)
(-> s3-1 vertex 2)
(new 'static 'rgba :r #x20 :g #x20 :b #x20 :a #x20)
)
(if (-> arg0 outline?)
(add-debug-outline-triangle
#t
(bucket-id bucket785)
(-> s3-1 vertex 0)
(-> s3-1 vertex 1)
(-> s3-1 vertex 2)
(new 'static 'rgba :r #x10 :g #x10 :b #x10 :a #x10)
)
)
)
)
)
)
(&+! s3-1 64)
)
)
)
(let ((s5-1 (the-as structure (-> *collide-cache* prims 0 prim-core))))
(countdown (s4-1 (-> *collide-cache* num-prims))
(when (= (-> (the-as collide-cache-prim s5-1) prim-core prim-type) -1)
(let ((v1-39 (-> (the-as collide-shape-prim-sphere (-> (the-as collide-cache-prim s5-1) prim)) pat)))
(when (= (-> arg1 show-pat) (logand v1-39 (-> arg1 show-pat-mask)))
(let ((t0-5 (copy-and-set-field (-> *pat-mode-info* (-> v1-39 mode) color) a 64)))
(add-debug-sphere
#t
(bucket-id bucket785)
(the-as vector (&+ s5-1 0))
(-> (the-as collide-cache-prim s5-1) prim-core world-sphere w)
t0-5
)
)
)
)
)
(set! s5-1 (&+ (the-as collide-cache-prim s5-1) 48))
)
)
(none)
)
)
(defmethod draw ((this col-rend))
(let ((s5-0 (new 'stack-no-clear 'collide-query)))
(let ((f30-0 (-> this bbox-radius)))
(let ((v1-0 (-> this track)))
(cond
((zero? v1-0)
(set! (-> this bbox-center quad) (-> (target-pos 0) quad))
(+! (-> this bbox-center y) (* 0.7 f30-0))
)
((= v1-0 1)
(position-in-front-of-camera!
(-> this bbox-center)
(+ (-> this camera-to-bbox-dist) (-> this bbox-radius))
0.0
)
)
)
)
(set! (-> s5-0 bbox min quad) (-> this bbox-center quad))
(set! (-> s5-0 bbox min x) (- (-> s5-0 bbox min x) f30-0))
(set! (-> s5-0 bbox min y) (- (-> s5-0 bbox min y) f30-0))
(set! (-> s5-0 bbox min z) (- (-> s5-0 bbox min z) f30-0))
(set! (-> s5-0 bbox max quad) (-> this bbox-center quad))
(+! (-> s5-0 bbox max x) f30-0)
(+! (-> s5-0 bbox max y) f30-0)
(+! (-> s5-0 bbox max z) f30-0)
)
(let ((v1-9 -1))
(let ((a0-9 (-> this cspec)))
(if (not (logtest? a0-9 (collide-spec crate)))
(set! v1-9 (logxor v1-9 1))
)
(if (not (logtest? a0-9 (collide-spec civilian)))
(set! v1-9 (logxor v1-9 64))
)
(if (not (logtest? a0-9 (collide-spec enemy)))
(set! v1-9 (logxor #x100000 v1-9))
)
(if (not (logtest? a0-9 (collide-spec obstacle)))
(set! v1-9 (logxor v1-9 2))
)
(if (not (logtest? a0-9 (collide-spec vehicle-sphere)))
(set! v1-9 (logand #x100e43 v1-9))
)
)
(set! (-> s5-0 collide-with) (the-as collide-spec v1-9))
)
(set! (-> s5-0 ignore-pat) (new 'static 'pat-surface))
(set! (-> s5-0 ignore-process0) #f)
(set! (-> s5-0 ignore-process1) #f)
(set! (-> s5-0 nav-mesh) #f)
(add-debug-box
#t
(bucket-id bucket793)
(-> s5-0 bbox min)
(-> s5-0 bbox max)
(if (logtest? (current-time) 128)
(new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x20)
(new 'static 'rgba :a #x20)
)
)
(fill-using-bounding-box *collide-cache* s5-0)
)
(let ((a1-17 (new 'stack 'col-rend-filter)))
(set! (-> a1-17 show-pat) (-> this show-only))
(set! (-> a1-17 show-pat-mask) (-> this show-only-mask))
(col-rend-draw this a1-17)
)
(none)
)
@@ -5,6 +5,7 @@
;; name in dgo: collide-h
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
(deftype collide-query (structure)
@@ -43,11 +43,11 @@ bound to the joint specified by `joint-id`."
(:methods
(debug-draw-tris (_type_ process-drawable int) none)
(overlap-test (_type_ collide-mesh-cache-tri vector) symbol)
(should-push-away-test (_type_ collide-mesh-cache-tri collide-tri-result vector float) float)
(sphere-on-platform-test (_type_ collide-mesh-cache-tri collide-tri-result vector float) float)
(should-push-away-test (_type_ collide-mesh-cache-tri collide-mesh-cache-tri vector float) float)
(unpack-mesh-to-cache! (_type_ (inline-array collide-mesh-cache-tri) matrix) none)
(collide-mesh-math-1 (_type_ object object) none)
(sphere-on-platform-test (_type_ collide-mesh-cache-tri collide-tri-result vector float) float)
(collide-mesh-math-2 (_type_ object object object) none)
(collide-mesh-math-1 (_type_ object object) none)
)
)
@@ -7,3 +7,603 @@
;; DECOMP BEGINS
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this collide-mesh))
(the-as int (+ (-> collide-mesh size) (* (+ (-> this num-tris) -1) 8)))
)
;; WARN: Return type mismatch int vs collide-mesh.
(defmethod mem-usage ((this collide-mesh) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 82 (-> usage length)))
(set! (-> usage data 81 name) "collide-mesh")
(+! (-> usage data 81 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 81 used) v1-6)
(+! (-> usage data 81 total) (logand -16 (+ v1-6 15)))
)
(set! (-> usage length) (max 82 (-> usage length)))
(set! (-> usage data 81 name) "collide-mesh")
(+! (-> usage data 81 count) 1)
(let ((v1-16 (* (-> this num-verts) 16)))
(+! (-> usage data 81 used) v1-16)
(+! (-> usage data 81 total) (logand -16 (+ v1-16 15)))
)
(the-as collide-mesh 0)
)
(defmethod debug-draw-tris ((this collide-mesh) (arg0 process-drawable) (arg1 int))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (the-as object (-> this tris)))
(s4-0 (-> arg0 node-list data arg1 bone transform))
)
(countdown (s3-0 (-> this num-tris))
(let ((a2-1 (new 'stack-no-clear 'vector))
(a3-0 (new 'stack-no-clear 'vector))
(t0-0 (new 'stack-no-clear 'vector))
)
(.lvf vf4 (&-> s4-0 rvec quad))
(.lvf vf5 (&-> s4-0 uvec quad))
(.lvf vf6 (&-> s4-0 fvec quad))
(.lvf vf7 (&-> s4-0 trans quad))
(.lvf vf1 (&-> (-> this vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 0)) quad))
(.lvf vf2 (&-> (-> this vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 1)) quad))
(.lvf vf3 (&-> (-> this vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 2)) quad))
(let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> (the-as collide-mesh-tri s5-0) pat mode) color) a 16)))
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf1 acc)
(.add.mul.y.vf acc vf5 vf1 acc)
(.add.mul.z.vf vf1 vf6 vf1 acc)
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf2 acc)
(.add.mul.y.vf acc vf5 vf2 acc)
(.add.mul.z.vf vf2 vf6 vf2 acc)
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf3 acc)
(.add.mul.y.vf acc vf5 vf3 acc)
(.add.mul.z.vf vf3 vf6 vf3 acc)
(.svf (&-> a2-1 quad) vf1)
(.svf (&-> a3-0 quad) vf2)
(.svf (&-> t0-0 quad) vf3)
(add-debug-flat-triangle-noclip #t (bucket-id bucket785) a2-1 a3-0 t0-0 (the-as int t1-0))
)
)
(set! s5-0 (&+ (the-as collide-mesh-tri s5-0) 8))
)
)
0
(none)
)
)
(deftype sopt-work (structure)
((intersect vector :inline)
(sphere-bbox4w bounding-box4w :inline)
)
)
(defmethod-mips2c "(method 11 collide-mesh)" 11 collide-mesh)
(deftype spat-work (structure)
((intersect vector :inline)
(sphere-bbox4w bounding-box4w :inline)
)
)
;; og:preserve-this moved to earlier
(deftype oot-work (structure)
((intersect vector :inline)
(sphere-bbox4w bounding-box4w :inline)
)
)
(defun should-push-away-test-mesh ((arg0 collide-mesh-cache-tri) (arg1 int) (arg2 (inline-array vector)) (arg3 vector) (arg4 float))
(local-vars
(v1-0 uint128)
(a0-1 uint128)
(a1-2 uint128)
(a1-3 uint128)
(a1-4 uint128)
(a1-7 pat-surface)
(a2-1 uint128)
(a2-2 uint128)
(a2-4 float)
(a2-5 float)
(a2-7 float)
(f0-0 float)
(f2-1 float)
(f3-0 float)
(f4-0 float)
)
(rlet ((Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(let ((s3-0 (new 'stack-no-clear 'oot-work))
(s2-0 arg0)
)
(.lvf vf3 (&-> arg3 quad))
(.sub.w.vf vf12 vf3 vf3)
(nop!)
(.add.w.vf vf13 vf3 vf3)
(nop!)
(.ftoi.vf vf12 vf12)
(nop!)
(.ftoi.vf vf13 vf13)
(nop!)
(.mov v1-0 vf12)
(.svf (&-> s3-0 sphere-bbox4w min quad) vf12)
(.mov a0-1 vf13)
(.svf (&-> s3-0 sphere-bbox4w max quad) vf13)
(until (>= a2-7 f4-0)
(until (> f0-0 f2-1)
(until (>= f3-0 f2-1)
(label cfg-1)
(b! (zero? arg1) cfg-10 :delay (set! a2-1 (-> s2-0 bbox4w min quad)))
(+! arg1 -1)
(let ((a1-1 (-> s2-0 bbox4w max quad)))
(.pcgtw a2-2 a2-1 a0-1)
(nop!)
(.pcgtw a1-2 v1-0 a1-1)
)
(nop!)
(.por a1-3 a2-2 a1-2)
(nop!)
(.ppach a1-4 (the-as uint128 0) a1-3)
(nop!)
(let ((a1-5 (shl (the-as int a1-4) 16)))
(nop!)
;; og:preserve-this
(b! (nonzero? a1-5) cfg-1 :likely-delay (set! s2-0 (&+ s2-0 96)))
)
(closest-pt-in-triangle (-> s3-0 intersect) arg3 (the-as matrix (-> s2-0 vertex)) (-> s2-0 normal))
(.lvf vf2 (&-> s3-0 intersect quad))
(.lvf vf3 (&-> arg3 quad))
(.lvf vf1 (&-> s2-0 normal quad))
(set! v1-0 (-> s3-0 sphere-bbox4w min quad))
(set! a0-1 (-> s3-0 sphere-bbox4w max quad))
(.sub.vf vf4 vf3 vf2)
(set! a1-7 (-> s2-0 pat))
(.mul.vf vf5 vf4 vf1)
(.lvf vf7 (&-> s2-0 vertex 0 quad))
(.mul.vf vf6 vf4 vf4)
(.lvf vf8 (&-> s2-0 vertex 1 quad))
(.mov.vf.w vf1 vf0)
(.lvf vf9 (&-> s2-0 vertex 2 quad))
(.add.x.vf.y vf5 vf5 vf5)
(&+! s2-0 96)
(.add.y.vf.x vf6 vf6 vf6)
(set! f3-0 arg4)
(.add.z.vf.y vf5 vf5 vf5)
(.add.z.vf.x vf6 vf6 vf6)
(.sqrt.vf Q vf6 :ftf #b0)
(.mov a2-4 vf5)
(set! f0-0 0.0)
(.wait.vf)
(let ((f1-0 (-> arg3 w)))
(.add.vf.x vf6 vf0 Q)
(.mov.vf vf10 vf6)
(b! (< (the-as int a2-4) 0) cfg-6 :likely-delay (.sub.vf vf10 vf0 vf10))
(label cfg-6)
(.mov a2-5 vf10)
(set! f2-1 (- a2-5 f1-0))
)
(.div.vf Q vf0 vf6 :fsf #b11 :ftf #b0)
)
)
(.wait.vf)
(nop!)
(.mul.vf vf11 vf4 Q)
(set! f4-0 0.707)
(.mul.vf vf5 vf11 vf1)
(.add.y.vf.x vf5 vf5 vf5)
(.add.z.vf.x vf5 vf5 vf5)
(.mov a2-7 vf5)
)
)
(set! arg4 f2-1)
(.svf (&-> arg2 0 quad) vf7)
(.svf (&-> arg2 1 quad) vf8)
(.svf (&-> arg2 2 quad) vf9)
(.svf (&-> arg2 3 quad) vf2)
(.svf (&-> arg2 4 quad) vf1)
(b! #t cfg-1 :delay (set! (-> arg2 5 x) (the-as float a1-7)))
(label cfg-10)
arg4
)
)
(defmethod-mips2c "(method 13 collide-mesh)" 13 collide-mesh)
(defmethod-mips2c "(method 14 collide-mesh)" 14 collide-mesh)
;; ERROR: Unsupported inline assembly instruction kind - [pxor v1, v1, a0]
;; ERROR: Unsupported inline assembly instruction kind - [pxor a0, a0, a1]
;; ERROR: Unsupported inline assembly instruction kind - [pxor a0, a0, a1]
;; ERROR: Unsupported inline assembly instruction kind - [pxor a0, a0, a1]
(defmethod populate-for-prim-mesh ((this collide-mesh-cache) (arg0 collide-shape-prim-mesh))
(local-vars
(r0-0 uint128)
(v1-7 uint128)
(v1-8 uint128)
(v1-9 uint128)
(v1-11 uint128)
(a0-6 uint128)
(a0-8 uint128)
(a0-10 uint128)
(a0-11 uint128)
(a0-12 uint128)
)
(let ((s5-0 (-> arg0 cshape process node-list data (-> arg0 transform-index) bone transform))
(s4-0 (-> arg0 mesh-cache-entry))
)
(cond
((= (-> arg0 mesh-cache-id) (-> this id))
(let ((v1-6 (-> s5-0 rvec quad))
(a0-4 (-> s4-0 mat rvec quad))
)
(.pxor v1-7 v1-6 a0-4)
)
(let ((a0-5 (-> s5-0 uvec quad))
(a1-1 (-> s4-0 mat uvec quad))
)
(.pxor a0-6 a0-5 a1-1)
)
(.por v1-8 v1-7 a0-6)
(let ((a0-7 (-> s5-0 fvec quad))
(a1-2 (-> s4-0 mat fvec quad))
)
(.pxor a0-8 a0-7 a1-2)
)
(.por v1-9 v1-8 a0-8)
(let ((a0-9 (-> s5-0 trans quad))
(a1-3 (-> s4-0 mat trans quad))
)
(.pxor a0-10 a0-9 a1-3)
)
(.por a0-11 v1-9 a0-10)
(let ((v1-10 a0-11))
(.pcpyud a0-12 a0-11 r0-0)
(.por v1-11 a0-12 v1-10)
)
(when (nonzero? v1-11)
(set! (-> s4-0 mat rvec quad) (-> s5-0 rvec quad))
(set! (-> s4-0 mat uvec quad) (-> s5-0 uvec quad))
(set! (-> s4-0 mat fvec quad) (-> s5-0 fvec quad))
(set! (-> s4-0 mat trans quad) (-> s5-0 trans quad))
(unpack-mesh-to-cache! (-> arg0 mesh) (-> s4-0 tris) s5-0)
)
)
(else
(let ((v1-19 (-> arg0 mesh)))
(when v1-19
(set! s4-0 (allocate! this (the-as int (+ (* (the-as uint 96) (-> v1-19 num-tris)) 64))))
(set! (-> arg0 mesh-cache-entry) s4-0)
(cond
(s4-0
(set! (-> arg0 mesh-cache-id) (-> this id))
(set! (-> s4-0 mat rvec quad) (-> s5-0 rvec quad))
(set! (-> s4-0 mat uvec quad) (-> s5-0 uvec quad))
(set! (-> s4-0 mat fvec quad) (-> s5-0 fvec quad))
(set! (-> s4-0 mat trans quad) (-> s5-0 trans quad))
(unpack-mesh-to-cache! (-> arg0 mesh) (-> s4-0 tris) s5-0)
)
(else
(set! (-> arg0 mesh-cache-id) (the-as uint 0))
0
)
)
)
)
)
)
s4-0
)
)
;; WARN: Return type mismatch (pointer uint8) vs collide-mesh-cache-entry.
(defmethod allocate! ((this collide-mesh-cache) (arg0 int))
(local-vars (a1-2 int) (a2-2 int))
(let* ((v1-0 (+ arg0 15))
(a1-1 (-> this used-size))
(v1-1 (/ v1-0 16))
(a3-0 (-> this data))
(a2-0 (-> this max-size))
(v1-2 (* v1-1 16))
(a3-1 (&+ a3-0 a1-1))
)
(let ((t1-0 (- a2-0 (the-as uint v1-2)))
(t0-0 (-> this id))
)
(b! (< (the-as int t1-0) 0) cfg-6 :delay (set! a1-2 (the-as int (+ a1-1 v1-2))))
(b! (>= (the-as int (- a2-0 (the-as uint a1-2))) 0) cfg-5 :delay (set! a2-2 (the-as int (+ t0-0 1))))
)
(b! (zero? (the-as uint a2-2)) cfg-4 :likely-delay (set! a2-2 1))
(label cfg-4)
(set! a1-2 v1-2)
(set! a3-1 (-> this data))
(set! (-> this id) (the-as uint a2-2))
(label cfg-5)
(set! (-> this used-size) (the-as uint a1-2))
(let ((v0-0 a3-1))
(b! #t cfg-7 :delay (nop!))
(label cfg-6)
(format 0 "ERROR: Attempted to allocate something bigger than the entire mesh cache!~%")
(set! v0-0 (the-as (pointer uint8) #f))
(label cfg-7)
(the-as collide-mesh-cache-entry v0-0)
)
)
)
;; ERROR: Failed load: (set! vf6 (l.vf (+ (the-as vector a3-0) 16))) at op 37
(defmethod unpack-mesh-to-cache! ((this collide-mesh) (arg0 (inline-array collide-mesh-cache-tri)) (arg1 matrix))
(local-vars (t0-2 uint))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(nop!)
(let ((t0-0 (scratchpad-object int)) ;; og:preserve-this
(v1-0 (-> this num-verts))
)
(nop!)
(let ((a3-0 (the-as object (-> this vertex-data))))
(b! (zero? v1-0) cfg-3 :delay (.lvf vf1 (&-> arg1 rvec quad)))
(nop!)
(.lvf vf2 (&-> arg1 uvec quad))
(let ((t0-1 (the-as object (+ t0-0 -64))))
(.lvf vf3 (&-> arg1 fvec quad))
(nop!)
(.lvf vf4 (&-> arg1 trans quad))
(nop!)
(.lvf vf5 (&-> (the-as (inline-array vector) a3-0) 0 quad))
(nop!)
(.lvf vf6 (&-> (the-as (inline-array vector) a3-0) 1 quad))
(nop!)
(.lvf vf7 (&-> (the-as (inline-array vector) a3-0) 2 quad))
(nop!)
(.lvf vf8 (&-> (the-as (inline-array vector) a3-0) 3 quad))
(label cfg-2)
(.mul.w.vf acc vf4 vf0)
(set! a3-0 (-> (the-as (inline-array vector) a3-0) 4))
(.add.mul.x.vf acc vf1 vf5 acc)
(set! t0-1 (-> (the-as (inline-array vector) t0-1) 4))
(.add.mul.y.vf acc vf2 vf5 acc)
(nop!)
(.add.mul.z.vf vf9 vf3 vf5 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(.lvf vf5 (&-> (the-as vector a3-0) quad))
(.add.mul.x.vf acc vf1 vf6 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf6 acc)
(nop!)
(.add.mul.z.vf vf10 vf3 vf6 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
;; og:preserve-this
(.lvf vf6 (&+ (the-as vector a3-0) 16))
(.add.mul.x.vf acc vf1 vf7 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf vf11 vf3 vf7 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
;; og:preserve-this
(.lvf vf7 (&+ (the-as vector a3-0) 32))
(.add.mul.x.vf acc vf1 vf8 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf8 acc)
(nop!)
(.add.mul.z.vf vf12 vf3 vf8 acc)
(nop!)
(nop!)
;; og:preserve-this
(.lvf vf8 (&+ (the-as vector a3-0) 48))
(+! v1-0 -4)
(.svf (&-> (the-as (inline-array vector) t0-1) 0 quad) vf9)
(nop!)
(.svf (&-> (the-as (inline-array vector) t0-1) 1 quad) vf10)
(nop!)
(.svf (&-> (the-as (inline-array vector) t0-1) 2 quad) vf11)
(b! (> (the-as int v1-0) 0) cfg-2 :delay (.svf (&-> (the-as (inline-array vector) t0-1) 3 quad) vf12))
)
)
)
(label cfg-3)
(let ((v1-1 (the-as object (-> this tris))))
(nop!)
(let ((a2-1 #x70000000)
(a0-1 (-> this num-tris))
)
(b! (zero? a0-1) cfg-6 :delay (set! t0-2 (-> (the-as (inline-array collide-mesh-tri) v1-1) 0 vertex-index 0)))
(let* ((a1-1 (-> arg0 -1))
(a3-1 (-> (the-as (inline-array collide-mesh-tri) v1-1) 0 vertex-index 1))
(t0-3 (* t0-2 16))
(t2-0 (-> (the-as (inline-array collide-mesh-tri) v1-1) 0 vertex-index 2))
(t1-0 (* a3-1 16))
(a3-2 (the-as uint (-> (the-as (inline-array collide-mesh-tri) v1-1) 0 pat)))
)
(let* ((t2-1 (* t2-0 16))
(t0-4 (+ t0-3 a2-1))
(t1-1 (+ t1-0 a2-1))
(t2-2 (+ t2-1 a2-1))
)
(label cfg-5)
(+! a0-1 -1)
(.lvf vf1 t0-4)
(set! v1-1 (&+ (the-as collide-mesh-tri v1-1) 8))
(.lvf vf2 t1-1)
(&+! a1-1 96)
(.lvf vf3 t2-2)
(.sub.vf vf4 vf2 vf1)
(.svf (&-> a1-1 vertex 0 quad) vf1)
(.min.vf vf8 vf1 vf2)
(.svf (&-> a1-1 vertex 1 quad) vf2)
(.sub.vf vf5 vf3 vf1)
(.svf (&-> a1-1 vertex 2 quad) vf3)
(.max.vf vf9 vf1 vf2)
(let ((t1-2 (-> (the-as collide-mesh-tri v1-1) vertex-index 0)))
(.outer.product.a.vf acc vf4 vf5)
(let ((t2-3 (-> (the-as collide-mesh-tri v1-1) vertex-index 1)))
(.outer.product.b.vf vf6 vf5 vf4 acc)
(let ((t0-5 (-> (the-as collide-mesh-tri v1-1) vertex-index 2)))
(.mul.vf vf7 vf6 vf6)
(nop!)
(.min.vf vf8 vf8 vf3)
(let ((t1-3 (* t1-2 16)))
(.max.vf vf9 vf9 vf3)
(let ((t2-4 (* t2-3 16)))
(.mul.x.vf.w acc vf0 vf7)
(let ((t3-0 (* t0-5 16)))
(.add.mul.y.vf.w acc vf0 vf7 acc)
(set! t0-4 (+ t1-3 a2-1))
(.add.mul.z.vf.w vf7 vf0 vf7 acc)
(set! t1-1 (+ t2-4 a2-1))
(.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b11)
(set! t2-2 (+ t3-0 a2-1))
)
)
)
)
)
)
)
(.ftoi.vf vf8 vf8)
(nop!)
(.ftoi.vf vf9 vf9)
(nop!)
(nop!)
(.svf (&-> a1-1 bbox4w min quad) vf8)
(.wait.vf)
(.svf (&-> a1-1 bbox4w max quad) vf9)
(.mul.vf.xyz vf6 vf6 Q)
(nop!)
(nop!)
(.svf (&-> a1-1 normal quad) vf6)
(nop!)
(set! (-> a1-1 pat) (the-as pat-surface a3-2))
(b! (nonzero? a0-1) cfg-5 :delay (set! a3-2 (the-as uint (-> (the-as collide-mesh-tri v1-1) pat))))
)
)
)
(label cfg-6)
0
(none)
)
)
(defmethod overlap-test ((this collide-mesh) (arg0 collide-mesh-cache-tri) (arg1 vector))
(local-vars
(v1-0 uint128)
(a0-1 uint128)
(a1-2 uint128)
(a1-3 uint128)
(a1-4 uint128)
(a1-7 float)
(a2-1 uint128)
(a2-2 uint128)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (new 'stack-no-clear 'oot-work))
(s4-0 arg0)
)
(.lvf vf2 (&-> arg1 quad))
(let ((s3-0 (-> this num-tris)))
(.sub.w.vf vf5 vf2 vf2)
(.add.w.vf vf6 vf2 vf2)
(.ftoi.vf vf5 vf5)
(.ftoi.vf vf6 vf6)
(.mov v1-0 vf5)
(.svf (&-> s5-0 sphere-bbox4w min quad) vf5)
(.mov a0-1 vf6)
(.svf (&-> s5-0 sphere-bbox4w max quad) vf6)
(label cfg-1)
(b! (zero? s3-0) cfg-7 :delay (set! a2-1 (-> s4-0 bbox4w min quad)))
(+! s3-0 -1)
)
(let ((a1-1 (-> s4-0 bbox4w max quad)))
(.pcgtw a2-2 a2-1 a0-1)
(nop!)
(.pcgtw a1-2 v1-0 a1-1)
)
(nop!)
(.por a1-3 a2-2 a1-2)
(nop!)
(.ppach a1-4 (the-as uint128 0) a1-3)
(nop!)
(let ((a1-5 (shl (the-as int a1-4) 16)))
(nop!)
;; og:preserve-this
(b! (nonzero? a1-5) cfg-1 :likely-delay (set! s4-0 (&+ s4-0 96)))
)
(closest-pt-in-triangle (-> s5-0 intersect) arg1 (the-as matrix (-> s4-0 vertex)) (-> s4-0 normal))
(.lvf vf1 (&-> s5-0 intersect quad))
(.lvf vf2 (&-> arg1 quad))
(set! v1-0 (-> s5-0 sphere-bbox4w min quad))
(set! a0-1 (-> s5-0 sphere-bbox4w max quad))
(.sub.vf vf3 vf2 vf1)
(.mul.w.vf.w vf4 vf2 vf2)
(.mul.vf vf3 vf3 vf3)
(.mul.x.vf.w acc vf0 vf3)
(.add.mul.y.vf.w acc vf0 vf3 acc)
(.add.mul.z.vf.w vf3 vf0 vf3 acc)
(.sub.w.vf.w vf3 vf3 vf4)
(.add.w.vf.y vf3 vf0 vf3)
(.mov a1-7 vf3)
;; og:preserve-this
(b! (>= (the-as int a1-7) 0) cfg-1 :delay (set! s4-0 (&+ s4-0 96)))
)
(return #t)
(label cfg-7)
#f
)
)
+79 -36
View File
@@ -95,11 +95,50 @@
(declare-type collide-cache basic)
(declare-type rigid-body structure)
(define-extern cshape-reaction-update-state (function collide-shape collide-query vector none))
(define-extern cshape-reaction-default (function collide-shape collide-query vector vector collide-status))
(define-extern cshape-reaction-just-move (function collide-shape collide-query vector collide-status))
(define-extern cshape-reaction-update-state (function collide-shape-moving collide-query vector none))
(define-extern cshape-reaction-default (function collide-shape-moving collide-query vector vector collide-status))
(define-extern cshape-reaction-just-move (function collide-shape-moving collide-query vector collide-status))
(define-extern collide-shape-draw-debug-marks (function none))
;; +++cshape-reaction-flags
(defenum cshape-reaction-flags
:bitfield #t
:type uint32
(csrf00)
(csrf01)
(csrf02)
(csrf03)
(csrf04)
(csrf05)
(csrf06)
(csrf07)
(csrf08)
(csrf09)
(csrf10)
(csrf11)
(csrf12)
(csrf13)
(csrf14)
(csrf15)
(csrf16)
(csrf17)
(csrf18)
(csrf19)
(csrf20)
(csrf21)
(csrf22)
(csrf23)
(csrf24)
(csrf25)
(csrf26)
(csrf27)
(csrf28)
(csrf29)
(csrf30)
(csrf31)
)
;; ---cshape-reaction-flags
;; DECOMP BEGINS
(deftype collide-rider (structure)
@@ -317,42 +356,46 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t
(deftype collide-shape-moving (collide-shape)
"A [[collide-shape]] for moving objects."
((rider-time time-frame)
(rider-last-move vector :inline)
(trans-old vector :inline)
(poly-pat pat-surface :offset 272)
(cur-pat pat-surface)
(ground-pat pat-surface)
(status collide-status)
(reaction (function collide-shape-moving collide-query vector vector collide-status) :offset 316)
(no-reaction (function collide-shape-moving collide-query vector vector object))
(local-normal vector :inline)
(surface-normal vector :inline)
(poly-normal vector :inline)
(ground-poly-normal vector :inline)
(gspot-pos vector :inline)
(gspot-normal vector :inline)
(ground-touch-point vector :inline)
(ground-impact-vel meters)
(surface-angle float)
(poly-angle float)
(touch-angle float)
(coverage float)
(dynam dynamics)
((rider-time time-frame)
(rider-last-move vector :inline)
(trans-old vector :inline)
(trans-old-old vector :inline :offset 240)
(trans-old-old-old vector :inline :offset 256)
(poly-pat pat-surface :offset 272)
(cur-pat pat-surface)
(ground-pat pat-surface)
(status collide-status)
(unknown-csm-uint64-1 uint64 :offset 304)
(reaction-flag cshape-reaction-flags)
(reaction (function collide-shape-moving collide-query vector vector collide-status) :offset 316)
(no-reaction (function collide-shape-moving collide-query vector vector object))
(local-normal vector :inline)
(surface-normal vector :inline)
(poly-normal vector :inline)
(ground-poly-normal vector :inline)
(gspot-pos vector :inline)
(gspot-normal vector :inline)
(ground-touch-point vector :inline)
(ground-impact-vel meters)
(surface-angle float)
(poly-angle float)
(touch-angle float)
(coverage float)
(dynam dynamics)
)
(:methods
(new (symbol type process-drawable collide-list-enum) _type_)
(collide-shape-moving-method-55 () none)
(collide-shape-moving-method-56 () none)
(collide-shape-moving-method-57 () none)
(collide-shape-moving-method-58 () none)
(collide-shape-moving-method-59 () none)
(collide-shape-moving-method-60 () none)
(collide-shape-moving-method-61 () none)
(collide-shape-moving-method-62 () none)
(collide-shape-moving-method-63 () none)
(collide-shape-moving-method-64 () none)
(collide-shape-moving-method-65 () none)
(find-ground (_type_ collide-query collide-spec float float float process) symbol)
(integrate-no-collide! (_type_ vector) none)
(integrate-for-enemy-no-mtg (_type_ vector overlaps-others-params) symbol)
(move-above-ground (_type_ vector move-above-ground-params) none)
(move-to-ground (_type_ float float symbol collide-spec) none)
(move-to-ground-point (_type_ vector vector vector) none)
(compute-acc-due-to-gravity (_type_ vector float) vector)
(rbody-collision (_type_ rigid-body-control float) none)
(try-snap-to-surface (_type_ vector float float float) symbol)
(fill-and-try-snap-to-surface (_type_ vector float float float collide-query) symbol)
(step-collision! (_type_ vector vector float int) float)
(collide-shape-moving-method-66 () none)
)
)
@@ -76,8 +76,10 @@
((collide-shape-prim-group)
(let ((s4-0 (-> this prim-core collide-with))
(s3-0 (-> (the-as collide-shape-prim-group arg0) child 0))
(s2-1 (the-as object (-> (the-as collide-shape-prim-group arg0) num-children)))
)
(countdown (s2-1 (-> arg0 specific 0))
(while (nonzero? (the-as uint s2-1))
(set! s2-1 (+ (the-as uint s2-1) -1))
(when (and (logtest? s4-0 (-> s3-0 prim-core collide-as))
(logtest? (-> s3-0 prim-core action) (collide-action can-ride))
)
@@ -103,9 +105,14 @@
(let ((v1-13 (populate-for-prim-mesh *collide-mesh-cache* this)))
(when v1-13
(let* ((s4-1 (new 'stack-no-clear 'collide-tri-result))
(f0-4
(should-push-away-test s3-1 (-> v1-13 tris 0) s4-1 (-> arg0 prim-core world-sphere) (-> arg1 best-dist))
)
(f0-4 (should-push-away-test
s3-1
(-> v1-13 tris 0)
(the-as collide-mesh-cache-tri s4-1)
(-> arg0 prim-core world-sphere)
(-> arg1 best-dist)
)
)
)
(when (< f0-4 (-> arg1 best-dist))
(set! (-> arg1 best-dist) f0-4)
@@ -161,7 +168,9 @@
)
(set! *actor-list-length* 0)
(if (logtest? s5-0 (collide-spec hit-by-others-list))
(set! *actor-list-length* (spatial-hash-method-38 *actor-hash* (-> s4-0 prim-core) *actor-list* 512))
(set! *actor-list-length*
(fill-actor-list-for-box *actor-hash* (-> s4-0 prim-core world-sphere) *actor-list* 512)
)
)
(when (logtest? s5-0 (collide-spec player-list))
(let ((a0-2 (-> *collide-player-list* alive-list next0)))
File diff suppressed because it is too large. Load diff
@@ -76,7 +76,7 @@
(deftype anchor-transform-array (inline-array-class)
((data anchor-transform :dynamic)
((data anchor-transform :inline :dynamic)
)
)
@@ -84,7 +84,7 @@
(set! (-> anchor-transform-array heap-base) (the-as uint 32))
(deftype sphere-transform-array (inline-array-class)
((data sphere-transform :dynamic)
((data sphere-transform :inline :dynamic)
)
)
@@ -92,7 +92,7 @@
(set! (-> sphere-transform-array heap-base) (the-as uint 32))
(deftype disc-transform-array (inline-array-class)
((data disc-transform :dynamic)
((data disc-transform :inline :dynamic)
)
)
@@ -100,7 +100,7 @@
(set! (-> disc-transform-array heap-base) (the-as uint 48))
(deftype cloth-thickness-array (inline-array-class)
((data uint8 :dynamic)
((data uint8 :inline :dynamic)
)
)
@@ -5,5 +5,330 @@
;; name in dgo: construction-obs-h
;; dgos: ENGINE, GAME
(define-extern rigid-body-object-event-handler (function process int symbol event-message-block object :behavior rigid-body-object))
(define-extern *simple-sprite-system* simple-sprite-system)
(deftype cquery-with-pad (structure)
"construction-object::71"
((cquery collide-query :inline)
(pad uint32 )
)
)
;; DECOMP BEGINS
(deftype construction-object (rigid-body-object)
((splash basic)
(pad uint32)
(blink-start-time int32)
(hit-time int32)
)
(:methods
(construction-object-method-90 (_type_) none)
(construction-object-method-91 (_type_) none)
(construction-object-method-92 (_type_ object) none)
(construction-object-method-93 (_type_) none)
)
)
(define *construction-glow-template* (new 'static 'sprite-glow-data
:position (new 'static 'vector :w 2867.2)
:size-probe 163.84
:z-offset 4096.0
:size-y 2867.2
:color (new 'static 'rgbaf :x 128.0 :y 100.0 :w 35.0)
:fade-a -0.0000122044
:fade-b 8.997864
:tex-id (new 'static 'texture-id :index #x15 :page #x4)
)
)
(defstate idle (construction-object)
:virtual #t
:event rigid-body-object-event-handler
:enter (behavior ()
(ja-post)
(set! (-> self splash) #f)
(let* ((gp-0 (current-time))
(f30-0 150.0)
(v1-3 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-4 (the-as number (logior #x3f800000 v1-3)))
)
(set! (-> self blink-start-time) (the-as int (+ gp-0 (the int (* f30-0 (+ -1.0 (the-as float v1-4)))))))
)
(logclear! (-> self root penetrated-by) (penetrate vehicle))
)
:exit (behavior ()
(set! (-> self disturbed-time) (the-as uint (current-time)))
)
:code sleep-code
)
(defstate active (construction-object)
:virtual #t
:enter (behavior ()
(call-parent-state-handler enter)
(set! (-> self rbody max-ang-momentum) (* 500000000.0 (-> self info info mass)))
)
:trans (behavior ()
(construction-object-method-90 self)
)
)
(defmethod construction-object-method-93 ((this construction-object))
(let ((gp-0 (new 'stack-no-clear 'sprite-glow-data)))
(quad-copy! (the-as pointer (-> gp-0 position)) (the-as pointer *construction-glow-template*) 4)
(vector-matrix*!
(-> (&+ gp-0 64) position)
(new 'static 'vector :y 20480.0 :w 1.0)
(-> this node-list data 0 bone transform)
)
(let* ((v1-2 (-> gp-0 position))
(a1-2 (&+ gp-0 64))
(f0-0 (-> v1-2 w))
)
(set! (-> (the-as vector (&-> v1-2 x)) quad) (-> a1-2 position quad))
(set! (-> v1-2 w) f0-0)
)
0
(set! (-> gp-0 rot-angle) (* 182.04445 (rand-vu-float-range -17.0 -13.0)))
(set! (-> gp-0 position w) (rand-vu-float-range 10240.0 12288.0))
(set! (-> gp-0 size-y) (-> gp-0 position w))
(add! *simple-sprite-system* (the-as sprite-glow-data (-> gp-0 position)))
)
(none)
)
;; WARN: Return type mismatch object vs symbol.
(defmethod rigid-body-object-method-80 ((this construction-object) (arg0 rigid-body-impact))
(the-as
symbol
(cond
((and (-> arg0 process) (logtest? (process-mask vehicle) (-> arg0 process mask)))
(let ((s4-0 (new 'stack-no-clear 'vector)))
(let* ((v1-3 (-> arg0 process))
(f30-0 (fmin 286720.0 (vector-length (-> (the-as process-drawable v1-3) root transv))))
)
(set! (-> s4-0 quad) (-> arg0 normal quad))
(vector-normalize! s4-0 (* 0.0012 f30-0))
(+! (-> s4-0 y) (/ f30-0 1000))
)
(set! (-> arg0 point quad) (-> (the-as process-drawable (-> arg0 process)) root trans quad))
(+! (-> arg0 point y) -20.48)
(apply-impact! (-> this rbody) (-> arg0 point) s4-0)
)
(rigid-body-control-method-12 (-> this rbody) 1.0)
(rigid-body-control-method-13 (-> this rbody))
(logior! (-> this root penetrated-by) (penetrate vehicle))
(let ((v0-4 (the-as object (+ (current-time) (seconds 0.1)))))
(set! (-> this hit-time) (the-as int v0-4))
v0-4
)
)
(else
((method-of-type rigid-body-object rigid-body-object-method-80) this arg0)
)
)
)
)
(defmethod rigid-body-object-method-82 ((this construction-object)
(arg0 process-drawable)
(arg1 rigid-body-object-constants)
(arg2 object)
(arg3 object)
)
(set! (-> arg1 info inertial-tensor fvec x) (/ (-> arg1 info inertial-tensor fvec x) 1000))
((method-of-type rigid-body-object rigid-body-object-method-82) this arg0 arg1 arg2 arg3)
)
(defmethod construction-object-method-90 ((this construction-object))
(local-vars (v1-9 float) (v1-14 float))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(when (>= (the-as uint (- (current-time) (the-as int (-> this disturbed-time)))) (the-as uint 600))
(let ((f0-1 (* (vector-vector-distance-squared (-> this root trans) (camera-pos)) (square 0.000054253473))))
(.lvf vf1 (&-> (-> this rbody ang-velocity) quad))
(.add.w.vf.x vf2 vf0 vf0)
(.mul.vf vf1 vf1 vf1)
(.mul.x.vf.x acc vf2 vf1)
(.add.mul.y.vf.x acc vf2 vf1 acc)
(.add.mul.z.vf.x vf1 vf2 vf1 acc)
(.mov v1-9 vf1)
(cond
((and (< v1-9 f0-1) (begin
(.lvf vf1 (&-> (-> this rbody lin-velocity) quad))
(.add.w.vf.x vf2 vf0 vf0)
(.mul.vf vf1 vf1 vf1)
(.mul.x.vf.x acc vf2 vf1)
(.add.mul.y.vf.x acc vf2 vf1 acc)
(.add.mul.z.vf.x vf1 vf2 vf1 acc)
(.mov v1-14 vf1)
(< v1-14 (* f0-1 (square 614.4)))
)
)
(set! (-> this rbody lin-momentum quad) (the-as uint128 0))
(set! (-> this rbody ang-momentum quad) (the-as uint128 0))
(construction-object-method-92 this #f)
(go (method-of-object this idle))
)
(else
(set! (-> this disturbed-time) (the-as uint (current-time)))
)
)
)
)
0
(none)
)
)
(defmethod rigid-body-object-method-71 ((this construction-object))
(when (not (-> this splash))
(let ((s5-0 (new 'stack-no-clear 'water-info)))
(water-info-init! (-> this root) s5-0 (collide-action solid semi-solid))
(when (logtest? (-> s5-0 flags) (water-flag dark-eco))
(let ((v1-8 (make-sound-instance (-> *sound-info* 568) 0 #f)))
(cond
(v1-8
(set! (-> v1-8 trans quad) (-> this root trans quad))
(logior! (-> v1-8 flags) 96)
(-> v1-8 id)
)
(else
0
)
)
)
(set! (-> this splash) (the-as basic #t))
)
)
)
(if (and (< (-> this hit-time) (current-time)) (< 20480.0 (vector-length (-> this rbody lin-velocity))))
(logclear! (-> this root penetrated-by) (penetrate vehicle))
)
(when (< (-> this root trans y) -614400.0)
(construction-object-method-92 this #t)
(go empty-state)
)
(let ((v1-28 (new 'stack-no-clear 'cquery-with-pad)))
(set! (-> v1-28 cquery start-pos quad) (-> this rbody position quad))
(vector-float*! (-> v1-28 cquery move-dist) (-> this rbody lin-velocity) (seconds-per-frame))
(let ((a0-16 (-> v1-28 cquery)))
(set! (-> a0-16 radius) (+ 24576.0 (-> this root root-prim local-sphere w)))
(set! (-> a0-16 collide-with) (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list))
(set! (-> a0-16 ignore-process0) this)
(set! (-> a0-16 ignore-process1) #f)
(set! (-> a0-16 ignore-pat)
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
)
(set! (-> a0-16 action-mask) (collide-action solid))
(set! (-> a0-16 nav-mesh) #f)
)
(fill-using-line-sphere *collide-cache* (-> v1-28 cquery))
)
((method-of-type rigid-body-object rigid-body-object-method-71) this)
(none)
)
(defmethod construction-object-method-92 ((this construction-object) (arg0 object))
(let ((gp-0 (entity-more-perm-hash-method-12
*entity-more-perm*
(-> this entity extra perm aid)
(the-as (pointer symbol) #f)
)
)
)
(cond
(arg0
(logior! (-> gp-0 user-uint64) 1)
(logior! (-> this entity extra perm status) (entity-perm-status dead))
)
(else
(set! (-> gp-0 user-uint64) (the-as uint 0))
(if (< (-> this root rot w) 0.0)
(quaternion-negate! (the-as quaternion (-> this root rot)) (the-as quaternion (-> this root rot)))
)
(set! (-> gp-0 user-int8 5) (the int (* 127.0 (-> this root rot x))))
(set! (-> gp-0 user-int8 6) (the int (* 127.0 (-> this root rot y))))
(set! (-> gp-0 user-int8 7) (the int (* 127.0 (-> this root rot z))))
(let ((v1-23 (new 'stack-no-clear 'vector)))
(vector-! (the-as vector (&-> v1-23 x)) (-> this root trans) (-> this entity trans))
(when (or (< 2457600.0 (fabs (-> v1-23 x))) (< 2457600.0 (fabs (-> v1-23 y))) (< 2457600.0 (fabs (-> v1-23 z))))
(logior! (-> gp-0 user-uint64) 1)
(logior! (-> this entity extra perm status) (entity-perm-status dead))
)
(let ((a0-20 (-> gp-0 user-uint64))
(a1-9 (logand (the int (* 0.0016662598 (-> v1-23 x))) 8191))
(a2-5 (logand (the int (* 0.0016662598 (-> v1-23 y))) 8191))
(v1-25 (logand (the int (* 0.0016662598 (-> v1-23 z))) 8191))
)
(set! (-> gp-0 user-uint64) (logior a0-20 (logior (logior (* a1-9 2) (shl a2-5 14)) (shl v1-25 27))))
)
)
)
)
)
0
(none)
)
(define *was-allocated* #f)
(defmethod construction-object-method-91 ((this construction-object))
(local-vars (v1-25 float))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (entity-more-perm-hash-method-11 *entity-more-perm* (-> this entity extra perm aid))))
(when s5-0
(when (logtest? (-> s5-0 user-uint64) 1)
(logior! (-> this entity extra perm status) (entity-perm-status dead))
(go empty-state)
)
(set! (-> this root rot x) (* 0.007874016 (the float (-> s5-0 user-int8 5))))
(set! (-> this root rot y) (* 0.007874016 (the float (-> s5-0 user-int8 6))))
(set! (-> this root rot z) (* 0.007874016 (the float (-> s5-0 user-int8 7))))
(let ((f0-6 1.0))
(.lvf vf1 (&-> (-> this root rot) quad))
(.add.w.vf.x vf2 vf0 vf0)
(.mul.vf vf1 vf1 vf1)
(.mul.x.vf.x acc vf2 vf1)
(.add.mul.y.vf.x acc vf2 vf1 acc)
(.add.mul.z.vf.x vf1 vf2 vf1 acc)
(.mov v1-25 vf1)
(set! (-> this root rot w) (sqrtf (- f0-6 v1-25)))
)
(let* ((v1-27 (-> s5-0 user-uint64))
(a1-1 (logand (shr v1-27 1) 8191))
(a0-6 (logand (shr v1-27 14) 8191))
(v1-29 (logand (shr v1-27 27) 8191))
)
(if (logtest? a1-1 4096)
(set! a1-1 (logior (the-as uint #xffffe000) a1-1))
)
(if (logtest? a0-6 4096)
(set! a0-6 (logior (the-as uint #xffffe000) a0-6))
)
(if (logtest? v1-29 4096)
(set! v1-29 (logior (the-as uint #xffffe000) v1-29))
)
(set! (-> this root trans x) (* 0.00024420026 (the float a1-1)))
(set! (-> this root trans y) (* 0.00024420026 (the float a0-6)))
(set! (-> this root trans z) (* 0.00024420026 (the float v1-29)))
)
(vector+float*! (-> this root trans) (-> this entity trans) (-> this root trans) 2457600.0)
)
)
0
(none)
)
)
@@ -22,10 +22,10 @@
(set! (-> this info turn-back-anim) 6)
(set! (-> this info turn-front-anim) 5)
(set! (-> this info up-down-anim) 7)
(set! (-> this info intro-anim0) 8)
(set! (-> this info intro-anim1) 9)
(set! (-> this info intro-anim2) 10)
(set! (-> this info intro-anim3) -1)
(set! (-> this stack 119) (the-as uint 8))
(set! (-> this stack 120) (the-as uint 9))
(set! (-> this stack 121) (the-as uint 10))
(set! (-> this stack 122) (the-as uint -1))
(set! (-> this info head-node) 6)
(set! (-> this info arm0-node) 8)
(set! (-> this info arm1-node) 11)
@@ -30,6 +30,7 @@
(taf6 6)
(taf7 7)
(taf8 8)
(taf9 9)
)
;; ---task-arrow-flags
@@ -105,10 +106,10 @@
(part sparticle-launch-control)
(callback (function part-tracker vector))
(linger-callback (function part-tracker vector))
(duration uint64)
(linger-duration uint64)
(state-time uint64)
(target uint64)
(duration time-frame)
(linger-duration time-frame)
(state-time time-frame)
(target handle)
(target-joint int32)
)
(:methods
+3 -3
View File
@@ -39,7 +39,7 @@ some special effect code, then sent to the prim renderer to be drawn."
"Base class for prim-strip."
()
(:methods
(generate-dma! (_type_ matrix) none)
(generate-dma! (_type_ matrix int) none)
)
)
@@ -62,7 +62,7 @@ some special effect code, then sent to the prim renderer to be drawn."
These are owned by the thing submitting to prim, not the prim renderer itself."
((flags prim-flags)
(tex-name basic)
(tex basic)
(tex texture)
(tex-id texture-id)
(adnops gs-adcmd 2 :inline)
(data0 gs-test :overlay-at (-> adnops 0 word 0))
@@ -169,6 +169,6 @@ These are owned by the thing submitting to prim, not the prim renderer itself."
(sinks prim-sink 114 :inline)
)
(:methods
(prim-work-method-9 () none)
(reset! (_type_) none)
)
)
+421
View File
@@ -7,3 +7,424 @@
;; DECOMP BEGINS
(define *prim-work*
(new 'static 'prim-work
:vertex-tmpl (new 'static 'inline-array dma-packet 3
(new 'static 'dma-packet
:dma (new 'static 'dma-tag :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x9 :cmd (vif-cmd unpack-v4-32))
)
(new 'static 'dma-packet
:dma (new 'static 'dma-tag :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x120 :cmd (vif-cmd unpack-v4-32))
)
(new 'static 'dma-packet
:dma (new 'static 'dma-tag :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x237 :cmd (vif-cmd unpack-v4-32))
)
)
:control-tmpl (new 'static 'inline-array dma-packet 2
(new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #xc :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x345 :num #xc :cmd (vif-cmd unpack-v4-32))
)
(new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #xc :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x363 :num #xc :cmd (vif-cmd unpack-v4-32))
)
)
:giftag (new 'static 'generic-gif-tag
:fan-prim (new 'static 'gif-tag-prim
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
:nreg #x3
)
:str-prim (new 'static 'gif-tag-prim
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
:nreg #x3
)
:regs (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
:num-strips #x1
)
:call-scissor (new 'static 'dma-packet
:dma (new 'static 'dma-tag :id (dma-tag-id cnt))
:vif0 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscalf) :msk #x1)
)
:call-noclip (new 'static 'dma-packet
:dma (new 'static 'dma-tag :id (dma-tag-id cnt))
:vif0 (new 'static 'vif-tag :imm #x8 :cmd (vif-cmd mscalf) :msk #x1)
)
:mask (new 'static 'vector4w :x -2 :y -1 :z -1)
)
)
(defmethod reset! ((this prim-work))
(dotimes (v1-0 114)
(let ((a1-2 (-> this sinks v1-0)))
(set! (-> a1-2 vertex-count) (the-as uint 0))
(set! (-> a1-2 control-count) (the-as uint 0))
)
0
)
0
(none)
)
(define *level-texture-page-translate*
(new 'static 'boxed-array :type uint32 #xb #xc #xd #xe #xf #x10 #x11 #x7 #x7 #x8)
)
;; WARN: disable def twice: 353. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
(defmethod generate-dma! ((this prim-strip) (arg0 matrix) (arg1 int))
"Generate DMA for prim rendering."
(local-vars
(v0-8 object)
(a2-10 uint128)
(a3-19 uint128)
(a3-20 uint128)
(t0-6 uint128)
(t0-7 uint128)
(t1-0 uint128)
(t1-1 uint128)
(t2-0 uint128)
(t2-1 uint128)
(sv-16 texture)
)
(rlet ((vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf14 :class vf)
(vf15 :class vf)
(vf16 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(let ((v1-5 (-> *display* frames (-> *display* on-screen) global-buf))
(a0-4 (/ (+ (-> this num-verts) 79) (the-as uint 80)))
)
(set! v0-8
(cond
((< (the-as uint (+ (* (the-as uint 144) (-> this num-verts)) (* a0-4 128)))
(the-as uint (&- (-> v1-5 end) (the-as uint (-> v1-5 base))))
)
(set! sv-16
(cond
((and (-> this tex)
(= (-> this tex type) texture)
(= (-> this tex-name) (-> this tex name))
(= (-> this tex-id) (-> this last-tex-id))
)
(set! sv-16 (-> this tex))
sv-16
)
((-> this tex-name)
(set! (-> this tex) (lookup-level-texture-by-name
(the-as string (-> this tex-name))
(-> this level)
(the-as (pointer texture-page) #f)
)
)
(when (not (-> this tex))
(set! (-> this tex) (lookup-texture-by-id-fast (new 'static 'texture-id :index #x3 :page #x1)))
(set! (-> this tex-name) (-> this tex name))
(set! (-> this last-tex-id) (the-as uint (-> this tex-id)))
)
(set! sv-16 (-> this tex))
sv-16
)
(else
(set! (-> this last-tex-id) (the-as uint (-> this tex-id)))
(set! (-> this tex) (lookup-texture-by-id-fast (-> this tex-id)))
)
)
)
(let* ((s3-0 *prim-work*)
(s2-0
(-> s3-0 sinks (vu1-bucket-map (-> this level draw-index) (-> this texture-index) arg1 (merc-mode mm5)))
)
)
(when sv-16
(let* ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf))
(s4-0 (-> s1-0 base))
)
(set! (-> s3-0 in-verts) (the-as int (-> this num-verts)))
(set! (-> s3-0 vert-ptr) (-> this data))
(let ((v1-37 (if (logtest? (-> this flags) (prim-flags alpha-blend-enable))
1
0
)
)
(a0-20 (if (logtest? (-> this flags) (prim-flags texture-enable))
1
0
)
)
(a1-9 (if (logtest? (-> this flags) (prim-flags fog-enable))
1
0
)
)
)
(set! (-> s3-0 giftag fan-prim)
(new 'static 'gif-tag-prim
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :abe v1-37 :tme a0-20 :fge a1-9)
)
)
(set! (-> s3-0 giftag str-prim)
(new 'static 'gif-tag-prim
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe v1-37 :tme a0-20 :fge a1-9)
)
)
)
(let ((v1-44 (-> this level))
(a0-27 (-> *level-texture-page-translate* (-> this texture-index)))
)
(dotimes (a1-14 3)
(let ((a2-9 (-> v1-44 texture-mask a0-27 mask quad))
(a3-10 (-> sv-16 masks data a1-14 mask quad))
)
(.por a2-10 a2-9 a3-10)
)
(set! (-> v1-44 texture-mask a0-27 mask quad) a2-10)
)
)
(adgif-shader<-texture-simple! (-> s3-0 shader) sv-16)
(set! (-> s3-0 shader clamp) (-> this clamp))
(set! (-> s3-0 shader clamp-reg) (gs-reg64 clamp-1))
(set! (-> s3-0 shader alpha) (the-as gs-miptbp (-> this alpha)))
(set! (-> s3-0 shader reg-4) (gs-reg alpha-1))
(.lvf vf1 (&-> arg0 rvec quad))
(.lvf vf2 (&-> arg0 uvec quad))
(.lvf vf3 (&-> arg0 fvec quad))
(.lvf vf4 (&-> arg0 trans quad))
(.lvf vf5 (&-> s3-0 shader quad 0 quad))
(.lvf vf6 (&-> s3-0 shader quad 1 quad))
(.lvf vf7 (&-> s3-0 shader quad 2 quad))
(.lvf vf8 (&-> s3-0 shader quad 3 quad))
(.lvf vf9 (&-> s3-0 shader quad 4 quad))
(.lvf vf10 (&-> s3-0 giftag qword quad))
(.lvf vf11 (&-> this adnops 0 quad))
(.lvf vf12 (&-> this adnops 1 quad))
(while (< 2 (-> s3-0 in-verts))
(set! (-> s3-0 num-verts) (min 80 (-> s3-0 in-verts)))
(let* ((a0-30 (-> s3-0 control-tmpl (logand (-> s2-0 control-count) 1)))
(v1-57 (-> s1-0 base))
(a0-31 (-> a0-30 quad))
(a1-16 (the-as object (&+ v1-57 16)))
(v1-58 (-> s3-0 num-verts))
)
(set! (-> (the-as (pointer uint128) a1-16) -1) a0-31)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 0 stq quad) vf1)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 0 pos quad) vf2)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 1 stq quad) vf3)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 1 pos quad) vf4)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 2 stq quad) vf10)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 2 pos quad) vf11)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 3 stq quad) vf12)
(set! (-> (the-as (inline-array prim-vertex) a1-16) 2 pos w) (the-as float v1-58))
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 3 pos quad) vf5)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 4 stq quad) vf6)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 4 pos quad) vf7)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 5 stq quad) vf8)
(.svf (&-> (the-as (inline-array prim-vertex) a1-16) 5 pos quad) vf9)
(set! (-> (the-as (inline-array prim-vertex) a1-16) 4 col) (the-as rgba (logior v1-58 #x8000)))
(set! (-> s1-0 base) (the-as pointer (-> (the-as (inline-array prim-vertex) a1-16) 6)))
(let ((a0-38 (-> s3-0 vertex-tmpl (mod (-> s2-0 vertex-count) (the-as uint 3)))))
(let ((a1-19 (* 3 v1-58)))
(set! (-> a0-38 dma qwc) a1-19)
(set! (-> a0-38 vif1 num) a1-19)
)
(let ((a2-16 (the-as object (-> s1-0 base)))
(a3-17 (-> a0-38 quad))
(a0-39 (-> s3-0 mask quad))
(a1-23 (-> s3-0 vert-ptr))
)
(set! (-> (the-as (inline-array prim-vertex) a2-16) 0 stq quad) a3-17)
(let ((a2-17 (the-as (object object) (-> (the-as (inline-array prim-vertex) a2-16) 0 pos))))
(set! (-> s1-0 base) (the-as pointer a2-17))
(nop!)
(label cfg-30)
(nop!)
(let ((t0-5 (the-as uint128 (-> a1-23 0 stq w))))
(nop!)
(let ((a3-18 (the-as uint128 (-> a1-23 1 stq w))))
(.pextlb t0-6 0 t0-5)
(.lvf vf15 (&-> a1-23 0 stq quad))
(.pextlh t0-7 0 t0-6)
(.lvf vf16 (&-> a1-23 1 stq quad))
(.pextlb a3-19 0 a3-18)
)
)
(.lvf vf13 (&-> a1-23 0 pos quad))
(.pextlh a3-20 0 a3-19)
(.lvf vf14 (&-> a1-23 1 pos quad))
(vftoi12.xyzw vf15 vf15)
(set! (-> (the-as (inline-array prim-vertex) a2-17) 0 pos quad) t0-7)
(vftoi12.xyzw vf16 vf16)
(set! (-> (the-as (inline-array prim-vertex) a2-17) 2 stq quad) a3-20)
(nop!)
(let ((t0-8 (the-as number (-> a1-23 0 stq z))))
(nop!)
(let ((a3-21 (the-as number (-> a1-23 1 stq z))))
(set! a1-23 (the-as (inline-array prim-vertex) (-> a1-23 2)))
(.mov t2-0 vf15)
(+! v1-58 -2)
(.mov t1-0 vf16)
(.pand t2-1 t2-0 a0-39)
(.svf (&-> (the-as (inline-array prim-vertex) a2-17) 1 stq quad) vf13)
(.pand t1-1 t1-0 a0-39)
(.svf (&-> (the-as (inline-array prim-vertex) a2-17) 2 pos quad) vf14)
(let ((t0-9 (logior (the-as int t2-1) (the-as int t0-8))))
(nop!)
(let ((a3-22 (logior (the-as int t1-1) (the-as int a3-21))))
(nop!)
(set! (-> (the-as (inline-array prim-vertex) a2-17) 0 stq quad) (the-as uint128 t0-9))
(set! a2-17 (the-as (object object) (-> (the-as (inline-array prim-vertex) a2-17) 3)))
(b! (> v1-58 0) cfg-30 :delay (set! (-> (the-as (pointer uint128) a2-17) -3) (the-as uint128 a3-22)))
)
)
)
)
)
)
)
)
(&+! (-> s1-0 base) (* 48 (-> s3-0 num-verts)))
(set! (-> (the-as (pointer uint128) (-> s1-0 base))) (-> s3-0 call-scissor quad))
(&+! (-> s1-0 base) 16)
(+! (-> s3-0 in-verts) -78)
(set! (-> s3-0 vert-ptr) (the-as (inline-array prim-vertex) (-> s3-0 vert-ptr 78)))
(+! (-> s2-0 vertex-count) 1)
(+! (-> s2-0 control-count) 1)
)
(let ((s3-1 (-> s1-0 base)))
(when (!= s4-0 s3-1)
(let ((v1-74 (the-as object (-> s1-0 base))))
(set! (-> (the-as dma-packet v1-74) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-74) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-74) vif1) (new 'static 'vif-tag))
(set! (-> s1-0 base) (the-as pointer (&+ (the-as dma-packet v1-74) 16)))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) bucket-group)
(the-as
bucket-id
(vu1-bucket-map (-> this level draw-index) (-> this texture-index) arg1 (merc-mode mercneric2))
)
s4-0
(the-as (pointer dma-tag) s3-1)
)
)
)
)
)
)
(when (not (paused?))
(when (logtest? (-> this flags) (prim-flags pf3))
(when (not (logtest? (-> this flags) (prim-flags pf4)))
(set! (-> this num-verts) (the-as uint 0))
0
)
(set! v0-8 (logclear (-> this flags) (prim-flags pf4)))
(set! (-> this flags) (the-as prim-flags v0-8))
v0-8
)
)
)
(else
(format *stdcon* "Out of DMA buffer for prim rendering~%")
)
)
)
)
0
(none)
)
)
(define *foreground-to-level-translate*
(new 'static 'boxed-array :type uint32 #x0 #x1 #x2 #x3 #x4 #x5 #x6 #x7 #x7)
)
(defmethod setup-dma-and-tex ((this prim-strip) (arg0 draw-control))
"Set up the bucket, prim sink, and texture."
(let ((v1-3 (-> *level* level (-> arg0 level-index))))
(-> v1-3 draw-index)
(let ((a0-4 (-> arg0 default-texture-page)))
(set! (-> this level) v1-3)
(set! (-> this texture-index) (the-as int a0-4))
)
(when (not (logtest? (-> this flags) (prim-flags no-texture-name)))
(set! (-> this tex-id) (lookup-level-texture-id-by-name
(the-as string (-> this tex-name))
v1-3
(the-as int (-> *foreground-to-level-translate* (-> this texture-index)))
)
)
(logior! (-> this flags) (prim-flags no-texture-name))
)
)
0
(none)
)
(defun prim-engine-execute ((arg0 object) (arg1 object) (arg2 int))
(when (logtest? (-> *display* vu1-enable-user) 4096)
(let ((gp-0 *viewport-array*))
(dotimes (s5-0 (the-as int (-> gp-0 num-viewports)))
(view-push-context s5-0)
(let* ((v1-4 gp-0)
(a0-2 s5-0)
(a1-4 (-> v1-4 data (the-as uint a0-2)))
)
(set! (-> v1-4 current-viewport-index) (the-as uint a0-2))
(let* ((s4-0 *prim-client-engine*)
(v1-6 (-> s4-0 alive-list next0))
(s3-0 (-> (the-as connection v1-6) next0))
)
(while (!= v1-6 (-> s4-0 alive-list-end))
(generate-dma! (the-as prim-strip (-> (the-as connection v1-6) param2)) (the-as matrix a1-4) arg2)
(set! v1-6 s3-0)
(set! s3-0 (-> s3-0 next0))
)
)
)
(let* ((s4-1 *prim-engine*)
(s3-1 (-> (view-get-active-math-camera) camera-temp))
(v1-12 (-> s4-1 alive-list next0))
(s2-0 (-> (the-as connection v1-12) next0))
)
(while (!= v1-12 (-> s4-1 alive-list-end))
(-> (the-as connection v1-12) param1)
(let* ((a0-13 (the-as prim-strip (-> (the-as connection v1-12) param2)))
(t9-3 (method-of-object a0-13 generate-dma!))
(a1-5 s3-1)
)
(set! arg2 s5-0)
(t9-3 a0-13 a1-5 arg2)
)
(set! v1-12 s2-0)
(set! s2-0 (-> s2-0 next0))
)
)
(view-pop-context)
)
)
(remove-all *prim-client-engine*)
)
0
(none)
)
@@ -94,20 +94,20 @@
(projectile-method-55 (_type_) none)
(projectile-method-56 (_type_) none)
(projectile-method-57 (_type_) none)
(projectile-method-58 (_type_) none)
(projectile-method-58 (_type_ int) none)
(projectile-method-59 (_type_) none)
(projectile-method-60 (_type_) none)
(projectile-method-61 (_type_) none)
(projectile-method-62 (_type_) none)
(projectile-method-63 (_type_) none)
(projectile-method-64 (_type_) none)
(projectile-method-65 (_type_) none)
(projectile-method-66 (_type_) none)
(projectile-method-64 (_type_) symbol)
(proj-event-handler (_type_ process int symbol event-message-block) object)
(projectile-method-66 (_type_ process event-message-block) none)
(projectile-method-67 (_type_) none)
(projectile-method-68 (_type_) none)
(projectile-method-69 (_type_) none)
(projectile-method-68 (_type_ process object) object)
(projectile-method-69 (_type_) object)
(projectile-method-70 (_type_) none)
(projectile-method-71 (_type_) none)
(projectile-method-71 (_type_) int)
)
)
@@ -5,5 +5,706 @@
;; name in dgo: projectile
;; dgos: ENGINE, GAME
(define-extern process-entity-set! (function process entity entity))
(define-extern transform-post (function int :behavior process-drawable))
;; DECOMP BEGINS
(defun cshape-reaction-projectile ((arg0 collide-shape-moving) (arg1 collide-query) (arg2 vector) (arg3 vector))
(let ((s5-0 (cshape-reaction-default arg0 arg1 arg2 arg3)))
(case (-> arg1 best-other-tri pat material)
(((pat-material stopproj))
(send-event (-> arg0 process) 'die)
)
)
s5-0
)
)
(defmethod projectile-method-70 ((this projectile))
0
(none)
)
(defmethod proj-event-handler ((this projectile) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('tracked)
(let ((v0-0 (the-as object (process->handle (the-as process (-> arg3 param 0))))))
(set! (-> this last-target) (the-as handle v0-0))
v0-0
)
)
(('touched 'touch)
(projectile-method-66 this arg0 arg3)
)
(('die)
(projectile-method-64 this)
)
)
)
;; WARN: Return type mismatch object vs projectile.
(defbehavior projectile-event-handler projectile ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(the-as projectile (proj-event-handler self arg0 arg1 arg2 arg3))
)
(defmethod projectile-method-68 ((this projectile) (arg0 process) (arg1 object))
(let ((s5-0 (new 'stack 'attack-info)))
(let ((v1-1 s5-0))
(set! (-> v1-1 mode) (-> this attack-mode))
(set! (-> v1-1 id) (-> this attack-id))
(set! (-> v1-1 mask) (attack-mask mode id))
)
(if (!= (-> this owner-handle) #f)
(logior! (-> s5-0 mask) (attack-mask attacker))
)
(set! (-> s5-0 attacker) (-> this owner-handle))
(when (logtest? (-> this options) (projectile-options po13))
(set! (-> s5-0 attacker-velocity quad) (-> this pre-move-transv quad))
(logior! (-> s5-0 mask) (attack-mask attacker-velocity))
)
(when (not (logtest? (-> this options) (projectile-options po14)))
(set! (-> s5-0 damage) (-> this damage))
(set! (-> s5-0 vehicle-damage-factor) (-> this vehicle-damage-factor))
(set! (-> s5-0 vehicle-impulse-factor) (-> this vehicle-impulse-factor))
(set! (-> s5-0 count) (-> this wpn-type))
(logior! (-> s5-0 mask) (attack-mask damage vehicle-damage-factor vehicle-impulse-factor))
)
(when (logtest? (projectile-options po16) (-> this options))
(set! (-> s5-0 invinc-time) (-> this invinc-time))
(logior! (-> s5-0 mask) (attack-mask invinc-time))
)
(let ((s3-1 (if (logtest? (projectile-options po17) (-> this options))
'attack-invinc
'attack
)
)
)
(send-event arg0 s3-1 arg1 s5-0)
(send-event (handle->process (-> s5-0 attacker)) 'you-attacked s3-1 arg0 s5-0)
)
)
)
;; WARN: Return type mismatch object vs none.
(defmethod projectile-method-66 ((this projectile) (arg0 process) (arg1 event-message-block))
(when (-> this attack-mode)
(let* ((a2-1 (-> arg1 param 0))
(s5-0 (projectile-method-68 this arg0 a2-1))
)
(when s5-0
(let ((v1-2 (-> this notify-handle)))
(send-event (handle->process v1-2) 'notify 'attack arg0)
)
(projectile-method-67 this)
(+! (-> this hits) 1)
(when (and (>= (-> this hits) (-> this max-hits))
(not (and (-> this next-state) (= (-> this next-state name) 'impact)))
)
(if (= s5-0 'no-impact)
(logior! (-> this options) (projectile-options po18))
)
(go (method-of-object this impact))
)
)
)
)
(none)
)
;; WARN: Return type mismatch symbol vs none.
(defmethod projectile-method-67 ((this projectile))
(none)
)
(defmethod projectile-method-64 ((this projectile))
(if (not (and (-> this next-state) (= (-> this next-state name) 'impact)))
(go (method-of-object this impact))
)
#t
)
(defmethod projectile-method-54 ((this projectile))
0
(none)
)
(defmethod projectile-method-55 ((this projectile))
(if (nonzero? (-> this part))
(sparticle-launch-control-method-16 (-> this part) (-> this root trans))
)
0
(none)
)
(defmethod projectile-method-56 ((this projectile))
0
(none)
)
(defmethod projectile-method-57 ((this projectile))
0
(none)
)
(defmethod projectile-method-58 ((this projectile) (arg0 int))
0
(none)
)
(defmethod projectile-method-59 ((this projectile))
(when (nonzero? (-> this sound-id))
(sound-stop (-> this sound-id) #t)
(set! (-> this sound-id) (new 'static 'sound-id))
0
)
0
(none)
)
;; WARN: Return type mismatch symbol vs object.
(defmethod projectile-method-69 ((this projectile))
(let ((v1-0 (-> this root))
(t1-0 (new 'stack-no-clear 'collide-query))
)
(let ((a1-0 t1-0))
(set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w))
(set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with))
(set! (-> a1-0 ignore-process0) this)
(set! (-> a1-0 ignore-process1) (handle->process (-> this ignore-handle)))
(set! (-> a1-0 ignore-pat) (-> v1-0 pat-ignore-mask))
(set! (-> a1-0 action-mask) (collide-action solid))
(set! (-> a1-0 nav-mesh) #f)
)
(fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0 t1-0)
)
)
(defun projectile-move-fill-all-dirs ((arg0 projectile))
(let ((v1-0 (-> arg0 root))
(a2-0 (new 'stack-no-clear 'collide-query))
)
(set! (-> a2-0 collide-with) (-> v1-0 root-prim prim-core collide-with))
(set! (-> a2-0 ignore-process0) arg0)
(set! (-> a2-0 ignore-process1) (handle->process (-> arg0 ignore-handle)))
(set! (-> a2-0 ignore-pat) (-> v1-0 pat-ignore-mask))
(set! (-> a2-0 action-mask) (collide-action solid))
(fill-cache-integrate-and-collide v1-0 (-> v1-0 transv) a2-0 (meters 0))
)
0
(none)
)
(defun projectile-move-fill-line-sphere ((arg0 projectile))
(local-vars (at-0 int))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((gp-0 (-> arg0 root)))
(let ((a1-0 (new 'stack-no-clear 'collide-query)))
(let ((a2-0 (-> gp-0 root-prim)))
(set! (-> a1-0 start-pos quad) (-> gp-0 trans quad))
(let ((v1-1 (-> a1-0 move-dist)))
(.lvf vf1 (&-> (-> gp-0 transv) quad))
(let ((f0-0 (seconds-per-frame)))
(.mov at-0 f0-0)
)
(.mov vf2 at-0)
(.mov.vf.w vf1 vf0)
(.mul.x.vf.xyz vf1 vf1 vf2)
(.svf (&-> v1-1 quad) vf1)
)
(let ((v1-2 a1-0))
(set! (-> v1-2 radius) (-> a2-0 prim-core world-sphere w))
(set! (-> v1-2 collide-with) (-> a2-0 prim-core collide-with))
(set! (-> v1-2 ignore-process0) arg0)
(set! (-> v1-2 ignore-process1) (handle->process (-> arg0 ignore-handle)))
(set! (-> v1-2 ignore-pat) (-> gp-0 pat-ignore-mask))
(set! (-> v1-2 action-mask) (collide-action solid))
(set! (-> v1-2 nav-mesh) #f)
)
)
(fill-using-line-sphere *collide-cache* a1-0)
)
(integrate-and-collide! gp-0 (-> gp-0 transv))
)
0
(none)
)
)
(defun projectile-update-velocity-add-gravity ((arg0 projectile))
(vector-v++! (-> arg0 root transv) (compute-acc-due-to-gravity (-> arg0 root) (new-stack-vector0) 1.0))
0
(none)
)
(defun projectile-update-velocity-space-wars ((arg0 projectile))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> arg0 target-pos) (-> arg0 root trans))))
(let ((s4-0 (new 'stack-no-clear 'vector))
(s3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root transv) 1.0))
(f30-0 (vector-length (-> arg0 root transv)))
)
(if (logtest? (-> arg0 root status) (collide-status touch-surface))
(vector-flatten! s5-1 s5-1 (-> arg0 root local-normal))
)
(vector-normalize-copy! s4-0 s5-1 1.0)
(if (and (or (not (handle->process (-> arg0 last-target)))
(zero? (-> (the-as projectile (handle->process (-> arg0 last-target))) root root-prim prim-core collide-as))
)
(< (vector-dot s4-0 s3-0) 0.0)
)
(go (method-of-object arg0 dissipate))
)
(vector-deg-slerp (-> arg0 root transv) s3-0 s4-0 (-> arg0 tween))
(vector-normalize! (-> arg0 root transv) f30-0)
)
(let ((v1-26 (-> arg0 root transv)))
(.lvf vf4 (&-> (-> arg0 root transv) quad))
(.lvf vf5 (&-> s5-1 quad))
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-26 quad) vf6)
)
)
(vector-v++! (-> arg0 root transv) (compute-acc-due-to-gravity (-> arg0 root) (new-stack-vector0) 0.0))
(if (< (-> arg0 max-speed) (vector-length (-> arg0 root transv)))
(vector-normalize! (-> arg0 root transv) (-> arg0 max-speed))
)
(if (logtest? (-> arg0 options) (projectile-options po0))
(set! (-> arg0 root transv y) -40960.0)
)
0
(none)
)
)
;; WARN: new jak 2 until loop case, check carefully
(defbehavior projectile-base-code projectile ()
(until #f
(projectile-method-55 self)
(projectile-method-58 self 3)
(suspend)
)
#f
)
(defstate moving (projectile)
:virtual #t
:event projectile-event-handler
:exit (behavior ()
(projectile-method-59 self)
)
:trans (behavior ()
(if (time-elapsed? (-> self spawn-time) (-> self timeout))
(go-virtual dissipate)
)
(let ((t9-1 (-> self pick-target)))
(if t9-1
(t9-1 self)
)
)
(let ((t9-2 (-> self update-velocity)))
(if t9-2
(t9-2 self)
)
)
(when (logtest? (-> self options) (projectile-options po1))
(seek! (-> self tween) 1.0 (* 0.5 (seconds-per-frame)))
(let ((f0-4 (vector-vector-distance (-> self root trans) (-> self target-pos))))
(cond
((< f0-4 20480.0)
(seek! (-> self tween) 1.0 (* 3.0 (seconds-per-frame)))
)
((< f0-4 40960.0)
(seek! (-> self tween) 1.0 (seconds-per-frame))
)
)
)
)
(let ((gp-0 (-> self root)))
(set! (-> self pre-move-transv quad) (-> gp-0 transv quad))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(set! (-> s5-0 quad) (-> gp-0 trans quad))
((-> self move) self)
(projectile-method-70 self)
(set! (-> self old-dist (-> self old-dist-count)) (* 0.0625 (vector-vector-distance s5-0 (-> gp-0 trans))))
)
)
(set! (-> self old-dist-count) (logand (+ (-> self old-dist-count) 1) 15))
(let ((f0-14 0.0))
(countdown (v1-38 16)
(+! f0-14 (-> self old-dist v1-38))
)
(if (or (and (logtest? (-> self options) (projectile-options po4))
(and (logtest? (-> self root status) (collide-status touch-wall)) (< f0-14 2048.0))
)
(< f0-14 (-> self stop-speed))
)
(projectile-method-63 self)
)
)
)
:code projectile-base-code
)
(defstate impact (projectile)
:virtual #t
:event projectile-event-handler
:enter (behavior ()
(projectile-method-56 self)
(projectile-method-58 self 1)
)
:code (behavior ()
(suspend)
(go-virtual die)
)
)
(defstate dissipate (projectile)
:virtual #t
:event projectile-event-handler
:enter (behavior ()
(projectile-method-57 self)
(projectile-method-58 self 2)
)
:code (behavior ()
(suspend)
(go-virtual die)
)
)
(defstate die (projectile)
:virtual #t
:code (behavior ()
(let ((v1-0 (-> self notify-handle)))
(send-event (handle->process v1-0) 'notify 'die)
)
(process-drawable-method-44 self)
)
)
(defmethod projectile-method-61 ((this projectile))
0
(none)
)
(defmethod projectile-method-60 ((this projectile))
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction) cshape-reaction-projectile)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(let ((v1-6 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-6 prim-core collide-as) (collide-spec projectile))
(set! (-> v1-6 prim-core collide-with)
(collide-spec backgnd crate civilian enemy obstacle vehicle-sphere hit-by-others-list pusher)
)
(set! (-> v1-6 prim-core action) (collide-action solid))
(set-vector! (-> v1-6 local-sphere) 0.0 5324.8 0.0 5324.8)
(set! (-> s5-0 total-prims) (the-as uint 1))
(set! (-> s5-0 root-prim) v1-6)
)
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
(let ((v1-9 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with))
)
(set! (-> s5-0 max-iteration-count) (the-as uint 2))
(set! (-> s5-0 event-self) 'touched)
(set! (-> this root) s5-0)
)
(set! (-> this root pat-ignore-mask) (new 'static 'pat-surface
:noentity #x1
:nogrind #x1
:nojak #x1
:probe #x1
:noproj #x1
:noendlessfall #x1
:board #x1
)
)
0
(none)
)
(defmethod projectile-method-62 ((this projectile))
(go (method-of-object this moving))
0
(none)
)
;; WARN: Return type mismatch object vs none.
(defmethod projectile-method-63 ((this projectile))
(if (not (and (-> this next-state) (= (-> this next-state name) 'impact)))
(go (method-of-object this impact))
)
(none)
)
(defmethod deactivate ((this projectile))
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
(projectile-method-59 this)
((method-of-type process-drawable deactivate) this)
(none)
)
(defmethod projectile-method-71 ((this projectile))
32
)
;; WARN: Return type mismatch int vs object.
(defbehavior projectile-init-by-other projectile ((arg0 projectile-init-by-other-params))
(let ((a1-0 (projectile-method-71 self)))
(stack-size-set! (-> self main-thread) a1-0)
)
(logclear! (-> self mask) (process-mask actor-pause))
(process-entity-set! self (-> arg0 ent))
(set! (-> self charge-level) (-> arg0 charge))
(set! (-> self options) (-> arg0 options))
(set! (-> self notify-handle) (-> arg0 notify-handle))
(set! (-> self owner-handle) (-> arg0 owner-handle))
(set! (-> self ignore-handle) (-> arg0 ignore-handle))
(set! (-> self attack-id) (-> arg0 attack-id))
(set! (-> self damage) (-> arg0 damage))
(set! (-> self vehicle-damage-factor) (-> arg0 vehicle-damage-factor))
(set! (-> self vehicle-impulse-factor) (-> arg0 vehicle-impulse-factor))
(set! (-> self attack-mode) #f)
(set! (-> self max-speed) 40960.0)
(set! (-> self tween) 1.0)
(set! (-> self last-target) (the-as handle #f))
(set! (-> self timeout) (-> arg0 timeout))
(set! (-> self max-hits) 1)
(set-time! (-> self spawn-time))
(set! (-> self update-velocity) #f)
(set! (-> self move) projectile-move-fill-line-sphere)
(set! (-> self pick-target) #f)
(set! (-> self stop-speed) 204.8)
(set! (-> self desired-target) (-> arg0 target-handle))
(set! (-> self wpn-type) (-> arg0 wpn-type))
(set! (-> self desired-target-pos quad) (-> arg0 target-pos quad))
(countdown (v1-21 16)
(set! (-> self old-dist v1-21) 4095996000.0)
)
(logior! (-> self options) (projectile-options po4))
(projectile-method-60 self)
(let ((s5-0 (-> self root)))
(when (type? s5-0 collide-shape-moving)
(set! (-> self root dynam gravity y) 1228800.0)
(set! (-> self root dynam gravity-length) 1228800.0)
(set! (-> self root dynam gravity-max) 1228800.0)
)
(logior! (-> self mask) (process-mask projectile))
(logclear! (-> self mask) (process-mask enemy))
(set! (-> s5-0 trans quad) (-> arg0 pos quad))
(set! (-> self starting-pos quad) (-> arg0 pos quad))
(quaternion-identity! (the-as quaternion (-> s5-0 rot)))
(vector-identity! (-> s5-0 scale))
(set! (-> s5-0 transv quad) (-> arg0 vel quad))
(set! (-> self pre-move-transv quad) (-> arg0 vel quad))
(vector-normalize-copy! (-> self starting-dir) (-> arg0 vel) 1.0)
(vector+float*! (-> self base-target-pos) (-> s5-0 trans) (-> self starting-dir) 2048000.0)
)
(set! (-> self target-pos quad) (-> self base-target-pos quad))
(set! (-> self event-hook) projectile-event-handler)
(projectile-method-61 self)
(update-transforms (-> self root))
(projectile-method-54 self)
(projectile-method-58 self 0)
(when (logtest? (-> self options) (projectile-options po15))
(if (projectile-method-69 self)
(go-virtual impact)
)
)
(projectile-method-62 self)
0
)
(defbehavior projectile-bounce-update-velocity projectile ((arg0 projectile-bounce))
(set! (-> arg0 root transv y) (- (-> arg0 root transv y) (* (-> arg0 gravity) (seconds-per-frame))))
0
(none)
)
(defmethod projectile-bounce-method-74 ((this projectile-bounce))
0
(none)
)
(defmethod projectile-method-71 ((this projectile-bounce))
256
)
(defbehavior projectile-bounce-falling-post projectile-bounce ()
(let ((gp-0 (-> self root))
(s4-0 (new 'stack-no-clear 'collide-query))
(s5-0 (new 'stack-no-clear 'vector))
)
(projectile-bounce-update-velocity self)
(set! (-> s5-0 quad) (-> gp-0 trans quad))
(vector-v++! s5-0 (-> gp-0 transv))
(when (find-ground
gp-0
s4-0
(collide-spec backgnd crate obstacle hit-by-others-list pusher)
4096.0
81920.0
1024.0
(the-as process #f)
)
(let ((f30-0 (+ (-> gp-0 gspot-pos y) (-> self root root-prim local-sphere w))))
(when (>= f30-0 (-> s5-0 y))
(projectile-bounce-method-74 self)
(set! (-> s5-0 y) f30-0)
(vector-reset! (-> gp-0 transv))
)
)
)
(move-to-point! gp-0 s5-0)
)
(transform-post)
0
(none)
)
(defstate sitting (projectile-bounce)
:virtual #t
:event projectile-event-handler
:trans (behavior ()
(projectile-bounce-method-73 self)
(if (time-elapsed? (-> self spawn-time) (-> self timeout))
(go-virtual impact)
)
)
:code sleep-code
:post projectile-bounce-falling-post
)
(defmethod projectile-bounce-method-73 ((this projectile-bounce))
0
(none)
)
(defstate dissipate (projectile-bounce)
:virtual #t
:enter (behavior ()
(go-virtual impact)
)
)
;; WARN: Return type mismatch object vs none.
(defmethod projectile-method-63 ((this projectile-bounce))
(go (method-of-object this sitting))
(none)
)
(defmethod projectile-method-55 ((this projectile-bounce))
(ja-post)
0
(none)
)
(defun projectile-bounce-move ((arg0 projectile-bounce))
(seek-toward-heading-vec! (-> arg0 root) (-> arg0 root transv) 131072.0 (seconds 0.1))
(quaternion*!
(the-as quaternion (-> arg0 root rot))
(the-as quaternion (-> arg0 root rot))
(-> arg0 tumble-quat)
)
(projectile-move-fill-all-dirs arg0)
(none)
)
(defun projectile-bounce-reaction ((arg0 collide-shape-moving) (arg1 collide-query) (arg2 vector) (arg3 vector))
(cshape-reaction-update-state arg0 arg1 arg3)
(let ((f30-0 (vector-dot arg3 (-> arg0 surface-normal)))
(s2-0 (new 'stack-no-clear 'vector))
)
(vector-float*! s2-0 (-> arg0 surface-normal) (* f30-0 (rand-vu-float-range 1.6 2.2)))
(vector-! arg2 arg3 s2-0)
)
(-> arg0 status)
)
;; WARN: Return type mismatch time-frame vs none.
(defmethod projectile-method-70 ((this projectile-bounce))
(let* ((a2-0 (-> this root))
(v1-0 (-> a2-0 status))
)
(if (logtest? v1-0 (collide-status touch-surface))
(vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.6)
)
(if (and (logtest? v1-0 (collide-status impact-surface))
(time-elapsed? (-> this played-bounce-time) (seconds 0.3))
)
(set-time! (-> this played-bounce-time))
)
)
(none)
)
(defmethod projectile-method-60 ((this projectile-bounce))
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction) projectile-bounce-reaction)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(set! (-> s5-0 penetrate-using) (penetrate jak-dark-shot))
(let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-7 prim-core action) (collide-action solid))
(set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 819.2)
(set! (-> s5-0 total-prims) (the-as uint 1))
(set! (-> s5-0 root-prim) v1-7)
)
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
(let ((v1-10 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with))
)
(set! (-> s5-0 max-iteration-count) (the-as uint 2))
(set! (-> s5-0 event-self) 'touched)
(set! (-> this root) s5-0)
)
(set-collide-with!
(-> this root)
(collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher)
)
(set-collide-as! (-> this root) (collide-spec projectile))
(set! (-> this root pat-ignore-mask) (new 'static 'pat-surface
:noentity #x1
:nogrind #x1
:nojak #x1
:probe #x1
:noproj #x1
:noendlessfall #x1
:board #x1
)
)
(none)
)
(defmethod projectile-method-61 ((this projectile-bounce))
(set! (-> this max-speed) 450560.0)
(set! (-> this timeout) (seconds 1.6))
(set! (-> this update-velocity) projectile-bounce-update-velocity)
(set! (-> this move) projectile-bounce-move)
(set! (-> this gravity) 184320.0)
(set! (-> this root dynam gravity y) 184320.0)
(set! (-> this root dynam gravity-length) 184320.0)
(set! (-> this root dynam gravity-max) 184320.0)
(let ((f0-5 1092.2667))
(quaternion-axis-angle! (-> this tumble-quat) 1.0 0.0 0.0 f0-5)
)
0
(none)
)
+6 -2
View File
@@ -189,8 +189,12 @@ This can be either an art container containing more arts, or an actual art thing
)
)
;; type art-mesh-anim is defined here, but it is unknown to the decompiler
;; og:preserve-this
(deftype art-mesh-anim (art-element)
"An unused mesh animation."
((data basic :dynamic))
:flag-assert #xe00000030
)
(deftype art-joint-anim (art-element)
"Art for a joint animation. Also contains the eye animation."
+21
View File
@@ -7,3 +7,24 @@
;; DECOMP BEGINS
(defenum anim-tester-flags
:bitfield #t
:type int32
(fanimt0)
(fanimt1)
(fanimt2)
(fanimt3)
(fanimt4)
(fanimt5)
)
;; added, still referenced in default-menu
(deftype anim-tester (process-focusable)
((flags anim-tester-flags :offset-assert 256)
;; (obj-list glst-list :inline :offset-assert 260)
;; (current-obj string :offset-assert 276)
(pad uint32 5)
(speed int32 :offset-assert 280)
)
)
+2 -42
View File
@@ -356,7 +356,7 @@
)
;; WARN: Return type mismatch symbol vs object.
(defun-debug add-debug-flat-triangle-noclip ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 int))
(defun-debug add-debug-flat-triangle-noclip ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 int))
(if (not (or arg0 *display-capture-mode*))
(return (the-as object #f))
)
@@ -372,7 +372,7 @@
(transform-point-qword! (-> s5-0 2) (the-as vector (-> s5-0 8)))
)
(with-dma-buffer-add-bucket ((v1-15 (-> *display* frames (-> *display* on-screen) debug-buf))
(the-as bucket-id arg1)
arg1
)
(let ((a0-12 (-> v1-15 base)))
(let* ((a1-4 v1-15)
@@ -1871,43 +1871,3 @@
0
(none)
)
;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count]
;; ERROR: Unsupported inline assembly instruction kind - [mfc0 a1, Count]
(defun-debug cpu-delay ((arg0 uint))
(local-vars (v1-2 int) (a1-0 int) (a1-1 int))
0
0
(.mfc0 v1-2 Count)
(until (>= (the-as uint a1-1) arg0)
(.mfc0 a1-0 Count)
(nop!)
(set! a1-1 (- a1-0 v1-2))
(nop!)
)
0
(none)
)
;; ERROR: Unsupported inline assembly instruction kind - [mfc0 a0, Count]
;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count]
(defun-debug qword-read-time ((arg0 (pointer uint128)) (arg1 int))
(local-vars (v1-1 int) (a0-1 int))
(let ((v1-0 (shr arg1 2))
(a1-1 arg0)
)
(.mfc0 a0-1 Count)
(until (zero? v1-0)
(-> a1-1 0)
(+! v1-0 -1)
(-> a1-1 1)
(nop!)
(-> a1-1 2)
(nop!)
(-> a1-1 3)
(set! a1-1 (&-> a1-1 4))
)
)
(.mfc0 v1-1 Count)
(- v1-1 a0-1)
)
File diff suppressed because it is too large. Load diff
+124 -141
View File
@@ -132,6 +132,14 @@
;; ---editable-flag
(declare-type editable-plane editable)
(declare-type editable-array basic)
(declare-type editable-region basic)
(define-extern sqlpipe-query (function string sql-result))
(define-extern old-sql-query function)
(define-extern sql-query (function string sql-result))
(define-extern *editable-sample-region* editable-region)
(define-extern *editable-light-region* editable-region)
(define-extern *editable-entity-region* editable-region)
;; DECOMP BEGINS
@@ -447,10 +455,10 @@
)
(:methods
(new (symbol type) _type_)
(editable-region-method-9 () none)
(editable-region-method-10 () none)
(editable-region-method-11 () none)
(editable-region-method-12 () none)
(save-region! (_type_ editable-array int int) symbol)
(editable-region-method-10 (_type_ int) symbol)
(print-region-info (_type_ vector int) none)
(editable-region-method-12 (_type_) editable-filter)
)
)
@@ -464,33 +472,33 @@
(prefix basic)
)
(:methods
(editable-method-9 () none)
(editable-method-10 () none)
(editable-method-11 () none)
(editable-method-12 () none)
(editable-method-13 () none)
(editable-method-14 () none)
(editable-method-15 () none)
(editable-method-16 () none)
(editable-method-17 () none)
(editable-method-18 () none)
(editable-method-19 () none)
(editable-method-20 () none)
(editable-method-21 () none)
(editable-method-22 () none)
(editable-method-23 () none)
(editable-method-24 () none)
(editable-method-25 () none)
(editable-method-26 () none)
(editable-method-27 () none)
(editable-method-28 () none)
(editable-method-29 () none)
(editable-method-30 () none)
(editable-method-31 () none)
(editable-method-32 () none)
(editable-method-33 () none)
(editable-method-34 () none)
(editable-method-35 () none)
(get-color (_type_) rgba)
(editable-method-10 (_type_) none)
(editable-method-11 (_type_ vector) symbol)
(set-selected! (_type_ symbol) none)
(editable-method-13 (_type_ vector) float)
(editable-method-14 (_type_ vector vector) float)
(editable-method-15 (_type_) vector)
(editable-method-16 (_type_) float)
(editable-method-17 (_type_ vector editable-flag) none)
(editable-method-18 (_type_ vector int) none)
(editable-method-19 (_type_ vector) none)
(editable-method-20 (_type_ vector matrix) none)
(editable-method-21 (_type_ vector) none)
(editable-method-22 (_type_ vector vector vector vector) none)
(change-region! (_type_ editable-region) none)
(editable-method-24 (_type_ editable-array int int) symbol)
(editable-method-25 (_type_) symbol)
(editable-method-26 (_type_) none)
(delete! (_type_ editable) none)
(editable-method-28 (_type_ editable editable) none)
(copy-into-editable-array! (_type_ editable-array) editable)
(editable-method-30 (_type_ editable-flag) none)
(editable-method-31 (_type_ editable-flag) none)
(get-null-vec (_type_) vector)
(get-null-vec2 (_type_ vector) vector)
(get-level-offset (_type_ editable-array) vector)
(editable-method-35 (_type_ vector) none)
)
)
@@ -520,17 +528,17 @@
)
(:methods
(new (symbol type int) _type_)
(editable-array-method-9 () none)
(editable-array-method-10 () none)
(editable-array-method-11 () none)
(editable-array-method-12 () none)
(editable-array-method-13 () none)
(editable-array-method-14 () none)
(editable-array-method-15 () none)
(editable-array-method-16 () none)
(editable-array-method-17 () none)
(editable-array-method-18 () none)
(editable-array-method-19 () none)
(handle-cmd (_type_ editable-command mouse-info object) symbol)
(editable-array-method-10 (_type_ vector int) editable)
(editable-array-method-11 (_type_ vector vector int) none)
(get-length (_type_) int)
(editable-array-method-13 (_type_ symbol) symbol)
(set-target-fields! (_type_ editable-command editable-command string) none)
(editable-array-method-15 (_type_ (function editable editable-region symbol) editable-region) (array editable))
(editable-array-method-16 (_type_ editable) none)
(editable-array-method-17 (_type_) none)
(editable-array-method-18 (_type_ vector vector) vector)
(editable-array-method-19 (_type_ string) symbol)
)
)
@@ -589,21 +597,16 @@
(set! (-> gp-0 region) #f)
(set! (-> gp-0 name) "undefined")
(set! (-> gp-0 prefix) "undefined")
(let* ((s3-0 gp-0)
(s2-0 (method-of-object s3-0 editable-method-23))
)
(set! arg1 (cond
(arg1
(empty)
arg1
)
(else
(new 'debug 'editable-region)
)
)
)
(s2-0)
)
(change-region! gp-0 (cond
(arg1
(empty)
arg1
)
(else
(new 'debug 'editable-region)
)
)
)
(set! (-> gp-0 trans quad) (-> arg0 quad))
(set! (-> gp-0 radius) 2048.0)
(set! (-> gp-0 owner) '())
@@ -624,21 +627,16 @@
(set! (-> s5-0 region) #f)
(set! (-> s5-0 name) "undefined")
(set! (-> s5-0 prefix) "undefined")
(let* ((s2-0 s5-0)
(s1-0 (method-of-object s2-0 editable-method-23))
)
(set! arg2 (cond
(arg2
(empty)
arg2
)
(else
(new 'debug 'editable-region)
)
)
)
(s1-0)
)
(change-region! s5-0 (cond
(arg2
(empty)
arg2
)
(else
(new 'debug 'editable-region)
)
)
)
(set! (-> s5-0 trans quad) (-> arg0 quad))
(set! (-> s5-0 radius) arg1)
(set! (-> s5-0 owner) '())
@@ -675,21 +673,16 @@
(defmethod new editable-light ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region))
(let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> gp-0 region) #f)
(let* ((s2-0 gp-0)
(s1-0 (method-of-object s2-0 editable-method-23))
)
(set! arg2 (cond
(arg2
(empty)
arg2
)
(else
(new 'debug 'editable-region)
)
)
)
(s1-0)
)
(change-region! gp-0 (cond
(arg2
(empty)
arg2
)
(else
(new 'debug 'editable-region)
)
)
)
(set! (-> gp-0 trans quad) (-> arg0 quad))
(set! (-> gp-0 radius) arg1)
(set! (-> gp-0 owner) '())
@@ -720,7 +713,8 @@
)
(:methods
(new (symbol type vector float editable-region) _type_)
(editable-entity-method-36 () none)
(editable-entity-method-36 (_type_) none)
(copy-into-editable-array! (_type_ editable-array) editable-entity :replace)
)
)
@@ -728,21 +722,16 @@
(defmethod new editable-entity ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region))
(let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> gp-0 region) #f)
(let* ((s2-0 gp-0)
(s1-0 (method-of-object s2-0 editable-method-23))
)
(set! arg2 (cond
(arg2
(empty)
arg2
)
(else
(new 'debug 'editable-region)
)
)
)
(s1-0)
)
(change-region! gp-0 (cond
(arg2
(empty)
arg2
)
(else
(new 'debug 'editable-region)
)
)
)
(set! (-> gp-0 trans quad) (-> arg0 quad))
(set! (-> gp-0 radius) arg1)
(set! (-> gp-0 owner) '())
@@ -760,8 +749,9 @@
)
(:methods
(new (symbol type editable-region) _type_)
(editable-face-method-36 () none)
(editable-face-method-37 () none)
(editable-face-method-36 (_type_ (inline-array vector)) int)
(editable-face-method-37 (_type_ vector) vector)
(copy-into-editable-array! (_type_ editable-array) editable-face :replace)
)
)
@@ -771,21 +761,16 @@
(set! (-> gp-0 region) #f)
(set! (-> gp-0 name) "undefined")
(set! (-> gp-0 prefix) "undefined")
(let* ((s4-0 gp-0)
(s3-0 (method-of-object s4-0 editable-method-23))
)
(set! arg0 (cond
(arg0
(empty)
arg0
)
(else
(new 'debug 'editable-region)
)
)
)
(s3-0)
)
(change-region! gp-0 (cond
(arg0
(empty)
arg0
)
(else
(new 'debug 'editable-region)
)
)
)
(set! (-> gp-0 owner) '())
gp-0
)
@@ -798,8 +783,9 @@
)
(:methods
(new (symbol type editable-region) _type_)
(editable-plane-method-36 () none)
(editable-plane-method-37 () none)
(editable-plane-method-36 (_type_ (inline-array vector)) int)
(editable-plane-method-37 (_type_ vector) vector)
(copy-into-editable-array! (_type_ editable-array) editable-plane :replace)
)
)
@@ -809,21 +795,16 @@
(set! (-> gp-0 region) #f)
(set! (-> gp-0 name) "undefined")
(set! (-> gp-0 prefix) "undefined")
(let* ((s4-0 gp-0)
(s3-0 (method-of-object s4-0 editable-method-23))
)
(set! arg0 (cond
(arg0
(empty)
arg0
)
(else
(new 'debug 'editable-region)
)
)
)
(s3-0)
)
(change-region! gp-0 (cond
(arg0
(empty)
arg0
)
(else
(new 'debug 'editable-region)
)
)
)
(set! (-> gp-0 owner) '())
(set! (-> gp-0 radius) 20480.0)
gp-0
@@ -853,11 +834,13 @@
(float-min float)
(float-id uint32)
)
(:state-methods
idle
)
(:methods
(editable-player-method-50 () none)
(editable-player-method-51 () none)
(editable-player-method-52 () none)
(editable-player-method-53 () none)
(editable-player-method-21 (_type_) none)
(editable-player-method-22 (_type_) none)
(editable-player-method-23 (_type_) symbol)
)
)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -25,6 +25,7 @@
:type uint32
(manip-mode0 0)
(manip-mode1 1)
(manip-mode2 2)
)
;; ---manipulator-mode
@@ -153,7 +154,7 @@
(.mul.x.vf.xyz acc vf5 vf7)
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
(.svf (&-> sv-288 quad) vf6)
(sv-176 (the-as vector sv-192) (the-as vector sv-208) sv-224 sv-256 sv-288 (the-as int arg4))
(sv-176 sv-192 (the-as bucket-id sv-208) sv-224 sv-256 sv-288 (the-as int arg4))
)
)
)
+555
View File
@@ -5,5 +5,560 @@
;; name in dgo: memory-usage
;; dgos: ENGINE, GAME
(define-extern *max-dma* int)
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(defmethod mem-usage ((this object) (usage memory-usage-block) (flags int))
this
)
(defmethod calculate-total ((this memory-usage-block))
(let ((v0-0 0))
(dotimes (v1-0 (-> this length))
(+! v0-0 (-> this data v1-0 total))
)
v0-0
)
)
(defmethod reset! ((this memory-usage-block))
(set! (-> this length) 0)
(dotimes (v1-0 112)
(set! (-> this data v1-0 used) 0)
(set! (-> this data v1-0 total) 0)
(set! (-> this data v1-0 count) 0)
)
this
)
(defun mem-size ((arg0 basic) (arg1 symbol) (arg2 int))
(let ((gp-0 (new 'stack 'memory-usage-block)))
(mem-usage arg0 gp-0 arg2)
(if arg1
(inspect gp-0)
)
(calculate-total gp-0)
)
)
(defmethod compute-memory-usage! ((this level) (arg0 symbol))
(if (zero? (-> this mem-usage-block))
(set! (-> this mem-usage-block) (new 'debug 'memory-usage-block))
)
(set! arg0 (or (zero? (-> this mem-usage-block length)) arg0))
(when arg0
(mem-usage this (reset! (-> this mem-usage-block)) 0)
(set! (-> this mem-usage) (calculate-total (-> this mem-usage-block)))
0
)
(-> this mem-usage-block)
)
(defmethod mem-usage ((this process-tree) (usage memory-usage-block) (flags int))
(let ((s3-0 90))
(let* ((s2-0 *dead-pool-list*)
(a0-1 (car s2-0))
)
(while (not (null? s2-0))
(set! (-> usage data s3-0 name) (symbol->string-debug (the-as symbol a0-1)))
(+! s3-0 1)
(set! s2-0 (cdr s2-0))
(set! a0-1 (car s2-0))
)
)
(set! (-> usage length) (max (-> usage length) s3-0))
)
(set! (-> usage data 96 name) "*debug-dead-pool*")
(set! *temp-mem-usage* usage)
(when (logtest? flags 32)
(let* ((s5-1 90)
(s4-1 *dead-pool-list*)
(v1-10 (car s4-1))
)
(while (not (null? s4-1))
(let ((a0-4 (-> (the-as symbol v1-10) value)))
(set! *global-search-count* s5-1)
(iterate-process-tree
(the-as process-tree a0-4)
(lambda ((arg0 basic))
(let ((gp-0 *temp-mem-usage*)
(s5-0 *global-search-count*)
)
(+! (-> gp-0 data s5-0 used) 1)
(+! (-> gp-0 data s5-0 total) (logand -16 (+ (asize-of arg0) 15)))
)
#t
)
*null-kernel-context*
)
)
(+! s5-1 1)
(set! s4-1 (cdr s4-1))
(set! v1-10 (car s4-1))
)
)
)
(iterate-process-tree
this
(lambda ((arg0 process-drawable))
(let ((gp-0 *temp-mem-usage*))
(let ((s4-0 (cond
((= (-> arg0 pool) *16k-dead-pool*)
92
)
((= (-> arg0 pool) *nk-dead-pool*)
93
)
((= (-> arg0 pool) *target-dead-pool*)
94
)
((= (-> arg0 pool) *camera-dead-pool*)
95
)
((= (-> arg0 pool) *debug-dead-pool*)
96
)
(else
90
)
)
)
)
(+! (-> gp-0 data s4-0 count) 1)
(+! (-> gp-0 data s4-0 total) (logand -16 (+ (asize-of arg0) 15)))
)
(set! (-> gp-0 length) (max 98 (-> gp-0 length)))
(set! (-> gp-0 data 97 name) "process-active")
(+! (-> gp-0 data 97 count) 1)
(let ((v1-22 (asize-of arg0)))
(+! (-> gp-0 data 97 used) v1-22)
(+! (-> gp-0 data 97 total) (logand -16 (+ v1-22 15)))
)
(set! (-> gp-0 length) (max 99 (-> gp-0 length)))
(set! (-> gp-0 data 98 name) "heap-total")
(+! (-> gp-0 data 98 count) 1)
(let ((v1-33 (+ (- -4 (the-as int arg0)) (the-as int (-> arg0 heap-cur)))))
(+! (-> gp-0 data 98 used) v1-33)
(+! (-> gp-0 data 98 total) (logand -16 (+ v1-33 15)))
)
(set! (-> gp-0 length) (max 100 (-> gp-0 length)))
(set! (-> gp-0 data 99 name) "heap-process")
(+! (-> gp-0 data 99 count) 1)
(let ((v1-44 (- (-> arg0 type size) (-> arg0 type heap-base))))
(+! (-> gp-0 data 99 used) v1-44)
(+! (-> gp-0 data 99 total) (logand -16 (+ v1-44 15)))
)
(set! (-> gp-0 length) (max 101 (-> gp-0 length)))
(set! (-> gp-0 data 100 name) "heap-header")
(+! (-> gp-0 data 100 count) 1)
(let ((v1-54 (-> arg0 type heap-base)))
(+! (-> gp-0 data 100 used) v1-54)
(+! (-> gp-0 data 100 total) (logand -16 (+ v1-54 15)))
)
(set! (-> gp-0 length) (max 102 (-> gp-0 length)))
(set! (-> gp-0 data 101 name) "heap-thread")
(+! (-> gp-0 data 101 count) 1)
(let ((v1-64 (asize-of (-> arg0 main-thread))))
(+! (-> gp-0 data 101 used) v1-64)
(+! (-> gp-0 data 101 total) (logand -16 (+ v1-64 15)))
)
(when (type? arg0 process-drawable)
(when (nonzero? (-> arg0 root))
(set! (-> gp-0 length) (max 103 (-> gp-0 length)))
(set! (-> gp-0 data 102 name) "heap-root")
(+! (-> gp-0 data 102 count) 1)
(let ((v1-77 (asize-of (-> arg0 root))))
(+! (-> gp-0 data 102 used) v1-77)
(+! (-> gp-0 data 102 total) (logand -16 (+ v1-77 15)))
)
(when (type? (-> arg0 root) collide-shape)
(set! (-> gp-0 length) (max 109 (-> gp-0 length)))
(set! (-> gp-0 data 108 name) "heap-collide-prim")
(+! (-> gp-0 data 108 count) 1)
(let ((v1-89 (asize-of (-> (the-as collide-shape-moving (-> arg0 root)) root-prim))))
(+! (-> gp-0 data 108 used) v1-89)
(+! (-> gp-0 data 108 total) (logand -16 (+ v1-89 15)))
)
)
)
(when (nonzero? (-> arg0 node-list))
(set! (-> gp-0 length) (max 106 (-> gp-0 length)))
(set! (-> gp-0 data 105 name) "heap-cspace")
(+! (-> gp-0 data 105 count) 1)
(let ((v1-101 (asize-of (-> arg0 node-list))))
(+! (-> gp-0 data 105 used) v1-101)
(+! (-> gp-0 data 105 total) (logand -16 (+ v1-101 15)))
)
)
(when (nonzero? (-> arg0 draw))
(set! (-> gp-0 length) (max 104 (-> gp-0 length)))
(set! (-> gp-0 data 103 name) "heap-draw-control")
(+! (-> gp-0 data 103 count) 1)
(let ((v1-113 (asize-of (-> arg0 draw))))
(+! (-> gp-0 data 103 used) v1-113)
(+! (-> gp-0 data 103 total) (logand -16 (+ v1-113 15)))
)
(when (nonzero? (-> arg0 draw skeleton))
(set! (-> gp-0 length) (max 107 (-> gp-0 length)))
(set! (-> gp-0 data 106 name) "heap-bone")
(+! (-> gp-0 data 106 count) 1)
(let ((v1-127 (asize-of (-> arg0 draw skeleton))))
(+! (-> gp-0 data 106 used) v1-127)
(+! (-> gp-0 data 106 total) (logand -16 (+ v1-127 15)))
)
)
)
(when (nonzero? (-> arg0 skel))
(set! (-> gp-0 length) (max 105 (-> gp-0 length)))
(set! (-> gp-0 data 104 name) "heap-joint-control")
(+! (-> gp-0 data 104 count) 1)
(let ((v1-139 (asize-of (-> arg0 skel))))
(+! (-> gp-0 data 104 used) v1-139)
(+! (-> gp-0 data 104 total) (logand -16 (+ v1-139 15)))
)
)
(when (nonzero? (-> arg0 part))
(set! (-> gp-0 length) (max 108 (-> gp-0 length)))
(set! (-> gp-0 data 107 name) "heap-part")
(+! (-> gp-0 data 107 count) 1)
(let ((v1-151 (asize-of (-> arg0 part))))
(+! (-> gp-0 data 107 used) v1-151)
(+! (-> gp-0 data 107 total) (logand -16 (+ v1-151 15)))
)
)
(when (nonzero? (-> arg0 nav))
(set! (-> gp-0 length) (max 110 (-> gp-0 length)))
(set! (-> gp-0 data 109 name) "heap-misc")
(+! (-> gp-0 data 109 count) 1)
(let ((v1-163 (asize-of (-> arg0 nav))))
(+! (-> gp-0 data 109 used) v1-163)
(+! (-> gp-0 data 109 total) (logand -16 (+ v1-163 15)))
)
)
(when (nonzero? (-> arg0 path))
(set! (-> gp-0 length) (max 110 (-> gp-0 length)))
(set! (-> gp-0 data 109 name) "heap-misc")
(+! (-> gp-0 data 109 count) 1)
(let ((v1-175 (asize-of (-> arg0 path))))
(+! (-> gp-0 data 109 used) v1-175)
(+! (-> gp-0 data 109 total) (logand -16 (+ v1-175 15)))
)
)
(when (nonzero? (-> arg0 vol))
(set! (-> gp-0 length) (max 110 (-> gp-0 length)))
(set! (-> gp-0 data 109 name) "heap-misc")
(+! (-> gp-0 data 109 count) 1)
(let ((v1-187 (asize-of (-> arg0 vol))))
(+! (-> gp-0 data 109 used) v1-187)
(+! (-> gp-0 data 109 total) (logand -16 (+ v1-187 15)))
)
)
)
)
#t
)
*null-kernel-context*
)
this
)
(defmethod print-mem-usage ((this memory-usage-block) (arg0 level) (arg1 object))
(let ((s3-0 (&- (-> arg0 heap current) (the-as uint (-> arg0 heap base)))))
(let ((v1-2 (+ (-> this data 61 total) (-> this data 62 total))))
(< #x10000 v1-2)
)
(let* ((v1-4 (-> arg0 info memory-mode))
(v1-5 (cond
((= v1-4 (level-memory-mode borrow0))
#xbd0000
)
((= v1-4 (level-memory-mode micro))
#x9d8000
)
((= v1-4 (level-memory-mode tiny))
#x4ec000
)
((= v1-4 (level-memory-mode tiny-edge))
#x2f4000
)
((= v1-4 (level-memory-mode tiny-center))
#x1f8000
)
((= v1-4 (level-memory-mode small-edge))
#x600000
)
((or (= v1-4 (level-memory-mode small-center))
(= v1-4 (level-memory-mode city-center))
(= v1-4 (level-memory-mode medium))
(= v1-4 (level-memory-mode large))
)
(+ (- #xc000 (the-as int (-> arg0 heap base))) (the-as int (-> arg0 heap top-base)))
)
((= v1-4 (level-memory-mode alias))
#x8c000
)
((= v1-4 (level-memory-mode borrow))
#x2f800
)
(else
#x9d8000
)
)
)
(a0-19 (-> arg0 info memory-mode))
(v1-8 (- (the-as int v1-5)
(the-as uint (if (or (= a0-19 (level-memory-mode alias)) (= a0-19 (level-memory-mode borrow)))
0
#xc000
)
)
)
)
(a0-22 0)
)
(when (-> arg0 info borrow)
(dotimes (a1-10 3)
(+! a0-22 (-> arg0 info borrow borrow-size a1-10))
)
)
(let ((s2-0 (- v1-8 (shl a0-22 10)))
(s1-0 (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) global-buf)) 16))
)
(set! *max-dma* (max s1-0 *max-dma*))
(if (< s2-0 s3-0)
(format arg1 "~3L")
)
(let* ((s0-0 format)
(sv-16 arg1)
(sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--")
(s4-1 (-> arg0 name))
(s3-1 (sar s3-0 10))
(s2-1 (sar s2-0 10))
(sv-48 (sar (memory-used *nk-dead-pool*) 10))
(t2-0 (sar (memory-total *nk-dead-pool*) 10))
(t0-0 s2-1)
(t1-0 sv-48)
)
(s0-0 sv-16 sv-32 s4-1 s3-1 t0-0 t1-0 t2-0)
(format arg1 "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10))
(when (not *stats-memory-short*)
(set! (-> *dma-mem-usage* data 87 total)
(* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16)
)
(let ((t9-7 format)
(a0-35 arg1)
(a1-16 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%")
(a2-9 (sar (+ (-> this data 58 total) (-> this data 59 total) (-> this data 60 total)) 10))
(a3-4 (sar (-> *dma-mem-usage* data 87 total) 10))
)
(t9-7 a0-35 a1-16 a2-9 a3-4 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0))
(format
arg1
" bsp-leaf-vis ~192H~5DK~%"
(sar (+ (-> this data 61 total) (-> this data 62 total)) 10)
(the-as none a3-4)
)
(format arg1 " level-code ~192H~5DK~%" (sar (-> this data 65 total) 10) (the-as none a3-4))
)
(format
arg1
" tfrag ~192H~5DK ~280Htfragment~456H~5DK~%"
(sar
(+ (-> this data 1 total)
(-> this data 2 total)
(-> this data 3 total)
(-> this data 4 total)
(-> this data 5 total)
(-> this data 6 total)
(-> this data 7 total)
(-> this data 8 total)
)
10
)
(sar (-> *dma-mem-usage* data 1 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
(format
arg1
" tie-proto ~192H~5DK ~280Hsky~456H~5DK~%"
(sar
(+ (-> this data 9 total)
(-> this data 10 total)
(-> this data 11 total)
(-> this data 12 total)
(-> this data 13 total)
(-> this data 14 total)
(-> this data 16 total)
(-> this data 17 total)
)
10
)
(sar (-> *dma-mem-usage* data 88 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
(format
arg1
" tie-instance ~192H~5DK ~280Htie-fragment~456H~5DK~%"
(sar (+ (-> this data 18 total) (-> this data 20 total) (-> this data 21 total) (-> this data 22 total)) 10)
(sar (-> *dma-mem-usage* data 9 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
(format
arg1
" shrub-proto ~192H~5DK ~280Htie-scissor~456H~5DK~%"
(sar
(+ (-> this data 25 total)
(-> this data 26 total)
(-> this data 27 total)
(-> this data 28 total)
(-> this data 29 total)
(-> this data 30 total)
(-> this data 31 total)
(-> this data 32 total)
(-> this data 33 total)
)
10
)
(sar (-> *dma-mem-usage* data 15 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
(format
arg1
" shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%"
(sar (-> this data 34 total) 10)
(sar (-> *dma-mem-usage* data 27 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
(format
arg1
" collision ~192H~5DK ~280Htie-generic~456H~5DK~%"
(sar
(+ (-> this data 50 total)
(-> this data 51 total)
(-> this data 52 total)
(-> this data 53 total)
(-> this data 54 total)
(-> this data 55 total)
(-> this data 56 total)
(-> this data 57 total)
)
10
)
(sar (-> *dma-mem-usage* data 17 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
(format
arg1
" pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%"
(sar
(+ (-> this data 35 total)
(-> this data 36 total)
(-> this data 37 total)
(-> this data 38 total)
(-> this data 39 total)
(-> this data 40 total)
(-> this data 41 total)
(-> this data 42 total)
(-> this data 73 total)
(-> this data 74 total)
(-> this data 75 total)
(-> this data 76 total)
(-> this data 78 total)
(-> this data 81 total)
(-> this data 80 total)
(-> this data 111 total)
)
10
)
(sar (-> *dma-mem-usage* data 35 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
(format
arg1
" pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%"
(sar
(+ (-> this data 67 total)
(-> this data 68 total)
(-> this data 69 total)
(-> this data 70 total)
(-> this data 71 total)
(-> this data 77 total)
(-> this data 79 total)
(-> this data 72 total)
)
10
)
(sar (-> *dma-mem-usage* data 89 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
(let ((t9-18 format)
(a0-46 arg1)
(a1-27 " textures ~192H~5DK ~280Htextures~456H~5DK~%")
(a2-75 (sar (-> this data 82 total) 10))
(a3-13 (sar (-> *dma-mem-usage* data 82 total) 10))
)
(t9-18 a0-46 a1-27 a2-75 a3-13 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0))
(format
arg1
" entity ~192H~5DK~%"
(sar
(+ (-> this data 66 total)
(-> this data 43 total)
(-> this data 44 total)
(-> this data 45 total)
(-> this data 49 total)
(-> this data 48 total)
(-> this data 46 total)
(-> this data 47 total)
)
10
)
(the-as none a3-13)
)
)
(format
arg1
" misc ~192H~5DK ~280Hsprite~456H~5DK~%"
(sar
(+ (-> this data 0 total)
(-> this data 63 total)
(-> this data 64 total)
(-> this data 83 total)
(-> this data 84 total)
)
10
)
(sar (-> *dma-mem-usage* data 85 total) 10)
(the-as none t0-0)
(the-as none t1-0)
(the-as none t2-0)
)
)
)
)
)
)
(format arg1 "~1K~0L")
this
)
+32 -27
View File
@@ -11,8 +11,9 @@
:bitfield #t
(gap 0)
(off 1)
(nmpf2 2)
(switch 2)
(user0 3)
(jump 4)
)
;; ---nav-mesh-poly-flag
@@ -24,6 +25,8 @@
)
;; ---nav-mesh-editable-flag
(declare-type nav-mesh-editable structure)
;; DECOMP BEGINS
;; this file is debug only
@@ -38,7 +41,7 @@
(set! (-> vector-array heap-base) (the-as uint 16))
(deftype int16-array (inline-array-class)
((data int16 :dynamic)
((data int16 :inline :dynamic)
)
)
@@ -54,11 +57,11 @@
(:methods
(new (symbol type) _type_)
(init-fields! (_type_) none)
(nav-mesh-poly-method-10 () none)
(nav-mesh-poly-method-11 () none)
(nav-mesh-poly-method-12 () none)
(nav-mesh-poly-method-13 () none)
(nav-mesh-poly-method-14 () none)
(nav-mesh-poly-method-10 (_type_ nav-mesh-editable) none)
(nav-mesh-poly-method-11 (_type_ int) none)
(nav-mesh-poly-method-12 (_type_ int) none)
(nav-mesh-poly-method-13 (_type_ int) int)
(nav-mesh-poly-method-14 (_type_ int int) object)
)
)
@@ -105,7 +108,7 @@
(deftype nav-mesh-tri-quad-array (inline-array-class)
((data nav-mesh-tri-quad :dynamic)
((data nav-mesh-tri-quad :inline :dynamic)
)
)
@@ -127,21 +130,21 @@
(:methods
(new (symbol type) _type_)
(init-fields! (_type_) none)
(nav-mesh-editable-method-10 () none)
(nav-mesh-editable-method-11 () none)
(nav-mesh-editable-method-12 () none)
(nav-mesh-editable-method-13 () none)
(nav-mesh-editable-method-14 () none)
(nav-mesh-editable-method-15 () none)
(nav-mesh-editable-method-16 () none)
(nav-mesh-editable-method-17 () none)
(nav-mesh-editable-method-18 () none)
(nav-mesh-editable-method-10 (_type_ symbol) none)
(add-vert! (_type_ vector) int)
(nav-mesh-editable-method-12 (_type_ vector symbol) object)
(nav-mesh-editable-method-13 (_type_) none)
(nav-mesh-editable-method-14 (_type_ vector) int)
(nav-mesh-editable-method-15 (_type_ int) object)
(nav-mesh-editable-method-16 (_type_) object)
(nav-mesh-editable-method-17 (_type_) object)
(nav-mesh-editable-method-18 (_type_) none)
)
)
(deftype nav-mesh-editable-array (inline-array-class)
((data nav-mesh-editable :dynamic)
((data nav-mesh-editable :inline :dynamic)
)
)
@@ -199,7 +202,7 @@
(deftype nav-mesh-editor-undo-array (inline-array-class)
((data nav-mesh-editor-undo :dynamic)
((data nav-mesh-editor-undo :inline :dynamic)
)
)
@@ -262,15 +265,17 @@
(hide-unselected symbol)
(allow-snap symbol)
)
(:state-methods
idle
)
(:methods
(nav-mesh-editor-method-50 () none)
(nav-mesh-editor-method-51 () none)
(nav-mesh-editor-method-52 () none)
(nav-mesh-editor-method-53 () none)
(nav-mesh-editor-method-54 () none)
(nav-mesh-editor-method-55 () none)
(nav-mesh-editor-method-56 () none)
(nav-mesh-editor-method-57 () none)
(nav-mesh-editor-method-51 (_type_) none)
(nav-mesh-editor-method-52 (_type_) none)
(set-level-info! (_type_ symbol) none)
(select-nav-mesh-by-id (_type_ int) object)
(nav-mesh-editor-method-55 (_type_) none)
(nav-mesh-editor-method-56 (_type_) none)
(nav-mesh-editor-method-57 (_type_) object)
)
)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+51
View File
@@ -5,5 +5,56 @@
;; name in dgo: sampler
;; dgos: ENGINE, GAME
(define-extern timer0-handler (function none))
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(define *sampler-mem* (the-as pointer #f))
(define *sampler-compare* (the-as uint 10))
(define *sampler-count* 0)
(define *sampler-above-range-count* 0)
;; ERROR: function was not converted to expressions. Cannot decompile.
(set! (-> (the-as timer-bank #x10000000) mode) (new 'static 'timer-mode))
(install-handler 9 timer0-handler)
(defun-debug sampler-start ()
(set! (-> (the-as timer-bank #x10000000) mode) (new 'static 'timer-mode))
(set! (-> (the-as timer-bank #x10000000) count) (the-as uint 0))
(set! (-> (the-as timer-bank #x10000000) comp) *sampler-compare*)
(if (not *sampler-mem*)
(set! *sampler-mem* (malloc 'debug #x1000000))
)
(when (nonzero? *sampler-mem*)
(mem-set32! *sampler-mem* #x400000 0)
(set! (-> (the-as timer-bank #x10000000) mode)
(new 'static 'timer-mode :clks (timer-clock-selection busclk/256) :zret #x1 :cue #x1 :cmpe #x1 :equf #x1)
)
(set! *sampler-count* 0)
(set! *sampler-above-range-count* 0)
0
)
(none)
)
(defun-debug sampler-stop ()
(set! (-> (the-as timer-bank #x10000000) mode) (new 'static 'timer-mode))
(format
0
"samples: in-range ~d above-range ~d total ~d~%"
*sampler-count*
*sampler-above-range-count*
(+ *sampler-count* *sampler-above-range-count*)
)
(set! (-> (the-as timer-bank #x10000000) mode) (new 'static 'timer-mode))
0
(none)
)
+235
View File
@@ -5,5 +5,240 @@
;; name in dgo: viewer
;; dgos: ENGINE, GAME
(declare-type viewer process-drawable)
(define-extern *viewer* viewer) ;; added
;; DECOMP BEGINS
(define *viewer-sg* (new 'static 'skeleton-group
:bounds (new 'static 'vector :w 16384.0)
:lod-dist (new 'static 'array float 6 4095996000.0 0.0 0.0 0.0 0.0 0.0)
:clothing #f
)
)
(deftype viewer (process-drawable)
((janim art-joint-anim)
)
(:states
viewer-process
)
)
(defstate viewer-process (viewer)
:code (behavior ()
(until #f
(ja-no-eval :group! (-> self janim)
:num! (seek! (the float (+ (-> self janim frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
#f
)
:post ja-post
)
(define viewer-string (new 'global 'string 64 (the-as string #f)))
(define viewer-ja-name (new 'global 'string 64 (the-as string #f)))
(define viewer-geo-name (new 'global 'string 64 (the-as string #f)))
(defun actor-get-arg! ((arg0 string) (arg1 string) (arg2 string))
(let ((s5-0 (-> arg2 data))
(gp-0 (-> arg0 data))
)
(set! (-> gp-0 0) (the-as uint 0))
(dotimes (s2-0 (- (length arg2) (+ (length arg1) 2)))
(when (= (-> s5-0 0) 45)
(let ((s1-0 #f))
(dotimes (s0-0 (length arg1))
(if (!= (-> s5-0 (+ s0-0 1)) (-> arg1 data s0-0))
(goto cfg-10)
)
)
(if (= (-> s5-0 (+ (length arg1) 1)) 45)
(set! s1-0 #t)
)
(label cfg-10)
(when s1-0
(let ((v1-22 (&+ s5-0 (+ (length arg1) 2))))
(while (and (!= (-> v1-22 0) 45) (nonzero? (-> v1-22 0)))
(set! (-> gp-0 0) (-> v1-22 0))
(set! v1-22 (&-> v1-22 1))
(set! gp-0 (&-> gp-0 1))
)
)
(set! (-> gp-0 0) (the-as uint 0))
(return #t)
)
)
)
(set! s5-0 (&-> s5-0 1))
)
)
#f
)
(defun art-part-name ((arg0 string))
(let ((gp-0 (-> arg0 data)))
(while (nonzero? (-> gp-0 0))
(when (= (-> gp-0 0) 45)
(copyn-string<-charp
viewer-string
(&-> gp-0 1)
(- (length arg0) (the-as int (+ (- -1 (the-as int (-> arg0 data))) (the-as int gp-0))))
)
(return viewer-string)
)
(set! gp-0 (&-> gp-0 1))
)
)
(clear viewer-string)
)
(defbehavior init-viewer viewer ((arg0 string) (arg1 string))
(let* ((s5-0 *level*)
(s3-0 (method-of-object s5-0 art-group-get-by-name))
)
(format (clear *temp-string*) "skel-~S" arg0)
(let ((a1-3 (s3-0 s5-0 *temp-string* (the-as (pointer level) #f))))
(cond
(a1-3
(process-drawable-method-42 self a1-3 0)
(cond
((>= (-> self skel active-channels) (the-as uint 1))
(set! (-> self janim) (-> self skel channel 0 frame-group))
)
(else
(let ((v1-8 (-> self draw art-group)))
(dotimes (a0-5 (-> v1-8 length))
(when (= (-> v1-8 data a0-5 type) art-joint-anim)
(set! (-> self janim) (the-as art-joint-anim (-> v1-8 data a0-5)))
(ja-channel-set! 1)
(goto cfg-10)
)
)
)
(go process-drawable-art-error "anim")
)
)
(label cfg-10)
(logior! (-> self skel status) (joint-control-status blend-shape eye-anim))
(go viewer-process)
)
(else
(actor-get-arg! viewer-ja-name "ja" arg1)
(actor-get-arg! viewer-geo-name "geo" arg1)
(let ((s2-1 (load-to-heap-by-name (-> self level art-group) arg0 'load global 0))
(s5-1 (the-as int #f))
(s4-1 (the-as int #f))
(s3-1 (the-as int #f))
)
(when s2-1
(dotimes (s1-0 (-> s2-1 length))
(cond
((not (-> s2-1 data s1-0))
)
((and (not s4-1)
(= (-> s2-1 data s1-0 type) merc-ctrl)
(or (zero? (length viewer-geo-name)) (string= (art-part-name (-> s2-1 data s1-0 name)) viewer-geo-name))
)
(set! s4-1 s1-0)
)
((= (-> s2-1 data s1-0 type) art-joint-geo)
(set! s3-1 s1-0)
)
((and (= (-> s2-1 data s1-0 type) art-joint-anim)
(or (zero? (length viewer-ja-name)) (string= (art-part-name (-> s2-1 data s1-0 name)) viewer-ja-name))
)
(set! s5-1 s1-0)
)
)
(if (and s4-1 s3-1 s5-1)
(goto cfg-44)
)
)
)
(label cfg-44)
(cond
((and s4-1 s3-1 s5-1)
(set! (-> self janim) (the-as art-joint-anim (-> s2-1 data s5-1)))
(let ((a1-12 *viewer-sg*))
(set! (-> a1-12 art-group-name) arg0)
(set! (-> a1-12 jgeo) s3-1)
(set! (-> a1-12 janim) s5-1)
(set! (-> a1-12 mgeo 0) s4-1)
(process-drawable-method-42 self a1-12 0)
)
(logior! (-> self skel status) (joint-control-status blend-shape eye-anim))
(go viewer-process)
)
(else
(go process-drawable-art-error arg0)
)
)
)
)
)
)
)
)
(defmethod init-from-entity! ((this viewer) (arg0 entity-actor))
(set! *viewer* this)
(set! (-> this root) (new 'process 'trsqv))
(process-drawable-from-entity! this arg0)
(let ((s5-1 (-> arg0 etype)))
(if (valid? s5-1 type (the-as string #f) #f 0)
(init-viewer (symbol->string (-> s5-1 symbol)) (-> arg0 name))
(go process-drawable-art-error "unknown")
)
)
)
(defbehavior init-viewer-for-other viewer ((arg0 string) (arg1 vector) (arg2 entity-actor))
(set! *viewer* self)
(process-entity-set! self arg2)
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> arg1 quad))
(quaternion-identity! (the-as quaternion (-> self root rot)))
(set-vector! (-> self root scale) 1.0 1.0 1.0 1.0)
(init-viewer arg0 arg0)
)
(defun add-a-bunch ((arg0 string) (arg1 int) (arg2 int) (arg3 float) (arg4 process-tree) (arg5 entity-actor))
(dotimes (s0-0 arg1)
(let ((sv-32 0))
(while (< sv-32 arg2)
(let ((sv-64 (new 'stack-no-clear 'vector)))
(set! (-> sv-64 quad) (the-as uint128 0))
(position-in-front-of-camera! sv-64 40960.0 4096.0)
(+! (-> sv-64 x) (the float (* (- s0-0 (/ arg1 2)) (the int arg3))))
(+! (-> sv-64 z) (the float (* (- sv-32 (/ arg2 2)) (the int arg3))))
(let ((sv-48 (get-process *default-dead-pool* viewer #x4000 1)))
(when sv-48
((method-of-type viewer activate) (the-as viewer sv-48) arg4 "viewer" (the-as pointer #x70004000))
(run-now-in-process sv-48 init-viewer-for-other arg0 sv-64 arg5)
(-> sv-48 ppointer)
)
)
)
(+! sv-32 1)
)
)
)
#f
)
;; WARN: Return type mismatch symbol vs object.
(defun birth-viewer ((arg0 process) (arg1 entity-actor))
(set! (-> arg0 type) viewer)
(init-entity arg0 arg1 viewer)
#t
)
+499
View File
@@ -5,5 +5,504 @@
;; name in dgo: visvol-edit
;; dgos: ENGINE, GAME
;; +++visvol-edit-func
(defenum visvol-edit-func
:type uint64
(visvol-positive 0)
(visvol-negative 1)
(adjust-sphere 2)
(adjust-vis-distance 3)
)
;; ---visvol-edit-func
(define-extern show-maya-skeleton (function process-drawable int int none))
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(deftype visvol-edit-info (structure)
((editing symbol)
(current-func visvol-edit-func)
(analog-func visvol-edit-func)
)
(:methods
(handle-pad-input (_type_) object)
(draw-menu (_type_ process-drawable) object)
(set-origin-joint-idx! (_type_ process-drawable) none)
)
)
(deftype visvol-editor (process)
((proc handle)
)
(:state-methods
idle
)
)
;; WARN: Return type mismatch int vs object.
(defmethod handle-pad-input ((this visvol-edit-info))
(if (cpad-pressed? 0 up)
(+! (-> this current-func) -1)
)
(if (cpad-pressed? 0 left)
(+! (-> this current-func) -4)
)
(if (cpad-pressed? 0 down)
(+! (-> this current-func) 1)
)
(if (cpad-pressed? 0 right)
(+! (-> this current-func) 4)
)
(cond
((< (the-as int (-> this current-func)) 0)
(let ((v0-0 2))
(set! (-> this current-func) (the-as visvol-edit-func v0-0))
v0-0
)
)
((>= (the-as int (-> this current-func)) 3)
(set! (-> this current-func) (visvol-edit-func visvol-positive))
0
)
)
)
;; WARN: Function (method 11 visvol-edit-info) has a return type of none, but the expression builder found a return statement.
(defmethod set-origin-joint-idx! ((this visvol-edit-info) (arg0 process-drawable))
(if (or (not arg0) (!= (-> this analog-func) 2))
(return #f)
)
(let ((v0-1 (the-as int (-> arg0 draw origin-joint-index))))
(let ((v1-7 (+ (-> arg0 node-list length) -1)))
(when (cpad-pressed? 0 r1)
(set! v0-1 (the-as int (+ (the-as uint v0-1) 1)))
(if (cpad-hold? 0 l1)
(set! v0-1 (the-as int (+ (the-as uint v0-1) 4)))
)
(case v0-1
((1 2)
(set! v0-1 3)
)
)
)
(when (cpad-pressed? 0 l1)
(+! v0-1 -1)
(if (cpad-hold? 0 r1)
(+! v0-1 -4)
)
(case v0-1
((1 2)
(set! v0-1 0)
)
)
)
(if (< v0-1 0)
(set! v0-1 v1-7)
)
(if (< v1-7 v0-1)
(set! v0-1 0)
)
)
(set! (-> arg0 draw origin-joint-index) (the-as uint v0-1))
)
(none)
)
;; WARN: Return type mismatch int vs object.
(defmethod draw-menu ((this visvol-edit-info) (arg0 process-drawable))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(when (cpad-pressed? 0 l2)
(set! (-> this editing) (not (-> this editing)))
(cond
((-> this editing)
(set! *external-cam-mode* 'locked)
)
((view-get-active-target)
(set! *external-cam-mode* #f)
)
(else
(set! *external-cam-mode* 'pad-0)
)
)
)
(cond
((or (not (-> this editing)) (cpad-hold? 0 r2))
(if (not (-> this editing))
(format *stdcon* "press l2 to edit visvol~%")
(format *stdcon* "release r2 to continue editing visvol~%")
)
(if (or (cpad-hold? 0 r2) (not (view-get-active-target)))
(set! *external-cam-mode* 'pad-0)
)
)
(else
(set! *external-cam-mode* 'locked)
(handle-pad-input this)
(set-origin-joint-idx! this arg0)
(let ((s3-0 ">")
(s4-0 " ")
)
(if (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8))
(set! s3-0 " ")
)
(format *stdcon* " r2/l2: move camera~%")
(format
*stdcon*
" r1/l1: select joint ~D ~S~%"
(if arg0
(the-as int (-> arg0 draw origin-joint-index))
-1
)
(if (and arg0 (-> arg0 node-list data (-> arg0 draw origin-joint-index) joint))
(-> arg0 node-list data (-> arg0 draw origin-joint-index) joint name)
"?"
)
)
(format *stdcon* " dpad: select function~%")
(format *stdcon* " x, tri: toggle/call~%")
(format *stdcon* "------------------------~%")
(let ((t9-11 format)
(a0-14 *stdcon*)
(a1-9 " ~S analog: ~S~%")
(a2-1 (if (= (-> this current-func) (visvol-edit-func visvol-positive))
s3-0
s4-0
)
)
(v1-43 (-> this analog-func))
)
(t9-11 a0-14 a1-9 a2-1 (cond
((= v1-43 (visvol-edit-func visvol-positive))
(set! *display-xyz-axes* #t)
"visvol positive"
)
((= v1-43 (visvol-edit-func visvol-negative))
(set! *display-xyz-axes* #t)
"visvol negative"
)
((= v1-43 (visvol-edit-func adjust-sphere))
(set! *display-xyz-axes* #f)
"adjust sphere"
)
((= v1-43 (visvol-edit-func adjust-vis-distance))
(set! *display-xyz-axes* #f)
"adjust vis distance"
)
(else
"???"
)
)
)
)
(format *stdcon* " ~S print to listener~%" (if (= (-> this current-func) (visvol-edit-func visvol-negative))
s3-0
s4-0
)
)
(format *stdcon* " ~S quit~%" (cond
((= (-> this current-func) (visvol-edit-func adjust-sphere))
(empty)
s3-0
)
(else
s4-0
)
)
)
)
(let ((v1-49 0))
(if (cpad-pressed? 0 x)
(+! v1-49 1)
)
(if (cpad-pressed? 0 triangle)
(+! v1-49 -1)
)
(when (nonzero? v1-49)
(case (-> this current-func)
(((visvol-edit-func visvol-positive))
(+! (-> this analog-func) v1-49)
)
(((visvol-edit-func visvol-negative))
(when arg0
(let ((s4-1 (entity-by-name (-> arg0 name))))
(when s4-1
(let ((f30-0 (res-lump-float s4-1 'vis-dist :default 200.0))
(s4-2 (res-lump-data s4-1 'visvol (pointer float)))
)
(when s4-2
(format #t "~%actor-vis ~S ~M " (-> arg0 name) f30-0)
(format #t "~M ~M ~M ~M ~M ~M~%~%" (-> s4-2 0) (-> s4-2 1) (-> s4-2 2) (-> s4-2 4) (-> s4-2 5) (-> s4-2 6))
)
)
)
)
(format
#t
"~%:bounds (static-spherem ~M ~M ~M ~M)~%"
(-> arg0 draw bounds x)
(-> arg0 draw bounds y)
(-> arg0 draw bounds z)
(-> arg0 draw bounds w)
)
(let ((v1-61 (-> arg0 draw origin-joint-index)))
(format
#t
":origin-joint ~s~%~%"
(if (and (>= v1-61 0) (< v1-61 (the-as uint (-> arg0 node-list length))) (-> arg0 node-list data v1-61 joint))
(-> arg0 node-list data v1-61 joint name)
"?"
)
)
)
)
)
(((visvol-edit-func adjust-sphere))
(kill-by-type visvol-editor *active-pool*)
)
(else
(format 0 "~%ERROR<GMJ>: bad visvol-edit-func~%")
)
)
)
)
(cond
((< (the-as int (-> this analog-func)) 0)
(set! (-> this analog-func) (visvol-edit-func adjust-vis-distance))
)
((>= (the-as int (-> this analog-func)) 4)
(set! (-> this analog-func) (visvol-edit-func visvol-positive))
0
)
)
(when arg0
(let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0))
(f30-1 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 1.0))
(f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 1.0))
(f0-10 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 1.0))
)
(when (or (!= f28-0 0.0) (!= f30-1 0.0) (!= f26-0 0.0) (!= f0-10 0.0))
(case (-> this analog-func)
(((visvol-edit-func visvol-positive) (visvol-edit-func visvol-negative))
(set! f28-0 (* 1228.8 f28-0))
(set! f30-1 (* -1228.8 f30-1))
(set! f26-0 (* 1228.8 f26-0))
(let ((f0-11 (/ f0-10 -100)))
(set! f0-10 (+ 1.0 f0-11))
)
)
(((visvol-edit-func adjust-sphere))
(set! f28-0 (* -409.6 f28-0))
(set! f30-1 (* -409.6 f30-1))
(set! f26-0 (* -409.6 f26-0))
(let ((f0-12 (/ f0-10 100)))
(set! f0-10 (+ 1.0 f0-12))
)
)
(((visvol-edit-func adjust-vis-distance))
(let ((f1-15 (/ f28-0 100)))
(set! f28-0 (+ 1.0 f1-15))
)
(let ((f1-17 (/ f30-1 -100)))
(set! f30-1 (+ 1.0 f1-17))
)
(let ((f1-19 (/ f26-0 100)))
(set! f26-0 (+ 1.0 f1-19))
)
)
)
(case (-> this analog-func)
(((visvol-edit-func visvol-positive))
(let ((a0-57 (entity-by-name (-> arg0 name))))
(when a0-57
(let ((v1-108 (res-lump-data a0-57 'visvol (pointer float))))
(when v1-108
(let ((a2-23 (&-> v1-108 4)))
(let ((a0-58 (the-as object (&-> v1-108 4)))
(a1-29 (new 'stack-no-clear 'vector))
)
(set! (-> a1-29 x) f28-0)
(set! (-> a1-29 y) f30-1)
(set! (-> a1-29 z) f26-0)
(set! (-> a1-29 w) 1.0)
(.lvf vf4 (&-> (the-as vector a0-58) quad))
(.lvf vf5 (&-> a1-29 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (the-as (pointer uint128) (&-> a2-23 0)) vf6)
)
(set! (-> v1-108 4) (fmax (-> v1-108 4) (+ 4096.0 (-> v1-108 0))))
(set! (-> v1-108 5) (fmax (-> v1-108 5) (+ 4096.0 (-> v1-108 1))))
(set! (-> v1-108 6) (fmax (-> v1-108 6) (+ 4096.0 (-> v1-108 2))))
)
)
)
)
)
(((visvol-edit-func visvol-negative))
(let ((a0-65 (entity-by-name (-> arg0 name))))
(when a0-65
(let ((v1-110 (res-lump-data a0-65 'visvol (pointer float))))
(when v1-110
(let ((a2-25 (&-> v1-110 0)))
(let ((a0-66 (the-as object (&-> v1-110 0)))
(a1-34 (new 'stack-no-clear 'vector))
)
(set! (-> a1-34 x) f28-0)
(set! (-> a1-34 y) f30-1)
(set! (-> a1-34 z) f26-0)
(set! (-> a1-34 w) 1.0)
(.lvf vf4 (&-> (the-as vector a0-66) quad))
(.lvf vf5 (&-> a1-34 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (the-as (pointer uint128) (&-> a2-25 0)) vf6)
)
(set! (-> v1-110 0) (fmin (-> v1-110 0) (+ -4096.0 (-> v1-110 4))))
(set! (-> v1-110 1) (fmin (-> v1-110 1) (+ -4096.0 (-> v1-110 5))))
(set! (-> v1-110 2) (fmin (-> v1-110 2) (+ -4096.0 (-> v1-110 6))))
)
)
)
)
)
(((visvol-edit-func adjust-sphere))
(set! (-> arg0 draw bounds w) (* (-> arg0 draw bounds w) f0-10))
(let ((s4-3 (matrix-copy! (new 'stack-no-clear 'matrix) (matrix-local->world #f #f)))
(s2-0 (matrix-copy!
(new 'stack-no-clear 'matrix)
(-> arg0 node-list data (-> arg0 draw origin-joint-index) bone transform)
)
)
(s3-1 (new 'stack-no-clear 'vector))
)
(set! (-> s3-1 x) f28-0)
(set! (-> s3-1 y) f30-1)
(set! (-> s3-1 z) f26-0)
(set! (-> s3-1 w) 1.0)
(vector-reset! (-> s4-3 trans))
(vector-matrix*! s3-1 s3-1 s4-3)
(vector-reset! (-> s2-0 trans))
(matrix-transpose! s2-0 s2-0)
(vector-matrix*! s3-1 s3-1 s2-0)
(+! (-> arg0 draw bounds x) (-> s3-1 x))
(+! (-> arg0 draw bounds y) (-> s3-1 y))
(+! (-> arg0 draw bounds z) (-> s3-1 z))
)
)
(((visvol-edit-func adjust-vis-distance))
(let ((s4-4 (entity-by-name (-> arg0 name))))
(when s4-4
(let ((f0-36 (* (res-lump-float s4-4 'vis-dist :default 200.0) f30-1)))
(add-32bit-data!
s4-4
(new 'static 'res-tag :name 'vis-dist :key-frame -1000000000.0 :elt-count #x1 :elt-type float)
f0-36
)
)
)
)
)
)
)
)
(case (-> this analog-func)
(((visvol-edit-func adjust-vis-distance))
(let ((a0-93 (entity-by-name (-> arg0 name))))
(when a0-93
(let ((f0-37 (res-lump-float a0-93 'vis-dist :default 200.0)))
(format *stdcon* "~%vis distance: ~M" f0-37)
)
)
)
)
)
)
)
)
(case (-> this analog-func)
(((visvol-edit-func adjust-sphere))
(when arg0
(let ((a1-53 (-> arg0 draw origin-joint-index)))
(show-maya-skeleton arg0 (the-as int a1-53) #x46400000)
)
)
)
)
0
)
)
(define *visvol-edit-info* (the-as visvol-edit-info 0))
(define *visvol-edit-info* (new 'static 'visvol-edit-info :editing #t))
(defstate idle (visvol-editor)
:virtual #t
:enter (behavior ()
(set! *display-actor-vis* #t)
)
:exit (behavior ()
(set! *display-xyz-axes* #f)
(set! *display-actor-vis* #f)
(set! *external-cam-mode* #f)
)
:trans (behavior ()
(draw-menu
*visvol-edit-info*
(the-as process-drawable (as-type (handle->process (-> self proc)) process-drawable))
)
)
:code sleep-code
)
(defbehavior visvol-editor-init-by-other visvol-editor ((arg0 handle))
(set! (-> self proc) arg0)
(go-virtual idle)
)
;; WARN: Return type mismatch int vs object.
(defun stop-visvol-edit ()
(kill-by-type visvol-editor *active-pool*)
0
)
;; WARN: Return type mismatch int vs object.
(defun visvol-edit ((arg0 string))
(stop-visvol-edit)
(let* ((v1-0 (process->ppointer (process-by-name arg0 *active-pool*)))
(gp-0 (logior (if v1-0
(new 'static 'handle :pid (-> v1-0 0 pid))
(new 'static 'handle)
)
(new 'static 'handle :process v1-0)
)
)
)
(let ((v1-2 (the-as handle gp-0)))
(if (not (and (nonzero? (l32-false-check v1-2)) (let ((a0-8 (-> v1-2 process 0)))
(if (= (the-as handle (-> v1-2 pid)) (-> a0-8 pid))
a0-8
)
)
)
)
(set! gp-0 (process->handle *debug-actor*))
(debug-actor arg0)
)
)
(process-spawn visvol-editor gp-0 :name "visvol-editor")
)
0
)
+1 -1
View File
@@ -344,7 +344,7 @@
(deftype dma-packet-array (inline-array-class)
"Unused dma array. Unclear how it should be used."
((data dma-packet :dynamic)
((data dma-packet :inline :dynamic)
)
)
+3 -6
View File
@@ -122,14 +122,11 @@
)
(defun reset-vif1-path ()
"When things go wrong, totally reset vif1."
(#unless PC_PORT
;; changed for jak 3! now prints to 0.
(format 0 "~`dma-bank-vif`I~`vif-bank`I" #x10009000 #x10003c00)
)
(format 0 "~`dma-bank-vif`I~`vif-bank`I" #x10009000 #x10003c00)
(reset-path)
(set-graphics-mode)
(format 0 "gkernel: vif1 path reset!~%")
0
(none)
)
@@ -159,4 +156,4 @@
;; configuration required to work around hardware bug on the PS2.
;; doesn't do anything important
(dma-initialize)
(dma-initialize)
@@ -7,3 +7,162 @@
;; DECOMP BEGINS
(deftype entity-more-perm (structure)
((aid actor-id)
(ent entity)
(user-object object 2)
(user-uint64 uint64 :overlay-at (-> user-object 0))
(user-float float 2 :overlay-at (-> user-object 0))
(user-int32 int32 2 :overlay-at (-> user-object 0))
(user-uint32 uint32 2 :overlay-at (-> user-object 0))
(user-int16 int16 4 :overlay-at (-> user-object 0))
(user-uint16 uint16 4 :overlay-at (-> user-object 0))
(user-int8 int8 8 :overlay-at (-> user-object 0))
(user-uint8 uint8 8 :overlay-at (-> user-object 0))
)
(:methods
(entity-more-perm-method-9 (_type_) none)
)
)
(deftype entity-more-perm-hash (structure)
((data entity-more-perm 512 :inline)
(entity-more-perm-ct int32)
(entity-indices int16 1024)
)
(:methods
(entity-more-perm-hash-method-9 (_type_) none)
(entity-more-perm-hash-method-10 (_type_ uint) uint)
(entity-more-perm-hash-method-11 (_type_ actor-id) entity-more-perm)
(entity-more-perm-hash-method-12 (_type_ actor-id (pointer symbol)) entity-more-perm)
(entity-more-perm-hash-method-13 (_type_ level) symbol)
(entity-more-perm-hash-method-14 (_type_ level) symbol)
)
)
(define *entity-more-perm* (new 'static 'entity-more-perm-hash))
(defmethod entity-more-perm-hash-method-9 ((this entity-more-perm-hash))
(dotimes (v1-0 1024)
(set! (-> this entity-indices v1-0) -1)
)
(set! (-> this entity-more-perm-ct) 0)
0
(none)
)
;; WARN: new jak 2 until loop case, check carefully
(defmethod entity-more-perm-hash-method-10 ((this entity-more-perm-hash) (arg0 uint))
(let ((v0-0 (logand arg0 1023)))
(let ((v1-1 (logior (shr arg0 10) 1)))
(until #f
(let ((a2-2 (-> this entity-indices v0-0)))
(if (= a2-2 -1)
(return v0-0)
)
(if (= (-> this data a2-2 aid) arg0)
(return v0-0)
)
)
(set! v0-0 (logand (+ v0-0 v1-1) 1023))
)
)
#f
v0-0
)
)
(defmethod entity-more-perm-hash-method-11 ((this entity-more-perm-hash) (arg0 actor-id))
(let ((v1-1 (entity-more-perm-hash-method-10 this (the-as uint arg0))))
(if (= (-> this entity-indices v1-1) -1)
(the-as entity-more-perm #f)
(-> this data (-> this entity-indices v1-1))
)
)
)
(defmethod entity-more-perm-hash-method-12 ((this entity-more-perm-hash) (arg0 actor-id) (arg1 (pointer symbol)))
(local-vars (s3-0 entity-more-perm))
(if arg1
(set! (-> arg1 0) #f)
)
(let ((v1-3 (entity-more-perm-hash-method-10 this (the-as uint arg0))))
(when (!= (-> this entity-indices v1-3) -1)
(set! s3-0 (-> this data (-> this entity-indices v1-3)))
(goto cfg-9)
)
(when (>= (-> this entity-more-perm-ct) 512)
(break!)
0
)
(set! s3-0 (-> this data (-> this entity-more-perm-ct)))
(set! (-> this entity-indices v1-3) (-> this entity-more-perm-ct))
)
(+! (-> this entity-more-perm-ct) 1)
(mem-clear! (the-as pointer s3-0) 16)
(set! (-> s3-0 aid) arg0)
(set! (-> s3-0 ent) (entity-by-aid (the-as uint arg0)))
(if arg1
(set! (-> arg1 0) #t)
)
(label cfg-9)
s3-0
)
(defmethod entity-more-perm-method-9 ((this entity-more-perm))
(/ (&- (the-as pointer this) (the-as uint (the-as pointer (-> *entity-more-perm* data)))) 16)
(none)
)
;; WARN: Return type mismatch int vs symbol.
(defmethod entity-more-perm-hash-method-13 ((this entity-more-perm-hash) (arg0 level))
(if (not (-> arg0 name))
(return (the-as symbol #f))
)
(if (not (and (nonzero? (-> arg0 entity)) (-> arg0 entity)))
(return (the-as symbol #f))
)
(dotimes (s5-0 (-> arg0 entity length))
(let ((s4-0 (-> arg0 entity data s5-0)))
(when (type? (-> s4-0 entity) entity-actor)
(let ((s4-1 (-> s4-0 entity)))
(if (type-type? (-> (the-as entity-actor s4-1) etype) process-nettable)
((the-as (function process-nettable entity-actor) (-> (the-as entity-actor s4-1) etype method-table 32))
(the-as process-nettable #f)
)
)
)
)
)
)
(the-as symbol 0)
)
;; WARN: Return type mismatch int vs symbol.
(defmethod entity-more-perm-hash-method-14 ((this entity-more-perm-hash) (arg0 level))
(if (not (-> arg0 name))
(return (the-as symbol #f))
)
(if (not (and (nonzero? (-> arg0 entity)) (-> arg0 entity)))
(return (the-as symbol #f))
)
(dotimes (s5-0 (-> arg0 entity length))
(let ((s4-0 (-> arg0 entity data s5-0)))
(when (type? (-> s4-0 entity) entity-actor)
(let ((s4-1 (-> s4-0 entity)))
(if (type-type? (-> (the-as entity-actor s4-1) etype) process-nettable)
((the-as (function process-nettable entity-actor none) (-> (the-as entity-actor s4-1) etype method-table 33))
(the-as process-nettable #f)
(the-as entity-actor s4-1)
)
)
)
)
)
)
(the-as symbol 0)
)
(entity-more-perm-hash-method-9 *entity-more-perm*)
+9 -8
View File
@@ -128,7 +128,7 @@
(define-extern *progress-process* (pointer process))
(define-extern stop (function symbol int int))
(define-extern jukebox-onoff (function symbol object))
(define-extern jukebox-onoff (function symbol none))
(define-extern cam-master-activate-slave (function symbol none))
(define-extern position-in-front-of-camera! (function vector float float vector))
@@ -395,19 +395,20 @@
(turbo-last-disabled int32)
(fragile-vehicle basic)
(music-data uint32 4)
(byte0 int8 :overlay-at (-> music-data 0))
(music-info uint32 :overlay-at (-> music-data 0))
(game-movie (array game-movie) :overlay-at (-> music-data 1))
(grand-prix (array grand-prix) :overlay-at (-> music-data 2))
(playing-grand-prix? symbol :overlay-at (-> music-data 3))
(music-data-bytes uint8 16 :overlay-at (-> music-data 0))
(byte0 int8 :overlay-at (-> music-data 0))
(music-info uint32 :overlay-at (-> music-data 0))
(game-movie (array game-movie) :overlay-at (-> music-data 1))
(grand-prix (array grand-prix) :overlay-at (-> music-data 2))
(playing-grand-prix? symbol :overlay-at (-> music-data 3))
(grand-prix-index uint32)
(collision-vs-rbody-damage-multiplier float)
(global-speed-factor float)
(this-race-grand-prix-score uint32 23)
(cumulative-grand-prix-score uint32 23)
(driver-info uint64)
(driver-unlock uint32 :overlay-at driver-info)
(driver-award uint32 :offset 1700)
(driver-unlock uint32 :overlay-at driver-info)
(driver-award uint32 :offset 1700)
)
(:methods
(reset (_type_ symbol game-save continue-point symbol) _type_)
+71 -7
View File
@@ -2119,11 +2119,7 @@
(with-dma-buffer-add-bucket ((s5-1 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id bucket787)
)
(-> self icon)
(let ((t9-8 (method-of-type hud-sprite hud-sprite-method-9)))
(-> self level)
(t9-8)
)
(draw (-> self icon) s5-1 (-> self level))
)
)
)
@@ -2987,12 +2983,80 @@
)
)
)
(sound-group-pause (the-as sound-group #xffffffff))
(sound-group-pause (sound-group
sfx
music
dialog
sog3
ambient
dialog2
special
sog7
sog8
sog9
sog10
sog11
sog12
sog13
sog14
sog15
sog16
sog17
sog18
sog19
sog20
sog21
sog22
sog23
sog24
sog25
sog26
sog27
sog28
sog29
sog30
sog31
)
)
(add-setting! 'process-mask 'set 0.0 (process-mask pause))
)
)
:exit (behavior ()
(sound-group-continue (the-as sound-group #xffffffff))
(sound-group-continue (sound-group
sfx
music
dialog
sog3
ambient
dialog2
special
sog7
sog8
sog9
sog10
sog11
sog12
sog13
sog14
sog15
sog16
sog17
sog18
sog19
sog20
sog21
sog22
sog23
sog24
sog25
sog26
sog27
sog28
sog29
sog30
sog31
)
)
)
:trans (behavior ()
(buzz-stop! 0)
+9 -1
View File
@@ -5,5 +5,13 @@
;; name in dgo: idle-control
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
;; +++idle-control-cmd
(defenum idle-control-cmd
:type uint8
(reset 0)
(play 1)
(push 2)
)
;; ---idle-control-cmd
;; DECOMP BEGINS
+3 -3
View File
@@ -6041,9 +6041,9 @@
(frames int32)
)
(:methods
(screen-filter-method-9 () none)
(screen-filter-method-10 () none)
(screen-filter-method-11 () none)
(draw (_type_) none)
(setup (_type_ vector vector float bucket-id int int symbol) none)
(disable (_type_) none)
)
)
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -586,7 +586,7 @@
(new (symbol type int) _type_)
(cam-connect (_type_ int object symbol object symbol object object) none)
(cam-connect-pers (_type_ int object time-frame object object float object) none)
(cam-reconnect (_type_ int object time-frame object object float object) none)
(cam-reconnect (_type_ int object time-frame object object float) none)
(cam-disconnect (_type_ int process symbol) none)
(add-setting (_type_ process symbol object object object) connection)
(setting-pers (_type_ symbol time-frame symbol symbol float int) none)
@@ -597,7 +597,7 @@
(move-arg0-to-dead (_type_ connection) none)
(get-setting (_type_ object) connectable)
(remove-setting-by-arg0 (_type_ object) none)
(set-setting-by-param (_type_ process symbol object object object) connection)
(set-setting-by-param (_type_ process symbol object object) connection)
(apply-settings! (_type_) user-setting-data)
(update! (_type_) user-setting-data)
)
+2 -10
View File
@@ -1137,15 +1137,7 @@
)
;; WARN: Return type mismatch connection vs none.
(defmethod cam-reconnect ((this setting-control)
(arg0 int)
(arg1 object)
(arg2 time-frame)
(arg3 object)
(arg4 object)
(arg5 float)
(arg6 object)
)
(defmethod cam-reconnect ((this setting-control) (arg0 int) (arg1 object) (arg2 time-frame) (arg3 object) (arg4 object) (arg5 float))
(if (= arg2 'mode-name)
(format 0 "mode-name -> ~A~%" arg4)
)
@@ -1328,7 +1320,7 @@
(none)
)
(defmethod set-setting-by-param ((this setting-control) (arg0 process) (arg1 symbol) (arg2 object) (arg3 object) (arg4 object))
(defmethod set-setting-by-param ((this setting-control) (arg0 process) (arg1 symbol) (arg2 object) (arg3 object))
(remove-by-param0 (-> this engine-hi) arg0)
(add-connection (-> this engine-hi) *dproc* arg0 arg1 arg2 arg3)
)
@@ -1211,8 +1211,8 @@
(borrow pair)
(close-time uint32)
(description text-id)
(intro-scene basic)
(outro-scene basic)
(intro-scene string)
(outro-scene string)
(time-of-day int32)
(task-sound-description string)
(ipu string)
@@ -51,7 +51,7 @@
(deftype bounding-box-array (inline-array-class)
((data bounding-box :dynamic)
((data bounding-box :inline :dynamic)
)
)
+1 -1
View File
@@ -85,7 +85,7 @@ These path-controls are typically allocated on a process heap."
(:methods
(new (symbol type process symbol float entity symbol) _type_)
(debug-draw (_type_) none)
(path-control-method-10 (_type_ vector float symbol) vector)
(get-point-in-path! (_type_ vector float symbol) vector)
(get-random-point (_type_ vector) vector)
(path-control-method-12 (_type_ vector float float) vector)
(path-control-method-13 (_type_ vector float) vector)
+17 -19
View File
@@ -96,7 +96,7 @@
(f26-0 (fabs arg1))
(s5-0 (new 'stack-no-clear 'vector))
)
(path-control-method-10 this s5-0 f30-0 'interp)
(get-point-in-path! this s5-0 f30-0 'interp)
0.0
(while (< 0.0 f26-0)
(let ((f24-0 (the float (the int (+ f28-0 f30-0)))))
@@ -142,7 +142,7 @@
)
)
(defmethod path-control-method-10 ((this path-control) (arg0 vector) (arg1 float) (arg2 symbol))
(defmethod get-point-in-path! ((this path-control) (arg0 vector) (arg1 float) (arg2 symbol))
(let ((a1-1 (-> this curve num-cverts))
(f0-3 (the float (the int arg1)))
)
@@ -190,7 +190,7 @@
)
(defmethod path-control-method-14 ((this path-control) (arg0 vector) (arg1 float) (arg2 symbol))
(path-control-method-10 this arg0 (* arg1 (the float (+ (-> this curve num-cverts) -1))) arg2)
(get-point-in-path! this arg0 (* arg1 (the float (+ (-> this curve num-cverts) -1))) arg2)
)
(defmethod path-control-method-14 ((this curve-control) (arg0 vector) (arg1 float) (arg2 symbol))
@@ -207,7 +207,7 @@
arg0
)
(defmethod path-control-method-10 ((this curve-control) (arg0 vector) (arg1 float) (arg2 symbol))
(defmethod get-point-in-path! ((this curve-control) (arg0 vector) (arg1 float) (arg2 symbol))
(if (not (logtest? (-> this flags) (path-control-flag not-found)))
(curve-evaluate!
arg0
@@ -398,11 +398,11 @@
(sv-120 (the-as symbol #f))
(sv-124 (the-as float -1.0))
)
(path-control-method-10 this sv-96 0.0 'interp)
(get-point-in-path! this sv-96 0.0 'interp)
(set! sv-112 (the-as float #x7f800000))
(when (not arg2)
(set! sv-124 (path-control-method-22 this arg0))
(path-control-method-10 this sv-108 sv-124 'interp)
(get-point-in-path! this sv-108 sv-124 'interp)
(set! sv-112 (vector-vector-distance-squared sv-108 arg0))
)
(let ((s3-1 (new 'stack-no-clear 'vector)))
@@ -418,7 +418,7 @@
(.svf (&-> a1-5 quad) vf6)
)
(dotimes (s2-0 (+ (-> this curve num-cverts) -1))
(path-control-method-10 this sv-100 (the float (+ s2-0 1)) 'interp)
(get-point-in-path! this sv-100 (the float (+ s2-0 1)) 'interp)
(vector-! sv-104 sv-100 sv-96)
(let ((s0-0 #f))
0.0
@@ -475,8 +475,8 @@
)
(defmethod path-control-method-29 ((this path-control) (arg0 vector) (arg1 int) (arg2 vector))
(let ((s2-0 (path-control-method-10 this (new 'stack-no-clear 'vector) (the float arg1) 'interp))
(a2-3 (path-control-method-10 this (new 'stack-no-clear 'vector) (the float (+ arg1 1)) 'interp))
(let ((s2-0 (get-point-in-path! this (new 'stack-no-clear 'vector) (the float arg1) 'interp))
(a2-3 (get-point-in-path! this (new 'stack-no-clear 'vector) (the float (+ arg1 1)) 'interp))
)
(vector-segment-distance-point! arg0 s2-0 a2-3 arg2)
)
@@ -492,11 +492,11 @@
(let ((s2-0 (new 'stack-no-clear 'vector)))
(set! (-> s3-0 quad) (-> arg0 quad))
(set! (-> s3-0 y) 0.0)
(path-control-method-10 this s4-0 0.0 'interp)
(get-point-in-path! this s4-0 0.0 'interp)
(set! (-> s4-0 y) 0.0)
(dotimes (s1-0 (+ (-> this curve num-cverts) -1))
(set! (-> s5-0 quad) (-> s4-0 quad))
(path-control-method-10 this s4-0 (the float (+ s1-0 1)) 'interp)
(get-point-in-path! this s4-0 (the float (+ s1-0 1)) 'interp)
(set! (-> s4-0 y) 0.0)
(let ((f0-5 (vector-segment-distance-point! s3-0 s5-0 s4-0 s2-0)))
(when (< f0-5 f30-0)
@@ -521,10 +521,10 @@
)
(let ((s2-0 (new 'stack-no-clear 'vector)))
(set! (-> s3-0 quad) (-> arg0 quad))
(path-control-method-10 this s4-0 0.0 'interp)
(get-point-in-path! this s4-0 0.0 'interp)
(dotimes (s1-0 (+ (-> this curve num-cverts) -1))
(set! (-> s5-0 quad) (-> s4-0 quad))
(path-control-method-10 this s4-0 (the float (+ s1-0 1)) 'interp)
(get-point-in-path! this s4-0 (the float (+ s1-0 1)) 'interp)
(let ((f0-2 (vector-segment-distance-point! s3-0 s5-0 s4-0 s2-0)))
(when (< f0-2 f30-0)
(set! f30-0 f0-2)
@@ -601,17 +601,15 @@
(vector+float*!
arg0
arg0
(path-control-method-10 this (new 'stack-no-clear 'vector) (the float s3-0) 'interp)
(get-point-in-path! this (new 'stack-no-clear 'vector) (the float s3-0) 'interp)
f30-0
)
)
)
(dotimes (s3-1 s4-0)
(let ((f0-10 (vector-vector-distance
arg0
(path-control-method-10 this (new 'stack-no-clear 'vector) (the float s3-1) 'interp)
)
)
(let ((f0-10
(vector-vector-distance arg0 (get-point-in-path! this (new 'stack-no-clear 'vector) (the float s3-1) 'interp))
)
)
(if (< (-> arg0 w) f0-10)
(set! (-> arg0 w) (+ 4096.0 f0-10))
@@ -15,6 +15,8 @@
(visible 5) ;; set by prototypes-game-visible-set! to hide things on purpose
(no-collide 6)
(tpage-water 7)
(protoflag8 8)
(protoflag9 9 )
)
;; ---prototype-flags
@@ -171,7 +173,7 @@
((array-data prototype-bucket-tie :dynamic :offset 16)
)
(:methods
(prototype-array-tie-method-9 () none)
(login (_type_) none)
)
)
@@ -186,8 +188,8 @@
(deftype prototype-node (structure)
((prototype basic)
(level basic)
((prototype prototype-bucket)
(level level)
(id int16)
(next-prototype int16)
(next-child int16)
@@ -203,12 +205,12 @@
(data prototype-node 512 :inline)
)
(:methods
(prototype-node-group-method-9 () none)
(prototype-node-group-method-10 () none)
(prototype-node-group-method-11 () none)
(prototype-node-group-method-12 () none)
(prototype-node-group-method-13 () none)
(prototype-node-group-method-14 () none)
(prototype-node-group-method-9 (_type_) none)
(prototype-node-group-method-10 (_type_ prototype-node) prototype-node)
(prototype-node-group-method-11 (_type_) none)
(prototype-node-group-method-12 (_type_) none)
(prototype-node-group-method-13 (_type_) none)
(prototype-node-group-method-14 (_type_) none)
)
)
@@ -5,5 +5,863 @@
;; name in dgo: tfrag-methods
;; dgos: ENGINE, GAME
(define-extern draw-inline-array-tfrag (function pointer drawable-inline-array int dma-buffer none))
(define-extern draw-inline-array-tfrag-scissor (function pointer drawable-inline-array int dma-buffer none))
(define-extern set-subdivide-settings! (function level none))
(define-extern *background-work* background-work)
;; DECOMP BEGINS
;; WARN: Return type mismatch symbol vs none.
(defun edge-debug-lines ((arg0 (array vector-array)))
(when (nonzero? arg0)
(dotimes (s5-0 (-> arg0 length))
(when (logtest? *display-strip-lines* (ash 1 s5-0))
(let ((s4-0 (-> arg0 s5-0)))
(dotimes (s3-0 (/ (-> s4-0 length) 2))
(add-debug-line
#t
(bucket-id bucket785)
(-> s4-0 data (* s3-0 2))
(-> s4-0 data (+ (* s3-0 2) 1))
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
#f
(the-as rgba -1)
)
)
)
)
)
)
(none)
)
;; WARN: Return type mismatch drawable-tree-tfrag vs none.
(defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag))
(when (logtest? (-> *display* vu1-enable-user) 64)
(let ((s5-0 (+ (-> arg0 length) -1)))
(when (nonzero? s5-0)
(dotimes (s4-0 s5-0)
(let* ((v1-8 (-> arg0 arrays s4-0))
(a0-4 (-> arg0 arrays (+ s4-0 1)))
(a1-1 (/ (-> (the-as drawable-inline-array-node v1-8) data 0 id) 8))
(a0-6 (/ (-> (the-as drawable-inline-array-node a0-4) data 0 id) 8))
(a1-3 (+ a1-1 #x3800 #x70000000))
(a0-8 (+ a0-6 #x3800 #x70000000))
)
(draw-node-cull
(the-as pointer a0-8)
(the-as pointer a1-3)
(the-as (inline-array draw-node) (&+ v1-8 32))
(-> v1-8 length)
)
)
)
)
(let* ((v1-14 (-> arg0 arrays s5-0))
(s4-1 (&+ v1-14 32))
(s3-0 (-> v1-14 length))
)
(when (nonzero? s3-0)
(let ((sv-16 (+ (/ (-> s4-1 id) 8) #x3800 #x70000000))
(s5-1 (-> *display* frames (-> *display* on-screen) global-buf base))
)
(with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf))
(-> (new 'static 'array bucket-id 12
(bucket-id hfrag)
(bucket-id gmerc-l0-tfrag)
(bucket-id gmerc-l1-tfrag)
(bucket-id emerc-l2-tfrag)
(bucket-id emerc-l3-tfrag)
(bucket-id merc-l4-tfrag)
(bucket-id merc-l5-tfrag)
(bucket-id etie-scissor-l6-tfrag)
(bucket-id etie-scissor-l7-tfrag)
(bucket-id tie-scissor-l8-tfrag)
(bucket-id tie-scissor-l9-tfrag)
(bucket-id shrub-vanish-l0-shrub)
)
(+ (* *draw-index* 2) (-> *viewport-array* current-viewport-index))
)
)
(set! (-> *tfrag-work* wait-to-spr) (the-as uint 0))
(set! (-> *tfrag-work* wait-from-spr) (the-as uint 0))
(set! (-> *tfrag-work* last-call) (-> *level* draw-level *draw-index* tfrag-last-calls 0))
(draw-inline-array-tfrag (the-as pointer sv-16) s4-1 s3-0 s1-0)
(set! (-> *level* draw-level *draw-index* tfrag-last-calls 0) (-> *tfrag-work* last-call))
(update-wait-stats
(-> *perf-stats* data 42)
(the-as uint 0)
(-> *tfrag-work* wait-to-spr)
(-> *tfrag-work* wait-from-spr)
)
)
(with-dma-buffer-add-bucket ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf))
(-> (new 'static 'array bucket-id 12
(bucket-id tfrag-l0-tfrag)
(bucket-id tex-l1-tfrag)
(bucket-id tex-l2-tfrag)
(bucket-id gmerc2-l2-tfrag)
(bucket-id gmerc2-l3-tfrag)
(bucket-id tie-vanish-l4-tfrag)
(bucket-id tie-vanish-l5-tfrag)
(bucket-id gmerc-l6-tfrag)
(bucket-id gmerc-l7-tfrag)
(bucket-id emerc-l8-tfrag)
(bucket-id emerc-l9-tfrag)
(bucket-id emerc-l0-shrub)
)
(+ (* *draw-index* 2) (-> *viewport-array* current-viewport-index))
)
)
(set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0))
(set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0))
(set! (-> *tfrag-work* last-call) (-> *level* draw-level *draw-index* tfrag-last-calls 1))
(draw-inline-array-tfrag-scissor (the-as pointer sv-16) s4-1 s3-0 s1-1)
(set! (-> *level* draw-level *draw-index* tfrag-last-calls 1) (-> *tfrag-work* last-call))
(update-wait-stats
(-> *perf-stats* data 43)
(the-as uint 0)
(-> *tfrag-work* near-wait-to-spr)
(-> *tfrag-work* near-wait-from-spr)
)
)
(let ((a0-35 *dma-mem-usage*))
(when (nonzero? a0-35)
(set! (-> a0-35 length) (max 2 (-> a0-35 length)))
(set! (-> a0-35 data 1 name) "tfragment")
(+! (-> a0-35 data 1 count) 1)
(+! (-> a0-35 data 1 used)
(&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1))
)
(set! (-> a0-35 data 1 total) (-> a0-35 data 1 used))
)
)
)
)
)
)
)
(none)
)
;; WARN: Return type mismatch drawable-tree-tfrag vs none.
(defun draw-drawable-tree-tfrag-trans ((arg0 drawable-tree-tfrag))
(when (logtest? #x80000 (-> *display* vu1-enable-user))
(let ((s5-0 (+ (-> arg0 length) -1)))
(when (nonzero? s5-0)
(dotimes (s4-0 s5-0)
(let* ((v1-7 (-> arg0 arrays s4-0))
(a0-6 (-> arg0 arrays (+ s4-0 1)))
(a1-1 (/ (-> (the-as drawable-inline-array-node v1-7) data 0 id) 8))
(a0-8 (/ (-> (the-as drawable-inline-array-node a0-6) data 0 id) 8))
(a1-3 (+ a1-1 #x3800 #x70000000))
(a0-10 (+ a0-8 #x3800 #x70000000))
)
(draw-node-cull
(the-as pointer a0-10)
(the-as pointer a1-3)
(the-as (inline-array draw-node) (&+ v1-7 32))
(-> v1-7 length)
)
)
)
)
(let* ((v1-13 (-> arg0 arrays s5-0))
(s5-1 (&+ v1-13 32))
(s4-1 (-> v1-13 length))
)
(when (nonzero? s4-1)
(let ((sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)))
(with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf))
(-> (new 'static 'array bucket-id 12
(bucket-id tie-scissor-l2-alpha)
(bucket-id tfrag-scissor-l3-alpha)
(bucket-id tfrag-scissor-l4-alpha)
(bucket-id gmerc-l5-alpha)
(bucket-id gmerc-l6-alpha)
(bucket-id emerc-l7-alpha)
(bucket-id emerc-l8-alpha)
(bucket-id merc-l9-alpha)
(bucket-id gmerc2-lcom-tfrag)
(bucket-id gmerc-l0-pris)
(bucket-id gmerc2-l2-pris)
(bucket-id gmerc2-l4-pris)
)
(+ (* *draw-index* 2) (-> *viewport-array* current-viewport-index))
)
)
(set! (-> *tfrag-work* wait-to-spr) (the-as uint 0))
(set! (-> *tfrag-work* wait-from-spr) (the-as uint 0))
(set! (-> *tfrag-work* last-call) (-> *level* draw-level *draw-index* tfrag-last-calls 2))
(draw-inline-array-tfrag (the-as pointer sv-16) s5-1 s4-1 s2-0)
(set! (-> *level* draw-level *draw-index* tfrag-last-calls 2) (-> *tfrag-work* last-call))
(update-wait-stats
(-> *perf-stats* data 42)
(the-as uint 0)
(-> *tfrag-work* wait-to-spr)
(-> *tfrag-work* wait-from-spr)
)
)
(with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf))
(-> (new 'static 'array bucket-id 12
(bucket-id etie-l3-alpha)
(bucket-id tie-l4-alpha)
(bucket-id tie-l5-alpha)
(bucket-id tfrag-l6-alpha)
(bucket-id tfrag-l7-alpha)
(bucket-id tex-l8-alpha)
(bucket-id tex-l9-alpha)
(bucket-id gmerc2-l9-alpha)
(bucket-id shadow)
(bucket-id gmerc2-l1-pris)
(bucket-id tex-l4-pris)
(bucket-id tex-l6-pris)
)
(+ (* *draw-index* 2) (-> *viewport-array* current-viewport-index))
)
)
(set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0))
(set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0))
(set! (-> *tfrag-work* last-call) (-> *level* draw-level *draw-index* tfrag-last-calls 3))
(draw-inline-array-tfrag-scissor (the-as pointer sv-16) s5-1 s4-1 s2-1)
(set! (-> *level* draw-level *draw-index* tfrag-last-calls 3) (-> *tfrag-work* last-call))
(update-wait-stats
(-> *perf-stats* data 43)
(the-as uint 0)
(-> *tfrag-work* near-wait-to-spr)
(-> *tfrag-work* near-wait-from-spr)
)
)
)
)
)
)
)
(none)
)
;; WARN: Return type mismatch drawable-tree-tfrag vs none.
(defun draw-drawable-tree-tfrag-water ((arg0 drawable-tree-tfrag))
(when (logtest? #x1000000 (-> *display* vu1-enable-user))
(let ((s5-0 (+ (-> arg0 length) -1)))
(when (nonzero? s5-0)
(dotimes (s4-0 s5-0)
(let* ((v1-7 (-> arg0 arrays s4-0))
(a0-6 (-> arg0 arrays (+ s4-0 1)))
(a1-1 (/ (-> (the-as drawable-inline-array-node v1-7) data 0 id) 8))
(a0-8 (/ (-> (the-as drawable-inline-array-node a0-6) data 0 id) 8))
(a1-3 (+ a1-1 #x3800 #x70000000))
(a0-10 (+ a0-8 #x3800 #x70000000))
)
(draw-node-cull
(the-as pointer a0-10)
(the-as pointer a1-3)
(the-as (inline-array draw-node) (&+ v1-7 32))
(-> v1-7 length)
)
)
)
)
(let* ((v1-13 (-> arg0 arrays s5-0))
(s5-1 (&+ v1-13 32))
(s4-1 (-> v1-13 length))
)
(when (nonzero? s4-1)
(let ((sv-16 (+ (/ (-> s5-1 id) 8) #x3800 #x70000000)))
(with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf))
(-> (new 'static 'array bucket-id 12
(bucket-id bucket636)
(bucket-id bucket645)
(bucket-id bucket655)
(bucket-id bucket664)
(bucket-id bucket674)
(bucket-id bucket683)
(bucket-id bucket693)
(bucket-id bucket702)
(bucket-id bucket712)
(bucket-id bucket721)
(bucket-id bucket731)
(bucket-id bucket740)
)
(+ (* *draw-index* 2) (-> *viewport-array* current-viewport-index))
)
)
(set! (-> *tfrag-work* wait-to-spr) (the-as uint 0))
(set! (-> *tfrag-work* wait-from-spr) (the-as uint 0))
(set! (-> *tfrag-work* last-call) (-> *level* draw-level *draw-index* tfrag-last-calls 4))
(draw-inline-array-tfrag (the-as pointer sv-16) s5-1 s4-1 s2-0)
(set! (-> *level* draw-level *draw-index* tfrag-last-calls 4) (-> *tfrag-work* last-call))
(update-wait-stats
(-> *perf-stats* data 42)
(the-as uint 0)
(-> *tfrag-work* wait-to-spr)
(-> *tfrag-work* wait-from-spr)
)
)
(with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf))
(-> (new 'static 'array bucket-id 12
(bucket-id bucket640)
(bucket-id bucket649)
(bucket-id bucket659)
(bucket-id bucket668)
(bucket-id bucket678)
(bucket-id bucket687)
(bucket-id bucket697)
(bucket-id bucket706)
(bucket-id bucket716)
(bucket-id bucket725)
(bucket-id bucket735)
(bucket-id bucket744)
)
(+ (* *draw-index* 2) (-> *viewport-array* current-viewport-index))
)
)
(set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0))
(set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0))
(set! (-> *tfrag-work* last-call) (-> *level* draw-level *draw-index* tfrag-last-calls 5))
(draw-inline-array-tfrag-scissor (the-as pointer sv-16) s5-1 s4-1 s2-1)
(set! (-> *level* draw-level *draw-index* tfrag-last-calls 5) (-> *tfrag-work* last-call))
(update-wait-stats
(-> *perf-stats* data 43)
(the-as uint 0)
(-> *tfrag-work* near-wait-to-spr)
(-> *tfrag-work* near-wait-from-spr)
)
)
)
)
)
)
)
(none)
)
;; WARN: Return type mismatch pointer vs none.
(defun tfrag-vu1-init-buf ((arg0 bucket-id) (arg1 gs-test) (arg2 int) (arg3 uint) (arg4 symbol))
(let ((v1-0 *display*)
(a0-1 32)
)
(+! (-> v1-0 mem-reserve-size) a0-1)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((t1-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> t1-0 real-buffer-end) (the-as int (&+ (-> t1-0 base) a0-1)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((s4-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= s4-0 (-> s4-0 last))
(let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf))
(s2-1 (-> s3-0 base))
)
(tfrag-init-buffer s3-0 arg1 arg2 arg4)
(let ((v1-14 (the-as object (-> s3-0 base))))
(set! (-> (the-as dma-packet v1-14) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> s4-0 next)))
(set! (-> (the-as dma-packet v1-14) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-14) vif1) (new 'static 'vif-tag))
(set! (-> s3-0 base) (the-as pointer (&+ (the-as dma-packet v1-14) 16)))
)
(set! (-> s4-0 next) (the-as uint s2-1))
)
)
)
(let ((s5-1 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= s5-1 (-> s5-1 last))
(let* ((s3-1 (-> *display* frames (-> *display* on-screen) global-buf))
(s4-1 (-> s3-1 base))
)
(tfrag-end-buffer s3-1 (the-as int arg3))
(let ((v0-5 (-> s3-1 base)))
(let ((v1-28 (the-as object (-> s3-1 base))))
(set! (-> (the-as dma-packet v1-28) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-28) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-28) vif1) (new 'static 'vif-tag))
(set! (-> s3-1 base) (&+ (the-as pointer v1-28) 16))
)
(set! (-> (the-as (pointer int32) (-> s5-1 last)) 1) (the-as int s4-1))
(set! (-> s5-1 last) (the-as (pointer dma-tag) v0-5))
)
)
)
)
)
)
)
(none)
)
;; WARN: Return type mismatch pointer vs none.
(defun tfrag-scissor-vu1-init-buf ((arg0 bucket-id) (arg1 gs-test) (arg2 int) (arg3 uint) (arg4 symbol))
(let ((v1-0 *display*)
(a0-1 32)
)
(+! (-> v1-0 mem-reserve-size) a0-1)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((t1-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> t1-0 real-buffer-end) (the-as int (&+ (-> t1-0 base) a0-1)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((s4-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= s4-0 (-> s4-0 last))
(let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf))
(s2-1 (-> s3-0 base))
)
(tfrag-scissor-init-buffer s3-0 arg1 arg2 arg4)
(let ((v1-14 (the-as object (-> s3-0 base))))
(set! (-> (the-as dma-packet v1-14) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> s4-0 next)))
(set! (-> (the-as dma-packet v1-14) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-14) vif1) (new 'static 'vif-tag))
(set! (-> s3-0 base) (the-as pointer (&+ (the-as dma-packet v1-14) 16)))
)
(set! (-> s4-0 next) (the-as uint s2-1))
)
)
)
(let ((s5-1 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= s5-1 (-> s5-1 last))
(let* ((s3-1 (-> *display* frames (-> *display* on-screen) global-buf))
(s4-1 (-> s3-1 base))
)
(tfrag-scissor-end-buffer s3-1 arg3)
(let ((v0-5 (-> s3-1 base)))
(let ((v1-28 (the-as object (-> s3-1 base))))
(set! (-> (the-as dma-packet v1-28) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-28) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-28) vif1) (new 'static 'vif-tag))
(set! (-> s3-1 base) (the-as pointer (&+ (the-as dma-packet v1-28) 16)))
)
(set! (-> (the-as (pointer int32) (-> s5-1 last)) 1) (the-as int s4-1))
(set! (-> s5-1 last) (the-as (pointer dma-tag) v0-5))
)
)
)
)
)
)
)
(none)
)
(deftype tfrag-init-data (structure)
((tfrag-bucket int32)
(tfrag-scissor-bucket int32)
(tfrag-trans-bucket int32)
(tfrag-scissor-trans-bucket int32)
(tfrag-water-bucket int32)
(tfrag-water-scissor-bucket int32)
)
)
(define *tfrag-init-table* (new 'static 'inline-array tfrag-init-data 10
(new 'static 'tfrag-init-data
:tfrag-bucket 8
:tfrag-scissor-bucket 11
:tfrag-trans-bucket #x104
:tfrag-scissor-trans-bucket #x10a
:tfrag-water-bucket #x27c
:tfrag-water-scissor-bucket #x280
)
(new 'static 'tfrag-init-data
:tfrag-bucket 19
:tfrag-scissor-bucket 22
:tfrag-trans-bucket #x10e
:tfrag-scissor-trans-bucket #x114
:tfrag-water-bucket #x285
:tfrag-water-scissor-bucket #x289
)
(new 'static 'tfrag-init-data
:tfrag-bucket 31
:tfrag-scissor-bucket 34
:tfrag-trans-bucket #x119
:tfrag-scissor-trans-bucket #x11f
:tfrag-water-bucket #x28f
:tfrag-water-scissor-bucket #x293
)
(new 'static 'tfrag-init-data
:tfrag-bucket 42
:tfrag-scissor-bucket 45
:tfrag-trans-bucket #x123
:tfrag-scissor-trans-bucket #x129
:tfrag-water-bucket #x298
:tfrag-water-scissor-bucket #x29c
)
(new 'static 'tfrag-init-data
:tfrag-bucket 54
:tfrag-scissor-bucket 57
:tfrag-trans-bucket #x12e
:tfrag-scissor-trans-bucket #x134
:tfrag-water-bucket #x2a2
:tfrag-water-scissor-bucket #x2a6
)
(new 'static 'tfrag-init-data
:tfrag-bucket 65
:tfrag-scissor-bucket 68
:tfrag-trans-bucket #x138
:tfrag-scissor-trans-bucket #x13e
:tfrag-water-bucket #x2ab
:tfrag-water-scissor-bucket #x2af
)
(new 'static 'tfrag-init-data
:tfrag-bucket 77
:tfrag-scissor-bucket 80
:tfrag-trans-bucket #x143
:tfrag-scissor-trans-bucket #x149
:tfrag-water-bucket #x2b5
:tfrag-water-scissor-bucket #x2b9
)
(new 'static 'tfrag-init-data
:tfrag-bucket 88
:tfrag-scissor-bucket 91
:tfrag-trans-bucket #x14d
:tfrag-scissor-trans-bucket #x153
:tfrag-water-bucket #x2be
:tfrag-water-scissor-bucket #x2c2
)
(new 'static 'tfrag-init-data
:tfrag-bucket 100
:tfrag-scissor-bucket #x67
:tfrag-trans-bucket #x158
:tfrag-scissor-trans-bucket #x15e
:tfrag-water-bucket #x2c8
:tfrag-water-scissor-bucket #x2cc
)
(new 'static 'tfrag-init-data
:tfrag-bucket #x6f
:tfrag-scissor-bucket #x72
:tfrag-trans-bucket #x162
:tfrag-scissor-trans-bucket #x168
:tfrag-water-bucket #x2d1
:tfrag-water-scissor-bucket #x2d5
)
)
)
;; WARN: Return type mismatch symbol vs none.
(defun tfrag-vu1-init-buffers ()
(let ((s5-0 *viewport-array*)
(gp-0 (view-get-active-index))
)
(let ((v1-0 gp-0))
(-> s5-0 data v1-0)
(set! (-> s5-0 current-viewport-index) (the-as uint v1-0))
)
(dotimes (s5-1 6)
(let ((s4-0 (-> *level* draw-level s5-1))
(s3-0 (-> *tfrag-init-table* (+ (* s5-1 2) gp-0)))
)
(when s4-0
(set-subdivide-settings! s4-0)
(let ((s2-0 (-> s4-0 tfrag-gs-test)))
(tfrag-vu1-init-buf
(the-as bucket-id (-> s3-0 tfrag-bucket))
s2-0
0
(-> s4-0 tfrag-last-calls 0)
(logtest? (-> s4-0 info level-flags) (level-flags use-camera-other))
)
(tfrag-scissor-vu1-init-buf
(the-as bucket-id (-> s3-0 tfrag-scissor-bucket))
s2-0
0
(-> s4-0 tfrag-last-calls 1)
(logtest? (-> s4-0 info level-flags) (level-flags use-camera-other))
)
)
(tfrag-vu1-init-buf
(the-as bucket-id (-> s3-0 tfrag-trans-bucket))
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))
1
(-> s4-0 tfrag-last-calls 2)
(logtest? (-> s4-0 info level-flags) (level-flags use-camera-other))
)
(tfrag-scissor-vu1-init-buf
(the-as bucket-id (-> s3-0 tfrag-scissor-trans-bucket))
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))
1
(-> s4-0 tfrag-last-calls 3)
(logtest? (-> s4-0 info level-flags) (level-flags use-camera-other))
)
(tfrag-vu1-init-buf
(the-as bucket-id (-> s3-0 tfrag-water-bucket))
(new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal))
1
(-> s4-0 tfrag-last-calls 4)
(logtest? (-> s4-0 info level-flags) (level-flags use-camera-other))
)
(tfrag-scissor-vu1-init-buf
(the-as bucket-id (-> s3-0 tfrag-water-scissor-bucket))
(new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal))
1
(-> s4-0 tfrag-last-calls 5)
(logtest? (-> s4-0 info level-flags) (level-flags use-camera-other))
)
)
)
)
)
(none)
)
(defmethod draw ((this drawable-tree-tfrag))
"Draw the drawable, and typically its children.
This usually means adding stuff to a list to be drawn later, rather than expensive drawing here."
(let ((v1-1 (-> *background-work* tfrag-tree-count))
(a1-3 (-> *level* draw-level *draw-index*))
)
(set! (-> *background-work* tfrag-trees v1-1) this)
(set! (-> *background-work* tfrag-levels v1-1) a1-3)
)
(+! (-> *background-work* tfrag-tree-count) 1)
0
(none)
)
(defmethod draw ((this drawable-tree-tfrag-trans))
"Draw the drawable, and typically its children.
This usually means adding stuff to a list to be drawn later, rather than expensive drawing here."
(let ((v1-1 (-> *background-work* tfrag-trans-tree-count))
(a1-3 (-> *level* draw-level *draw-index*))
)
(set! (-> *background-work* tfrag-trans-trees v1-1) this)
(set! (-> *background-work* tfrag-trans-levels v1-1) a1-3)
)
(+! (-> *background-work* tfrag-trans-tree-count) 1)
0
(none)
)
(defmethod draw ((this drawable-tree-tfrag-water))
"Draw the drawable, and typically its children.
This usually means adding stuff to a list to be drawn later, rather than expensive drawing here."
(let ((v1-1 (-> *background-work* tfrag-water-tree-count))
(a1-3 (-> *level* draw-level *draw-index*))
)
(set! (-> *background-work* tfrag-water-trees v1-1) this)
(set! (-> *background-work* tfrag-water-levels v1-1) a1-3)
)
(+! (-> *background-work* tfrag-water-tree-count) 1)
0
(none)
)
(defmethod draw ((this drawable-tree-tfrag-shared))
"Draw the drawable, and typically its children.
This usually means adding stuff to a list to be drawn later, rather than expensive drawing here."
(let ((v1-1 (-> *background-work* tfrag-shared-tree-count))
(a1-3 (-> *level* draw-level *draw-index*))
)
(set! (-> *background-work* tfrag-shared-trees v1-1) this)
(set! (-> *background-work* tfrag-shared-levels v1-1) a1-3)
)
(+! (-> *background-work* tfrag-shared-tree-count) 1)
0
(none)
)
(defmethod draw ((this drawable-tree-tfrag-trans-shared))
"Draw the drawable, and typically its children.
This usually means adding stuff to a list to be drawn later, rather than expensive drawing here."
(let ((v1-1 (-> *background-work* tfrag-trans-shared-tree-count))
(a1-3 (-> *level* draw-level *draw-index*))
)
(set! (-> *background-work* tfrag-trans-shared-trees v1-1) this)
(set! (-> *background-work* tfrag-trans-shared-levels v1-1) a1-3)
)
(+! (-> *background-work* tfrag-trans-shared-tree-count) 1)
0
(none)
)
(defmethod draw ((this drawable-tree-tfrag-water-shared))
"Draw the drawable, and typically its children.
This usually means adding stuff to a list to be drawn later, rather than expensive drawing here."
(let ((v1-1 (-> *background-work* tfrag-water-shared-tree-count))
(a1-3 (-> *level* draw-level *draw-index*))
)
(set! (-> *background-work* tfrag-water-shared-trees v1-1) this)
(set! (-> *background-work* tfrag-water-shared-levels v1-1) a1-3)
)
(+! (-> *background-work* tfrag-water-shared-tree-count) 1)
0
(none)
)
(defmethod collect-stats ((this tfragment))
"Collect triangle/perf statistics for rendering.
This is only called when viewing stats.
The vis-bits and culling registers are loaded during this time."
(stats-tfrag-asm this)
0
(none)
)
(defmethod collect-stats ((this drawable-tree-tfrag))
"Collect triangle/perf statistics for rendering.
This is only called when viewing stats.
The vis-bits and culling registers are loaded during this time."
(when (logtest? (-> *display* vu1-enable-user) 64)
(set! (-> *tfrag-work* vu1-enable-tfrag) (the-as int (logand (-> *display* vu1-enable-user) 64)))
(set! (-> *tfrag-work* vu1-enable-tfrag-scissor) (the-as int (logand (-> *display* vu1-enable-user) 64)))
(set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag))
(set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor))
(let ((v1-15 (-> *tfrag-work* frag-dists quad)))
(set! (-> *tfrag-work* frag-dists quad) v1-15)
)
(dotimes (s5-0 (-> this length))
(collect-stats (-> this arrays s5-0))
)
)
0
(none)
)
(defmethod collect-stats ((this drawable-tree-tfrag-trans))
"Collect triangle/perf statistics for rendering.
This is only called when viewing stats.
The vis-bits and culling registers are loaded during this time."
(when (logtest? #x80000 (-> *display* vu1-enable-user))
(set! (-> *tfrag-work* vu1-enable-tfrag) (the-as int (logand #x80000 (-> *display* vu1-enable-user))))
(set! (-> *tfrag-work* vu1-enable-tfrag-scissor) (the-as int (logand #x80000 (-> *display* vu1-enable-user))))
(set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag-trans))
(set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor-trans))
(let ((v1-12 (-> *tfrag-work* frag-dists quad)))
(set! (-> *tfrag-work* frag-dists quad) v1-12)
)
(dotimes (s5-0 (-> this length))
(collect-stats (-> this arrays s5-0))
)
)
0
(none)
)
(defmethod collect-stats ((this drawable-tree-tfrag-water))
"Collect triangle/perf statistics for rendering.
This is only called when viewing stats.
The vis-bits and culling registers are loaded during this time."
(when (logtest? #x1000000 (-> *display* vu1-enable-user))
(set! (-> *tfrag-work* vu1-enable-tfrag) (the-as int (logand #x1000000 (-> *display* vu1-enable-user))))
(set! (-> *tfrag-work* vu1-enable-tfrag-scissor)
(the-as int (logand #x1000000 (-> *display* vu1-enable-user)))
)
(set! (-> *tfrag-work* tr-stat-tfrag) (-> *terrain-stats* tfrag-water))
(set! (-> *tfrag-work* tr-stat-tfrag-scissor) (-> *terrain-stats* tfrag-scissor-water))
(let ((v1-12 (-> *tfrag-work* frag-dists quad)))
(set! (-> *tfrag-work* frag-dists quad) v1-12)
)
(dotimes (s5-0 (-> this length))
(collect-stats (-> this arrays s5-0))
)
)
0
(none)
)
(defmethod collect-stats ((this drawable-inline-array-tfrag))
"Collect triangle/perf statistics for rendering.
This is only called when viewing stats.
The vis-bits and culling registers are loaded during this time."
(when (logtest? (-> *display* vu1-enable-user) 64)
(dotimes (s5-0 (-> this length))
(let ((s4-0 (-> this data s5-0)))
(if (vis-cull (-> s4-0 id))
(collect-stats s4-0)
)
)
)
)
0
(none)
)
(defmethod collect-stats ((this drawable-inline-array-tfrag-trans))
"Collect triangle/perf statistics for rendering.
This is only called when viewing stats.
The vis-bits and culling registers are loaded during this time."
(when (logtest? #x80000 (-> *display* vu1-enable-user))
(dotimes (s5-0 (-> this length))
(let ((s4-0 (-> this data s5-0)))
(if (vis-cull (-> s4-0 id))
(collect-stats s4-0)
)
)
)
)
0
(none)
)
(defmethod collect-stats ((this drawable-inline-array-tfrag-water))
"Collect triangle/perf statistics for rendering.
This is only called when viewing stats.
The vis-bits and culling registers are loaded during this time."
(when (logtest? #x1000000 (-> *display* vu1-enable-user))
(dotimes (s5-0 (-> this length))
(let ((s4-0 (-> this data s5-0)))
(if (vis-cull (-> s4-0 id))
(collect-stats s4-0)
)
)
)
)
0
(none)
)
(defmethod debug-draw ((this drawable-tree-tfrag))
"Debug-draw a drawable and its children. Typically uses the debug-draw functions."
(when (logtest? (-> *display* vu1-enable-user) 64)
(dotimes (s5-0 (-> this length))
(debug-draw (-> this arrays s5-0))
)
)
0
(none)
)
(defmethod debug-draw ((this drawable-tree-tfrag-trans))
"Debug-draw a drawable and its children. Typically uses the debug-draw functions."
(when (logtest? #x80000 (-> *display* vu1-enable-user))
(dotimes (s5-0 (-> this length))
(debug-draw (-> this arrays s5-0))
)
)
0
(none)
)
(defmethod debug-draw ((this drawable-tree-tfrag-water))
"Debug-draw a drawable and its children. Typically uses the debug-draw functions."
(when (logtest? #x1000000 (-> *display* vu1-enable-user))
(dotimes (s5-0 (-> this length))
(debug-draw (-> this arrays s5-0))
)
)
0
(none)
)
(defmethod debug-draw ((this drawable-inline-array-tfrag))
"Debug-draw a drawable and its children. Typically uses the debug-draw functions."
(dotimes (s5-0 (-> this length))
(let ((s4-0 (-> this data s5-0)))
(if (vis-cull (-> s4-0 id))
(debug-draw s4-0)
)
)
)
0
(none)
)
(defmethod debug-draw ((this tfragment))
"Debug-draw a drawable and its children. Typically uses the debug-draw functions."
(-> *display* frames (-> *display* on-screen) global-buf)
(edge-debug-lines (-> this debug-data debug-lines))
0
(none)
)
@@ -5,5 +5,457 @@
;; name in dgo: tfrag
;; dgos: ENGINE, GAME
(define-extern draw-node-cull (function pointer pointer (inline-array draw-node) int none))
(defun stats-tfrag-asm ((frag tfragment))
(format 0 "no stats for you~%")
(none)
)
;; DECOMP BEGINS
(defmethod login ((this tfragment))
"Initialize the object after it is loaded."
(when (nonzero? *texture-masks-array*)
(let ((s5-0 (-> *texture-masks-array* data (-> this texture-masks-index))))
(dotimes (s4-0 (the-as int (-> this num-shaders)))
(let ((v1-6 (adgif-shader-login-no-remap (-> this shader s4-0))))
(when v1-6
(dotimes (a0-7 3)
(logior! (-> s5-0 data a0-7 mask dword 0) (-> v1-6 masks data a0-7 mask dword 0))
(logior! (-> s5-0 data a0-7 mask z) (-> v1-6 masks data a0-7 mask z))
(set! (-> s5-0 data a0-7 dist) (fmax (-> s5-0 data a0-7 dist) (-> v1-6 masks data a0-7 dist)))
)
)
)
)
(set! (-> s5-0 level) (-> *level* tfrag-login-level))
)
)
this
)
(defmethod mem-usage ((this tfragment) (usage memory-usage-block) (flags int))
(when (logtest? flags 2)
(+! (-> usage data 19 count) 1)
(let ((v1-6 (+ (-> this num-base-colors) (-> this num-level0-colors) (-> this num-level1-colors))))
(+! (-> usage data 19 used) v1-6)
(+! (-> usage data 19 total) (logand -4 (+ v1-6 3)))
)
(set! this this)
(goto cfg-16)
)
(let ((s4-0 1))
(set! (-> usage length) (max (-> usage length) (+ s4-0 8)))
(set! (-> usage data s4-0 name) "tfragment")
(+! (-> usage data s4-0 count) 1)
(let ((v1-20 (asize-of this)))
(+! (-> usage data s4-0 used) v1-20)
(+! (-> usage data s4-0 total) (logand -16 (+ v1-20 15)))
)
(set! (-> usage data (+ s4-0 1) name) "tfragment-base")
(+! (-> usage data (+ s4-0 1) count) 1)
(let ((v1-31 (* (-> this dma-qwc 0) 16)))
(+! (-> usage data (+ s4-0 1) used) v1-31)
(+! (-> usage data (+ s4-0 1) total) v1-31)
)
(set! (-> usage data (+ s4-0 2) name) "tfragment-common")
(+! (-> usage data (+ s4-0 2) count) 1)
(let ((v1-41 (* (- (-> this dma-qwc 1) (-> this dma-qwc 0)) 16)))
(+! (-> usage data (+ s4-0 2) used) v1-41)
(+! (-> usage data (+ s4-0 2) total) v1-41)
)
(set! (-> usage data (+ s4-0 3) name) "tfragment-level0")
(when (nonzero? (-> this num-level0-colors))
(+! (-> usage data (+ s4-0 3) count) 1)
(let ((v1-53 (* (- (-> this dma-qwc 2) (-> this dma-qwc 0)) 16)))
(+! (-> usage data (+ s4-0 3) used) v1-53)
(+! (-> usage data (+ s4-0 3) total) v1-53)
)
)
(set! (-> usage data (+ s4-0 4) name) "tfragment-level1")
(when (not (or (= (-> this dma-level-1) (-> this dma-common))
(= (-> this dma-level-1) (-> this dma-base))
(zero? (-> this num-level1-colors))
)
)
(+! (-> usage data (+ s4-0 4) count) 1)
(let ((v1-68 (* (- (-> this dma-qwc 3)
(- (/ (the-as int (- (-> this dma-level-1) (-> this dma-common))) 16) (-> this dma-qwc 0))
)
16
)
)
)
(+! (-> usage data (+ s4-0 4) used) v1-68)
(+! (-> usage data (+ s4-0 4) total) v1-68)
)
)
(set! (-> usage data (+ s4-0 5) name) "tfragment-color")
(+! (-> usage data (+ s4-0 5) count) 1)
(let ((v1-77
(if (logtest? flags 1)
0
(the-as int (* (+ (-> this num-base-colors) (-> this num-level0-colors) (-> this num-level1-colors)) 2))
)
)
)
(+! (-> usage data (+ s4-0 5) used) v1-77)
(+! (-> usage data (+ s4-0 5) total) (logand -16 (+ v1-77 15)))
)
(set! (-> usage data (+ s4-0 6) name) "tfragment-debug")
)
(label cfg-16)
this
)
(defmethod mem-usage ((this drawable-inline-array-tfrag) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 1 (-> usage length)))
(set! (-> usage data 0 name) "drawable-group")
(+! (-> usage data 0 count) 1)
(let ((v1-5 32))
(+! (-> usage data 0 used) v1-5)
(+! (-> usage data 0 total) (logand -16 (+ v1-5 15)))
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) usage flags)
)
this
)
(defmethod mem-usage ((this drawable-tree-tfrag) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 1 (-> usage length)))
(set! (-> usage data 0 name) "drawable-group")
(+! (-> usage data 0 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 0 used) v1-6)
(+! (-> usage data 0 total) (logand -16 (+ v1-6 15)))
)
(when (nonzero? (-> this time-of-day-pal))
(set! (-> usage length) (max 9 (-> usage length)))
(set! (-> usage data 8 name) "tfragment-pal")
(+! (-> usage data 8 count) 1)
(let ((v1-18 (asize-of (-> this time-of-day-pal))))
(+! (-> usage data 8 used) v1-18)
(+! (-> usage data 8 total) (logand -16 (+ v1-18 15)))
)
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this arrays s3-0) usage flags)
)
this
)
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this drawable-inline-array-tfrag))
(the-as int (+ (-> drawable-inline-array-tfrag size) (* (+ (-> this length) -1) 64)))
)
(define *tfrag-display-stats* #f)
(define tfrag-vu1-block (new 'static 'vu-function :length #x74b :qlength #x3a6))
;; WARN: Return type mismatch tfrag-data vs none.
(defun tfrag-data-setup ((arg0 tfrag-data) (arg1 int) (arg2 int))
(let ((v1-0 (view-get-active-math-camera)))
(let ((a0-1 (-> arg0 data)))
(set! (-> a0-1 0) (the-as uint (-> v1-0 pfog0)))
(set! (-> a0-1 1) (the-as uint (-> v1-0 fog-min)))
(set! (-> a0-1 2) (the-as uint (-> v1-0 fog-max)))
(set! (-> a0-1 3) (the-as uint 3072.0))
)
(set-vector! (-> arg0 val) 0.5 1.0 2048.0 0.0)
(set-vector! (-> arg0 ambient) 1.0 1.0 1.0 1.0)
(cond
((zero? arg2)
(set! (-> arg0 strgif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
(set! (-> arg0 fangif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
)
((= arg2 1)
(set! (-> arg0 strgif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
(set! (-> arg0 fangif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
)
((= arg2 2)
(set! (-> arg0 strgif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe arg1)
)
)
(set! (-> arg0 fangif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :fge #x1 :abe arg1)
)
)
)
((= arg2 3)
(set! (-> arg0 strgif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
(set! (-> arg0 fangif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
)
)
(set! (-> arg0 strgif regs)
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(set! (-> arg0 fangif regs)
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
(set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
(set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad))
(set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad))
(set! (-> arg0 invh-scale quad) (-> v1-0 inv-hmge-scale quad))
(set! (-> arg0 guard quad) (-> v1-0 guard quad))
)
(set-tfrag-dists! (-> arg0 dists))
(none)
)
;; WARN: Return type mismatch pointer vs none.
(defun add-tfrag-mtx-0 ((arg0 dma-buffer) (arg1 symbol))
(let* ((a2-0 4)
(v1-0 arg0)
(a0-1 (the-as object (-> v1-0 base)))
)
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0))
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as dma-packet a0-1) vif1)
(new 'static 'vif-tag :imm #x5 :cmd (vif-cmd unpack-v4-32) :num a2-0)
)
(set! (-> v1-0 base) (the-as pointer (&+ (the-as dma-packet a0-1) 16)))
)
(if arg1
(column-scale-matrix!
(the-as matrix (-> arg0 base))
(new 'static 'vector :data (new 'static 'array float 4 1.0 1.0 1.0 1.0))
(-> (view-get-active-math-camera) camera-temp-other)
)
(column-scale-matrix!
(the-as matrix (-> arg0 base))
(new 'static 'vector :data (new 'static 'array float 4 1.0 1.0 1.0 1.0))
(-> (view-get-active-math-camera) camera-temp)
)
)
(&+! (-> arg0 base) 64)
(none)
)
;; WARN: Return type mismatch pointer vs none.
(defun add-tfrag-mtx-1 ((arg0 dma-buffer) (arg1 symbol))
(let* ((a2-0 4)
(v1-0 arg0)
(a0-1 (the-as object (-> v1-0 base)))
)
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0))
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as dma-packet a0-1) vif1)
(new 'static 'vif-tag :imm #x14d :cmd (vif-cmd unpack-v4-32) :num a2-0)
)
(set! (-> v1-0 base) (the-as pointer (&+ (the-as dma-packet a0-1) 16)))
)
(if arg1
(column-scale-matrix!
(the-as matrix (-> arg0 base))
(new 'static 'vector :data (new 'static 'array float 4 1.0 1.0 1.0 1.0))
(-> (view-get-active-math-camera) camera-temp-other)
)
(column-scale-matrix!
(the-as matrix (-> arg0 base))
(new 'static 'vector :data (new 'static 'array float 4 1.0 1.0 1.0 1.0))
(-> (view-get-active-math-camera) camera-temp)
)
)
(&+! (-> arg0 base) 64)
(none)
)
;; WARN: Return type mismatch dma-packet vs none.
(defun add-tfrag-data ((arg0 dma-buffer) (arg1 int) (arg2 int))
(let* ((a3-0 14)
(v1-0 arg0)
(a0-1 (the-as dma-packet (-> v1-0 base)))
)
(set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a3-0))
(set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x290 :cmd (vif-cmd unpack-v4-32) :num a3-0))
(set! (-> v1-0 base) (the-as pointer (&+ a0-1 16)))
)
(tfrag-data-setup (the-as tfrag-data (-> arg0 base)) arg1 arg2)
(&+! (-> arg0 base) 224)
(let ((v1-3 (the-as dma-packet (-> arg0 base))))
(set! (-> v1-3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
(set! (-> v1-3 vif0) (new 'static 'vif-tag))
(set! (-> v1-3 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1))
(set! (-> arg0 base) (the-as pointer (&+ v1-3 16)))
)
(none)
)
(define t-stat (new 'global 'tfrag-stats))
;; WARN: Return type mismatch symbol vs none.
(defun tfrag-print-stats ((arg0 symbol))
(when (and *tfrag-display-stats* (!= *master-mode* 'menu))
(format arg0 "~%")
(format arg0 "tris: ~8d~%" (-> t-stat tris))
(format arg0 "verts: ~8d~%" (+ (-> t-stat base-verts) (-> t-stat level0-verts) (-> t-stat level1-verts)))
(format arg0 " base: ~8d~%" (-> t-stat base-verts))
(format arg0 " lev0: ~8d~%" (-> t-stat level0-verts))
(format arg0 " lev1: ~8d~%" (-> t-stat level1-verts))
(format arg0 "tfaces: ~8d~%" (-> t-stat tfaces))
(format arg0 "tfrags: ~8d~%" (-> t-stat tfrags))
(format arg0 "dtris: ~8d~%" (-> t-stat dtris))
(format arg0 "dps: ~8d~%" (-> t-stat drawpoints))
(format arg0 "strips: ~8d~%" (-> t-stat strips))
(format arg0 "shaders:~8d~%" (-> t-stat dma-tex))
(format arg0 "tri/str:~8f~%" (/ (the float (-> t-stat dtris)) (the float (-> t-stat strips))))
(format arg0 "dma-cnt:~8d (~8d)~%" (-> t-stat dma-cnt) (* (-> t-stat dma-cnt) 32))
(format arg0 "dma-dta:~8d (~8d)~%" (-> t-stat dma-dta) (/ (* 33 (-> t-stat dma-dta)) 10))
(let ((f0-4 (* 32.0 (the float (-> t-stat dma-cnt))))
(f1-5 (* 3.3 (the float (-> t-stat dma-dta))))
(f2-3 (* 30.0 (the float (-> t-stat tfrags))))
)
(+ f0-4 f1-5 f2-3)
)
)
(none)
)
(set! (-> t-stat from) 0)
(set! (-> t-stat to) 0)
(set! (-> t-stat cnt) 0)
;; WARN: Return type mismatch symbol vs none.
(defun tfrag-init-buffer ((arg0 dma-buffer) (arg1 gs-test) (arg2 int) (arg3 symbol))
(let ((v1-0 *display*)
(a0-6 (+ (* (+ (/ (-> tfrag-vu1-block qlength) 127) 1) 16) 528))
)
(+! (-> v1-0 mem-reserve-size) a0-6)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-6)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(dma-buffer-add-vu-function arg0 tfrag-vu1-block 1)
(let* ((v1-2 *viewport-array*)
(v1-3 (-> v1-2 data (-> v1-2 current-viewport-index)))
)
(dma-buffer-add-gs-set arg0
(test-1 arg1)
(frame-1 (-> v1-3 frame))
(zbuf-1 (-> v1-3 zbuf-on))
(scissor-1 (-> v1-3 scissor))
)
)
(add-tfrag-mtx-0 arg0 arg3)
(add-tfrag-mtx-1 arg0 arg3)
(add-tfrag-data arg0 arg2 (the-as int *subdivide-draw-mode*))
(let ((v1-7 (the-as object (-> arg0 base))))
(set! (-> (the-as dma-packet v1-7) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
(set! (-> (the-as dma-packet v1-7) vif0) (new 'static 'vif-tag :cmd (vif-cmd base)))
(set! (-> (the-as dma-packet v1-7) vif1) (new 'static 'vif-tag :imm #x148 :cmd (vif-cmd offset)))
(set! (-> arg0 base) (the-as pointer (&+ (the-as dma-packet v1-7) 16)))
)
)
)
)
(none)
)
;; WARN: Return type mismatch symbol vs none.
(defun tfrag-end-buffer ((arg0 dma-buffer) (arg1 int))
(let ((v1-0 *display*)
(a2-0 64)
)
(+! (-> v1-0 mem-reserve-size) a2-0)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-0)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(let* ((v1-2 arg0)
(a2-4 (the-as dma-packet (-> v1-2 base)))
)
(set! (-> a2-4 dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)))
(set! (-> a2-4 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmask)))
(set! (-> a2-4 vif1) (new 'static 'vif-tag))
(set! (-> v1-2 base) (the-as pointer (&+ a2-4 16)))
)
(let* ((v1-3 arg0)
(a0-1 (-> v1-3 base))
)
(set! (-> (the-as (pointer vif-tag) a0-1) 0) (the-as vif-tag arg1))
(set! (-> (the-as (pointer vif-tag) a0-1) 1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
(set! (-> (the-as (pointer vif-tag) a0-1) 2) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
(set! (-> (the-as (pointer vif-tag) a0-1) 3) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1))
(set! (-> (the-as (pointer int32) a0-1) 4) 0)
(set! (-> (the-as (pointer int32) a0-1) 5) 0)
(set! (-> (the-as (pointer int32) a0-1) 6) 0)
(set! (-> (the-as (pointer int32) a0-1) 7) 0)
(set! (-> (the-as (pointer vif-tag) a0-1) 8) (new 'static 'vif-tag :cmd (vif-cmd base)))
(set! (-> (the-as (pointer vif-tag) a0-1) 9) (new 'static 'vif-tag :cmd (vif-cmd offset)))
(set! (-> (the-as (pointer vif-tag) a0-1) 10) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as (pointer vif-tag) a0-1) 11) (new 'static 'vif-tag))
(set! (-> v1-3 base) (&+ a0-1 48))
)
)
)
)
(none)
)
;; og:preserve-this
(defun tfrag-scissor-init-buffer ((arg0 dma-buffer) (arg1 gs-test) (arg2 int) (arg3 symbol))
(none)
)
;; og:preserve-this
(defun tfrag-scissor-end-buffer ((arg0 dma-buffer) (arg1 uint))
(none)
)
@@ -6,4 +6,3 @@
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
@@ -7,3 +7,657 @@
;; DECOMP BEGINS
(defmethod login ((this tie-fragment))
"Initialize the object after it is loaded."
(let ((s5-0 (the-as adgif-shader (-> this gif-ref)))
(s4-0 (/ (-> this tex-count) (the-as uint 5)))
)
(dotimes (s3-0 (the-as int s4-0))
(let ((v1-1 (adgif-shader-login-no-remap s5-0)))
(when v1-1
(dotimes (a0-4 3)
(logior! (-> *texture-masks* data a0-4 mask dword 0) (-> v1-1 masks data a0-4 mask dword 0))
(logior! (-> *texture-masks* data a0-4 mask z) (-> v1-1 masks data a0-4 mask z))
(set! (-> *texture-masks* data a0-4 dist)
(fmax (-> *texture-masks* data a0-4 dist) (-> v1-1 masks data a0-4 dist))
)
)
)
)
(when (= (-> s5-0 reg-4) (gs-reg alpha-1))
(set! (-> s5-0 reg-4) (gs-reg hack))
(set! (-> s5-0 alpha) (new 'static 'gs-miptbp))
0
)
(&+! s5-0 80)
)
)
this
)
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this drawable-inline-array-instance-tie))
(the-as int (+ (-> drawable-inline-array-instance-tie size) (* (+ (-> this length) -1) 64)))
)
(defmethod login ((this prototype-tie))
"Initialize the object after it is loaded."
(dotimes (s5-0 (-> this length))
(login (-> this data s5-0))
)
this
)
(defmethod mem-usage ((this drawable-tree-instance-tie) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 1 (-> usage length)))
(set! (-> usage data 0 name) "drawable-group")
(+! (-> usage data 0 count) 1)
(let ((v1-5 32))
(+! (-> usage data 0 used) v1-5)
(+! (-> usage data 0 total) (logand -16 (+ v1-5 15)))
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) usage flags)
)
(mem-usage (-> this prototypes prototype-array-tie) usage (logior flags 1))
this
)
(defmethod mem-usage ((this tie-fragment) (usage memory-usage-block) (flags int))
(when (logtest? flags 2)
(let ((v1-3 (* (-> this color-count) 4))
(a0-2 (cond
((logtest? flags 4)
20
)
((logtest? flags 8)
21
)
(else
22
)
)
)
)
(+! (-> usage data a0-2 count) 1)
(+! (-> usage data a0-2 used) v1-3)
(+! (-> usage data a0-2 total) (logand -4 (+ v1-3 3)))
)
(set! (-> usage length) (max 23 (-> usage length)))
(set! this this)
(goto cfg-13)
)
(set! (-> usage length) (max 18 (-> usage length)))
(set! (-> usage data 9 name) "tie-fragment")
(set! (-> usage data 10 name) "tie-gif")
(set! (-> usage data 11 name) "tie-points")
(set! (-> usage data 12 name) "tie-colors")
(set! (-> usage data 14 name) "tie-debug")
(set! (-> usage data 13 name) "tie-draw-points")
(set! (-> usage data 17 name) "tie-generic")
(+! (-> usage data 9 count) 1)
(let ((v1-21 (asize-of this)))
(+! (-> usage data 9 used) v1-21)
(+! (-> usage data 9 total) (logand -16 (+ v1-21 15)))
)
(let ((v1-26 (* (-> this gif-count) 16)))
(+! (-> usage data 10 count) (-> this tex-count))
(+! (-> usage data 10 used) v1-26)
(+! (-> usage data 10 total) (logand -16 (+ v1-26 15)))
)
(let ((v1-31 (* (-> this vertex-count) 16)))
(+! (-> usage data 11 count) (-> this vertex-count))
(+! (-> usage data 11 used) v1-31)
(+! (-> usage data 11 total) (logand -16 (+ v1-31 15)))
)
(let ((v1-36 (* (-> this dp-qwc) 16)))
(+! (-> usage data 13 count) (* (-> this dp-qwc) 16))
(+! (-> usage data 13 used) v1-36)
(+! (-> usage data 13 total) (logand -16 (+ v1-36 15)))
)
(let ((v1-41 (* (-> this generic-count) 16)))
(+! (-> usage data 17 count) 1)
(+! (-> usage data 17 used) v1-41)
(+! (-> usage data 17 total) (logand -16 (+ v1-41 15)))
)
(let ((s4-0 (-> this debug debug-lines)))
(when (nonzero? s4-0)
(dotimes (s3-0 (-> s4-0 length))
(+! (-> usage data 14 count) (-> s4-0 s3-0 length))
(let ((v1-52 (asize-of (-> s4-0 s3-0))))
(+! (-> usage data 12 used) v1-52)
(+! (-> usage data 12 total) (logand -16 (+ v1-52 15)))
)
)
)
)
(label cfg-13)
this
)
(defmethod mem-usage ((this instance-tie) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 19 (-> usage length)))
(set! (-> usage data 18 name) "instance-tie")
(+! (-> usage data 18 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 18 used) v1-6)
(+! (-> usage data 18 total) (logand -16 (+ v1-6 15)))
)
(when (nonzero? (-> this color-indices))
(set! (-> usage length) (max 24 (-> usage length)))
(set! (-> usage data 23 name) "instance-tie-colors*")
(set! (-> usage data 19 name) "instance-tie-colors0")
(set! (-> usage data 20 name) "instance-tie-colors1")
(set! (-> usage data 21 name) "instance-tie-colors2")
(set! (-> usage data 22 name) "instance-tie-colors3")
(+! (-> usage data 23 count) 1)
(let ((s3-0 (-> this bucket-ptr)))
(+ (-> usage data 19 used) (-> usage data 20 used) (-> usage data 21 used) (-> usage data 22 used))
(dotimes (s2-0 4)
(let ((a0-10 (-> s3-0 tie-geom s2-0)))
(when (nonzero? a0-10)
(let ((t9-1 (method-of-object a0-10 mem-usage))
(a1-2 usage)
(v1-29 s2-0)
)
(t9-1 a0-10 a1-2 (logior (logior (cond
((= v1-29 1)
4
)
((= v1-29 2)
8
)
((= v1-29 3)
16
)
(else
0
)
)
2
)
flags
)
)
)
)
)
)
)
)
this
)
(defmethod mem-usage ((this drawable-inline-array-instance-tie) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 1 (-> usage length)))
(set! (-> usage data 0 name) "drawable-group")
(+! (-> usage data 0 count) 1)
(let ((v1-5 32))
(+! (-> usage data 0 used) v1-5)
(+! (-> usage data 0 total) (logand -16 (+ v1-5 15)))
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) usage flags)
)
this
)
(defmethod mem-usage ((this prototype-tie) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 1 (-> usage length)))
(set! (-> usage data 0 name) "drawable-group")
(+! (-> usage data 0 count) 1)
(let ((v1-5 32))
(+! (-> usage data 0 used) v1-5)
(+! (-> usage data 0 total) (logand -16 (+ v1-5 15)))
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) usage flags)
)
this
)
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this prototype-tie))
(the-as int (+ (-> prototype-tie size) (* (+ (-> this length) -1) 64)))
)
(deftype tie-consts (structure)
((data uint32 40)
(vector vector 10 :inline :overlay-at (-> data 0))
(quads uint128 10 :overlay-at (-> data 0))
(adgif gs-gif-tag :inline :overlay-at (-> data 0))
(strgif gs-gif-tag :inline :overlay-at (-> data 4))
(extra vector :inline :overlay-at (-> data 8))
(gifbufs vector :inline :overlay-at (-> data 12))
(clrbufs qword :inline :overlay-at (-> data 16))
(misc qword :inline :overlay-at (-> data 20))
(atestgif gs-gif-tag :inline :overlay-at (-> data 24))
(alpha gs-adcmd :inline :overlay-at (-> data 28))
(atest gs-adcmd 2 :inline :overlay-at (-> data 32))
(atest-tra gs-adcmd :inline :overlay-at (-> data 32))
(atest-def gs-adcmd :inline :overlay-at (-> data 36))
)
)
(define tie-vu1-block (new 'static 'vu-function :length #x3e7 :qlength #x1f4))
(defun tie-init-consts ((arg0 tie-consts) (arg1 gs-alpha) (arg2 gs-test) (arg3 gs-test))
"Set up tie-consts for VU1"
(set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
(set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
(case *subdivide-draw-mode*
(((subdivide-setting textured))
(set! (-> arg0 strgif tag)
(new 'static 'gif-tag64
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
:nreg #x3
)
)
)
(((subdivide-setting outline))
(set! (-> arg0 strgif tag)
(new 'static 'gif-tag64
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
:nreg #x3
)
)
)
(((subdivide-setting gouraud))
(set! (-> arg0 strgif tag)
(new 'static 'gif-tag64
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe #x1)
:nreg #x3
)
)
)
(((subdivide-setting hack))
(set! (-> arg0 strgif tag)
(new 'static 'gif-tag64
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
:nreg #x3
)
)
)
)
(set! (-> arg0 strgif regs)
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(let ((f0-0 8388894.0)
(f1-0 8389078.0)
(f2-0 8389262.0)
)
(set! (-> arg0 gifbufs x) f2-0)
(set! (-> arg0 gifbufs y) f1-0)
(set! (-> arg0 gifbufs z) f2-0)
(set! (-> arg0 gifbufs w) f1-0)
(set! (-> arg0 extra x) (+ f0-0 f1-0 f2-0))
(set! (-> arg0 extra y) 0.0)
(set! (-> arg0 extra z) (+ f0-0 f1-0 f2-0))
)
(set! (-> arg0 clrbufs vector4w x) 198)
(set! (-> arg0 clrbufs vector4w y) 242)
(set! (-> arg0 clrbufs vector4w z) 198)
(set! (-> arg0 clrbufs vector4w w) 242)
(set! (-> arg0 atestgif tag) (new 'static 'gif-tag64 :nloop #x2 :eop #x1 :nreg #x1))
(set! (-> arg0 atestgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
(set! (-> arg0 alpha data) (the-as uint arg1))
(set! (-> arg0 alpha cmds) (gs-reg64 alpha-1))
(set! (-> arg0 atest-tra cmds) (gs-reg64 test-1))
(set! (-> arg0 atest-tra data) (the-as uint arg2))
(set! (-> arg0 atest-def cmds) (gs-reg64 test-1))
(set! (-> arg0 atest-def data) (the-as uint arg3))
(set! (-> arg0 misc vector4w x) 0)
(set! (-> arg0 misc vector4w y) -1)
(none)
)
(defun tie-init-engine ((arg0 dma-buffer) (arg1 gs-alpha) (arg2 gs-test) (arg3 gs-test))
"Set up DMA to initialize TIE vu1."
(let ((v1-0 *display*)
(a0-6 (+ (* (+ (/ (-> tie-vu1-block qlength) 127) 1) 16) 336))
)
(+! (-> v1-0 mem-reserve-size) a0-6)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-6)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(dma-buffer-add-vu-function arg0 tie-vu1-block 1)
(let ((s2-0 10))
(let* ((v1-2 arg0)
(a0-11 (the-as dma-packet (-> v1-2 base)))
)
(set! (-> a0-11 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc s2-0))
(set! (-> a0-11 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
(set! (-> a0-11 vif1) (new 'static 'vif-tag :imm #x3c6 :cmd (vif-cmd unpack-v4-32) :num s2-0))
(set! (-> v1-2 base) (the-as pointer (&+ a0-11 16)))
)
(tie-init-consts (the-as tie-consts (-> arg0 base)) arg1 arg2 arg3)
(&+! (-> arg0 base) (* s2-0 16))
)
(let* ((v1-5 arg0)
(a0-15 (the-as dma-packet (-> v1-5 base)))
)
(set! (-> a0-15 dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
(set! (-> a0-15 vif0) (new 'static 'vif-tag :imm #x8 :cmd (vif-cmd mscalf) :msk #x1))
(set! (-> a0-15 vif1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
(set! (-> v1-5 base) (the-as pointer (&+ a0-15 16)))
)
(let* ((v1-6 arg0)
(a0-17 (the-as dma-packet (-> v1-6 base)))
)
(set! (-> a0-17 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
(set! (-> a0-17 vif0) (new 'static 'vif-tag))
(set! (-> a0-17 vif1) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1))
(set! (-> v1-6 base) (the-as pointer (&+ a0-17 16)))
)
(let* ((v1-7 arg0)
(a0-19 (the-as object (-> v1-7 base)))
)
(set! (-> (the-as vector a0-19) x) 8388608.0)
(set! (-> (the-as vector a0-19) y) 8388608.0)
(set! (-> (the-as vector a0-19) z) 8388608.0)
(set! (-> (the-as vector a0-19) w) 8388608.0)
(set! (-> (the-as (pointer vif-tag) a0-19) 4) (new 'static 'vif-tag :cmd (vif-cmd base)))
(set! (-> (the-as (pointer vif-tag) a0-19) 5) (new 'static 'vif-tag :imm #x2c :cmd (vif-cmd offset)))
(set! (-> (the-as (pointer vif-tag) a0-19) 6) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
(set! (-> (the-as (pointer vif-tag) a0-19) 7) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> v1-7 base) (&-> (the-as (pointer vif-tag) a0-19) 8))
)
(let* ((v1-8 *viewport-array*)
(v1-9 (-> v1-8 data (-> v1-8 current-viewport-index)))
)
(let* ((a0-24 arg0)
(a1-33 (the-as object (-> a0-24 base)))
)
(set! (-> (the-as dma-packet a1-33) dma) (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)))
(set! (-> (the-as dma-packet a1-33) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet a1-33) vif1) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1))
(set! (-> a0-24 base) (the-as pointer (&+ (the-as dma-packet a1-33) 16)))
)
(let* ((a0-25 arg0)
(a1-35 (-> a0-25 base))
)
(set! (-> (the-as (pointer uint64) a1-35) 0) (make-u128 0 (the-as uint #x3000000000008001)))
(set! (-> (the-as (pointer uint64) a1-35) 1) (the-as uint #xeeeeeeeeeeeeeeee))
(set! (-> a0-25 base) (&-> (the-as (pointer uint64) a1-35) 2))
)
(let ((a0-26 (-> arg0 base)))
(set! (-> (the-as (pointer uint64) a0-26)) (-> v1-9 frame))
(set! (-> (the-as (pointer uint64) a0-26) 1) (the-as uint 76))
(set! (-> (the-as (pointer uint64) a0-26) 2) (-> v1-9 zbuf-on))
(set! (-> (the-as (pointer uint64) a0-26) 3) (the-as uint 78))
(set! (-> (the-as (pointer uint64) a0-26) 4) (-> v1-9 scissor))
(set! (-> (the-as (pointer uint64) a0-26) 5) (the-as uint 64))
(set! (-> arg0 base) (&-> (the-as (pointer uint64) a0-26) 6))
)
)
)
)
)
0
(none)
)
(defun tie-end-buffer ((arg0 dma-buffer))
"Set up DMA to finish TIE."
(let ((v1-0 *display*)
(a1-0 96)
)
(+! (-> v1-0 mem-reserve-size) a1-0)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((a3-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> a3-0 real-buffer-end) (the-as int (&+ (-> a3-0 base) a1-0)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(dma-buffer-add-gs-set arg0 (test-1 (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))))
(let* ((v1-5 arg0)
(a1-10 (the-as dma-packet (-> v1-5 base)))
)
(set! (-> a1-10 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
(set! (-> a1-10 vif0) (new 'static 'vif-tag :cmd (vif-cmd stmask)))
(set! (-> a1-10 vif1) (new 'static 'vif-tag))
(set! (-> v1-5 base) (the-as pointer (&+ a1-10 16)))
)
(let* ((v1-6 arg0)
(a0-1 (-> v1-6 base))
)
(set! (-> (the-as (pointer vif-tag) a0-1) 0) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd mscalf) :msk #x1))
(set! (-> (the-as (pointer vif-tag) a0-1) 1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
(set! (-> (the-as (pointer vif-tag) a0-1) 2) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
(set! (-> (the-as (pointer vif-tag) a0-1) 3) (new 'static 'vif-tag :cmd (vif-cmd strow) :msk #x1))
(set! (-> (the-as (pointer vif-tag) a0-1) 4) (new 'static 'vif-tag))
(set! (-> (the-as (pointer vif-tag) a0-1) 5) (new 'static 'vif-tag))
(set! (-> (the-as (pointer vif-tag) a0-1) 6) (new 'static 'vif-tag))
(set! (-> (the-as (pointer vif-tag) a0-1) 7) (new 'static 'vif-tag))
(set! (-> v1-6 base) (&+ a0-1 32))
)
)
)
)
0
(none)
)
(defun-debug tie-int-reg ((arg0 int))
"Get the name of TIE VU1 program integer register."
(let ((v1-0 arg0))
(cond
((zero? v1-0)
"zero"
)
((= v1-0 1)
"itemp"
)
((= v1-0 2)
"point-ptr"
)
((= v1-0 3)
"clr-ptr"
)
((= v1-0 4)
"target-bp1-ptr"
)
((= v1-0 5)
"skip-bp2"
)
((= v1-0 6)
"target-bp2-ptr"
)
((= v1-0 7)
"target-ip1-ptr"
)
((= v1-0 8)
"target-ip2-ptr"
)
((= v1-0 9)
"ind/ind0"
)
((= v1-0 10)
" ind1"
)
((= v1-0 11)
" ind2"
)
((= v1-0 12)
"dest-ptr"
)
((= v1-0 13)
"dest2-ptr"
)
((= v1-0 14)
"skip-ips"
)
((= v1-0 15)
"kick-addr"
)
)
)
)
(defun-debug tie-float-reg ((arg0 int))
"Get the name of TIE VU1 program float register."
(let ((v1-0 arg0))
(cond
((zero? v1-0)
"zero"
)
((= v1-0 1)
"t-mtx0"
)
((= v1-0 2)
"t-mtx1"
)
((= v1-0 3)
"t-mtx2"
)
((= v1-0 4)
"t-mtx3"
)
((= v1-0 5)
"vtx-0"
)
((= v1-0 6)
"vtx-1"
)
((= v1-0 7)
"vtx-2"
)
((= v1-0 8)
"vtx-3"
)
((= v1-0 9)
"pos-0/2"
)
((= v1-0 10)
"pos-1/3"
)
((= v1-0 11)
"clr-0"
)
((= v1-0 12)
"clr-1"
)
((= v1-0 13)
"clr-2"
)
((= v1-0 14)
"clr-3"
)
((= v1-0 15)
"tex-0"
)
((= v1-0 16)
"tex-1"
)
((= v1-0 17)
"tex-2"
)
((= v1-0 18)
"tex-3"
)
((= v1-0 19)
"res-0/2"
)
((= v1-0 20)
"res-1/3"
)
((= v1-0 21)
"gifbuf"
)
((= v1-0 22)
"clrbuf"
)
((= v1-0 23)
"extra"
)
((= v1-0 24)
"inds"
)
((= v1-0 25)
"--"
)
((= v1-0 26)
"--"
)
((= v1-0 27)
"morph"
)
((= v1-0 28)
"xyzofs"
)
((= v1-0 29)
"clr1"
)
((= v1-0 30)
"clr2"
)
((= v1-0 31)
"--"
)
)
)
)
;; WARN: Return type mismatch symbol vs none.
(defun-debug tie-ints ()
"Dump TIE integer regs for debug."
(let ((gp-0 (+ #x3da0 #x1100c000)))
(dotimes (s5-0 16)
(if (< s5-0 10)
(format 0 " ")
)
(format
0
"vi~d: ~6d #x~4,'0X ~s~%"
s5-0
(-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)
(-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)
(tie-int-reg s5-0)
)
)
)
(none)
)
;; WARN: Return type mismatch symbol vs none.
(defun-debug tie-floats ()
"Dump TIE float regs for debug."
(let ((gp-0 (the-as (pointer uint32) (+ #x3da0 #x1100c000))))
(dotimes (s5-0 32)
(if (< s5-0 10)
(format 0 " ")
)
(format
0
"vf~d: #x~8,'0X #x~8,'0X #x~8,'0X #x~8,'0X "
s5-0
(-> gp-0 (* s5-0 4))
(-> gp-0 (+ (* s5-0 4) 1))
(-> gp-0 (+ (* s5-0 4) 2))
(-> gp-0 (+ (* s5-0 4) 3))
)
(format
0
"~F ~F ~F ~F ~s~%"
(-> gp-0 (* s5-0 4))
(-> gp-0 (+ (* s5-0 4) 1))
(-> gp-0 (+ (* s5-0 4) 2))
(-> gp-0 (+ (* s5-0 4) 3))
(tie-float-reg s5-0)
)
)
)
(none)
)
+1 -1
View File
@@ -38,7 +38,7 @@
(blit-displays-work-method-14 () none)
(blit-displays-work-method-15 () none)
(blit-displays-work-method-16 () none)
(blit-displays-work-method-17 () none)
(do-blit-displays (_type_) none)
(blit-displays-work-method-18 () none)
(get-horizontal-flip-flag (_type_) symbol)
(set-horizontal-flip-flag (_type_ symbol) symbol)
+3 -3
View File
@@ -151,10 +151,10 @@
)
(:methods
(new (symbol type matrix int int float font-color font-flags) _type_)
(font-context-method-9 () none)
(font-context-method-9 (_type_) none)
(set-origin! (font-context int int) font-context)
(font-context-method-11 () none)
(font-context-method-12 () none)
(font-context-method-11 (_type_ int) int)
(font-context-method-12 (_type_ int) none)
(set-mat! (_type_ matrix) none)
(set-x-y! (_type_ int int) none)
(set-z! (_type_ int) none)
@@ -7,3 +7,282 @@
;; DECOMP BEGINS
(define *bone-calculation-list* (new 'global 'bone-calculation-list))
(defun bone-list-init ()
(let ((v1-0 *bone-calculation-list*))
(set! (-> v1-0 first) (the-as bone-calculation 0))
(set! (-> v1-0 next) (the-as bone-calculation 0))
)
0
0
(none)
)
(bone-list-init)
(define bones-vu0-block (new 'static 'vu-function :length 54 :qlength 27))
(defun bones-set-sqwc ()
(set! (-> (the-as dma-bank-control #x1000e000) sqwc) (new 'static 'dma-sqwc :sqwc #x1 :tqwc #x4))
(none)
)
(defun bones-reset-sqwc ()
(set! (-> (the-as dma-bank-control #x1000e000) sqwc) (new 'static 'dma-sqwc :sqwc #x1 :tqwc #x1))
(none)
)
(defun bones-init ((arg0 dma-buffer))
(let ((v1-1 (-> (the-as bone-memory #x70000000) work)))
(+ #x70000000 0)
(set! (-> v1-1 layout joint 0) (the-as (inline-array matrix) (-> (the-as bone-memory #x70000000) buffer)))
(set! (-> v1-1 layout joint 1) (the-as (inline-array matrix) (-> (the-as bone-memory #x70000000) buffer 1)))
(set! (-> v1-1 layout bone 0) (-> (the-as bone-memory #x70000000) buffer 0 bone))
(set! (-> v1-1 layout bone 1) (-> (the-as bone-memory #x70000000) buffer 1 bone))
(set! (-> v1-1 layout output 0) (-> (the-as bone-memory #x70000000) buffer 0 output))
(set! (-> v1-1 layout output 1) (-> (the-as bone-memory #x70000000) buffer 1 output))
)
(let ((gp-0 *vu0-dma-list*))
(let ((v1-2 gp-0))
(set! (-> v1-2 base) (-> v1-2 data))
(set! (-> v1-2 end) (the-as pointer (+ (+ (-> v1-2 allocated-length) 28) (the-as int v1-2))))
)
(dma-buffer-add-vu-function gp-0 bones-vu0-block 0)
(let* ((v1-3 gp-0)
(a0-20 (the-as object (-> v1-3 base)))
)
(set! (-> (the-as dma-packet a0-20) dma) (new 'static 'dma-tag :id (dma-tag-id end)))
(set! (-> (the-as (pointer uint64) a0-20) 1) (the-as uint 0))
(set! (-> v1-3 base) (&+ (the-as pointer a0-20) 16))
)
(.sync.l)
(dma-buffer-send-chain (the-as dma-bank-source #x10008000) gp-0)
)
0
(none)
)
(def-mips2c bones-mtx-calc (function (inline-array pris-mtx) (inline-array joint) (inline-array bone) uint none))
;; TODO FIX ME
;; ;; ERROR: Unsupported inline assembly instruction kind - [addiu a0, a0, 128]
;; ;; ERROR: Unsupported inline assembly instruction kind - [addiu a1, a1, 128]
;; (defun bones-mtx-calc-execute ()
;; (local-vars (v1-30 float))
;; (rlet ((vf1 :class vf)
;; (vf25 :class vf)
;; (vf26 :class vf)
;; (vf27 :class vf)
;; (vf28 :class vf)
;; (vf29 :class vf)
;; (vf30 :class vf)
;; (vf31 :class vf)
;; (vf4 :class vf)
;; (vf5 :class vf)
;; (vf6 :class vf)
;; (vf7 :class vf)
;; (vf8 :class vf)
;; )
;; (when *debug-segment*
;; 'bones
;; (let ((gp-0 (-> *display* frames (-> *display* on-screen) profile-array data 0))
;; (v1-8 'bones)
;; (s5-0 *profile-bones-color*)
;; )
;; (when (and *dproc* *debug-segment*)
;; (let ((s4-0 (-> gp-0 data (-> gp-0 count))))
;; (let ((s3-0 (-> gp-0 base-time)))
;; (set! (-> s4-0 name) v1-8)
;; (set! (-> s4-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-0))))
;; )
;; (set! (-> s4-0 depth) (the-as uint (-> gp-0 depth)))
;; (set! (-> s4-0 color) s5-0)
;; (set! (-> gp-0 segment (-> gp-0 depth)) s4-0)
;; )
;; (set! (-> gp-0 count) (min 2099 (+ (-> gp-0 count) 1)))
;; (+! (-> gp-0 depth) 1)
;; (set! (-> gp-0 max-depth) (max (-> gp-0 max-depth) (-> gp-0 depth)))
;; )
;; )
;; 0
;; )
;; (-> *perf-stats* data 48)
;; 0
;; (let ((v1-25 (the-as object (+ #x70000000 0))))
;; (+ #x70000000 0)
;; (let ((a0-13 (+ 80 #x70000000)))
;; (s.w! (the-as int v1-25) a0-13)
;; )
;; (let ((a0-15 (+ 4432 #x70000000)))
;; (s.w! (+ (the-as int v1-25) 4) a0-15)
;; )
;; (set! (-> (the-as bone-memory v1-25) work layout bone 0) (the-as (inline-array bone) (+ 1104 #x70000000)))
;; (let ((a0-19 (+ 5456 #x70000000)))
;; (s.w! (+ (the-as int v1-25) 12) a0-19)
;; )
;; (let ((a0-21 (+ 2384 #x70000000)))
;; (s.w! (+ (the-as int v1-25) 16) a0-21)
;; )
;; (let ((a0-23 (+ 6736 #x70000000)))
;; (s.w! (+ (the-as int v1-25) 20) a0-23)
;; )
;; )
;; (let ((v1-26 #x40001)
;; (a0-24 #x1000e000)
;; )
;; (s.w! (+ a0-24 48) v1-26)
;; )
;; (let* ((s4-1 *bone-calculation-list*)
;; (gp-1 *identity-matrix*)
;; (s5-1 (-> (view-get-active-math-camera) camera-rot))
;; (s4-2 (-> s4-1 first))
;; )
;; (while (nonzero? s4-2)
;; (let ((v1-29 (if (logtest? (-> s4-2 flags) (bone-calc-flags no-cam-rot))
;; gp-1
;; s5-1
;; )
;; )
;; )
;; (.lvf vf28 (&-> v1-29 rvec quad))
;; (.lvf vf29 (&-> v1-29 uvec quad))
;; (.lvf vf30 (&-> v1-29 fvec quad))
;; (.lvf vf31 (&-> v1-29 trans quad))
;; (.lvf vf25 (&-> v1-29 rvec quad))
;; (.lvf vf26 (&-> v1-29 uvec quad))
;; (.lvf vf27 (&-> v1-29 fvec quad))
;; )
;; (.mov v1-30 vf27)
;; (bones-mtx-calc (-> s4-2 matrix-area) (-> s4-2 joints) (-> s4-2 bones) (-> s4-2 num-bones))
;; (when (logtest? (-> s4-2 flags) (bone-calc-flags write-ripple-data))
;; (let* ((a2-1 s4-2)
;; (v1-34 (-> a2-1 num-bones))
;; (a0-26 (the-as object (-> a2-1 matrix-area)))
;; (a1-9 (the-as object (-> a2-1 ripple-area)))
;; )
;; (.lvf vf1 (&-> a2-1 ripple-vec quad))
;; (label cfg-13)
;; (.lvf vf5 (&-> (the-as pris-mtx a0-26) t-mtx uvec quad))
;; (.lvf vf6 (&-> (the-as pris-mtx a0-26) t-mtx trans quad))
;; (.lvf vf7 (&-> (the-as pris-mtx a0-26) n-mtx quad 0))
;; (.lvf vf8 (&-> (the-as pris-mtx a0-26) n-mtx quad 2))
;; (.mul.x.vf vf4 vf5 vf1)
;; (.mul.y.vf vf5 vf5 vf1)
;; (let ((a3-1 (-> (the-as pris-mtx a0-26) t-mtx rvec quad)))
;; (.mul.z.vf vf7 vf7 vf1)
;; (let ((a2-2 (-> (the-as pris-mtx a0-26) t-mtx fvec quad)))
;; (.mul.z.vf vf8 vf8 vf1)
;; (s.q! a1-9 a3-1)
;; (let ((a3-2 (-> (the-as pris-mtx a0-26) n-mtx quad 1)))
;; (.sub.vf vf6 vf6 vf4)
;; (s.q! (+ a1-9 32) a2-2)
;; (s.vf! (+ a1-9 16) vf5)
;; (s.q! (+ a1-9 80) a3-2)
;; )
;; )
;; )
;; (+! v1-34 -1)
;; (s.vf! (+ a1-9 64) vf7)
;; (.addiu a0-26 (the-as (inline-array pris-mtx) a0-26) 128)
;; (s.vf! (+ a1-9 48) vf6)
;; (.addiu a1-9 a1-9 128)
;; (b! (nonzero? v1-34) cfg-13 :delay (s.vf! (+ (the-as int a1-9) -32) vf8))
;; )
;; 0
;; )
;; (set! s4-2 (-> s4-2 next))
;; )
;; )
;; (let ((v1-37 #x10001)
;; (a0-27 #x1000e000)
;; )
;; (s.w! (+ a0-27 48) v1-37)
;; )
;; (bone-list-init)
;; (-> *perf-stats* data 48)
;; 0
;; (when *debug-segment*
;; (let ((gp-2 (-> *display* frames (-> *display* on-screen) profile-array data 0)))
;; (when (and *dproc* *debug-segment*)
;; (let* ((v1-52 (+ (-> gp-2 depth) -1))
;; (s5-2 (-> gp-2 segment v1-52))
;; (s4-3 (-> gp-2 base-time))
;; )
;; (when (>= v1-52 0)
;; (set! (-> s5-2 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-3))))
;; (+! (-> gp-2 depth) -1)
;; )
;; )
;; )
;; )
;; 0
;; )
;; 0
;; (none)
;; )
;; )
(defun-debug dump-qword ((arg0 qword))
(let ((v1-0 arg0))
(format
0
"~8,'0X: ~8,'0X ~8,'0X ~8,'0X ~8,'0X~%"
v1-0
(-> v1-0 data 0)
(-> v1-0 data 1)
(-> v1-0 data 2)
(-> v1-0 data 3)
)
)
0
(none)
)
(defun-debug dump-mem ((arg0 pointer) (arg1 int))
(dotimes (s4-0 arg1)
(format
0
"~8,'0X: ~8,'0X ~8,'0X ~8,'0X ~8,'0X"
(&+ arg0 (* (* s4-0 4) 4))
(-> (the-as (pointer uint32) (&+ arg0 (* (* s4-0 4) 4))))
(-> (the-as (pointer uint32) (&+ arg0 (* (+ (* s4-0 4) 1) 4))))
(-> (the-as (pointer uint32) (&+ arg0 (* (+ (* s4-0 4) 2) 4))))
(-> (the-as (pointer uint32) (&+ arg0 (* (+ (* s4-0 4) 3) 4))))
)
(format
0
" ~F ~F ~F ~F ~%"
(-> (the-as (pointer uint32) (&+ arg0 (* (* s4-0 4) 4))))
(-> (the-as (pointer uint32) (&+ arg0 (* (+ (* s4-0 4) 1) 4))))
(-> (the-as (pointer uint32) (&+ arg0 (* (+ (* s4-0 4) 2) 4))))
(-> (the-as (pointer uint32) (&+ arg0 (* (+ (* s4-0 4) 3) 4))))
)
)
0
(none)
)
(defun-debug bones-debug ()
0
(none)
)
(defun-debug dump-bone-mem ()
(format 0 "== joints 0 ===========~%")
(dump-mem (the-as pointer (+ 80 #x70000000)) 64)
(format 0 "== bones 0 ============~%")
(dump-mem (the-as pointer (+ 1104 #x70000000)) 80)
(format 0 "== output 0 ===========~%")
(dump-mem (the-as pointer (+ 2384 #x70000000)) 128)
(format 0 "~%~%~%")
(format 0 "== joints 1 ===========~%")
(dump-mem (the-as pointer (+ 4432 #x70000000)) 64)
(format 0 "== bones 1 ============~%")
(dump-mem (the-as pointer (+ 5456 #x70000000)) 80)
(format 0 "== output 1 ===========~%")
(dump-mem (the-as pointer (+ 6736 #x70000000)) 128)
(format 0 "========================~%~%")
0
(none)
)
+2 -2
View File
@@ -24,7 +24,7 @@
(deftype eye-control (structure)
((process uint64)
((process handle)
(random-time uint16)
(bucket uint16)
(blink float)
@@ -61,7 +61,7 @@
(dotimes (v1-5 32)
(let ((a0-11 (-> *eye-control-array* data v1-5)))
(set! (-> a0-11 process) (the-as uint #f))
(set! (-> a0-11 process) (the-as handle #f))
(set! (-> a0-11 random-time) (the-as uint 60))
(set! (-> a0-11 blink) 0.0)
(set! (-> a0-11 shaders) (the-as (inline-array adgif-shader) #f))
File diff suppressed because it is too large. Load diff
@@ -5,5 +5,7 @@
;; name in dgo: foreground
;; dgos: ENGINE, GAME
(define-extern *foreground* foreground-globals)
;; DECOMP BEGINS
@@ -7,3 +7,157 @@
;; DECOMP BEGINS
(defun emerc-vu1-initialize-chain ((arg0 dma-gif-packet))
(let ((gp-0 (the-as object (merc-vu1-add-vu-function (-> arg0 dma-vif) emerc-vu1-block 1))))
(set! (-> (the-as dma-gif-packet gp-0) dma-vif dma) (new 'static 'dma-tag :qwc #xb :id (dma-tag-id cnt)))
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
(set! (-> (the-as (pointer vif-tag) gp-0) 4) (new 'static 'vif-tag :imm #x1ba :cmd (vif-cmd base)))
(set! (-> (the-as (pointer vif-tag) gp-0) 5) (new 'static 'vif-tag :imm #xfe46 :cmd (vif-cmd offset)))
(set! (-> (the-as (pointer vif-tag) gp-0) 6) (new 'static 'vif-tag))
(set! (-> (the-as (pointer vif-tag) gp-0) 7) (new 'static 'vif-tag :num #x9 :cmd (vif-cmd unpack-v4-32)))
(let ((s5-0 (the-as emerc-vu1-low-mem (&-> (the-as (pointer vif-tag) gp-0) 8))))
(set! (-> s5-0 tri-strip-gif tag)
(new 'static 'gif-tag64
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1)
:nreg #x3
)
)
(set! (-> s5-0 tri-strip-gif regs)
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303e4000 32)) 32))
(set! (-> s5-0 ad-gif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
(set! (-> s5-0 ad-gif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
(set! (-> s5-0 hvdf-offset quad) (-> (view-get-active-math-camera) hvdf-off quad))
(quad-copy!
(the-as pointer (-> s5-0 perspective))
(the-as pointer (-> (view-get-active-math-camera) perspective))
4
)
(set-vector!
(-> s5-0 fog)
(-> (view-get-active-math-camera) pfog0)
(-> (view-get-active-math-camera) fog-min)
(-> (view-get-active-math-camera) fog-max)
0.0
)
(set-vector!
;; og:preserve-this
(-> s5-0 unperspect)
(/ 1.0 (-> (view-get-active-math-camera) perspective rvec x))
(/ 1.0 (-> (view-get-active-math-camera) perspective uvec y))
0.5
(/ 1.0 (-> (view-get-active-math-camera) perspective fvec w))
)
)
(let ((v1-23 (-> (the-as (inline-array dma-packet) gp-0) 11)))
(set! (-> v1-23 dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
(set! (-> v1-23 vif0) (new 'static 'vif-tag))
(set! (-> v1-23 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x0))
(&+ v1-23 16)
)
)
)
(defun emerc-vu1-init-buffer ((arg0 bucket-id) (arg1 gs-test) (arg2 int))
(let ((v1-0 *display*)
(a1-6 (+ (* (+ (/ (-> emerc-vu1-block qlength) 127) 1) 16) 304))
)
(+! (-> v1-0 mem-reserve-size) a1-6)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((a3-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> a3-0 real-buffer-end) (the-as int (&+ (-> a3-0 base) a1-6)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((s5-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= s5-0 (-> s5-0 last))
(let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf))
(s4-3 (-> s3-0 base))
)
(set! (-> s3-0 base) (the-as pointer (emerc-vu1-initialize-chain (the-as dma-gif-packet (-> s3-0 base)))))
(let* ((v1-14 *viewport-array*)
(v1-15 (-> v1-14 data (-> v1-14 current-viewport-index)))
)
(dma-buffer-add-gs-set s3-0
(test-1 arg1)
(frame-1 (-> v1-15 frame))
(zbuf-1 (-> v1-15 zbuf-on))
(scissor-1 (-> v1-15 scissor))
)
)
(let ((v1-19 (the-as object (-> s3-0 base))))
(set! (-> (the-as (pointer uint64) v1-19)) (logior #x20000000 (shr (shl (-> s5-0 next) 33) 1)))
(set! (-> (the-as dma-packet v1-19) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-19) vif1) (new 'static 'vif-tag))
(set! (-> s3-0 base) (the-as pointer (&+ (the-as dma-packet v1-19) 16)))
)
(set! (-> s5-0 next) (the-as uint s4-3))
)
)
)
)
)
)
0
(none)
)
(defun emerc-vu1-init-buffers ()
(when (logtest? (-> *display* vu1-enable-user) #x4000)
(let ((gp-0 *viewport-array*))
(dotimes (s5-0 19)
(dotimes (s4-0 2)
(view-push-context s4-0)
(let ((v1-4 gp-0)
(a0-1 s4-0)
)
(-> v1-4 data (the-as uint a0-1))
(set! (-> v1-4 current-viewport-index) (the-as uint a0-1))
)
(let ((a0-3 (vu1-bucket-map s5-0 0 s4-0 (merc-mode emerc))))
(emerc-vu1-init-buffer
(the-as bucket-id a0-3)
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))
0
)
)
(let ((a0-5 (vu1-bucket-map s5-0 1 s4-0 (merc-mode emerc))))
(emerc-vu1-init-buffer
(the-as bucket-id a0-5)
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))
0
)
)
(let ((a0-7 (vu1-bucket-map s5-0 2 s4-0 (merc-mode emerc))))
(emerc-vu1-init-buffer
(the-as bucket-id a0-7)
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))
0
)
)
(let ((a0-9 (vu1-bucket-map s5-0 3 s4-0 (merc-mode emerc))))
(emerc-vu1-init-buffer
(the-as bucket-id a0-9)
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))
0
)
)
(let ((a0-11 (vu1-bucket-map s5-0 6 s4-0 (merc-mode emerc))))
(emerc-vu1-init-buffer
(the-as bucket-id a0-11)
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal))
0
)
)
(view-pop-context)
)
)
)
)
0
(none)
)
@@ -5,5 +5,269 @@
;; name in dgo: merc-blend-shape
;; dgos: ENGINE, GAME
(define-extern setup-blerc-chains (function merc-ctrl (pointer int16) dma-buffer none))
;; DECOMP BEGINS
(define *stats-blerc* #f)
(deftype blerc-block-header (structure)
((tag generic-merc-tag :inline)
(vtx-count uint32)
(overlap uint32)
(lump-dest uint32)
(lump-qwc uint32)
)
)
(deftype blerc-block (structure)
((output uint8 848)
(header blerc-block-header :inline)
)
)
(deftype blerc-dcache (structure)
((repl-mult vector 40 :inline)
)
)
(deftype blerc-globals (structure)
((first uint32)
(next uint32)
(min-val int16)
(max-val int16)
(fragment-count int32)
(vtx-count int32)
(target-vtx-count int32)
)
)
(define *blerc-globals* (new 'global 'blerc-globals))
(deftype blerc-context (structure)
((block-a blerc-block :inline)
(dummy uint8 7312)
(block-b blerc-block :inline)
)
)
(defun-debug blerc-stats-init ()
(when *stats-blerc*
(when (nonzero? (-> *blerc-globals* fragment-count))
(format *stdcon* "~%BLERC (merc blend target) STATS~%")
(format
*stdcon*
" ~D fragments, ~D vertices~%"
(-> *blerc-globals* fragment-count)
(-> *blerc-globals* vtx-count)
)
(format
*stdcon*
" ~D blend target computations (~F average)~%"
(-> *blerc-globals* target-vtx-count)
(/ (the float (-> *blerc-globals* target-vtx-count)) (the float (-> *blerc-globals* vtx-count)))
)
(if (< (-> *blerc-globals* min-val) 0)
(format *stdcon* "MINIMUM OUT OF RANGE: ~D~%" (-> *blerc-globals* min-val))
)
(if (< 255 (-> *blerc-globals* max-val))
(format *stdcon* "MAXIMUM OUT OF RANGE: ~D~%" (-> *blerc-globals* max-val))
)
)
(let ((a0-7 *blerc-globals*))
(set! (-> a0-7 min-val) 255)
(set! (-> a0-7 max-val) 0)
(set! (-> a0-7 fragment-count) 0)
(set! (-> a0-7 vtx-count) 0)
(set! (-> a0-7 target-vtx-count) 0)
)
)
0
(none)
)
(defun blerc-init ()
(blerc-stats-init)
(let ((v1-0 *blerc-globals*))
(set! (-> v1-0 first) (the-as uint 0))
(set! (-> v1-0 next) (the-as uint 0))
)
0
(none)
)
;; ERROR: function was not converted to expressions. Cannot decompile.
;; ERROR: function has no type analysis. Cannot decompile.
;; ERROR: function has no type analysis. Cannot decompile.
(def-mips2c blerc-execute (function none))
;; WARN: Return type mismatch int vs object.
(defun merc-blend-shape ((arg0 process-drawable))
(let* ((v1-1 (-> arg0 skel float-channels))
(a2-0 (cond
((> v1-1 0)
(-> arg0 skel channel (+ v1-1 -1 (-> arg0 skel active-channels)))
)
(else
(let ((v1-7 (-> arg0 skel root-channel))
(a0-5 (-> arg0 skel effect))
)
(-> v1-7 (if a0-5
(-> a0-5 channel-offset)
0
)
)
)
)
)
)
(a3-0 (-> a2-0 frame-group))
(a1-0 (new 'stack-no-clear 'array 'int16 128))
)
(when (and a3-0 (and (> (-> arg0 skel active-channels) 0)
(zero? (-> arg0 draw cur-lod))
(logtest? (-> arg0 skel status) (joint-control-status blend-shape))
)
)
(cond
((and (-> arg0 skel override) (!= (-> arg0 skel override 0) 0.0))
(let* ((a0-12 (-> arg0 draw mgeo))
(v1-20 (-> a0-12 header blend-target-count))
(a2-2 (-> arg0 skel override))
)
(when (nonzero? v1-20)
(dotimes (a3-1 (the-as int v1-20))
(set! (-> a1-0 a3-1) (the int (* 8192.0 (-> a2-2 (+ a3-1 1)))))
)
(setup-blerc-chains a0-12 a1-0 (-> *display* frames (-> *display* on-screen) global-buf))
(logior! (-> arg0 skel status) (joint-control-status blend-shape-valid))
(return (the-as object #f))
)
)
)
(else
(let ((t2-0 (-> a3-0 blend-shape-anim)))
(when t2-0
(let ((a0-14 (-> arg0 draw mgeo)))
(let* ((v1-33 (-> a0-14 header blend-target-count))
(t0-8 (-> a2-0 frame-num))
(t1-2 (the int t0-8))
(a2-6 (&+ t2-0 (* (the-as uint t1-2) v1-33)))
)
(cond
((< t1-2 (the-as int (+ (-> a3-0 frames num-frames) -1)))
(let* ((a3-6 (&+ a2-6 v1-33))
(t0-9 (* 64.0 (- t0-8 (the float t1-2))))
(t1-4 (- 64.0 t0-9))
)
(dotimes (t2-2 (the-as int v1-33))
(set! (-> a1-0 t2-2) (the int (+ 0.5
(* (the float (+ (-> (the-as (pointer uint8) (&+ a3-6 t2-2))) -64)) t0-9)
(* (the float (+ (-> (the-as (pointer uint8) (&+ a2-6 t2-2))) -64)) t1-4)
)
)
)
)
)
)
(else
(dotimes (a3-7 (the-as int v1-33))
(set! (-> a1-0 a3-7) (the-as int (* (+ (-> (the-as (pointer uint8) (&+ a2-6 a3-7))) -64) 64)))
)
)
)
)
(setup-blerc-chains a0-14 a1-0 (-> *display* frames (-> *display* on-screen) global-buf))
)
(logior! (-> arg0 skel status) (joint-control-status blend-shape-valid))
(return (the-as object #f))
)
)
)
)
)
)
(when (logtest? (-> arg0 skel status) (joint-control-status blend-shape-valid))
(logclear! (-> arg0 skel status) (joint-control-status blend-shape-valid))
(setup-blerc-chains
(-> arg0 draw lod-set lod 0 geo)
(new 'static 'array int16 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
(-> *display* frames (-> *display* on-screen) global-buf)
)
)
0
)
(def-mips2c setup-blerc-chains-for-one-fragment (function object object object object object object object))
(defun setup-blerc-chains ((arg0 merc-ctrl) (arg1 (pointer int16)) (arg2 dma-buffer))
(let* ((sv-16 (-> arg0 header effect-count))
(s3-0 (-> arg0 header blend-target-count))
(v1-1 (-> arg2 base))
(sv-20 (&+ v1-1 0))
;; og:preserve-this
(sv-32 (the-as object #f))
(a2-1 (the-as object (&+ v1-1 16)))
)
(if (zero? (-> *blerc-globals* first))
(set! (-> *blerc-globals* first) (the-as uint a2-1))
)
(dotimes (s2-0 (the-as int sv-16))
(let* ((sv-24 (-> arg0 effect s2-0))
(sv-28 (-> sv-24 blend-frag-count))
)
(when (nonzero? sv-28)
(let ((v1-15 (the-as object (-> sv-24 frag-geo)))
(s1-0 (the-as structure (-> sv-24 frag-ctrl)))
(s0-0 (the-as object (-> sv-24 blend-data)))
(sv-48 0)
)
;; og:preserve-this
(set! sv-32 (-> sv-24 blend-ctrl))
(while (< sv-48 (the-as int sv-28))
(let ((sv-64 (+ (the-as int v1-15)
(logand (* (+ (-> (the-as merc-fragment-control s1-0) unsigned-four-count) 3) 4) #xfff0)
)
)
)
(if (nonzero? (-> (the-as (pointer uint8) sv-32) 0))
(set! a2-1 (setup-blerc-chains-for-one-fragment s3-0 arg1 a2-1 s0-0 sv-32 sv-64))
)
(let ((a0-14 (logand (+ (* (the-as uint 6) (-> (the-as merc-blend-ctrl sv-32) blend-vtx-count)) 15) #xfff0)))
(set! v1-15
(+ sv-64
(logand (* (+ (-> (the-as merc-fragment-control s1-0) lump-four-count) 3) 4) #xfff0)
(* (-> (the-as merc-fragment-control s1-0) fp-qwc) 16)
)
)
;; og:preserve-this
(set! s1-0 (&+ s1-0 (* (-> (the-as merc-fragment-control s1-0) mat-xfer-count) 2) 4))
(set! s0-0
(+ (the-as int s0-0) (* (the-as uint a0-14) (+ (-> (the-as merc-blend-ctrl sv-32) nonzero-index-count) 1)))
)
)
)
(set! sv-32 (+ (the-as int sv-32) s3-0 2))
sv-32
(+! sv-48 1)
)
)
)
)
)
(set! (-> (the-as (pointer int64) sv-20)) (logior #x20000000 (shr (shl (the-as int a2-1) 33) 1)))
(set! (-> (the-as (pointer uint32) sv-20) 2) (the-as uint 0))
(set! (-> (the-as (pointer uint32) sv-20) 3) (the-as uint 0))
(set! (-> arg2 base) (the-as pointer a2-1))
)
0
(none)
)
@@ -5,6 +5,9 @@
;; name in dgo: merc-death
;; dgos: ENGINE, GAME
(define-extern particle-adgif-callback (function adgif-shader texture-id none))
(define-extern sp-launch-particles-death (function sparticle-system sparticle-launcher vector none))
;; DECOMP BEGINS
(define *merc-death-globals* (new 'global 'vector))
@@ -5,5 +5,595 @@
;; name in dgo: merc
;; dgos: ENGINE, GAME
(define-extern find-free-eye-index (function int string int int))
(define-extern free-eye-index (function int int))
;; DECOMP BEGINS
(define *texture-login-data* (new 'static 'texture-login-data))
(defmethod login ((this art-joint-geo))
(let ((s5-0 *texture-login-data*))
(set! (-> s5-0 default-texture-index)
(res-lump-value (-> this extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)
)
)
this
)
(defun texture-usage-init ((arg0 merc-ctrl))
(let ((gp-0 *texture-login-data*))
(if (zero? (-> arg0 header texture-usage-group))
(set! (-> arg0 header texture-usage-group) (new 'loading-level 'texture-usage-group))
)
(set! (-> gp-0 texture-usage-group) (-> arg0 header texture-usage-group))
(set! (-> gp-0 merc-ctrl-header) (-> arg0 header))
(set! (-> gp-0 name) (-> arg0 name))
(dotimes (v1-7 7)
(dotimes (a0-2 3)
(set! (-> (the-as vector (+ (the-as uint (-> gp-0 texture-usage-group)) (* 48 v1-7) (* a0-2 16))) quad)
(the-as uint128 0)
)
)
)
)
#f
)
(defun texture-usage-update ((arg0 texture))
(local-vars (a3-3 uint128))
(let* ((v1-0 *texture-login-data*)
(a1-0 (-> v1-0 current-texture-index))
(v1-2 (-> v1-0 texture-usage-group data a1-0))
)
(dotimes (a1-3 3)
(let* ((a2-3 (-> v1-2 data a1-3))
(t1-0 (-> arg0 masks data a1-3))
(a3-2 (-> a2-3 mask quad))
(t0-0 (-> t1-0 mask quad))
(f0-0 (-> a2-3 dist))
(f1-0 (-> t1-0 dist))
)
(.por a3-3 a3-2 t0-0)
(let ((f0-1 (fmax f0-0 f1-0)))
(set! (-> a2-3 mask quad) a3-3)
(set! (-> a2-3 dist) f0-1)
)
)
)
)
#f
)
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this merc-fragment))
(the-as int (* (-> this header mm-quadword-size) 16))
)
(defmethod login-adgifs ((this merc-fragment))
(local-vars (v0-3 symbol))
(let* ((s5-0 (merc-fragment-fp-data this))
(v1-1 (-> *texture-login-data* merc-ctrl-header))
(s4-0 (if (nonzero? (-> v1-1 eye-ctrl))
(-> v1-1 eye-ctrl)
(the-as merc-eye-ctrl #f)
)
)
(s3-0 #x306900)
(s2-0 #x306a00)
(s1-0 (the-as adgif-shader (&+ s5-0 16)))
)
(dotimes (s0-0 (the-as int (-> s5-0 shader-cnt)))
(let ((a0-3 (-> s4-0 eye-ctrl-index))
(v1-3 (logand (the-as texture-id -256) (-> s1-0 texture-id)))
)
(set! v0-3
(cond
((and s4-0 (!= a0-3 -1) (or (= v1-3 s3-0) (= v1-3 s2-0)))
(let* ((sv-16 (-> *eye-control-array* data a0-3))
(v1-4 (if (= v1-3 s2-0)
1
0
)
)
(sv-32 (-> sv-16 eyes v1-4))
)
(adgif-shader-login s1-0)
(let ((v1-9 (-> sv-32 tbp)))
(set! (-> sv-32 shader (-> sv-32 shader-count)) s1-0)
(+! (-> sv-32 shader-count) 1)
(cond
((-> sv-16 high-res?)
(set! (-> s1-0 tex0 tbp0) v1-9)
(set! (-> s1-0 tex0 tw) 6)
(set! (-> s1-0 tex0 th) 6)
(set! (-> s1-0 tex0 tbw) 2)
(set! (-> s1-0 clamp)
(new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
)
)
(else
(set! (-> s1-0 tex0 tbp0) v1-9)
(set! (-> s1-0 tex0 tw) 5)
(set! (-> s1-0 tex0 th) 5)
(set! (-> s1-0 tex0 tbw) 1)
(set! (-> s1-0 clamp)
(new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
)
)
)
)
)
(set! (-> s1-0 tex0 tcc) 1)
(set! (-> s1-0 tex0 psm) 0)
(set! (-> s1-0 tex1 mxl) 0)
v0-3
)
(else
(let ((a0-39 (adgif-shader-login s1-0)))
(if a0-39
(texture-usage-update a0-39)
)
)
)
)
)
)
(&+! s1-0 80)
)
)
this
)
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this merc-fragment-control))
(the-as int (+ (* (-> this mat-xfer-count) 2) 4))
)
;; WARN: Return type mismatch merc-effect vs none.
(defmethod login-adgifs ((this merc-effect))
(let* ((v1-0 *texture-login-data*)
(a0-1 (-> v1-0 default-texture-index))
(a1-0 1)
(a2-0 (-> this merc-effect-version))
)
(when (= a2-0 a1-0)
(let ((a1-2 255))
(set! a2-0 (-> this texture-index))
(if (!= a2-0 a1-2)
(set! a0-1 (the-as int (-> this texture-index)))
)
)
)
(set! (-> v1-0 current-texture-index) a0-1)
(set! (-> this texture-index) (the-as uint a0-1))
(let ((v1-1 (-> this extra-info)))
(when (nonzero? v1-1)
(when (nonzero? (-> v1-1 shader-offset))
(let ((a0-6 (adgif-shader-login (the-as adgif-shader (+ (the-as uint v1-1) (* (-> v1-1 shader-offset) 16))))))
(if a0-6
(texture-usage-update a0-6)
)
)
)
)
)
(let* ((v1-3 (the-as structure (-> *kernel-context* login-object)))
(a0-8 (-> *texture-login-data* merc-ctrl-header))
(s5-0 (if (nonzero? (-> a0-8 eye-ctrl))
(-> a0-8 eye-ctrl)
(the-as merc-eye-ctrl #f)
)
)
)
(if s5-0
(set! (-> s5-0 eye-ctrl-index) (find-free-eye-index
(the-as int (-> (the-as merc-eye-ctrl v1-3) left-iris-shader quad 0 data 0))
(the-as string (-> s5-0 eye-slot))
(the-as int a2-0)
)
)
)
)
)
(let ((s5-1 (the-as object (-> this frag-ctrl)))
(s4-0 (the-as object (-> this frag-geo)))
)
(dotimes (s3-0 (the-as int (-> this frag-count)))
(let ((s2-0 ((method-of-type merc-fragment-control asize-of) (the-as merc-fragment-control s5-1))))
(let ((s1-0 ((method-of-type merc-fragment asize-of) (the-as merc-fragment s4-0))))
((method-of-type merc-fragment login-adgifs) (the-as merc-fragment s4-0))
(set! s4-0 (&+ (the-as pointer s4-0) s1-0))
)
(set! s5-1 (&+ (the-as pointer s5-1) s2-0))
)
)
)
(none)
)
(defmethod mem-usage ((this merc-ctrl) (usage memory-usage-block) (flags int))
(if (-> this extra)
(mem-usage (-> this extra) usage flags)
)
(let ((s4-0 (+ 48 128 (* (-> this header effect-count) 32))))
(dotimes (s3-0 (the-as int (-> this header effect-count)))
(let ((s2-0 (the-as object (-> this effect s3-0 frag-ctrl))))
(dotimes (s1-0 (the-as int (-> this effect s3-0 frag-count)))
(set! s4-0 (+ s4-0
(* (shr (+ (-> (the-as merc-fragment-control s2-0) unsigned-four-count) 3) 2) 16)
(* (shr (+ (-> (the-as merc-fragment-control s2-0) lump-four-count) 3) 2) 16)
(* (-> (the-as merc-fragment-control s2-0) fp-qwc) 16)
(asize-of (the-as merc-fragment-control s2-0))
)
)
(set! s2-0 (&+ (the-as pointer s2-0) (asize-of (the-as merc-fragment-control s2-0))))
)
)
)
(set! (-> usage length) (max 79 (-> usage length)))
(set! (-> usage data 78 name) "merc-ctrl")
(+! (-> usage data 78 count) 1)
(+! (-> usage data 78 used) s4-0)
(+! (-> usage data 78 total) (logand -16 (+ s4-0 15)))
)
(let ((v1-35 0))
(dotimes (a0-15 (the-as int (-> this header effect-count)))
(when (nonzero? (-> this effect a0-15 blend-frag-count))
(let ((a1-9 (the-as object (-> this effect a0-15 blend-ctrl))))
(dotimes (a2-1 (the-as int (-> this effect a0-15 blend-frag-count)))
(let ((v1-36
(+ v1-35
(* (+ (-> (the-as merc-blend-ctrl a1-9) nonzero-index-count) 1)
(the-as uint (logand (+ (* (the-as uint 6) (-> (the-as merc-blend-ctrl a1-9) blend-vtx-count)) 15) #xfff0))
)
)
)
)
(set! v1-35 (the-as int (+ (-> this header blend-target-count) 2 v1-36)))
)
(set! a1-9 (&+ (the-as pointer a1-9) (+ (-> this header blend-target-count) 2)))
)
)
)
)
(when (nonzero? v1-35)
(set! (-> usage length) (max 81 (-> usage length)))
(set! (-> usage data 80 name) "blend-shape")
(+! (-> usage data 80 count) 1)
(+! (-> usage data 80 used) v1-35)
(+! (-> usage data 80 total) (logand -16 (+ v1-35 15)))
)
)
(when (and (-> this header eye-ctrl) (nonzero? (-> this header eye-ctrl)))
(let ((a0-29 (-> this header eye-ctrl)))
(set! (-> usage length) (max 112 (-> usage length)))
(set! (-> usage data 111 name) "eye-anim")
(+! (-> usage data 111 count) 1)
(let ((v1-49 (asize-of a0-29)))
(+! (-> usage data 111 used) v1-49)
(+! (-> usage data 111 total) (logand -16 (+ v1-49 15)))
)
)
)
this
)
(defmethod login ((this merc-ctrl))
(set! (-> *kernel-context* login-object) this)
(texture-usage-init this)
(dotimes (s5-0 (the-as int (-> this header effect-count)))
(login-adgifs (-> this effect s5-0))
)
(when (and (-> this header eye-ctrl) (nonzero? (-> this header eye-ctrl)))
(let ((s5-1 (-> this header eye-ctrl)))
(dotimes (s4-0 (-> s5-1 shader-count))
(let ((a0-5 (adgif-shader-login (-> s5-1 shader s4-0))))
(if a0-5
(texture-usage-update a0-5)
)
)
)
)
)
(set! (-> *kernel-context* login-object) #f)
this
)
(defmethod art-method-10 ((this merc-ctrl))
(let* ((v1-0 (-> this header))
(v1-1 (if (nonzero? (-> v1-0 eye-ctrl))
(-> v1-0 eye-ctrl)
(the-as merc-eye-ctrl #f)
)
)
)
(if v1-1
(free-eye-index (-> v1-1 eye-ctrl-index))
)
)
this
)
;; WARN: Return type mismatch symbol vs none.
(defun-debug merc-stats-display ((arg0 merc-ctrl))
(format #t "~30s:" (-> arg0 name))
(let ((s5-0 (-> arg0 header st-int-scale))
(s4-0 (ash 1 (- 12 (the-as int (-> arg0 header st-int-scale)))))
)
(format #t " ST ~3D, " s4-0)
(cond
((>= s5-0 (the-as uint 5))
(format #t "RANGE ~D+," (/ 128 s4-0))
)
((= s5-0 4)
(format #t "RANGE 0.5+,")
)
)
)
(dotimes (s5-1 (the-as int (-> arg0 header effect-count)))
(let ((s3-0 (-> arg0 effect s5-1)))
(if (nonzero? s5-1)
(format #t "~48s " " ")
)
(let ((a2-4 (-> s3-0 frag-count))
(s4-1 (-> s3-0 tri-count))
(f30-0 (the float (-> s3-0 frag-count)))
(f28-0 (the float (-> s3-0 dvert-count)))
(f26-0 (the float (-> s3-0 tri-count)))
)
(if (>= (/ (+ 50.0 f28-0) f30-0) 50.0)
(format #t "~3D frags, ~2,,1f dverts/frag " a2-4 (/ f28-0 f30-0))
(format #t "~3D frags, ~2,,1f ******/**** " a2-4 (/ f28-0 f30-0))
)
(format
#t
"(~4D tris, striplen ~2,,2f, ~2,,1f tris/frag)~%"
s4-1
(/ (* 2.0 f26-0) (- f28-0 f26-0))
(/ f26-0 f30-0)
)
)
)
)
(none)
)
(defun-debug merc-stats ()
(dotimes (gp-0 19)
(let ((s5-0 (-> *level* level gp-0 art-group)))
(when (nonzero? s5-0)
(dotimes (s4-0 (-> s5-0 art-group-array length))
(let ((s3-0 (-> s5-0 art-group-array s4-0)))
(dotimes (s2-0 (-> s3-0 length))
(let ((a0-3 (as-type (-> s3-0 data s2-0) merc-ctrl)))
(if a0-3
(merc-stats-display (the-as merc-ctrl a0-3))
)
)
)
)
)
)
)
)
0
(none)
)
(defun-debug merc-edge-stats ()
(dotimes (gp-0 19)
(let ((s5-0 (-> *level* level gp-0 art-group)))
(when (nonzero? s5-0)
(dotimes (s4-0 (-> s5-0 art-group-array length))
(let ((s3-0 (-> s5-0 art-group-array s4-0)))
(dotimes (s2-0 (-> s3-0 length))
(let ((v1-9 (as-type (-> s3-0 data s2-0) merc-ctrl)))
(if v1-9
(format #t "~30s: ~f~%" (-> v1-9 name) (-> (the-as merc-ctrl v1-9) header longest-edge))
)
)
)
)
)
)
)
)
0
(none)
)
;; WARN: Return type mismatch dma-packet vs dma-gif-packet.
(defun merc-vu1-add-vu-function ((arg0 dma-packet) (arg1 vu-function) (arg2 int))
(let ((v1-0 (the-as object (+ (the-as uint arg1) 16)))
(a3-0 (-> arg1 qlength))
(a1-1 (-> arg1 origin))
)
(while (> a3-0 0)
(let ((t0-1 (min 127 a3-0)))
(set! (-> arg0 dma) (new 'static 'dma-tag :id (dma-tag-id ref) :qwc t0-1 :addr (the-as int v1-0)))
(set! (-> arg0 vif0) (new 'static 'vif-tag :cmd (if (zero? arg2) 16 19)))
(set! (-> arg0 vif1) (new 'static 'vif-tag :cmd (vif-cmd mpg) :num (* t0-1 2) :imm a1-1))
(&+! arg0 16)
(set! v1-0 (+ (the-as uint v1-0) (* t0-1 16)))
(set! a3-0 (- a3-0 t0-1))
(+! a1-1 (* t0-1 2))
)
)
)
(the-as dma-gif-packet arg0)
)
(defun merc-vu1-initialize-chain ((arg0 dma-gif-packet) (arg1 int))
(let ((gp-0 (the-as object (merc-vu1-add-vu-function (-> arg0 dma-vif) merc-vu1-block 1))))
(set! (-> (the-as dma-gif-packet gp-0) dma-vif dma) (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt)))
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
(set! (-> (the-as (pointer vif-tag) gp-0) 4) (new 'static 'vif-tag :imm #x1ba :cmd (vif-cmd base)))
(set! (-> (the-as (pointer vif-tag) gp-0) 5) (new 'static 'vif-tag :imm #xfe46 :cmd (vif-cmd offset)))
(set! (-> (the-as (pointer vif-tag) gp-0) 6) (new 'static 'vif-tag))
(set! (-> (the-as (pointer vif-tag) gp-0) 7) (new 'static 'vif-tag :num #x8 :cmd (vif-cmd unpack-v4-32)))
(let ((s5-0 (the-as merc-vu1-low-mem (&+ (the-as dma-gif-packet gp-0) 32))))
(case *subdivide-foreground-draw-mode*
(((subdivide-setting textured))
(set! (-> s5-0 tri-strip-gif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
(set! (-> s5-0 tri-strip-gif regs)
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303e4000 32)) 32))
)
(((subdivide-setting outline))
(set! (-> s5-0 tri-strip-gif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
(set! (-> s5-0 tri-strip-gif regs)
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303d4000 32)) 32))
)
(((subdivide-setting gouraud))
(set! (-> s5-0 tri-strip-gif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe arg1)
)
)
(set! (-> s5-0 tri-strip-gif regs)
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x30364000 32)) 32))
)
(((subdivide-setting hack))
(set! (-> s5-0 tri-strip-gif tag)
(new 'static 'gif-tag64
:pre #x1
:nreg #x3
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
)
)
(set! (-> s5-0 tri-strip-gif regs)
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303d4000 32)) 32))
)
)
(set! (-> s5-0 ad-gif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
(set! (-> s5-0 ad-gif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
(set! (-> s5-0 hvdf-offset quad) (-> (view-get-active-math-camera) hvdf-off quad))
(quad-copy! (-> s5-0 perspective) (the-as pointer (-> (view-get-active-math-camera) perspective)) 4)
(set-vector!
(-> s5-0 fog)
(-> (view-get-active-math-camera) pfog0)
(-> (view-get-active-math-camera) fog-min)
(-> (view-get-active-math-camera) fog-max)
0.0
)
)
(let ((v1-49 (-> (the-as (inline-array dma-packet) gp-0) 10)))
(set! (-> v1-49 dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
(set! (-> v1-49 vif0) (new 'static 'vif-tag))
(set! (-> v1-49 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x0))
(&+ v1-49 16)
)
)
)
(defun merc-vu1-init-buffer ((arg0 bucket-id) (arg1 int) (arg2 symbol) (arg3 int))
(let ((v1-0 *display*)
(a2-6 (+ (* (+ (/ (-> merc-vu1-block qlength) 127) 1) 16) 272))
)
(+! (-> v1-0 mem-reserve-size) a2-6)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-6)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((s4-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= s4-0 (-> s4-0 last))
(let* ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf))
(s3-3 (-> s2-0 base))
)
(set! (-> s2-0 base) (the-as pointer (merc-vu1-initialize-chain (the-as dma-gif-packet (-> s2-0 base)) arg1)))
(let* ((v1-14 *viewport-array*)
(v1-15 (-> v1-14 data (-> v1-14 current-viewport-index)))
)
(dma-buffer-add-gs-set s2-0
(test-1 arg3)
(zbuf-1 (if arg2
(-> v1-15 zbuf-on)
(-> v1-15 zbuf-off)
)
)
(frame-1 (-> v1-15 frame))
(scissor-1 (-> v1-15 scissor))
)
)
(let ((v1-19 (the-as object (-> s2-0 base))))
(set! (-> (the-as (pointer uint64) v1-19)) (logior #x20000000 (shr (shl (-> s4-0 next) 33) 1)))
(set! (-> (the-as dma-packet v1-19) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-19) vif1) (new 'static 'vif-tag))
(set! (-> s2-0 base) (the-as pointer (&+ (the-as dma-packet v1-19) 16)))
)
(set! (-> s4-0 next) (the-as uint s3-3))
)
)
)
)
)
)
0
)
(defun merc-vu1-init-buffers ()
(when (logtest? (-> *display* vu1-enable-user) 8192)
(let ((gp-0 *viewport-array*))
(dotimes (s5-0 19)
(dotimes (s4-0 2)
(view-push-context s4-0)
(let ((v1-4 gp-0)
(a0-1 s4-0)
)
(-> v1-4 data (the-as uint a0-1))
(set! (-> v1-4 current-viewport-index) (the-as uint a0-1))
)
(let ((a0-3 (vu1-bucket-map s5-0 0 s4-0 (merc-mode merc))))
(merc-vu1-init-buffer (the-as bucket-id a0-3) 0 #t #x5026b)
)
(let ((a0-5 (vu1-bucket-map s5-0 1 s4-0 (merc-mode merc))))
(merc-vu1-init-buffer (the-as bucket-id a0-5) 0 #t #x5026b)
)
(let ((a0-7 (vu1-bucket-map s5-0 2 s4-0 (merc-mode merc))))
(merc-vu1-init-buffer (the-as bucket-id a0-7) 0 #t #x5026b)
)
(let ((a0-9 (vu1-bucket-map s5-0 3 s4-0 (merc-mode merc))))
(merc-vu1-init-buffer (the-as bucket-id a0-9) 1 #t #x51001)
)
(let ((a0-11 (vu1-bucket-map s5-0 6 s4-0 (merc-mode merc))))
(merc-vu1-init-buffer (the-as bucket-id a0-11) 0 #t #x5026b)
)
(let ((a0-13 (vu1-bucket-map s5-0 4 s4-0 (merc-mode merc))))
(merc-vu1-init-buffer (the-as bucket-id a0-13) 1 #f #x51001)
)
(view-pop-context)
)
)
)
)
0
(none)
)
@@ -5,5 +5,7 @@
;; name in dgo: generic-effect
;; dgos: ENGINE, GAME
(define-extern generic-initialize-without-sync (function matrix vu-lights none))
;; DECOMP BEGINS
@@ -7,3 +7,132 @@
;; DECOMP BEGINS
(define mercneric-vu0-block (new 'static 'vu-function :length #xbe :origin #x118 :qlength 95))
(deftype invinitdata (structure)
((count uint8)
(init-data uint8)
(init-addr uint16)
)
)
(define *inv-init-table* (new 'static 'inline-array invinitdata 8
(new 'static 'invinitdata :count #x48 :init-addr #x1)
(new 'static 'invinitdata :count #x38 :init-data #x24 :init-addr #xe1)
(new 'static 'invinitdata :count #xbe)
(new 'static 'invinitdata :count #x81 :init-data #x80 :init-addr #x3b80)
(new 'static 'invinitdata :count #x88 :init-data #x50 :init-addr #x100a)
(new 'static 'invinitdata :count #x7d :init-data #xb :init-addr #x81e8)
(new 'static 'invinitdata :count #x7d :init-data #x1b :init-addr #x81e8)
(new 'static 'invinitdata :count #x2 :init-data #x68 :init-addr #x5200)
)
)
(def-mips2c generic-merc-init-asm (function none))
;; ERROR: function was not converted to expressions. Cannot decompile.
;; ERROR: function was not converted to expressions. Cannot decompile.
;; ERROR: function has no type analysis. Cannot decompile.
(def-mips2c mercneric-convert function)
(def-mips2c high-speed-reject function)
(def-mips2c generic-translucent (function gsf-buffer none))
(def-mips2c generic-merc-query function)
(def-mips2c generic-merc-death function)
(def-mips2c generic-merc-execute-asm function)
(def-mips2c generic-merc-do-chain (function mercneric-chain dma-buffer pointer))
(defun generic-merc-execute-all ((arg0 dma-buffer))
(let ((s4-0 (-> *foreground* foreground-grid))
(gp-0 (-> *display* frames (-> *display* on-screen) global-buf base))
)
(when *debug-segment*
'generic
(let ((s3-0 (-> *display* frames (-> *display* on-screen) profile-array data 0))
(v1-15 'generic)
(s2-0 *profile-generic-color*)
)
(when (and *dproc* *debug-segment*)
(let ((s1-0 (-> s3-0 data (-> s3-0 count))))
(let ((s0-0 (-> s3-0 base-time)))
(set! (-> s1-0 name) v1-15)
(set! (-> s1-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s0-0))))
)
(set! (-> s1-0 depth) (the-as uint (-> s3-0 depth)))
(set! (-> s1-0 color) s2-0)
(set! (-> s3-0 segment (-> s3-0 depth)) s1-0)
)
(set! (-> s3-0 count) (min 2099 (+ (-> s3-0 count) 1)))
(+! (-> s3-0 depth) 1)
(set! (-> s3-0 max-depth) (max (-> s3-0 max-depth) (-> s3-0 depth)))
)
)
0
)
(-> *perf-stats* data 38)
0
(set! (-> (the-as generic-work #x70000000) saves to-vu0-waits) (the-as uint 0))
(set! (-> (the-as generic-work #x70000000) saves to-spr-waits) (the-as uint 0))
(set! (-> (the-as generic-work #x70000000) saves from-spr-waits) (the-as uint 0))
(flush-cache 0)
(generic-initialize-without-sync (-> (view-get-active-math-camera) perspective) *default-lights*)
(generic-merc-init-asm)
(set! (-> (the-as generic-work #x70000000) in-buf merc shadow write-limit)
(the-as int (&+ (-> arg0 end) -262144))
)
(dotimes (s3-2 19)
(dotimes (s2-1 10)
(generic-merc-do-chain
(the-as mercneric-chain (+ (the-as uint (-> s4-0 level-buckets 0 data 0 mercneric)) (* 480 s3-2) (* 48 s2-1)))
arg0
)
)
)
(generic-merc-do-chain (-> s4-0 warp-chain) arg0)
(-> *perf-stats* data 38)
0
(update-wait-stats
(-> *perf-stats* data 38)
(-> (the-as generic-work #x70000000) saves to-vu0-waits)
(-> (the-as generic-work #x70000000) saves to-spr-waits)
(-> (the-as generic-work #x70000000) saves from-spr-waits)
)
(when *debug-segment*
(let ((s5-1 (-> *display* frames (-> *display* on-screen) profile-array data 0)))
(when (and *dproc* *debug-segment*)
(let* ((v1-61 (+ (-> s5-1 depth) -1))
(s4-1 (-> s5-1 segment v1-61))
(s3-3 (-> s5-1 base-time))
)
(when (>= v1-61 0)
(set! (-> s4-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-3))))
(+! (-> s5-1 depth) -1)
)
)
)
)
0
)
(let ((v1-66 *dma-mem-usage*))
(when (nonzero? v1-66)
(set! (-> v1-66 length) (max 90 (-> v1-66 length)))
(set! (-> v1-66 data 89 name) "pris-generic")
(+! (-> v1-66 data 89 count) 1)
(+! (-> v1-66 data 89 used)
(&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint gp-0))
)
(set! (-> v1-66 data 89 total) (-> v1-66 data 89 used))
)
)
)
(none)
)
@@ -5,5 +5,300 @@
;; name in dgo: generic-vu1
;; dgos: ENGINE, GAME
(define-extern fx-copy-buf (function dma-buffer none))
;; DECOMP BEGINS
(define generic-vu1-block (new 'static 'vu-function :length #x6de :qlength #x36f))
(defun generic-setup-constants ((arg0 generic-constants) (arg1 viewport))
(let ((v1-0 (-> arg1 math-camera)))
(set-vector! (-> arg0 fog) (-> v1-0 pfog0) (-> v1-0 fog-min) (-> v1-0 fog-max) 3072.0)
(set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x7 :nreg #x1))
(set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
(set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad))
(set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad))
(set! (-> arg0 invh-scale quad) (-> v1-0 inv-hmge-scale quad))
(set! (-> arg0 guard quad) (-> v1-0 guard quad))
)
(set! (-> arg0 flush dword 0) (the-as uint #x3f80000080808080))
(set! (-> arg0 flush dword 1) (the-as uint 1))
(none)
)
;; WARN: Return type mismatch pointer vs none.
(defun generic-add-constants ((arg0 dma-buffer) (arg1 viewport))
(let* ((a2-0 8)
(v1-0 arg0)
(a0-1 (the-as object (-> v1-0 base)))
)
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0))
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as dma-packet a0-1) vif1)
(new 'static 'vif-tag :imm #x381 :cmd (vif-cmd unpack-v4-32) :num a2-0)
)
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
)
(generic-setup-constants (the-as generic-constants (-> arg0 base)) arg1)
(&+! (-> arg0 base) 128)
(none)
)
(defun generic-setup-shrub-constants ((arg0 generic-shrub-constants) (arg1 int) (arg2 int) (arg3 int))
(set! (-> arg0 shrub-giftag fan-prim)
(new 'static 'gif-tag-prim :pre #x1 :nreg #x3 :prim (the-as gs-prim arg3))
)
(set! (-> arg0 shrub-giftag str-prim)
(new 'static 'gif-tag-prim :pre #x1 :nreg #x3 :prim (the-as gs-prim arg2))
)
(set! (-> arg0 shrub-giftag regs)
(new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
(set! (-> arg0 shrub-giftag num-strips) (the-as uint 0))
(set! (-> arg0 shrub-adnop dword 0) (the-as uint arg1))
(set! (-> arg0 shrub-adnop dword 1) (the-as uint 71))
(none)
)
;; WARN: Return type mismatch pointer vs none.
(defun generic-add-shrub-constants ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int))
(let ((v1-0 2)
(a0-1 *display*)
(t0-0 64)
)
(+! (-> a0-1 mem-reserve-size) t0-0)
(when (not (-> a0-1 dma-buffer-overflow))
(let ((t2-0 (-> a0-1 frames (-> a0-1 on-screen) global-buf)))
(if (< (-> t2-0 real-buffer-end) (the-as int (&+ (-> t2-0 base) t0-0)))
(set! (-> a0-1 dma-buffer-overflow) #t)
)
)
(when (not (-> a0-1 dma-buffer-overflow))
(let* ((a0-3 arg0)
(t0-4 (the-as object (-> a0-3 base)))
)
(set! (-> (the-as dma-packet t0-4) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-0))
(set! (-> (the-as dma-packet t0-4) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as dma-packet t0-4) vif1)
(new 'static 'vif-tag :imm #x389 :cmd (vif-cmd unpack-v4-32) :num v1-0)
)
(set! (-> a0-3 base) (&+ (the-as pointer t0-4) 16))
)
)
)
)
(generic-setup-shrub-constants (the-as generic-shrub-constants (-> arg0 base)) arg1 arg2 arg3)
(&+! (-> arg0 base) 32)
(none)
)
(defun generic-init-buf ((arg0 dma-buffer) (arg1 gs-zbuf) (arg2 viewport) (arg3 object))
(let ((v1-0 *display*)
(a0-6 (+ (* (+ (/ (-> generic-vu1-block qlength) 127) 1) 16) 304))
)
(+! (-> v1-0 mem-reserve-size) a0-6)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-6)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(dma-buffer-add-vu-function arg0 generic-vu1-block 1)
(dma-buffer-add-gs-set arg0
(zbuf-1 arg1)
(frame-1 (-> arg2 frame))
(scissor-1 (-> arg2 scissor))
(test-1 arg3)
)
(generic-add-constants arg0 arg2)
(let* ((v1-5 arg0)
(a0-18 (the-as object (-> v1-5 base)))
)
(set! (-> (the-as dma-packet a0-18) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
(set! (-> (the-as dma-packet a0-18) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1))
(set! (-> (the-as dma-packet a0-18) vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
(set! (-> v1-5 base) (&+ (the-as pointer a0-18) 16))
)
(let ((v1-6 (-> arg0 base)))
(set! (-> (the-as (pointer int32) v1-6) 0) #x3000000)
(set! (-> (the-as (pointer int32) v1-6) 1) #x2000000)
(set! (-> (the-as (pointer int32) v1-6) 2) 0)
(set! (-> (the-as (pointer int32) v1-6) 3) #x30000000)
(set! (-> (the-as (pointer int32) v1-6) 4) 0)
(set! (-> (the-as (pointer int32) v1-6) 5) 0)
(set! (-> (the-as (pointer int32) v1-6) 6) 0)
(set! (-> (the-as (pointer int32) v1-6) 7) 0)
(set! (-> arg0 base) (&+ v1-6 32))
)
)
)
)
0
(none)
)
(defun generic-vu1-init-buf ((arg0 bucket-id) (arg1 gs-zbuf) (arg2 viewport) (arg3 object))
(let ((v1-0 *display*)
(t0-0 16)
)
(+! (-> v1-0 mem-reserve-size) t0-0)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((t2-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> t2-0 real-buffer-end) (the-as int (&+ (-> t2-0 base) t0-0)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((gp-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= gp-0 (-> gp-0 last))
(let* ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))
(s5-3 (-> s4-0 base))
)
(generic-init-buf s4-0 arg1 arg2 arg3)
(let ((v1-14 (the-as object (-> s4-0 base))))
(set! (-> (the-as dma-packet v1-14) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> gp-0 next)))
(set! (-> (the-as dma-packet v1-14) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-14) vif1) (new 'static 'vif-tag))
(set! (-> s4-0 base) (&+ (the-as pointer v1-14) 16))
)
(set! (-> gp-0 next) (the-as uint s5-3))
)
)
)
)
)
)
0
(none)
)
(defun generic-vu1-init-buf-special ((arg0 bucket-id) (arg1 gs-zbuf) (arg2 object) (arg3 object))
(let ((v1-0 *display*)
(a1-1 16)
)
(+! (-> v1-0 mem-reserve-size) a1-1)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((a3-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
(if (< (-> a3-1 real-buffer-end) (the-as int (&+ (-> a3-1 base) a1-1)))
(set! (-> v1-0 dma-buffer-overflow) #t)
)
)
(when (not (-> v1-0 dma-buffer-overflow))
(let ((s3-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
(when (!= s3-0 (-> s3-0 last))
(let* ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf))
(s2-3 (-> s1-0 base))
)
(fx-copy-buf s1-0)
(generic-init-buf s1-0 arg1 (the-as viewport arg2) arg3)
(let ((v1-14 (the-as object (-> s1-0 base))))
(set! (-> (the-as dma-packet v1-14) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> s3-0 next)))
(set! (-> (the-as dma-packet v1-14) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-14) vif1) (new 'static 'vif-tag))
(set! (-> s1-0 base) (&+ (the-as pointer v1-14) 16))
)
(set! (-> s3-0 next) (the-as uint s2-3))
)
)
)
)
)
)
0
(none)
)
(defun generic-vu1-init-buffers ()
(when (logtest? (-> *display* vu1-enable-user) 4096)
(let ((gp-0 *viewport-array*))
(dotimes (s5-0 19)
(dotimes (s4-0 2)
(let ((v1-4 gp-0)
(a0-0 s4-0)
)
(-> v1-4 data (the-as uint a0-0))
(set! (-> v1-4 current-viewport-index) (the-as uint a0-0))
)
(let* ((v1-5 gp-0)
(s2-0 (-> v1-5 data (-> v1-5 current-viewport-index)))
(s1-0 (-> s2-0 zbuf-on))
(s3-0 (-> s2-0 zbuf-off))
)
(let ((a0-5 (vu1-bucket-map s5-0 0 s4-0 (merc-mode mercneric))))
(generic-vu1-init-buf (the-as bucket-id a0-5) (the-as gs-zbuf s1-0) s2-0 #x5026b)
)
(let ((a0-7 (vu1-bucket-map s5-0 1 s4-0 (merc-mode mercneric))))
(generic-vu1-init-buf (the-as bucket-id a0-7) (the-as gs-zbuf s1-0) s2-0 #x5026b)
)
(let ((a0-9 (vu1-bucket-map s5-0 2 s4-0 (merc-mode mercneric))))
(generic-vu1-init-buf (the-as bucket-id a0-9) (the-as gs-zbuf s1-0) s2-0 #x5026b)
)
(let ((a0-11 (vu1-bucket-map s5-0 3 s4-0 (merc-mode mercneric))))
(generic-vu1-init-buf (the-as bucket-id a0-11) (the-as gs-zbuf s1-0) s2-0 #x51001)
)
(let ((a0-13 (vu1-bucket-map s5-0 6 s4-0 (merc-mode mercneric))))
(generic-vu1-init-buf (the-as bucket-id a0-13) (the-as gs-zbuf s1-0) s2-0 #x5026b)
)
(let ((a0-15 (vu1-bucket-map s5-0 4 s4-0 (merc-mode mercneric))))
(generic-vu1-init-buf (the-as bucket-id a0-15) (the-as gs-zbuf s3-0) s2-0 #x51001)
)
(let ((a0-17 (vu1-bucket-map s5-0 0 s4-0 (merc-mode mercneric2))))
(generic-vu1-init-buf (the-as bucket-id a0-17) (the-as gs-zbuf s1-0) s2-0 #x5026b)
)
(let ((a0-19 (vu1-bucket-map s5-0 1 s4-0 (merc-mode mercneric2))))
(generic-vu1-init-buf (the-as bucket-id a0-19) (the-as gs-zbuf s1-0) s2-0 #x5026b)
)
(let ((a0-21 (vu1-bucket-map s5-0 2 s4-0 (merc-mode mercneric2))))
(generic-vu1-init-buf (the-as bucket-id a0-21) (the-as gs-zbuf s1-0) s2-0 #x5026b)
)
(let ((a0-23 (vu1-bucket-map s5-0 3 s4-0 (merc-mode mercneric2))))
(generic-vu1-init-buf (the-as bucket-id a0-23) (the-as gs-zbuf s1-0) s2-0 #x51001)
)
(let ((a0-25 (vu1-bucket-map s5-0 6 s4-0 (merc-mode mercneric2))))
(generic-vu1-init-buf (the-as bucket-id a0-25) (the-as gs-zbuf s1-0) s2-0 #x5026b)
)
(let ((a0-27 (vu1-bucket-map s5-0 4 s4-0 (merc-mode mercneric2))))
(generic-vu1-init-buf (the-as bucket-id a0-27) (the-as gs-zbuf s3-0) s2-0 #x51001)
)
)
)
)
(let ((v1-22 gp-0)
(a0-28 0)
)
(-> v1-22 data (the-as uint a0-28))
(set! (-> v1-22 current-viewport-index) (the-as uint a0-28))
)
(let* ((v1-23 gp-0)
(s5-1 (-> v1-23 data (-> v1-23 current-viewport-index)))
)
(generic-vu1-init-buf (bucket-id bucket768) (the-as gs-zbuf (-> s5-1 zbuf-on)) s5-1 #x5026b)
(generic-vu1-init-buf (bucket-id bucket770) (the-as gs-zbuf (-> s5-1 zbuf-on)) s5-1 #x5026b)
(generic-vu1-init-buf (bucket-id bucket778) (the-as gs-zbuf (-> s5-1 zbuf-off)) s5-1 #x5026b)
(generic-vu1-init-buf-special (bucket-id bucket781) (the-as gs-zbuf (-> s5-1 zbuf-on)) s5-1 #x5026b)
(generic-vu1-init-buf (bucket-id bucket788) (the-as gs-zbuf (-> s5-1 zbuf-on)) s5-1 #x5026b)
)
(let ((v1-25 gp-0)
(a0-37 1)
)
(-> v1-25 data (the-as uint a0-37))
(set! (-> v1-25 current-viewport-index) (the-as uint a0-37))
)
(let* ((v1-26 gp-0)
(s5-2 (-> v1-26 data (-> v1-26 current-viewport-index)))
)
(generic-vu1-init-buf (bucket-id bucket771) (the-as gs-zbuf (-> s5-2 zbuf-on)) s5-2 #x5026b)
(generic-vu1-init-buf (bucket-id bucket773) (the-as gs-zbuf (-> s5-2 zbuf-on)) s5-2 #x5026b)
(generic-vu1-init-buf (bucket-id bucket779) (the-as gs-zbuf (-> s5-2 zbuf-off)) s5-2 #x5026b)
(generic-vu1-init-buf-special (bucket-id bucket782) (the-as gs-zbuf (-> s5-2 zbuf-on)) s5-2 #x5026b)
)
(let ((v1-28 0))
(-> gp-0 data (the-as uint v1-28))
(set! (-> gp-0 current-viewport-index) (the-as uint v1-28))
)
)
)
0
(none)
)
@@ -5,5 +5,851 @@
;; name in dgo: lightning
;; dgos: ENGINE, GAME
(define-extern lightning-tracker-init (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker)) ;; added
;; DECOMP BEGINS
(kmemopen global "part-tables")
(define *lightning-spec-id-table* (new 'global 'boxed-array lightning-spec 128))
(kmemclose)
(define *lightning-gcf*
(new 'static 'gcf-control
:giftag (new 'static 'generic-gif-tag
:fan-prim (new 'static 'gif-tag-prim
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1)
:nreg #x3
)
:str-prim (new 'static 'gif-tag-prim
:pre #x1
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1)
:nreg #x3
)
:regs (new 'static 'gif-tag-regs-32 :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
)
:adnops (new 'static 'inline-array gs-adcmd 2
(new 'static 'gs-adcmd :cmds (gs-reg64 hack))
(new 'static 'gs-adcmd :cmds (gs-reg64 hack))
)
)
)
(defun lightning-fractal-gen ((arg0 (inline-array vector)) (arg1 int) (arg2 int) (arg3 float) (arg4 lightning-spec))
(when (< 1 (- arg2 arg1))
(let ((s1-0 (/ (+ arg1 arg2) 2)))
(let ((sv-16 (-> arg0 arg1))
(sv-32 (-> arg0 arg2))
(s0-0 (-> arg0 s1-0))
)
(let* ((f30-0 (* 0.5 (+ (-> sv-16 x) (-> sv-32 x))))
(f28-0 arg3)
(f26-0 -0.5)
(v1-12 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-13 (the-as number (logior #x3f800000 v1-12)))
)
(set! (-> s0-0 x) (+ f30-0 (* f28-0 (+ f26-0 (+ -1.0 (the-as float v1-13))))))
)
(let* ((f30-1 (* 0.5 (+ (-> sv-16 y) (-> sv-32 y))))
(f28-1 arg3)
(f26-1 -0.5)
(v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-20 (the-as number (logior #x3f800000 v1-19)))
)
(set! (-> s0-0 y) (+ f30-1 (* f28-1 (+ f26-1 (+ -1.0 (the-as float v1-20))))))
)
(let* ((f30-2 (* 0.5 (+ (-> sv-16 z) (-> sv-32 z))))
(f28-2 arg3)
(f26-2 -0.5)
(v1-26 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-27 (the-as number (logior #x3f800000 v1-26)))
)
(set! (-> s0-0 z) (+ f30-2 (* f28-2 (+ f26-2 (+ -1.0 (the-as float v1-27))))))
)
)
(lightning-fractal-gen arg0 arg1 s1-0 (* arg3 (-> arg4 reduction)) arg4)
(lightning-fractal-gen arg0 s1-0 arg2 (* arg3 (-> arg4 reduction)) arg4)
)
)
0
(none)
)
(defun lightning-uniform-gen ((arg0 (inline-array vector)) (arg1 int) (arg2 int) (arg3 float) (arg4 lightning-spec))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s4-0 (-> arg0 arg1))
(s3-0 (-> arg0 arg2))
(f30-0 (/ 1.0 (the float (- arg2 arg1))))
(f28-0 0.0)
(s2-0 (new-stack-vector0))
(s1-0 arg1)
(s0-0 arg2)
)
(while (>= s0-0 s1-0)
(vector-lerp! (-> arg0 s1-0) s4-0 s3-0 f28-0)
(let ((sv-32 s2-0))
(let* ((f26-0 0.4)
(f24-0 -0.5)
(v1-7 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-8 (the-as number (logior #x3f800000 v1-7)))
)
(set! (-> sv-32 x) (* f26-0 (+ f24-0 (+ -1.0 (the-as float v1-8))) arg3))
)
(let* ((f26-1 0.4)
(f24-1 -0.5)
(v1-13 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-14 (the-as number (logior #x3f800000 v1-13)))
)
(set! (-> sv-32 y) (* f26-1 (+ f24-1 (+ -1.0 (the-as float v1-14))) arg3))
)
(let* ((f26-2 0.4)
(f24-2 -0.5)
(v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-20 (the-as number (logior #x3f800000 v1-19)))
)
(set! (-> sv-32 z) (* f26-2 (+ f24-2 (+ -1.0 (the-as float v1-20))) arg3))
)
(set! (-> sv-32 w) 1.0)
)
(let ((v1-26 (-> arg0 s1-0)))
(let ((a0-12 (-> arg0 s1-0))
(a1-2 s2-0)
)
(.lvf vf4 (&-> a0-12 quad))
(.lvf vf5 (&-> a1-2 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-26 quad) vf6)
)
(+! f28-0 f30-0)
(+! s1-0 1)
)
)
0
(none)
)
)
(defun lightning-trail-uniform-gen ((arg0 (inline-array vector)) (arg1 (inline-array vector)) (arg2 float) (arg3 int))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s2-0 (new 'stack-no-clear 'vector)))
(dotimes (s1-0 arg3)
(let ((s0-0 s2-0))
(let* ((f30-0 0.4)
(f28-0 -0.5)
(v1-3 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-4 (the-as number (logior #x3f800000 v1-3)))
)
(set! (-> s0-0 x) (* f30-0 (+ f28-0 (+ -1.0 (the-as float v1-4))) arg2))
)
(let* ((f30-1 0.4)
(f28-1 -0.5)
(v1-9 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-10 (the-as number (logior #x3f800000 v1-9)))
)
(set! (-> s0-0 y) (* f30-1 (+ f28-1 (+ -1.0 (the-as float v1-10))) arg2))
)
(let* ((f30-2 0.4)
(f28-2 -0.5)
(v1-15 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-16 (the-as number (logior #x3f800000 v1-15)))
)
(set! (-> s0-0 z) (* f30-2 (+ f28-2 (+ -1.0 (the-as float v1-16))) arg2))
)
(set! (-> s0-0 w) 1.0)
)
(let ((v1-20 (-> arg0 s1-0)))
(let ((a0-11 (-> arg1 s1-0))
(a1-1 s2-0)
)
(.lvf vf4 (&-> a0-11 quad))
(.lvf vf5 (&-> a1-1 quad))
)
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-20 quad) vf6)
)
)
)
#f
)
)
(defun lightning-trail-fractal-gen ((arg0 (inline-array vector))
(arg1 (inline-array vector))
(arg2 int)
(arg3 int)
(arg4 float)
(arg5 lightning-spec)
)
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(when (< 1 (- arg3 arg2))
(let ((s0-0 (/ (+ arg2 arg3) 2)))
(let ((sv-96 (new 'stack-no-clear 'vector)))
(let ((v1-5 (-> arg0 arg2))
(a0-3 (-> arg1 arg2))
)
(.lvf vf4 (&-> v1-5 quad))
(.lvf vf5 (&-> a0-3 quad))
)
(.mov.vf.w vf6 vf0)
(.sub.vf.xyz vf6 vf4 vf5)
(.svf (&-> sv-96 quad) vf6)
(let ((sv-112 (new 'stack-no-clear 'vector)))
(let ((v1-9 (-> arg0 arg3))
(a0-5 (-> arg1 arg3))
)
(.lvf vf4 (&-> v1-9 quad))
(.lvf vf5 (&-> a0-5 quad))
)
(.mov.vf.w vf6 vf0)
(.sub.vf.xyz vf6 vf4 vf5)
(.svf (&-> sv-112 quad) vf6)
(let ((sv-144 (new 'stack-no-clear 'vector)))
(let ((sv-128 (new 'stack-no-clear 'vector)))
(let ((sv-80 sv-144))
(let* ((f30-0 arg4)
(f28-0 -0.5)
(v1-15 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-16 (the-as number (logior #x3f800000 v1-15)))
)
(set! (-> sv-80 x) (* f30-0 (+ f28-0 (+ -1.0 (the-as float v1-16)))))
)
(let* ((f30-1 arg4)
(f28-1 -0.5)
(v1-20 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-21 (the-as number (logior #x3f800000 v1-20)))
)
(set! (-> sv-80 y) (* f30-1 (+ f28-1 (+ -1.0 (the-as float v1-21)))))
)
(let* ((f30-2 arg4)
(f28-2 -0.5)
(v1-25 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-26 (the-as number (logior #x3f800000 v1-25)))
)
(set! (-> sv-80 z) (* f30-2 (+ f28-2 (+ -1.0 (the-as float v1-26)))))
)
(set! (-> sv-80 w) 1.0)
)
(let ((v1-31 sv-128)
(a0-15 sv-128)
)
(.lvf vf4 (&-> sv-96 quad))
(.lvf vf5 (&-> sv-112 quad))
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> a0-15 quad) vf6)
(vector-float*! v1-31 a0-15 0.5)
)
(let ((v1-33 sv-144))
(.lvf vf4 (&-> sv-144 quad))
(.lvf vf5 (&-> sv-128 quad))
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-33 quad) vf6)
)
)
(let ((v1-35 (-> arg0 s0-0)))
(.lvf vf4 (&-> (-> arg1 s0-0) quad))
(.lvf vf5 (&-> sv-144 quad))
(.mov.vf.w vf6 vf0)
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-35 quad) vf6)
)
)
)
)
(lightning-trail-fractal-gen arg0 arg1 arg2 s0-0 (* arg4 (-> arg5 reduction)) arg5)
(lightning-trail-fractal-gen arg0 arg1 s0-0 arg3 (* arg4 (-> arg5 reduction)) arg5)
)
)
0
(none)
)
)
(deftype lightning-globals (structure)
((gcf-buf uint16)
(vtx-buf uint16)
)
)
(defun gs-packed-rgba-lerp! ((arg0 gs-packed-rgba) (arg1 rgba) (arg2 rgba) (arg3 float))
(local-vars (v1-0 uint128) (v1-1 uint128) (a1-1 uint128) (a1-2 uint128))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
)
(init-vf0-vector)
(.pextlb v1-0 0 arg1)
(.pextlb a1-1 0 arg2)
(.pextlh v1-1 0 v1-0)
(.pextlh a1-2 0 a1-1)
(.mov vf1 v1-1)
(.mov vf2 a1-2)
(.mov vf3 arg3)
(.itof.vf vf1 vf1)
(.itof.vf vf2 vf2)
(.mul.w.vf acc vf1 vf0)
(.add.mul.x.vf acc vf2 vf3 acc)
(.sub.mul.x.vf vf1 vf1 vf3 acc)
(.ftoi.vf vf1 vf1)
(.svf (&-> arg0 quad) vf1)
arg0
)
)
(defbehavior lightning-fade process ((arg0 lightning-control))
(local-vars (v0-1 int))
(let ((f0-0 (-> arg0 spec fade-time)))
(-> arg0 process 0 clock)
(cond
((< (-> arg0 state counter) f0-0)
(+! (-> arg0 state counter) (* 300.0 (seconds-per-frame)))
(let ((gp-0 (-> arg0 state)))
(let* ((s5-0 (-> arg0 spec))
(f30-0 (fmax 0.0 (fmin 1.0 (* (- 1.0 (/ (-> gp-0 counter) f0-0)) (-> s5-0 fade-start-factor)))))
(sv-16 (-> s5-0 fade-to-color))
)
(set! (-> gp-0 start-color) (rgba-lerp sv-16 (-> s5-0 start-color) (the-as rgba f30-0)))
(set! v0-1 (the-as int (rgba-lerp sv-16 (-> s5-0 end-color) (the-as rgba f30-0))))
)
(set! (-> gp-0 end-color) (the-as rgba v0-1))
)
)
(else
(let ((v1-9 arg0))
(set! v0-1 0)
(let ((a0-4 (!= v0-1 (-> v1-9 state mode))))
(case v0-1
((3)
(if a0-4
(set! (-> v1-9 state counter) 0.0)
)
)
((1)
(set! (-> v1-9 state start-color) (-> v1-9 spec start-color))
(set! (-> v1-9 state end-color) (-> v1-9 spec end-color))
)
)
)
(set! (-> v1-9 state mode) (the-as uint v0-1))
)
)
)
)
v0-1
)
(defun lightning-update ((arg0 lightning-control))
(let* ((gp-0 (-> arg0 state points-to-draw))
(s4-0 (+ gp-0 -1))
(s5-0 (-> arg0 state))
(sv-16 (-> arg0 spec))
(sv-20 (-> s5-0 line))
(sv-24 (-> s5-0 meet))
(sv-28 (-> s5-0 path))
(sv-32 (= (-> s5-0 mode) 1))
(sv-36 (-> arg0 process 0 clock))
)
(when (not (or (= (-> sv-36 time-adjust-ratio) 0.0) (< gp-0 2)))
(when (logtest? (-> sv-16 flags) (lightning-spec-flags lsf4))
(let ((f1-1 (vector-vector-distance (-> sv-24 data 0) (-> sv-24 data s4-0))))
(set! (-> s5-0 box-size)
(* (-> sv-16 box-size) (fmax 1.0 (fmin 5.0 (/ f1-1 (* 4096.0 (the float (-> sv-16 adjust-distance)))))))
)
)
)
(set! (-> s5-0 counter) (fmax 0.0 (- (-> s5-0 counter) (-> sv-36 time-adjust-ratio))))
(when sv-32
(set! (-> s5-0 mode) (the-as uint 2))
(set! (-> s5-0 counter) 0.0)
)
(when (>= 0.0 (-> s5-0 counter))
(let ((v1-33 (-> sv-16 rand-func)))
(cond
((or (zero? v1-33) (= v1-33 1))
(let ((v1-35 (-> sv-16 rand-func)))
(cond
((zero? v1-35)
(lightning-fractal-gen (-> sv-24 data) 0 s4-0 (-> s5-0 box-size) sv-16)
)
((= v1-35 1)
(lightning-uniform-gen (-> sv-24 data) 0 s4-0 (-> s5-0 box-size) sv-16)
)
)
)
(when sv-32
(dotimes (v1-43 gp-0)
(set! (-> sv-20 data v1-43 quad) (-> sv-24 data v1-43 quad))
)
)
)
((or (= v1-33 2) (= v1-33 3))
(case (-> sv-16 rand-func)
((2)
(set! (-> sv-24 data 0 quad) (-> sv-28 data 0 quad))
(set! (-> sv-24 data s4-0 quad) (-> sv-28 data s4-0 quad))
(lightning-trail-fractal-gen (-> sv-24 data) (-> sv-28 data) 0 s4-0 (-> s5-0 box-size) sv-16)
)
(else
(lightning-trail-uniform-gen (-> sv-24 data) (-> sv-28 data) (-> s5-0 box-size) gp-0)
)
)
(when sv-32
(dotimes (v1-63 gp-0)
(set! (-> sv-20 data v1-63 quad) (-> sv-28 data v1-63 quad))
)
)
)
)
)
(set! (-> s5-0 counter) (the float (-> sv-16 merge-count)))
)
(let ((f0-14 (fmax 0.0 (fmin 1.0 (* (-> sv-16 merge-factor) (-> sv-36 time-adjust-ratio))))))
(dotimes (v1-72 gp-0)
(let* ((a1-21 (-> sv-20 data v1-72))
(a2-7 (-> sv-24 data v1-72))
(a0-31 a1-21)
)
(set! (-> a0-31 x) (+ (-> a1-21 x) (* f0-14 (- (-> a2-7 x) (-> a1-21 x)))))
(set! (-> a0-31 y) (+ (-> a1-21 y) (* f0-14 (- (-> a2-7 y) (-> a1-21 y)))))
(set! (-> a0-31 z) (+ (-> a1-21 z) (* f0-14 (- (-> a2-7 z) (-> a1-21 z)))))
)
)
)
#f
)
)
)
(defun lightning-draw ((arg0 dma-buffer) (arg1 lightning-control) (arg2 lightning-globals))
(local-vars (sv-128 int))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf17 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(let* ((sv-16 (view-get-active-math-camera))
(sv-20 (the-as (inline-array gcf-vertex) *gsf-buffer*))
(s3-0 (-> arg1 state points-to-draw))
(s2-0 (+ s3-0 -1))
(s1-0 *lightning-gcf*)
(s0-0 (-> sv-16 camera-rot))
(sv-32 (lookup-texture-by-id (-> arg1 spec texture)))
(sv-48 (-> arg1 state line))
(sv-24 (-> arg1 spec))
)
(when (< 1 s3-0)
(let ((sv-64 0))
(while (< sv-64 2)
(let ((sv-28 (/ 1.0 (the float s2-0))))
(cond
((logtest? (-> sv-24 flags) (lightning-spec-flags lsf0))
(let ((sv-80 0))
(while (< sv-80 (* s3-0 2))
(cond
((not (logtest? sv-80 1))
(gs-packed-rgba-lerp!
(-> sv-20 sv-80 clr)
(-> arg1 state start-color)
(-> arg1 state end-color)
(* (the float (/ sv-80 2)) sv-28)
)
(let ((v1-23 (-> sv-20 sv-80)))
(set! (-> v1-23 tex x) 0)
(set! (-> v1-23 tex y) (* (/ 4096 s3-0) (/ sv-80 2)))
(set! (-> v1-23 tex z) 4096)
(set! (-> v1-23 tex w) 0)
)
)
(else
(gs-packed-rgba-lerp!
(-> sv-20 sv-80 clr)
(-> arg1 state start-color)
(-> arg1 state end-color)
(* (the float (/ sv-80 2)) sv-28)
)
(let ((v1-32 (-> sv-20 sv-80)))
(set! (-> v1-32 tex x) 4096)
(set! (-> v1-32 tex y) (* (/ 4096 s3-0) (/ sv-80 2)))
(set! (-> v1-32 tex z) 4096)
(set! (-> v1-32 tex w) 0)
)
)
)
(+! sv-80 1)
)
)
)
((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1))
(dotimes (v1-42 (* s3-0 2))
(cond
((not (logtest? v1-42 1))
(let ((a0-26 (-> sv-20 v1-42)))
(set! (-> a0-26 tex x) 0)
(set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-42 2)))
(set! (-> a0-26 tex z) 4096)
(set! (-> a0-26 tex w) 0)
)
)
(else
(let ((a0-30 (-> sv-20 v1-42)))
(set! (-> a0-30 tex x) 4096)
(set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-42 2)))
(set! (-> a0-30 tex z) 4096)
(set! (-> a0-30 tex w) 0)
)
)
)
)
(dotimes (v1-45 (* s2-0 2))
(set! (-> sv-20 v1-45 clr x) (the-as int (-> arg1 state start-color r)))
(set! (-> sv-20 v1-45 clr y) (the-as int (-> arg1 state start-color g)))
(set! (-> sv-20 v1-45 clr z) (the-as int (-> arg1 state start-color b)))
(set! (-> sv-20 v1-45 clr w) (the-as int (-> arg1 state start-color a)))
)
(dotimes (v1-48 2)
(let ((a0-45 (+ v1-48 (* s2-0 2))))
(set! (-> sv-20 a0-45 clr x) (the-as int (-> arg1 state end-color r)))
(set! (-> sv-20 a0-45 clr y) (the-as int (-> arg1 state end-color g)))
(set! (-> sv-20 a0-45 clr z) (the-as int (-> arg1 state end-color b)))
(set! (-> sv-20 a0-45 clr w) (the-as int (-> arg1 state end-color a)))
)
)
)
((logtest? (-> sv-24 flags) (lightning-spec-flags lsf2))
(dotimes (v1-55 (* s3-0 2))
(cond
((not (logtest? v1-55 1))
(let ((a0-52 (-> sv-20 v1-55)))
(set! (-> a0-52 tex x) 0)
(set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-55 2)))
(set! (-> a0-52 tex z) 4096)
(set! (-> a0-52 tex w) 0)
)
)
(else
(let ((a0-56 (-> sv-20 v1-55)))
(set! (-> a0-56 tex x) 4096)
(set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-55 2)))
(set! (-> a0-56 tex z) 4096)
(set! (-> a0-56 tex w) 0)
)
)
)
)
(dotimes (v1-58 (* (+ s3-0 -2) 2))
(let ((a0-58 (+ v1-58 2)))
(set! (-> sv-20 a0-58 clr x) (the-as int (-> arg1 state start-color r)))
(set! (-> sv-20 a0-58 clr y) (the-as int (-> arg1 state start-color g)))
(set! (-> sv-20 a0-58 clr z) (the-as int (-> arg1 state start-color b)))
(set! (-> sv-20 a0-58 clr w) (the-as int (-> arg1 state start-color a)))
)
)
(dotimes (v1-61 2)
(let ((a0-63 v1-61))
(set! (-> sv-20 a0-63 clr x) (the-as int (-> arg1 state end-color r)))
(set! (-> sv-20 a0-63 clr y) (the-as int (-> arg1 state end-color g)))
(set! (-> sv-20 a0-63 clr z) (the-as int (-> arg1 state end-color b)))
(set! (-> sv-20 a0-63 clr w) (the-as int (-> arg1 state end-color a)))
)
)
(dotimes (v1-64 2)
(let ((a0-67 (+ v1-64 (* s2-0 2))))
(set! (-> sv-20 a0-67 clr x) (the-as int (-> arg1 state end-color r)))
(set! (-> sv-20 a0-67 clr y) (the-as int (-> arg1 state end-color g)))
(set! (-> sv-20 a0-67 clr z) (the-as int (-> arg1 state end-color b)))
(set! (-> sv-20 a0-67 clr w) (the-as int (-> arg1 state end-color a)))
)
)
)
)
)
(let ((f0-8 (-> sv-24 radius))
(f1-4 0.5)
(v1-70 (the-as object (-> sv-48 data)))
(a0-71 (the-as object (-> sv-20 0)))
(a1-82 (the-as object (-> sv-20 1)))
)
1
(.lvf vf1 (&-> s0-0 rvec quad))
(.lvf vf2 (&-> s0-0 uvec quad))
(.lvf vf3 (&-> s0-0 fvec quad))
(.lvf vf4 (&-> s0-0 trans quad))
(let ((a2-44 f0-8))
(.mov vf8 a2-44)
)
(let ((a2-45 f1-4))
(.mov vf17 a2-45)
)
(.add.x.vf.y vf17 vf0 vf8)
(.add.w.vf.z vf17 vf0 vf0)
(.add.w.vf.z vf17 vf17 vf0)
(dotimes (a2-46 s3-0)
(.lvf vf8 (&-> (the-as vector v1-70) quad))
(.mul.w.vf.xyz acc vf4 vf0)
(.add.mul.x.vf.xyz acc vf1 vf8 acc)
(.add.mul.y.vf.xyz acc vf2 vf8 acc)
(.add.mul.z.vf.xyz vf8 vf3 vf8 acc)
(.add.x.vf vf6 vf8 vf0)
(b! (zero? sv-64) cfg-44 :delay (.add.x.vf vf7 vf8 vf0))
(.add.y.vf.y vf6 vf6 vf17)
(b! #t cfg-45 :delay (.sub.y.vf.y vf7 vf7 vf17))
(label cfg-44)
(.add.y.vf.x vf6 vf6 vf17)
(.sub.y.vf.x vf7 vf7 vf17)
(label cfg-45)
(.svf (&-> (the-as (pointer uint128) a1-82) 2) vf6)
(.svf (&-> (the-as (pointer uint128) a0-71) 2) vf7)
(set! a1-82 (&-> (the-as (pointer uint128) a1-82) 6))
(set! a0-71 (&-> (the-as (pointer uint128) a0-71) 6))
(.add.x.vf vf9 vf8 vf0)
(set! v1-70 (-> (the-as (inline-array vector) v1-70) 1))
)
)
(let ((sv-96 s2-0)
(sv-112 0)
)
(while (> sv-96 0)
(set! sv-128 (cond
((< 40 sv-96)
(set! sv-128 40)
sv-128
)
(else
sv-96
)
)
)
(let ((sv-144 (+ sv-128 1)))
(let ((sv-160 12))
(let* ((v1-80 arg0)
(a0-73 (the-as object (-> v1-80 base)))
)
(set! (-> (the-as dma-packet a0-73) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc sv-160))
(set! (-> (the-as dma-packet a0-73) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet a0-73) vif1)
(new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 gcf-buf) 54) 54) :num sv-160)
)
(set! (-> v1-80 base) (the-as pointer (&+ (the-as dma-packet a0-73) 16)))
)
(let ((sv-176 (the-as gcf-control (-> arg0 base))))
(matrix-copy! (-> sv-176 matrix) (-> sv-16 perspective))
(quad-copy! (the-as pointer (-> sv-176 giftag)) (the-as pointer (-> s1-0 giftag)) 3)
(set! (-> sv-176 giftag num-strips) (the-as uint 1))
(set! (-> sv-176 num-dps) (the-as uint (* sv-144 2)))
(set! (-> sv-176 kick-offset) (the-as uint 0))
(when sv-32
(adgif-shader<-texture-simple! (-> sv-176 shader 0 shader) sv-32)
(adgif-shader-update! (-> sv-176 shader 0 shader) sv-32)
)
(set! (-> sv-176 shader 0 shader alpha) (new 'static 'gs-miptbp :tbp1 #x48 :tbw2 #x20))
(set! (-> sv-176 shader 0 shader tex0 tfx) 0)
(set! (-> sv-176 shader 0 pos) (the-as uint 0))
(set! (-> sv-176 shader 0 num) (the-as uint (+ #x8000 (* sv-144 2))))
)
(&+! (-> arg0 base) (* sv-160 16))
)
(let* ((v1-103 arg0)
(a0-90 (the-as object (-> v1-103 base)))
)
(set! (-> (the-as dma-packet a0-90) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 6 sv-144)))
(set! (-> (the-as dma-packet a0-90) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet a0-90) vif1)
(new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 vtx-buf) 54) 54) :num (* 6 sv-144))
)
(set! (-> v1-103 base) (the-as pointer (&+ (the-as dma-packet a0-90) 16)))
)
(quad-copy! (-> arg0 base) (the-as pointer (-> sv-20 sv-112)) (* 6 sv-144))
(&+! (-> arg0 base) (* 96 sv-144))
)
(let* ((v1-108 arg0)
(a0-95 (the-as object (-> v1-108 base)))
)
(set! (-> (the-as dma-packet a0-95) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
(set! (-> (the-as dma-packet a0-95) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet a0-95) vif1) (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1))
(set! (-> v1-108 base) (the-as pointer (&+ (the-as dma-packet a0-95) 16)))
)
(set! (-> arg2 gcf-buf) (- 1704 (the-as int (-> arg2 gcf-buf))))
(+! (-> arg2 vtx-buf) 279)
(if (< (the-as uint 567) (-> arg2 vtx-buf))
(set! (-> arg2 vtx-buf) (the-as uint 9))
)
(set! sv-96 (- sv-96 sv-128))
(+! sv-112 (* sv-128 2))
sv-112
)
)
(+! sv-64 1)
)
)
#f
)
)
)
)
(defun-debug lightning-start ((arg0 float) (arg1 float))
(let ((gp-0 (get-process *default-dead-pool* lightning-tracker #x4000 0)))
(when gp-0
(let ((t9-1 (method-of-type lightning-tracker activate)))
(t9-1 (the-as lightning-tracker gp-0) *entity-pool* "lightning-tracker" (the-as pointer #x70004000))
)
(let ((t9-2 run-function-in-process)
(a0-3 gp-0)
(a1-3 lightning-tracker-init)
(a2-2 (new 'static 'lightning-spec
:name #f
:flags (lightning-spec-flags lsf1)
:start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
:end-color (new 'static 'rgba :r #x80 :a #x80)
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
:fade-start-factor 0.2
:fade-time 120.0
:texture (new 'static 'texture-id :index #x4f :page #x4)
:reduction 0.42
:num-points 16
:box-size 32768.0
:merge-factor 0.5
:merge-count 2
:radius 2048.0
:duration 18000.0
:sound #f
)
)
(a3-2 0)
(t0-0 #f)
(t1-0 #f)
(t2-0 (new 'stack-no-clear 'vector))
)
(set! (-> t2-0 x) arg0)
(set! (-> t2-0 y) 0.0)
(set! (-> t2-0 z) arg1)
(set! (-> t2-0 w) 1.0)
(let ((t3-0 (new 'stack-no-clear 'vector)))
(set! (-> t3-0 x) arg0)
(set! (-> t3-0 y) 262144.0)
(set! (-> t3-0 z) arg1)
(set! (-> t3-0 w) 1.0)
((the-as (function object object object object object object object object none) t9-2)
a0-3
a1-3
a2-2
a3-2
t0-0
t1-0
t2-0
t3-0
)
)
)
(-> gp-0 ppointer)
)
)
)
(define *lightning-globals* (new 'global 'lightning-globals))
(define *lightning* #t)
(defun lightning-draw-all ()
(when *lightning*
(when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask etie-scissor))
(let ((s5-0 *lightning-engine*))
(when (> (length s5-0) 0)
(with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))
(the-as
bucket-id
(-> (new 'static 'vector4w :x #x30a :y #x30b) data (-> *viewport-array* current-viewport-index))
)
)
(let ((s3-0 *lightning-globals*))
(let ((v1-14 s3-0))
(set! (-> v1-14 gcf-buf) (the-as uint 837))
(set! (-> v1-14 vtx-buf) (the-as uint 9))
)
(let* ((v1-16 (-> s5-0 alive-list next0))
(s2-0 (-> v1-16 next0))
)
(while (!= v1-16 (-> s5-0 alive-list-end))
(let* ((s1-0 (-> (the-as connection v1-16) param1))
(s0-0 (-> (the-as dma-buffer s1-0) data-buffer 0))
)
(when (not (paused?))
(case s0-0
((1 2)
(lightning-update (the-as lightning-control s1-0))
)
((3)
(lightning-fade (the-as lightning-control s1-0))
)
)
)
(if (or (= s0-0 2) (= s0-0 3))
(lightning-draw s4-0 (the-as lightning-control s1-0) s3-0)
)
)
(set! v1-16 s2-0)
(set! s2-0 (-> s2-0 next0))
)
)
)
)
)
)
)
)
0
(none)
)
(defun unlink-lightning-spec-by-heap ((arg0 kheap))
(let* ((v1-0 *lightning-spec-id-table*)
(a2-0 (-> v1-0 length))
(a1-0 (-> arg0 base))
(a0-1 (-> arg0 top-base))
)
(while (nonzero? a2-0)
(+! a2-0 -1)
(let ((a3-2 (-> v1-0 a2-0)))
(when (and (>= (the-as int a3-2) (the-as int a1-0)) (< (the-as int a3-2) (the-as int a0-1)))
(set! (-> v1-0 a2-0) (the-as lightning-spec 0))
0
)
)
)
)
0
(none)
)
Loaded 100 of 465 files, more files were not shown because too many files have changed in this diff. Show more