Skip to content

Commit f883b07

Browse files
authored
jak3: port anim-tester-x (#3830)
1 parent fe648ac commit f883b07

File tree

15 files changed

+641
-127
lines changed

15 files changed

+641
-127
lines changed

common/formatter/rules/rule_config.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
295295
{"defun-debug", new_flow_rule(3)},
296296
{"defbehavior", new_flow_rule(4)},
297297
{"if", new_inlineable_flow_rule(2)},
298+
{"aif", new_inlineable_flow_rule(2)},
298299
{"#if", new_inlineable_flow_rule(2)},
299300
{"define", new_permissive_flow_rule()},
300301
{"def-mips2c", new_permissive_flow_rule()},
@@ -305,10 +306,14 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
305306
{"declare-type", new_permissive_flow_rule()},
306307
{"defmacro", new_function_rule(3)},
307308
{"desfun", new_function_rule(3)},
309+
{"def-actor", new_flow_rule(2, true)},
308310
{"defskelgroup", new_flow_rule(2, true)},
309311
{"defpartgroup", new_flow_rule(2, true)},
310312
{"defpart", new_flow_rule(2, true)},
311313
{"defstate", new_defstate_rule(3, true)},
314+
{"defevent", new_flow_rule(2)},
315+
{"event", new_flow_rule(1)},
316+
{"defpost", new_flow_rule(2)},
312317
{"behavior", new_flow_rule(2)},
313318
{"dotimes", new_flow_rule(2)},
314319
{"dolist", new_flow_rule(2)},
@@ -319,6 +324,7 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
319324
{"rlet", new_binding_rule(5)},
320325
{"mlet", new_binding_rule(5)},
321326
{"when", new_flow_rule(2)},
327+
{"awhen", new_flow_rule(2)},
322328
{"unless", new_flow_rule(2)},
323329
{"with-profiler", new_flow_rule(2)},
324330
{"with-pc", new_flow_rule(0)},

game/overlord/jak3/iso.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ void IsoQueueVagStream(ISO_VAGCommand* user_cmd) {
511511
if (!internal_stereo_cmd) {
512512
// allocating stereo failed, give up.
513513
internal_cmd->flags.scanned = 0;
514-
ASSERT_NOT_REACHED();
514+
// ASSERT_NOT_REACHED();
515515
ReleaseMessage(internal_cmd);
516516
RemoveVagCmd(internal_cmd);
517517
FreeVagCmd(internal_cmd);

game/sound/989snd/sfxgrain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ s32 Grain::snd_SFX_GRAIN_TYPE_STOP(BlockSoundHandler& handler) {
255255
}
256256

257257
s32 Grain::snd_SFX_GRAIN_TYPE_RAND_PLAY(BlockSoundHandler& handler) {
258-
auto cp = std::get<ControlParams>(data);
258+
auto& cp = std::get<ControlParams>(data);
259259
auto options = cp.param[0];
260260
auto count = cp.param[1];
261261
auto& previous = cp.param[2];

goal_src/jak1/engine/data/art-h.gc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,27 @@
311311
;; define skel group
312312
(define ,name skel)))
313313

314+
(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))
315+
`(begin
316+
(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-lod0-jg" name) 0)
317+
(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-lod0-mg" name) 1)
318+
,@(apply-i (lambda (x i)
319+
`(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-{}" name x) ,(+ i 2)))
320+
art)
321+
,@(apply-i (lambda (x i) `(def-joint-node ,(string->symbol-format "{}-lod0-jg" name) ,(symbol->string x) ,(1+ i))) joints)
322+
(defskelgroup ,(string->symbol-format "*{}-sg*" name)
323+
,name
324+
,(string->symbol-format "{}-lod0-jg" name)
325+
,(if idle (string->symbol-format "{}-{}" name idle) (string->symbol-format "{}-{}" name (car art)))
326+
,(if lods
327+
`(,@(apply (lambda (x) `(,(string->symbol-format "{}-{}-mg" name (car x)) (meters ,(cadr x)))) lods))
328+
`((,(string->symbol-format "{}-lod0-mg" name) (meters 999999))))
329+
:shadow ,shadow
330+
:bounds (static-spherem ,@bounds)
331+
:longest-edge ,longest-edge
332+
:texture-level ,texture-level
333+
:sort ,sort)))
334+
314335
(import "goal_src/jak1/engine/data/art-elts.gc")
315336

316337
(import "goal_src/jak1/engine/data/joint-nodes.gc")

goal_src/jak1/engine/load/loader.gc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@
724724
(set! sv-24 f28-0))
725725
(logclear! (-> self skel status) (janim-status spool)))
726726
(else
727-
(format 0 "ERROR: <asg> ~A in spool anim loop for ~A ~D, but not loaded.~" self (-> arg0 name) spool-part)
727+
(format 0 "ERROR: <asg> ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> arg0 name) spool-part)
728728
(goto cfg-88))))
729729
(set! spool-part (+ spool-part 1)))
730730
(set! spool-part (+ spool-part -1))

