diff --git a/decompiler/config/jak2/ntsc_v1/type_casts.jsonc b/decompiler/config/jak2/ntsc_v1/type_casts.jsonc index 51a0423d7d..b8c12a0234 100644 --- a/decompiler/config/jak2/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak2/ntsc_v1/type_casts.jsonc @@ -3152,7 +3152,8 @@ [872, "f1", "float"], [22, "v1", "float"], ["_stack_", 56, "handle"], - ["_stack_", 16, "float"] + ["_stack_", 16, "float"], + [792, "t1", "sound-name"] ], "target-bomb1-fire-shot": [ [12, "v1", "handle"], diff --git a/decompiler/config/jak2/ntsc_v1/var_names.jsonc b/decompiler/config/jak2/ntsc_v1/var_names.jsonc index aa1afe6217..d23eacbc3a 100644 --- a/decompiler/config/jak2/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak2/ntsc_v1/var_names.jsonc @@ -4632,5 +4632,10 @@ "gp-0": ["name", "sound-name"], "v1-0": "sound-type" } + }, + "(code target-darkjak-running-attack)": { + "vars": { + "t1-3": ["imp-sound", "sound-name"] + } } } diff --git a/goal_src/goal-lib.gc b/goal_src/goal-lib.gc index 1a7263bb72..0b5ac7fb8a 100644 --- a/goal_src/goal-lib.gc +++ b/goal_src/goal-lib.gc @@ -543,11 +543,13 @@ ) ) -(defmacro eq-any? (val &rest pred) - "is val equal to any of the values in pred? evaluated using or, so it short circuits." - (with-gensyms (val-var) - `(let ((,val-var ,val)) - (or ,@(apply (lambda (x) `(= ,val-var ,x)) pred))) +(defmacro symbol-member? (sym lst) + "is sym present in lst? uses or, so it short circuits." + (with-gensyms (sym-var) + (fmt #t "{}" lst) + `(let ((,sym-var ,sym)) + ;; TODO fix this bug + (or ,@(apply (lambda (x) `(= ,sym-var (quote ,x))) (second lst)))) ) ) diff --git a/goal_src/jak2/engine/target/target-darkjak.gc b/goal_src/jak2/engine/target/target-darkjak.gc index 881e038b3c..2c4de6d545 100644 --- a/goal_src/jak2/engine/target/target-darkjak.gc +++ b/goal_src/jak2/engine/target/target-darkjak.gc @@ -902,14 +902,14 @@ (-> s5-2 ppointer) ) ) - (let ((t1-3 (make-u128 (the-as uint #x7469682d6863) (the-as uint #x6e75702d6b616a64)))) + (let ((imp-sound (static-sound-name "djak-punch-hit"))) (play-effect-sound (-> self skel effect) 'punch -1.0 (-> self control impact-ctrl joint) (the-as basic #f) - (the-as sound-name t1-3) + imp-sound ) ) (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) @@ -1585,9 +1585,7 @@ (set! sv-32 (-> self focus-search)) (set! sv-40 0) (set! sv-48 0) - (set! sv-56 - (the-as sphere (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main))) - ) + (set! sv-56 (the-as sphere (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main)))) (set! sv-60 (new 'static 'array handle 128 (new 'static 'handle) diff --git a/goal_src/jak2/engine/ui/text-id-h.gc b/goal_src/jak2/engine/ui/text-id-h.gc index 754ac5146b..e009a797c4 100644 --- a/goal_src/jak2/engine/ui/text-id-h.gc +++ b/goal_src/jak2/engine/ui/text-id-h.gc @@ -654,7 +654,6 @@ (progress-music-player-palcab-battle #x1235) (progress-music-player-race #x1236) (progress-music-player-ruins #x1237) - ;; TODO - these strings are not used (progress-window-size #x1238) (progress-window-size-decoration #x1239) (progress-game-res #x123a) @@ -697,7 +696,6 @@ (progress-cheats-board-tricks #x1260) (progress-cheats-weather-bad #x1261) (progress-cheats-weather-good #x1262) - ;; -- end not being used (progress-camera-options #x1280) (progress-camera-options-first-horz #x1281) (progress-camera-options-first-vert #x1282) diff --git a/goal_src/jak2/levels/forest/forest-obs.gc b/goal_src/jak2/levels/forest/forest-obs.gc index ef0ab924ce..e3521ea059 100644 --- a/goal_src/jak2/levels/forest/forest-obs.gc +++ b/goal_src/jak2/levels/forest/forest-obs.gc @@ -361,17 +361,12 @@ This commonly includes things such as: (defun forest-youngsamos-bounce-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) (let ((s3-0 (new 'static 'array int32 4 0 0 0 0))) - (let ((t9-0 (method-of-type array new)) - (a0-1 (new 'stack-no-clear 'array 'sound-name 2)) - (a1-1 array) - (a2-1 sound-name) - (a3-1 2) - ) - (make-u128 #x316c6c (the-as uint #x61662d736f6d6173)) - (make-u128 #x326c6c (the-as uint #x61662d736f6d6173)) - (let ((v1-3 (the-as (array sound-name) (t9-0 (the-as symbol a0-1) a1-1 a2-1 a3-1)))) - (sound-play-by-name (-> v1-3 (-> s3-0 0)) (new-sound-id) 1024 0 0 (sound-group sfx) #t) - ) + ;; og:preserve-this manually fixed this monstrosity. also added a fix so we don't go out of bounds + (let ((v1-3 (let ((samos-sounds (new 'stack-no-clear 'array 'sound-name 2))) + (set! (-> samos-sounds 0) (static-sound-name "samos-fall1")) + (set! (-> samos-sounds 1) (static-sound-name "samos-fall2")) + samos-sounds))) + (sound-play-by-name (-> v1-3 (mod (-> s3-0 0) 2)) (new-sound-id) 1024 0 0 (sound-group sfx) #t) ) (+! (-> s3-0 0) 1) ) diff --git a/goal_src/jak2/pc/pckernel.gc b/goal_src/jak2/pc/pckernel.gc index aeb6c9b68a..b9d8aa6c11 100644 --- a/goal_src/jak2/pc/pckernel.gc +++ b/goal_src/jak2/pc/pckernel.gc @@ -344,7 +344,7 @@ ((set! simon-plat (search-process-tree *active-pool* (lambda ((proc process)) (and (= (-> proc type symbol) 'tomb-plat-simon) (-> proc next-state) - (eq-any? (-> proc next-state name) 'appear 'show-sequence 'idle))))) + (symbol-member? (-> proc next-state name) '(appear show-sequence idle)))))) (set! disable-fader? #f) (case (-> simon-plat next-state name) (('appear) @@ -441,6 +441,17 @@ `(-> *pc-settings* flava-unlocked ,flava)) +(defun inside-city? () + "are we inside haven city?" + (symbol-member? (-> *game-info* current-continue vis-nick) ;; TODO get actual level we're in? + '(ctysluma ctyslumb ctyslumc + ctygena ctygenb ctygenc + ctymarka ctymarkb + ctyfarma ctyfarmb + ctyinda ctyindb + ctypal ctyport stadium))) + + (defmethod update-cheats ((obj pc-settings-jak2)) "run cheats." @@ -467,13 +478,7 @@ ((and (pc-cheats? (-> *pc-settings* cheats) turbo-board) *target* (focus-test? *target* board) - (case (-> *game-info* current-continue vis-nick) - (('ctysluma 'ctyslumb 'ctyslumc 'ctypal - 'ctygena 'ctygenb 'ctygenc 'ctyport - 'ctymarka 'ctymarkb 'ctyfarma 'ctyfarmb - 'ctyinda 'ctyindb 'stadium) #t) - ;; also allow in forest - (('forest) #t #|(not (task-node-open? (game-task-node forest-scouts-pegasus)))|#))) + (inside-city?)) (set-setting! 'string-spline-max-move 'abs (* (-> *pc-cheat-state* turbo-board-speed) (meters 2)) 0) (set-setting! 'string-spline-accel 'abs (* (-> *pc-cheat-state* turbo-board-speed) (meters 0.045)) 0) (set-setting! 'string-spline-max-move-player 'abs (* (-> *pc-cheat-state* turbo-board-speed) (meters 1.5)) 0) diff --git a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc index cf044729eb..76987cb849 100644 --- a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc @@ -906,14 +906,14 @@ (-> s5-2 ppointer) ) ) - (let ((t1-3 (make-u128 (the-as uint #x7469682d6863) (the-as uint #x6e75702d6b616a64)))) + (let ((imp-sound (static-sound-name "djak-punch-hit"))) (play-effect-sound (-> self skel effect) 'punch -1.0 (-> self control impact-ctrl joint) (the-as basic #f) - (the-as sound-name t1-3) + imp-sound ) ) (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) @@ -1943,3 +1943,7 @@ ) :post (-> target-grab post) ) + + + +