diff --git a/decompiler/analysis/insert_lets.cpp b/decompiler/analysis/insert_lets.cpp index 6b73e80f32..d25442cffb 100644 --- a/decompiler/analysis/insert_lets.cpp +++ b/decompiler/analysis/insert_lets.cpp @@ -1276,7 +1276,16 @@ FormElement* rewrite_joint_macro(LetElement* in, const Env& env, FormPool& pool) Form* num_form = nullptr; // check the num! arg if (prelim_num == "identity") { - if (set_fn2) { + if (env.version == GameVersion::Jak2 && set_fn && !set_fn2) { + // jak 2-specific made-up thing! + // this has only appeared once so far. + if (set_fn->to_form(env).is_float(0.0)) { + num_form = pool.form("zero"); + set_fn = nullptr; + } else { + return nullptr; + } + } else if (set_fn2) { auto obj_fn2 = set_fn2->to_form(env); if (obj_fn2.is_float(0.0)) { num_form = pool.form("min"); diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index 23693b5685..56cf014d70 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -33,7 +33,7 @@ "disassemble_data": false, // unpack textures to assets folder - "process_tpages": true, + "process_tpages": false, // unpack game text to assets folder "process_game_text": true, // unpack game count to assets folder diff --git a/goal_src/jak2/engine/process-drawable/process-drawable-h.gc b/goal_src/jak2/engine/process-drawable/process-drawable-h.gc index 484a35c909..0f4b4fc6f3 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable-h.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable-h.gc @@ -273,6 +273,7 @@ - (chan channel) = copy frame from another channel. - min = the start of the animation. - max = the end of the animation. + - zero = frame zero. " (let* ((num-args (if (pair? num!) (cdr num!) '())) @@ -281,7 +282,7 @@ ((or (eq? num! 'identity) (eq? num! 'min) (eq? num! 'max) - ) + (eq? num! 'zero)) 'num-func-identity) ((eq? num! 'none) 'num-func-none) ((eq? num! '+!) 'num-func-+!) @@ -313,11 +314,13 @@ (cond ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) ))) - (frame-num (if (eq? 'max frame-num) (if group! + (frame-num (cond + ((eq? 'max frame-num) (if group! `(the float (1- (-> (the art-joint-anim ,group!) frames num-frames))) `(the float (1- (-> ja-ch frame-group frames num-frames))) - ) - frame-num)) + )) + ((eq? 'zero frame-num) 0) + (#t frame-num))) (frame-group (if (or p0 p1 frame-num (not nf)) group! #f)) ) `(let ((ja-ch (-> self skel root-channel ,chan))) diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index 4fc8bb1a9b..032aa1989a 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -825,6 +825,7 @@ - (chan channel) = copy frame from another channel. - min = the start of the animation. - max = the end of the animation. + - zero = frame zero. " (let* ((num-args (if (pair? num!) (cdr num!) '())) @@ -833,7 +834,7 @@ ((or (eq? num! 'identity) (eq? num! 'min) (eq? num! 'max) - ) + (eq? num! 'zero)) 'num-func-identity) ((eq? num! 'none) 'num-func-none) ((eq? num! '+!) 'num-func-+!) @@ -865,11 +866,13 @@ (cond ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) ))) - (frame-num (if (eq? 'max frame-num) (if group! + (frame-num (cond + ((eq? 'max frame-num) (if group! `(the float (1- (-> (the art-joint-anim ,group!) frames num-frames))) `(the float (1- (-> ja-ch frame-group frames num-frames))) - ) - frame-num)) + )) + ((eq? 'zero frame-num) 0) + (#t frame-num))) (frame-group (if (or p0 p1 frame-num (not nf)) group! #f)) ) `(let ((ja-ch (-> self skel root-channel ,chan)))