Skip to content

Commit

Permalink
d/jak2: finish sidekick, target-carry and battle. Close to fini…
Browse files Browse the repository at this point in the history
…shing `target-death` and `warp-gate` (#1990)
  • Loading branch information
xTVaser committed Oct 29, 2022
1 parent 92105bb commit 5007653
Show file tree
Hide file tree
Showing 40 changed files with 6,666 additions and 452 deletions.
2 changes: 1 addition & 1 deletion Taskfile.yml
Expand Up @@ -146,4 +146,4 @@ tasks:
- task: offline-test-file
type-test:
cmds:
- cmd: '{{.GOALCTEST_BIN_RELEASE_DIR}}/goalc-test --gtest_brief=0 --gtest_break_on_failure --gtest_filter="*Jak2TypeConsistency*"'
- cmd: '{{.GOALCTEST_BIN_RELEASE_DIR}}/goalc-test --gtest_brief=0 --gtest_filter="*Jak2TypeConsistency*" --gtest_break_on_failure'
334 changes: 169 additions & 165 deletions decompiler/config/jak2/all-types.gc

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion decompiler/config/jak2/anonymous_function_types.jsonc
Expand Up @@ -433,5 +433,23 @@
[92, "(function object nav-control none)"],
[93, "(function object nav-control none)"]
],
"scene-actor": [[10, "(function process-taskable process)"]]
"scene-actor": [[10, "(function process-taskable process)"]],
"scene": [[4, "(function symbol :behavior scene-player)"]],
"sidekick": [
[5, "(function object vector object string :behavior sidekick)"]
],
"target-death": [
[1, "(function symbol :behavior target)"],
[2, "(function symbol :behavior target)"],
[3, "(function none :behavior target)"],
[8, "(function none)"],
[12, "(function process entity-perm-status)"],
[23, "(function surface object object int float :behavior target)"],
[24, "(function surface object object int float :behavior target)"],
[26, "(function continue-point target)"]
],
"warp-gate": [
[8, "(function string none)"],
[12, "(function none :behavior target)"]
]
}
12 changes: 6 additions & 6 deletions decompiler/config/jak2/hacks.jsonc
Expand Up @@ -219,7 +219,10 @@
"(post play-anim scene-player)",
"(method 25 scene-player)",
"(method 25 scene-player)",
"scene-player-init"
"scene-player-init",
"next-continue",
"(method 25 warp-gate)",
"(code use warp-gate)"
],

// If format is used with the wrong number of arguments,
Expand Down Expand Up @@ -280,7 +283,6 @@

"(method 12 perf-stat)": [0],
"(method 11 perf-stat)": [0],
"(method 22 gui-control)": [117, 121, 127, 128, 129, 139],
"bsp-camera-asm": [1, 2, 3, 4, 6, 7],
"(method 9 texture-page-dir)": [5, 6],
"level-remap-texture": [2, 3, 4, 5, 6],
Expand Down Expand Up @@ -343,7 +345,6 @@
"(method 11 sparticle-launch-control)": [
18, 24, 25, 28, 29, 32, 33, 34, 36, 41, 55, 58, 93, 95
],

"(method 22 gui-control)": [
10, // goto L63 (B39)
16, // goto L58 (B27)
Expand All @@ -361,10 +362,9 @@
117, // goto L91
120
],

"(anon-function 11 game-save)": [0, 3, 4, 5],

"update-actor-hash": [0, 2, 4]
"update-actor-hash": [0, 2, 4],
"(code target-death)": [111, 140]
},