goal_src/jak1/levels/test-zone/test-zone-obs.gc

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,12 @@
88
(bob-offset int64)
99
(bob-amount float))
1010
(:methods
11-
(init-collision! (_type_) none))
11+
(init-collision! (_type_) object))
1212
(:state-methods
1313
idle))
1414

15-
(def-art-elt test-actor-ag test-actor-lod0-jg 0)
16-
(def-art-elt test-actor-ag test-actor-lod0-mg 1)
17-
(def-art-elt test-actor-ag test-actor-idle-ja 2)
18-
(defskelgroup *test-actor-sg*
19-
test-actor
20-
test-actor-lod0-jg
21-
test-actor-idle-ja
22-
((test-actor-lod0-mg (meters 9999999)))
23-
:bounds (static-spherem 0 0 0 5)
24-
:texture-level 2)
15+
(def-actor test-actor
16+
:bounds (0 0 0 5))
2517

2618
(defmethod init-collision! ((this test-actor))
2719
(let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
@@ -54,8 +46,7 @@
5446
)
5547
(set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w)))
5648
(backup-collide-with-as cshape)
57-
(set! (-> this root) cshape))
58-
(none))
49+
(set! (-> this root) cshape)))
5950

6051
(defmethod init-from-entity! ((this test-actor) (e entity-actor))
6152
(logior! (-> this mask) (process-mask enemy))

goal_src/jak3/dgos/game.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@
418418
"visvol-edit.o"
419419
"collision-editor.o"
420420
"speech-manager.o"
421+
"anim-tester-x.o" ;; added
421422
"vag-player.o" ;; added
422423
"default-menu-pc.o" ;; added
423424
"dir-tpages.go"

goal_src/jak3/engine/anim/joint.gc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,22 @@
11401140
this
11411141
)
11421142

1143+
(defmethod inspect ((this art-group))
1144+
"Print all elements in an art-group."
1145+
(format #t "[~8x] ~A~%" this (-> this type))
1146+
(format #t "~Tinfo: ~A~%" (-> this info))
1147+
(format #t "~Tlength: ~D~%" (-> this length))
1148+
(format #t "~Tname: ~A~%" (-> this name))
1149+
(if (-> this extra)
1150+
(format #t "~Textra: ~I" (-> this extra))
1151+
(format #t "~Textra: ~A~%" (-> this extra)))
1152+
(format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data))
1153+
(dotimes (i (-> this length))
1154+
(if (-> this data i)
1155+
(format #t "~T [~D] ~A (~D bytes)~%" i (-> this data i) (mem-size (-> this data i) #f 0))
1156+
(format #t "~T [~D] ~A (~D bytes)~%" i (-> this data i) 0)))
1157+
this)
1158+
11431159
(defmethod art-method-10 ((this art-group))
11441160
(dotimes (s5-0 (-> this length))
11451161
(if (-> this data s5-0)

goal_src/jak3/engine/debug/memory-usage-h.gc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
;; name in dgo: memory-usage-h
66
;; dgos: GAME
77

8+
(define-extern mem-size (function basic symbol int int))
9+
810
;; DECOMP BEGINS
911

1012
;; this file is debug only

goal_src/jak3/engine/ps2/vu1-macros.gc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,16 @@ directly implemented by the OpenGOAL compiler
246246
)
247247
)
248248

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

252260
;; DECOMP BEGINS
253261

0 commit comments

Comments
 (0)