Skip to content

Commit

Permalink
jak3: port anim-tester-x (#3830)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hat-Kid authored Jan 5, 2025
1 parent fe648ac commit f883b07
Show file tree
Hide file tree
Showing 15 changed files with 641 additions and 127 deletions.
6 changes: 6 additions & 0 deletions common/formatter/rules/rule_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
{"defun-debug", new_flow_rule(3)},
{"defbehavior", new_flow_rule(4)},
{"if", new_inlineable_flow_rule(2)},
{"aif", new_inlineable_flow_rule(2)},
{"#if", new_inlineable_flow_rule(2)},
{"define", new_permissive_flow_rule()},
{"def-mips2c", new_permissive_flow_rule()},
Expand All @@ -305,10 +306,14 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
{"declare-type", new_permissive_flow_rule()},
{"defmacro", new_function_rule(3)},
{"desfun", new_function_rule(3)},
{"def-actor", new_flow_rule(2, true)},
{"defskelgroup", new_flow_rule(2, true)},
{"defpartgroup", new_flow_rule(2, true)},
{"defpart", new_flow_rule(2, true)},
{"defstate", new_defstate_rule(3, true)},
{"defevent", new_flow_rule(2)},
{"event", new_flow_rule(1)},
{"defpost", new_flow_rule(2)},
{"behavior", new_flow_rule(2)},
{"dotimes", new_flow_rule(2)},
{"dolist", new_flow_rule(2)},
Expand All @@ -319,6 +324,7 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
{"rlet", new_binding_rule(5)},
{"mlet", new_binding_rule(5)},
{"when", new_flow_rule(2)},
{"awhen", new_flow_rule(2)},
{"unless", new_flow_rule(2)},
{"with-profiler", new_flow_rule(2)},
{"with-pc", new_flow_rule(0)},
Expand Down
2 changes: 1 addition & 1 deletion game/overlord/jak3/iso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ void IsoQueueVagStream(ISO_VAGCommand* user_cmd) {
if (!internal_stereo_cmd) {
// allocating stereo failed, give up.
internal_cmd->flags.scanned = 0;
ASSERT_NOT_REACHED();
// ASSERT_NOT_REACHED();
ReleaseMessage(internal_cmd);
RemoveVagCmd(internal_cmd);
FreeVagCmd(internal_cmd);
Expand Down
2 changes: 1 addition & 1 deletion game/sound/989snd/sfxgrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ s32 Grain::snd_SFX_GRAIN_TYPE_STOP(BlockSoundHandler& handler) {
}

s32 Grain::snd_SFX_GRAIN_TYPE_RAND_PLAY(BlockSoundHandler& handler) {
auto cp = std::get<ControlParams>(data);
auto& cp = std::get<ControlParams>(data);
auto options = cp.param[0];
auto count = cp.param[1];
auto& previous = cp.param[2];
Expand Down
21 changes: 21 additions & 0 deletions goal_src/jak1/engine/data/art-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,27 @@
;; define skel group
(define ,name skel)))

(defmacro def-actor (name &key (idle #f) &key (lods #f) &key (art (idle-ja)) &key (joints ()) &key (shadow 0) &key bounds &key (longest-edge 0.0) &key (texture-level 0) &key (sort 0))
`(begin
(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-lod0-jg" name) 0)
(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-lod0-mg" name) 1)
,@(apply-i (lambda (x i)
`(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-{}" name x) ,(+ i 2)))
art)
,@(apply-i (lambda (x i) `(def-joint-node ,(string->symbol-format "{}-lod0-jg" name) ,(symbol->string x) ,(1+ i))) joints)
(defskelgroup ,(string->symbol-format "*{}-sg*" name)
,name
,(string->symbol-format "{}-lod0-jg" name)
,(if idle (string->symbol-format "{}-{}" name idle) (string->symbol-format "{}-{}" name (car art)))
,(if lods
`(,@(apply (lambda (x) `(,(string->symbol-format "{}-{}-mg" name (car x)) (meters ,(cadr x)))) lods))
`((,(string->symbol-format "{}-lod0-mg" name) (meters 999999))))
:shadow ,shadow
:bounds (static-spherem ,@bounds)
:longest-edge ,longest-edge
:texture-level ,texture-level
:sort ,sort)))

(import "goal_src/jak1/engine/data/art-elts.gc")

(import "goal_src/jak1/engine/data/joint-nodes.gc")
2 changes: 1 addition & 1 deletion goal_src/jak1/engine/load/loader.gc
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@
(set! sv-24 f28-0))
(logclear! (-> self skel status) (janim-status spool)))
(else
(format 0 "ERROR: <asg> ~A in spool anim loop for ~A ~D, but not loaded.~" self (-> arg0 name) spool-part)
(format 0 "ERROR: <asg> ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> arg0 name) spool-part)
(goto cfg-88))))
(set! spool-part (+ spool-part 1)))
(set! spool-part (+ spool-part -1))
Expand Down
17 changes: 4 additions & 13 deletions goal_src/jak1/levels/test-zone/test-zone-obs.gc
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,12 @@
(bob-offset int64)
(bob-amount float))
(:methods
(init-collision! (_type_) none))
(init-collision! (_type_) object))
(:state-methods
idle))