// Sometimes the game might use format strings that are fetched dynamically,
Expand Down
19 changes: 19 additions & 0 deletions decompiler/config/jak2/label_types.jsonc
Expand Up @@ -466,5 +466,24 @@
["L132", "vector"],
["L131", "vector"],
["L130", "vector"]
],
"sidekick": [["L71", "vector"]],
"target-death": [
["L441", "uint64", true],
["L445", "uint64", true],
["L447", "uint64", true],
["L446", "uint64", true],
["L440", "uint64", true],
["L449", "uint64", true],
["L459", "uint64", true],
["L436", "vector"]
],
"warp-gate": [
["L815", "vector"],
["L1249", "uint64", true],
["L1250", "uint64", true],
["L1158", "vector"],
["L1222", "uint64", true],
["L1223", "uint64", true]
]
}
7 changes: 6 additions & 1 deletion decompiler/config/jak2/stack_structures.jsonc
Expand Up @@ -1097,5 +1097,10 @@
"(method 150 nav-enemy)": [[16, "vector"]],
"(anon-function 88 nav-enemy)": [[16, "vector"]],
"(anon-function 93 nav-enemy)": [[16, "vector"]],
"(method 54 rigid-body-platform)": [[16, "vector"]]
"(method 54 rigid-body-platform)": [[16, "vector"]],
"target-carry-update": [[560, ["inline-array", "sphere", 1]]],
"(code target-carry-drop)": [[672, ["inline-array", "sphere", 1]]],
"(code target-carry-throw)": [[640, ["inline-array", "sphere", 1]]],
"(code target-hit)": [[16, "vector"]],
"(method 39 battle)": [[64, "transformq"]]
}
67 changes: 64 additions & 3 deletions decompiler/config/jak2/type_casts.jsonc
Expand Up @@ -3485,7 +3485,7 @@
[30, "v1", "collide-shape-moving"]
],
"(post fall crate)": [
[4, "a0", "collide-shape-moving"],
[[4, 10], "a0", "collide-shape-moving"],
[15, "v1", "collide-shape-moving"],
[26, "v1", "collide-shape-moving"],
[[34, 53], "gp", "collide-shape-moving"]
Expand All @@ -3500,7 +3500,7 @@
[37, "a0", "collide-shape-moving"]
],
"(enter fall crate)": [
[35, "v0", "carry-info"],
[[35, 40], "a0", "carry-info"],
[42, "v1", "collide-shape-moving"],
[46, "v1", "collide-shape-moving"],
[50, "a0", "collide-shape-moving"],
Expand Down Expand Up @@ -3987,5 +3987,66 @@
"(method 25 remote)": [[[8, 12], "a0", "collide-shape"]],
"(method 25 judge)": [[[8, 12], "a0", "collide-shape"]],
"(event wait judge)": [[63, "gp", "process-focusable"]],
"(code idle judge)": [[39, "v0", "float"]]
"(code idle judge)": [[39, "v0", "float"]],
"(post sidekick-clone)": [[[474, 513], "gp", "(pointer process-drawable)"]],
"(code target-carry-pickup)": [
[79, "v0", "carry-info"],
[290, "v0", "carry-info"]
],
"(code target-carry-drop)": [
[24, "v0", "carry-info"],
[92, "v1", "art-joint-anim"],
[158, "v0", "carry-info"],
[273, "v0", "carry-info"]
],
"(code target-carry-throw)": [
[51, "v0", "carry-info"],
[112, "v0", "carry-info"],
[194, "v0", "carry-info"]
],
"next-continue": [
[4, "a2", "symbol"],
[5, "a2", "level-load-info"],
[12, "a3", "continue-point"]
],
"(code target-continue)": [[643, "s5", "handle"]],
"(code target-warp-in)": [[336, "v1", "art-joint-anim"]],
"target-hit-effect": [[39, "t4", "vector"]],
"target-hit-setup-anim": [
[153, "v1", "art-joint-anim"],
[225, "v1", "art-joint-anim"]
],
"(code target-hit)": [[576, "v1", "art-joint-anim"]],
"(anon-function 12 target-death)": [[[12, 19], "gp", "process-drawable"]],
"target-death-reset": [[21, "v1", "connection"]],
"(anon-function 3 target-death)": [[259, "v1", "art-joint-anim"]],
"(anon-function 2 target-death)": [
[58, "v1", "art-joint-anim"],
[197, "v1", "art-joint-anim"],
[141, "v1", "art-joint-anim"]
],
"(anon-function 1 target-death)": [[73, "v1", "art-joint-anim"]],
"(event target-continue)": [[18, "a0", "process"]],
"(method 30 battle)": [
[7, "s5", "nav-enemy"],
[32, "a2", "nav-enemy"]
],
"(method 7 battle)": [
[15, "t9", "(function process-drawable int process-drawable)"]
],
"(method 51 battle)": [[[38, 95], "s4", "touch-tracker"]],
"(method 26 battle)": [
[35, "a0", "connection"],
[36, "a0", "collide-shape"],
[84, "a0", "connection"],
[85, "a0", "collide-shape"]
],
"(method 28 battle)": [
["_stack_", 16, "res-tag"],
[[21, 31], "s5", "(pointer entity-actor)"]
],
"(method 29 battle)": [
["_stack_", 16, "res-tag"],
["_stack_", 32, "res-tag"]
]
}
2 changes: 1 addition & 1 deletion decompiler/config/jak2_ntsc_v1.jsonc
Expand Up @@ -7,7 +7,7 @@

