add ja zero func (#2074)

fixes #2071
This commit is contained in:
ManDude
2023-01-02 18:23:33 +00:00
committed by GitHub
parent 77a3e4125c
commit 15a8a9c8ef
4 changed files with 25 additions and 10 deletions
+10 -1
View File
@@ -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<ConstantTokenElement>("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<ConstantTokenElement>("min");
+1 -1
View File
@@ -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
@@ -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)))
+7 -4
View File
@@ -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)))