(def-art-elt test-actor-ag test-actor-lod0-jg 0)
(def-art-elt test-actor-ag test-actor-lod0-mg 1)
(def-art-elt test-actor-ag test-actor-idle-ja 2)
(defskelgroup *test-actor-sg*
test-actor
test-actor-lod0-jg
test-actor-idle-ja
((test-actor-lod0-mg (meters 9999999)))
:bounds (static-spherem 0 0 0 5)
:texture-level 2)
(def-actor test-actor
:bounds (0 0 0 5))

(defmethod init-collision! ((this test-actor))
(let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
Expand Down Expand Up @@ -54,8 +46,7 @@
)
(set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w)))
(backup-collide-with-as cshape)
(set! (-> this root) cshape))
(none))
(set! (-> this root) cshape)))

(defmethod init-from-entity! ((this test-actor) (e entity-actor))
(logior! (-> this mask) (process-mask enemy))
Expand Down
1 change: 1 addition & 0 deletions goal_src/jak3/dgos/game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
"visvol-edit.o"
"collision-editor.o"
"speech-manager.o"
"anim-tester-x.o" ;; added
"vag-player.o" ;; added
"default-menu-pc.o" ;; added
"dir-tpages.go"
Expand Down
16 changes: 16 additions & 0 deletions goal_src/jak3/engine/anim/joint.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,22 @@
this
)

(defmethod inspect ((this art-group))
"Print all elements in an art-group."
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~Tinfo: ~A~%" (-> this info))
(format #t "~Tlength: ~D~%" (-> this length))
(format #t "~Tname: ~A~%" (-> this name))
(if (-> this extra)
(format #t "~Textra: ~I" (-> this extra))
(format #t "~Textra: ~A~%" (-> this extra)))
(format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data))
(dotimes (i (-> this length))
(if (-> this data i)
(format #t "~T [~D] ~A (~D bytes)~%" i (-> this data i) (mem-size (-> this data i) #f 0))
(format #t "~T [~D] ~A (~D bytes)~%" i (-> this data i) 0)))
this)

(defmethod art-method-10 ((this art-group))
(dotimes (s5-0 (-> this length))
(if (-> this data s5-0)
Expand Down
2 changes: 2 additions & 0 deletions goal_src/jak3/engine/debug/memory-usage-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
;; name in dgo: memory-usage-h
;; dgos: GAME

(define-extern mem-size (function basic symbol int int))

;; DECOMP BEGINS

;; this file is debug only
Expand Down
12 changes: 10 additions & 2 deletions goal_src/jak3/engine/ps2/vu1-macros.gc
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,16 @@ directly implemented by the OpenGOAL compiler
)
)



(defmacro format-vf (&key (iter 0) &key (buf 0) &key (v (new-stack-vector0)) &rest regs)
(with-gensyms (vec)
`(let ((,vec ,v))
,@(apply (lambda (reg)
`(begin
(.svf (&-> ,vec quad) ,reg)
(format ,buf "[~D] ~A: ~f ~f ~f ~f~%" ,iter (quote ,reg) (-> ,vec x) (-> ,vec y) (-> ,vec z) (-> ,vec w))))
regs)
(1+! ,iter)
,vec)))

;; DECOMP BEGINS

Loading

0 comments on commit f883b07

Please sign in to comment.