// if you want to filter to only some object names.
// it will make the decompiler much faster.
"allowed_objects": ["nav-enemy"],
"allowed_objects": [],
"banned_objects": ["effect-control", "ctywide-scenes", "texture-anim-tables", "traffic-engine"],

////////////////////////////
Expand Down
6 changes: 4 additions & 2 deletions goal_src/jak2/engine/ai/enemy-h.gc
Expand Up @@ -7,6 +7,10 @@

(define-extern get-penetrate-using-from-attack-event (function process-drawable event-message-block penetrate))

;; NOTE - for battle
(declare-type enemy process-focusable)
(define-extern enemy-init-by-other (function process-drawable transformq none :behavior enemy))

;; +++enemy-flag
(defenum enemy-flag
:type int64
Expand Down Expand Up @@ -83,8 +87,6 @@
)
;; ---knocked-type

(declare-type enemy process-focusable)

;; DECOMP BEGINS

(deftype enemy-focus (focus)
Expand Down
7 changes: 2 additions & 5 deletions goal_src/jak2/engine/camera/cam-interface.gc
Expand Up @@ -32,7 +32,7 @@
)
)

(defun matrix-world->local ()
(defun matrix-world->local ((arg0 symbol) (arg1 object))
"Returns [[*math-camera*]]'s `camera-rot`"
(-> *math-camera* camera-rot)
)
Expand Down Expand Up @@ -83,6 +83,7 @@
)
)

;; WARN: Return type mismatch object vs none.
(defbehavior camera-teleport-to-entity process ((arg0 entity-actor))
(let ((gp-0 (new 'stack 'transformq)))
(set! (-> gp-0 trans quad) (-> arg0 extra trans quad))
Expand All @@ -92,7 +93,3 @@
)
(none)
)




4 changes: 2 additions & 2 deletions goal_src/jak2/engine/collide/collide-target-h.gc
Expand Up @@ -63,6 +63,7 @@
(unknown-dword02 int64 :offset 4416)
(unknown-vector16 vector :inline :offset 4432)
(unknown-float14 float :offset 4448)
(unknown-floatiujh1bnb2n3i1 float :offset 4452)
(unknown-float15 float :offset 4456)
(unknown-word01 int32 :offset 4460)
(unknown-vector17 vector :inline :offset 4464)
Expand Down Expand Up @@ -118,8 +119,7 @@
(unknown-vector29 vector :inline :offset 5168)
(unknown-vector30 vector :inline :offset 5184)
(unknown-vector31 vector :inline :offset 5200)
(unknown-vector32 vector :inline :offset 5216)
(unknown-vector33 vector :inline :offset 5232)
(unknown-cspacei1un23i1 cspace :inline :offset 5216)
(unknown-symbol00 symbol :offset 5248)
(unknown-float000 float :offset 5252)
(unknown-float31 float :offset 5256)
Expand Down

0 comments on commit 5007653

Please sign in to comment.