diff --git a/common/serialization/subtitles/subtitles.cpp b/common/serialization/subtitles/subtitles.cpp index 075a6d496a..776e4cf20c 100644 --- a/common/serialization/subtitles/subtitles.cpp +++ b/common/serialization/subtitles/subtitles.cpp @@ -6,7 +6,9 @@ #include "common/util/json_util.h" static const std::unordered_map s_text_ver_enum_map = { - {"jak1-v1", GameTextVersion::JAK1_V1}}; + {"jak1-v1", GameTextVersion::JAK1_V1}, + {"jak1-v2", GameTextVersion::JAK1_V1} +}; // TODO - why not just return the inputs instead of passing in an empty one? void open_text_project(const std::string& kind, @@ -27,6 +29,10 @@ void open_text_project(const std::string& kind, auto& ver = o.as_pair()->car.as_symbol()->name; auto& in = o.as_pair()->cdr.as_pair()->car.as_string()->data; + if (s_text_ver_enum_map.count(ver) == 0) { + throw std::runtime_error(fmt::format("unknown text version {}", ver)); + } + inputs[s_text_ver_enum_map.at(ver)].push_back(in); }); } diff --git a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc index 286c51ef15..50f4d8ab12 100644 --- a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc @@ -875,7 +875,7 @@ ], "target2": [ - [11, "(function vector time-frame float symbol :behavior target)"], + [11, "(function vector time-frame float symbol :behavior process)"], [99, "(function symbol)"] ], diff --git a/decompiler/config/jak1_pal.jsonc b/decompiler/config/jak1_pal.jsonc index 0379e3cbf0..648befe55a 100644 --- a/decompiler/config/jak1_pal.jsonc +++ b/decompiler/config/jak1_pal.jsonc @@ -6,7 +6,7 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. - "allowed_objects": ["target", "eichar-ag"], + "allowed_objects": ["target2", "eichar-ag"], "banned_objects": [], //////////////////////////// diff --git a/decompiler/config/jak1_pal/label_types.jsonc b/decompiler/config/jak1_pal/label_types.jsonc index 9464982810..d137bac80c 100644 --- a/decompiler/config/jak1_pal/label_types.jsonc +++ b/decompiler/config/jak1_pal/label_types.jsonc @@ -1580,102 +1580,6 @@ ["L355", "float", true] ], - "target2": [ - ["L615", "attack-info"], - ["L656", "float", true], - ["L657", "float", true], - ["L658", "float", true], - ["L659", "float", true], - ["L660", "float", true], - ["L661", "float", true], - ["L662", "float", true], - ["L663", "float", true], - ["L664", "float", true], - ["L665", "float", true], - ["L666", "float", true], - ["L667", "float", true], - ["L668", "float", true], - ["L669", "float", true], - ["L670", "float", true], - ["L671", "float", true], - ["L672", "float", true], - ["L673", "float", true], - ["L674", "float", true], - ["L675", "float", true], - ["L676", "float", true], - ["L677", "float", true], - ["L678", "float", true], - ["L679", "float", true], - ["L680", "float", true], - ["L681", "float", true], - ["L682", "float", true], - ["L683", "float", true], - ["L684", "float", true], - ["L685", "float", true], - ["L686", "float", true], - ["L687", "float", true], - ["L688", "float", true], - ["L689", "float", true], - ["L690", "float", true], - ["L691", "float", true], - ["L692", "float", true], - ["L693", "float", true], - ["L694", "float", true], - ["L695", "float", true], - ["L696", "float", true], - ["L697", "float", true], - ["L698", "float", true], - ["L699", "float", true], - ["L700", "float", true], - ["L701", "float", true], - ["L702", "float", true], - ["L703", "float", true], - ["L704", "float", true], - ["L705", "float", true], - ["L706", "float", true], - ["L707", "float", true], - ["L708", "float", true], - ["L709", "float", true], - ["L710", "float", true], - ["L711", "float", true], - ["L712", "float", true], - ["L713", "float", true], - ["L714", "float", true], - ["L715", "float", true], - ["L716", "float", true], - ["L717", "float", true], - ["L718", "float", true], - ["L719", "float", true], - ["L720", "float", true], - ["L721", "float", true], - ["L722", "float", true], - ["L723", "float", true], - ["L724", "float", true], - ["L725", "float", true], - ["L726", "float", true], - ["L727", "float", true], - ["L728", "float", true], - ["L729", "float", true], - ["L730", "float", true], - ["L731", "float", true], - ["L732", "float", true], - ["L733", "float", true], - ["L734", "float", true], - ["L735", "float", true], - ["L736", "float", true], - ["L737", "float", true], - ["L738", "float", true], - ["L739", "float", true], - ["L740", "float", true], - ["L741", "float", true], - ["L742", "float", true], - ["L743", "float", true], - ["L744", "float", true], - ["L745", "uint64", true], - ["L746", "uint64", true], - ["L757", "uint64", true] - ], - "collide-shape": [ ["L399", "attack-info"], ["L408", "vector"], @@ -2145,6 +2049,104 @@ ["L824", "uint64", true] ], + "target2": [ + ["L615", "attack-info"], + ["L656", "float", true], + ["L657", "float", true], + ["L658", "float", true], + ["L659", "float", true], + ["L660", "float", true], + ["L661", "float", true], + ["L662", "float", true], + ["L663", "float", true], + ["L664", "float", true], + ["L665", "float", true], + ["L666", "float", true], + ["L667", "float", true], + ["L668", "float", true], + ["L669", "float", true], + ["L670", "float", true], + ["L671", "float", true], + ["L672", "float", true], + ["L673", "float", true], + ["L674", "float", true], + ["L675", "float", true], + ["L676", "float", true], + ["L677", "float", true], + ["L678", "float", true], + ["L679", "float", true], + ["L680", "float", true], + ["L681", "float", true], + ["L682", "float", true], + ["L683", "float", true], + ["L684", "float", true], + ["L685", "float", true], + ["L686", "float", true], + ["L687", "float", true], + ["L688", "float", true], + ["L689", "float", true], + ["L690", "float", true], + ["L691", "float", true], + ["L692", "float", true], + ["L693", "float", true], + ["L694", "float", true], + ["L695", "float", true], + ["L696", "float", true], + ["L697", "float", true], + ["L698", "float", true], + ["L699", "float", true], + ["L700", "float", true], + ["L701", "float", true], + ["L702", "float", true], + ["L703", "float", true], + ["L704", "float", true], + ["L705", "float", true], + ["L706", "float", true], + ["L707", "float", true], + ["L708", "float", true], + ["L709", "float", true], + ["L710", "float", true], + ["L711", "float", true], + ["L712", "float", true], + ["L713", "float", true], + ["L714", "float", true], + ["L715", "float", true], + ["L716", "float", true], + ["L717", "float", true], + ["L718", "float", true], + ["L719", "float", true], + ["L720", "float", true], + ["L721", "float", true], + ["L722", "float", true], + ["L723", "float", true], + ["L724", "float", true], + ["L725", "float", true], + ["L726", "float", true], + ["L727", "float", true], + ["L728", "float", true], + ["L729", "float", true], + ["L730", "float", true], + ["L731", "float", true], + ["L732", "float", true], + ["L733", "float", true], + ["L734", "float", true], + ["L735", "float", true], + ["L736", "float", true], + ["L737", "float", true], + ["L738", "float", true], + ["L739", "float", true], + ["L740", "float", true], + ["L741", "float", true], + ["L742", "float", true], + ["L743", "float", true], + ["L744", "float", true], + ["L745", "float", true], + ["L746", "float", true], + ["L747", "float", true], + ["L748", "uint64", true], + ["L759", "uint64", true] + ], + // please do not add things after this entry! git is dumb. "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] } diff --git a/decompiler/config/jak1_pal/type_casts.jsonc b/decompiler/config/jak1_pal/type_casts.jsonc index d6ea7709bf..f44da71697 100644 --- a/decompiler/config/jak1_pal/type_casts.jsonc +++ b/decompiler/config/jak1_pal/type_casts.jsonc @@ -5692,22 +5692,6 @@ "(code target-swim-down)": [[52, "v1", "art-joint-anim"]], - "(anon-function 11 target2)": [ - [19, "s4", "target"], // confusing -- the parent of a target is a target? - [21, "s4", "target"], - [29, "s4", "target"], - [34, "s4", "target"], - [40, "s4", "target"], - [54, "s4", "target"], - [66, "s4", "target"], - [76, "s4", "target"], - [82, "s4", "target"], - [87, "s4", "target"], - [89, "s4", "target"], - [118, "s4", "target"], - [129, "s4", "target"] - ], - "(code target-play-anim)": [[8, "v0", "art-joint-anim"]], "(code target-look-around)": [[20, "v0", "float"]], @@ -7719,5 +7703,9 @@ "(code target-duck-high-jump)": [[77, "v0", "sound-rpc-set-param"]], "(trans target-duck-high-jump-jump)": [[9, "v0", "sound-rpc-set-param"]], + "(anon-function 11 target2)": [ + [[15, 135], "s4", "target"] // confusing -- the parent of a target is a target? + ], + "placeholder-do-not-add-below": [] } diff --git a/goal_src/engine/target/target2.gc b/goal_src/engine/target/target2.gc index 56c5efc115..6e598a2035 100644 --- a/goal_src/engine/target/target2.gc +++ b/goal_src/engine/target/target2.gc @@ -2611,7 +2611,7 @@ (if (nonzero? arg3) (process-spawn-function process - (lambda :behavior target + (lambda :behavior process ((arg0 vector) (arg1 time-frame) (arg2 float)) (local-vars (sv-32 time-frame) (sv-40 vector) (sv-44 symbol)) (set! sv-32 (-> *display* base-frame-counter)) @@ -2627,13 +2627,12 @@ (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control unknown-vector52 y)) arg2) ) (vector-xz-normalize! (-> (the-as target s4-0) control transv) (the-as float 0.0)) - (case (-> (the-as target s4-0) current-level name) - (('jungleb) - (let ((v1-16 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40))) - (set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -4096.0 (fmin 4096.0 (-> v1-16 x))))) - (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -4096.0 (fmin 4096.0 (-> v1-16 z))))) - ) - ) + ;; PAL patch here + (when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0) + (let ((v1-16 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40))) + (set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -2867.2 (fmin 2867.2 (-> v1-16 x))))) + (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-16 z))))) + ) ) ) (else @@ -2677,7 +2676,8 @@ :to self ) ) - (sound-play "launch-fire") + ;; PAL patch (sound plays elsewhere) + ;(sound-play "launch-fire") (go target-high-jump arg0 arg0 'launch) (none) ) @@ -2704,8 +2704,8 @@ :exit (behavior () (target-exit) (set! (-> self cam-user-mode) 'normal) - (logior! (-> self state-flags) (state-flags grabbed)) - (logclear! (-> self state-flags) (state-flags invulnerable)) + ;; PAL patch here + (logclear! (-> self state-flags) (state-flags invulnerable grabbed)) (none) ) :code (behavior ((arg0 handle))