diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 65d34a79cc..df66bf7709 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -2687,13 +2687,8 @@ void FunctionCallElement::update_from_stack(const Env& env, std::swap(all_pop_vars.at(0), all_pop_vars.at(1)); } - if (tp_type.kind == TP_Type::Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION) { - if (unstacked.at(0)->to_string(env) != "run-function-in-process") { - throw std::runtime_error( - fmt::format("Expression pass could not find the run-function-in-process function. Found " - "{} instead. Make sure there are no casts on this function.", - all_pop_vars.at(0).to_string(env))); - } + if (tp_type.kind == TP_Type::Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION && + unstacked.at(0)->to_string(env) == "run-function-in-process") { unstacked.at(0) = pool.form("run-now-in-process"); } diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index fd0a20e1de..37ec2c2df9 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -2962,7 +2962,7 @@ (falloff-near int32 :offset-assert 80) (falloff-far int32 :offset-assert 84) (falloff-mode int32 :offset-assert 88) - (params sound-play-parms :offset-assert 92) + (params (pointer float) :offset-assert 92) (param-count int32 :offset-assert 96) (entity entity :offset-assert 100) (sound-count int32 :offset-assert 104) @@ -11556,7 +11556,7 @@ (last-frame-num float :offset-assert 16) (channel-offset int32 :offset-assert 20) (res res-lump :offset-assert 24) - (name uint32 :offset-assert 28) + (name (pointer res-tag) :offset-assert 28) (param uint32 :offset-assert 32) ) :method-count-assert 15 @@ -11564,12 +11564,12 @@ :flag-assert #xf00000024 (:methods (new (symbol type process-drawable) _type_) - (dummy-9 () none 9) - (dummy-10 (_type_ symbol float int) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) + (TODO-RENAME-9 (_type_) none 9) + (dummy-10 (_type_ symbol float int) object 10) + (dummy-11 (_type_ symbol basic int basic int) none 11) + (dummy-12 (_type_ symbol basic int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) - (dummy-14 () none 14) + (TODO-RENAME-14 (_type_ float float float) none 14) ) ) @@ -15141,7 +15141,7 @@ (define-extern get-sound-buffer-entry (function pointer)) (define-extern sound-trans-convert (function vector3w vector int)) (define-extern sound-stop (function sound-id int)) -(define-extern effect-param->sound-spec (function sound-spec sound-play-parms int sound-spec)) +(define-extern effect-param->sound-spec (function sound-spec (pointer float) int sound-spec)) (define-extern ear-trans (function vector)) (define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id)) (define-extern sound-play-by-name (function sound-name sound-id int int int uint vector sound-id)) @@ -16631,7 +16631,7 @@ (define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo)) (define-extern particle-adgif (function adgif-shader texture-id none)) (define-extern lookup-part-group-by-name (function string basic)) -(define-extern lookup-part-group-pointer-by-name (function string (pointer sparticle-launch-group))) +(define-extern lookup-part-group-pointer-by-name (function string (pointer sparticle-launch-group))) ;; this can actually be a pointer to way more than just a SLG - can be - SLG | sparticle-launcher | sound-spec | death-info. See effect-control::10 (define-extern unlink-part-group-by-heap (function kheap int)) (define-extern particle-setup-adgif (function adgif-shader texture-id none)) (define-extern sp-queue-launch (function sparticle-system sparticle-launcher vector int)) @@ -19560,7 +19560,7 @@ ;; - Functions -(define-extern target-land-effect function) +(define-extern target-land-effect (function none :behavior target)) (define-extern target-hit-ground-anim function) (define-extern mod-var-jump function) (define-extern init-var-jump function) @@ -20298,11 +20298,11 @@ ;; - Functions -(define-extern sound-name-with-material function) +(define-extern sound-name-with-material (function symbol int string sound-name)) ;; - Unknowns -;;(define-extern *footstep-surface* object) ;; unknown type +(define-extern *footstep-surface* int) ;; unknown type ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index 707ffef596..ab86963b9c 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -803,6 +803,18 @@ ["L733", "uint64", true] ], + "effect-control": [ + ["L300", "float", true], + ["L301", "float", true], + ["L302", "float", true], + ["L306", "float", true], + ["L307", "float", true], + ["L309", "float", true], + ["L310", "float", true], + ["L312", "float", true], + ["L314", "float", true] + ], + // please do not add things after this entry! git is dumb. "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 22ea64a663..a3da69c315 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -2733,5 +2733,23 @@ [16, "event-message-block"] ], + "(method 10 effect-control)": [ + [16, "event-message-block"], + [96, "vector"], + [112, "vector"], + [128, "vector"], + [144, "vector"] + ], + + "(method 11 effect-control)": [ + [16, "vector"], + [32, "vector"] + ], + + "(method 12 effect-control)": [ + [16, "sound-spec"], + [96, "vector"] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 1ab280b347..d8db28d037 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -3911,5 +3911,18 @@ [2, "v1", "(pointer process-drawable)"] ], + "(method 10 effect-control)": [ + [88, "v1", "collide-shape-moving"], + [143, "s3", "(pointer sparticle-launch-group)"], + [147, "s3", "sparticle-launch-group"], + [199, "s3", "sparticle-launch-group"], + [240, "s3", "basic"], + [286, "s3", "basic"], + [346, "s3", "basic"], + [367, "s3", "basic"], + [367, "s3", "basic"], + [[371, 451], "s3", "death-info"] + ], + "placeholder-do-not-add-below": [] } diff --git a/goal_src/engine/ambient/ambient.gc b/goal_src/engine/ambient/ambient.gc index f126b3bbb2..aeea9b4857 100644 --- a/goal_src/engine/ambient/ambient.gc +++ b/goal_src/engine/ambient/ambient.gc @@ -1063,7 +1063,7 @@ (if a1-7 (effect-param->sound-spec s4-2 - (the-as sound-play-parms a1-7) + (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count)) ) ) @@ -1115,7 +1115,7 @@ ) (t9-2 a0-5 - (the-as sound-play-parms (&+ (-> v1-8 data-base) (-> a1-2 data-offset))) + (the-as (pointer float) (&+ (-> v1-8 data-base) (-> a1-2 data-offset))) (the-as int (-> (the-as (pointer res-tag) s3-0) 0 elt-count)) ) ) diff --git a/goal_src/engine/game/effect-control-h.gc b/goal_src/engine/game/effect-control-h.gc index b2dd021abe..56290453a2 100644 --- a/goal_src/engine/game/effect-control-h.gc +++ b/goal_src/engine/game/effect-control-h.gc @@ -5,27 +5,31 @@ ;; name in dgo: effect-control-h ;; dgos: GAME, ENGINE +(define-extern effect-param->sound-spec (function sound-spec (pointer float) int sound-spec)) + +;; decomp begins + (deftype effect-control (basic) - ((process process-drawable :offset-assert 4) - (flags uint32 :offset-assert 8) - (last-frame-group art-joint-anim :offset-assert 12) - (last-frame-num float :offset-assert 16) - (channel-offset int32 :offset-assert 20) - (res res-lump :offset-assert 24) - (name uint32 :offset-assert 28) - (param uint32 :offset-assert 32) + ((process process-drawable :offset-assert 4) + (flags uint32 :offset-assert 8) + (last-frame-group art-joint-anim :offset-assert 12) + (last-frame-num float :offset-assert 16) + (channel-offset int32 :offset-assert 20) + (res res-lump :offset-assert 24) + (name (pointer res-tag) :offset-assert 28) + (param uint32 :offset-assert 32) ) :method-count-assert 15 :size-assert #x24 :flag-assert #xf00000024 (:methods - (new (symbol type process-drawable) _type_ 0) - (dummy-9 () none 9) - (dummy-10 (_type_ symbol float int) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) + (new (symbol type process-drawable) _type_) + (TODO-RENAME-9 (_type_) none 9) + (dummy-10 (_type_ symbol float int) object 10) + (dummy-11 (_type_ symbol basic int basic int) none 11) + (dummy-12 (_type_ symbol basic int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) - (dummy-14 () none 14) + (TODO-RENAME-14 (_type_ float float float) none 14) ) ) diff --git a/goal_src/engine/game/effect-control.gc b/goal_src/engine/game/effect-control.gc index 0c6dcb52d4..87ce3de4c3 100644 --- a/goal_src/engine/game/effect-control.gc +++ b/goal_src/engine/game/effect-control.gc @@ -5,3 +5,1385 @@ ;; name in dgo: effect-control ;; dgos: GAME, ENGINE +;; DECOMP BEGINS + +(define *footstep-surface* 448) + +(define *debug-effect-control* #f) + +(defun sound-name-with-material ((arg0 symbol) (arg1 int) (arg2 string)) + (let ((gp-0 format) + (a0-2 (clear *temp-string*)) + (a1-1 "~S-~S~S") + (v1-1 (shr (shl arg1 52) 58)) + ) + (gp-0 a0-2 a1-1 arg0 (cond + ((= v1-1 5) + "sand" + ) + ((= v1-1 6) + "wood" + ) + ((= v1-1 13) + "crwood" + ) + ((or (= v1-1 18) (= v1-1 8)) + "pcmetal" + ) + ((or (= v1-1 16) (= v1-1 21)) + "metal" + ) + ((= v1-1 9) + "snow" + ) + ((= v1-1 10) + "dpsnow" + ) + ((= v1-1 14) + "gravel" + ) + ((= v1-1 15) + "dirt" + ) + ((zero? v1-1) + "stone" + ) + ((= v1-1 3) + "water" + ) + ((= v1-1 4) + "tar" + ) + ((= v1-1 17) + "straw" + ) + ((= v1-1 1) + "ice" + ) + ((= v1-1 19) + "swamp" + ) + ((= v1-1 22) + "neutral" + ) + (else + "grass" + ) + ) + arg2 + ) + ) + (string->sound-name *temp-string*) + ) + +(defun + effect-param->sound-spec + ((arg0 sound-spec) (arg1 (pointer float)) (arg2 int)) + (while (> arg2 0) + (case (the int (-> arg1 0)) + ((3) + (logior! (-> arg0 mask) 1) + (set! (-> arg0 volume) (the int (* 10.24 (-> arg1 1)))) + ) + ((4) + (logior! (-> arg0 mask) 1) + (+! (-> arg0 volume) (the int (* 10.24 (* (-> arg1 1) (rand-vu))))) + ) + ((5) + (logior! (-> arg0 mask) 2) + (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1)))) + ) + ((6) + (logior! (-> arg0 mask) 2) + (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu))))) + ) + ((9) + (logior! (-> arg0 mask) 4) + (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1)))) + ) + ((10) + (logior! (-> arg0 mask) 4) + (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu))))) + ) + ((11) + (logior! (-> arg0 mask) 64) + (set! (-> arg0 fo-min) (the int (-> arg1 1))) + ) + ((12) + (logior! (-> arg0 mask) 128) + (set! (-> arg0 fo-max) (the int (-> arg1 1))) + ) + ((13) + (logior! (-> arg0 mask) 256) + (set! (-> arg0 fo-curve) (the int (-> arg1 1))) + ) + ((19) + (set! (-> arg0 priority) (the int (-> arg1 1))) + ) + ) + (+! arg2 -2) + (set! arg1 (&-> arg1 2)) + ) + arg0 + ) + +(defmethod TODO-RENAME-9 effect-control ((obj effect-control)) + (let* ((a0-1 (-> obj process skel)) + (v1-3 + (the-as + joint-control-channel + (if (< (-> obj channel-offset) (-> a0-1 active-channels)) + (-> a0-1 root-channel (-> obj channel-offset)) + (the-as joint-control-channel #f) + ) + ) + ) + ) + (cond + ((and v1-3 (-> v1-3 frame-group)) + (let* ((s5-0 (-> v1-3 frame-group)) + (f30-0 + (+ + (* (-> v1-3 frame-num) (-> s5-0 artist-step)) + (-> s5-0 artist-base) + ) + ) + ) + (let ((a0-3 (-> a0-1 root-channel 0 num-func))) + (cond + ((!= s5-0 (-> obj last-frame-group)) + (set! (-> obj res) (-> s5-0 extra)) + (let + ((v1-6 + (-> + ((method-of-type res-lump lookup-tag-idx) + (-> s5-0 extra) + 'effect-name + 'base + -1000000000.0 + ) + lo + ) + ) + ) + (set! + (-> obj name) + (the-as (pointer res-tag) (if (>= (the-as int v1-6) 0) + (&-> (-> s5-0 extra tag) v1-6) + (the-as (pointer res-tag) #f) + ) + ) + ) + ) + (if (and (-> obj name) (= (-> obj name 0 key-frame) -1000000000.0)) + (set! (-> obj name) (&-> (-> obj name) 1)) + ) + (TODO-RENAME-14 obj f30-0 f30-0 f30-0) + ) + ((or (not (-> obj name)) (= f30-0 (-> obj last-frame-num))) + ) + (else + (let ((f28-0 (-> obj last-frame-num)) + (f26-0 f30-0) + ) + (cond + ((= a0-3 num-func-seek!) + (let + ((f0-6 + (+ + (* (-> v1-3 param 0) (-> s5-0 artist-step)) + (-> s5-0 artist-base) + ) + ) + ) + (cond + ((< f26-0 f28-0) + (if (>= f28-0 f0-6) + (TODO-RENAME-14 obj f26-0 f28-0 f30-0) + ) + ) + (else + (if (>= f0-6 f28-0) + (TODO-RENAME-14 obj f28-0 f26-0 f30-0) + ) + ) + ) + ) + ) + ((= a0-3 num-func-loop!) + (cond + ((>= (-> v1-3 param 0) 0.0) + (cond + ((< f26-0 f28-0) + (TODO-RENAME-14 obj f28-0 9999999.0 f30-0) + (TODO-RENAME-14 obj -100000000.0 f26-0 9999999.0) + ) + (else + (TODO-RENAME-14 obj f28-0 f26-0 f30-0) + ) + ) + ) + ((< f28-0 f26-0) + (TODO-RENAME-14 obj f26-0 9999999.0 f30-0) + (TODO-RENAME-14 obj -100000000.0 f28-0 9999999.0) + ) + (else + (TODO-RENAME-14 obj f26-0 f28-0 f30-0) + ) + ) + ) + ((= a0-3 num-func-+!) + (if (>= (-> v1-3 param 0) 0.0) + (TODO-RENAME-14 obj f28-0 f26-0 f30-0) + (TODO-RENAME-14 obj f26-0 f28-0 f30-0) + ) + ) + ((= a0-3 num-func-identity) + (TODO-RENAME-14 obj f30-0 f30-0 f30-0) + ) + ) + ) + ) + ) + ) + (set! (-> obj last-frame-group) s5-0) + (set! (-> obj last-frame-num) f30-0) + ) + ) + (else + (set! (-> obj last-frame-group) #f) + ) + ) + ) + 0 + (none) + ) + +(defmethod + TODO-RENAME-14 + effect-control + ((obj effect-control) (arg0 float) (arg1 float) (arg2 float)) + (let ((s2-0 (-> obj name))) + (while (= (-> s2-0 0 name) 'effect-name) + (let ((f0-0 (-> s2-0 0 key-frame))) + (when (or (and (< f0-0 arg1) (< arg0 f0-0)) (= f0-0 arg2)) + (let* ((a0-1 obj) + (t9-0 (method-of-object a0-1 dummy-10)) + (v1-7 (-> obj res)) + (a1-1 (-> s2-0 0)) + ) + (t9-0 + a0-1 + (the-as + symbol + (-> + (the-as + (pointer uint32) + (&+ (-> v1-7 data-base) (-> a1-1 data-offset)) + ) + ) + ) + f0-0 + -1 + ) + ) + ) + ) + (set! s2-0 (&-> s2-0 1)) + ) + ) + 0 + (none) + ) + +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +(defmethod + dummy-10 + effect-control + ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int)) + (local-vars + (sv-160 int) + (sv-176 symbol) + (sv-192 symbol) + (sv-208 symbol) + (sv-224 int) + (sv-240 symbol) + (sv-256 symbol) + (sv-272 symbol) + (sv-288 res-lump) + ) + (with-pp + (let ((s3-0 (-> arg0 value)) + (s5-0 (cond + ((< arg2 0) + (let + ((v0-0 + (get-property-value + (-> obj res) + 'effect-joint + 'exact + arg1 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (the-as int (if (zero? v0-0) + 0 + (the-as int (+ v0-0 1)) + ) + ) + ) + ) + (else + (empty) + arg2 + ) + ) + ) + ) + (when (logtest? (-> obj flags) 1) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) pp) + (set! (-> a1-2 num-params) 3) + (set! (-> a1-2 message) 'effect) + (set! (-> a1-2 param 0) (the-as uint arg0)) + (set! (-> a1-2 param 1) (the-as uint arg1)) + (set! (-> a1-2 param 2) (the-as uint s5-0)) + (if (send-event-function (-> obj process) a1-2) + (return (the-as object 0)) + ) + ) + ) + (let ((v1-10 (symbol->string arg0))) + (cond + ((and + (= (-> v1-10 data 0) 101) + (= (-> v1-10 data 1) 102) + (= (-> v1-10 data 2) 102) + (= (-> v1-10 data 3) 101) + (= (-> v1-10 data 4) 99) + (= (-> v1-10 data 5) 116) + (= (-> v1-10 data 6) 45) + ) + (let* ((s3-1 (-> obj process root)) + (v1-14 + (if + (and + (nonzero? s3-1) + (type-type? (-> s3-1 type) collide-shape-moving) + ) + s3-1 + ) + ) + (t1-1 (if v1-14 + (the-as + int + (-> (the-as collide-shape-moving v1-14) ground-pat) + ) + *footstep-surface* + ) + ) + ) + (dummy-11 obj arg0 (the-as basic arg1) s5-0 (-> obj res) t1-1) + ) + ) + ((let ((v1-18 (symbol->string arg0))) + (and + (= (-> v1-18 data 0) 103) + (= (-> v1-18 data 1) 114) + (= (-> v1-18 data 2) 111) + (= (-> v1-18 data 3) 117) + (= (-> v1-18 data 4) 112) + (= (-> v1-18 data 5) 45) + ) + ) + (set! s3-0 (cond + ((zero? s3-0) + (let + ((v0-5 + (lookup-part-group-pointer-by-name (symbol->string arg0)) + ) + ) + (when v0-5 + (set! (-> arg0 value) v0-5) + (set! s3-0 (-> v0-5 0)) + ) + ) + (the-as (pointer sparticle-launch-group) s3-0) + ) + (else + (-> (the-as (pointer sparticle-launch-group) s3-0) 0) + ) + ) + ) + (when + (and + (nonzero? s3-0) + (= + (-> (the-as sparticle-launch-group s3-0) type) + sparticle-launch-group + ) + ) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-1 + (let ((t9-7 (method-of-type part-tracker activate))) + (t9-7 + (the-as part-tracker s4-1) + (-> obj process) + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (let ((s2-1 run-function-in-process) + (s1-0 s4-1) + (s0-0 part-tracker-init) + ) + (set! sv-160 -1) + (set! sv-176 (the-as symbol #f)) + (set! sv-192 (the-as symbol #f)) + (set! sv-208 (the-as symbol #f)) + (let + ((t3-0 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-0) + ) + ) + ) + (s2-1 + s1-0 + s0-0 + (the-as sparticle-launch-group s3-0) + sv-160 + sv-176 + sv-192 + sv-208 + t3-0 + ) + ) + ) + (-> s4-1 ppointer) + ) + ) + ) + ) + ((= arg0 'camera-shake) + (activate! *camera-smush-control* 819.2 37 600 1.0 0.995) + ) + ((zero? s3-0) + (dummy-12 + obj + arg0 + (the-as basic arg1) + s5-0 + (-> obj res) + (string->sound-name (symbol->string arg0)) + ) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launcher) + (if *debug-effect-control* + (format + #t + "(~5D) effect part ~A ~A frame ~F joint ~D~%" + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (format + #t + "-----> (~5D) effect part ~A ~A frame ~F joint ~D~%" + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (the-as sparticle-launcher s3-0) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-0) + ) + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launch-group) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-3 + (let ((t9-19 (method-of-type part-tracker activate))) + (t9-19 + (the-as part-tracker s4-3) + (-> obj process) + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (let ((s2-3 run-function-in-process) + (s1-2 s4-3) + (s0-2 part-tracker-init) + ) + (set! sv-224 -1) + (set! sv-240 (the-as symbol #f)) + (set! sv-256 (the-as symbol #f)) + (set! sv-272 (the-as symbol #f)) + (let + ((t3-1 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-0) + ) + ) + ) + (s2-3 s1-2 s0-2 s3-0 sv-224 sv-240 sv-256 sv-272 t3-1) + ) + ) + (-> s4-3 ppointer) + ) + ) + ) + ((= (-> (the-as basic s3-0) type) sound-spec) + (sound-play-by-spec + (the-as sound-spec s3-0) + (new-sound-id) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-0) + ) + ) + ) + ((= (-> (the-as basic s3-0) type) death-info) + (let ((v1-67 (-> obj process draw))) + (let ((a1-42 (-> (the-as death-info s3-0) vertex-skip)) + (a0-55 + (max + 2 + (the-as + int + (/ + (-> (the-as death-info s3-0) timer) + (the-as uint (the int (-> *display* time-factor))) + ) + ) + ) + ) + ) + (when (= (-> *setting-control* current video-mode) 'pal) + (if (< (the-as uint 1) a1-42) + (set! + a1-42 + (/ (the-as uint (* (the-as uint 50) a1-42)) (the-as uint 60)) + ) + ) + ) + (let + ((a2-29 + (-> *display* frames (-> *display* last-screen) frame run-time) + ) + ) + (cond + ((< 9000 (the-as int a2-29)) + (set! a1-42 (* a1-42 4)) + ) + ((< 7000 (the-as int a2-29)) + (set! a1-42 (* a1-42 2)) + ) + ) + ) + (set! (-> v1-67 death-vertex-skip) a1-42) + (set! (-> v1-67 death-effect) (-> (the-as death-info s3-0) effect)) + (set! (-> v1-67 death-timer) (+ a0-55 1)) + ) + (set! (-> v1-67 death-timer-org) (-> v1-67 death-timer)) + (set! + (-> v1-67 death-draw-overlap) + (-> (the-as death-info s3-0) overlap) + ) + ) + (when (-> (the-as death-info s3-0) sound) + (let* ((s2-5 obj) + (s1-3 (method-of-object s2-5 dummy-12)) + (s0-3 (-> (the-as death-info s3-0) sound)) + ) + (set! sv-288 (-> obj res)) + (let + ((t1-11 + (string->sound-name + (the-as + string + (-> + (the-as + (pointer uint32) + (+ #xff38 (the-as int (-> (the-as death-info s3-0) sound))) + ) + ) + ) + ) + ) + ) + (s1-3 s2-5 (the-as symbol s0-3) (the-as basic arg1) s5-0 sv-288 t1-11) + ) + ) + ) + (let ((a1-46 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-46 from) pp) + (set! (-> a1-46 num-params) 1) + (set! (-> a1-46 message) 'death-start) + (set! (-> a1-46 param 0) (the-as uint s3-0)) + (send-event-function (-> obj process) a1-46) + ) + ) + (else + (dummy-12 + obj + arg0 + (the-as basic arg1) + s5-0 + (-> obj res) + (string->sound-name (symbol->string arg0)) + ) + ) + ) + ) + ) + 0 + ) + ) + +(defmethod + dummy-11 + effect-control + ((obj effect-control) + (arg0 symbol) + (arg1 basic) + (arg2 int) + (arg3 basic) + (arg4 int) + ) + (local-vars + (sv-48 + (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) + ) + (sv-64 sparticle-system) + (sv-80 + (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) + ) + (sv-96 sparticle-system) + ) + (let ((s1-0 (the-as sound-name #f))) + (let ((a0-4 (-> *display* frames (-> *display* last-screen) frame run-time))) + (case arg0 + (('effect-walk-step-left 'effect-run-step-left) + (set! s1-0 (sound-name-with-material 'walk arg4 "1")) + ) + (('effect-walk-step-right 'effect-run-step-right) + (set! s1-0 (sound-name-with-material 'walk arg4 "2")) + ) + (('effect-roll) + (set! s1-0 (sound-name-with-material 'roll arg4 "")) + ) + (('effect-slide) + (set! s1-0 (sound-name-with-material 'slide arg4 "")) + ) + (('effect-land) + (set! s1-0 (sound-name-with-material 'land arg4 "")) + ) + (('effect-zoom-land) + (set! s1-0 (sound-name-with-material 'zoom-land arg4 "")) + ) + (('effect-zoom-hit) + (set! s1-0 (sound-name-with-material 'zoom-hit arg4 "")) + ) + (('effect-flut-land) + (set! s1-0 (sound-name-with-material 'flut-land arg4 "")) + ) + (('effect-land-poof) + (when (< (the-as int a0-4) 9000) + (let* ((a0-13 obj) + (t9-8 (method-of-object a0-13 dummy-10)) + (v1-15 (shr (shl arg4 52) 58)) + ) + (t9-8 a0-13 (cond + ((= v1-15 5) + 'group-land-poof-sand + ) + ((= v1-15 6) + 'group-land-poof-wood + ) + ((= v1-15 13) + 'group-land-poof-crwood + ) + ((or (= v1-15 18) (= v1-15 8)) + 'group-land-poof-pcmetal + ) + ((or (= v1-15 16) (= v1-15 21)) + 'group-land-poof-metal + ) + ((= v1-15 1) + 'group-land-poof-ice + ) + ((= v1-15 9) + 'group-land-poof-snow + ) + ((= v1-15 10) + 'group-land-poof-dpsnow + ) + ((= v1-15 14) + 'group-land-poof-gravel + ) + ((= v1-15 15) + 'group-land-poof-dirt + ) + ((zero? v1-15) + 'group-land-poof-stone + ) + ((= v1-15 3) + 'group-land-poof-water + ) + ((= v1-15 4) + 'group-land-poof-tar + ) + ((= v1-15 17) + 'group-land-poof-straw + ) + ((= v1-15 19) + 'group-land-poof-swamp + ) + ((= v1-15 22) + 'group-land-poof-neutral + ) + (else + 'group-land-poof-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + ) + (('effect-run-poof) + (when (< (the-as int a0-4) 9000) + (let* ((a0-14 obj) + (t9-9 (method-of-object a0-14 dummy-10)) + (v1-20 (shr (shl arg4 52) 58)) + ) + (t9-9 a0-14 (cond + ((= v1-20 5) + 'group-run-poof-sand + ) + ((= v1-20 6) + 'group-run-poof-wood + ) + ((= v1-20 13) + 'group-run-poof-crwood + ) + ((or (= v1-20 18) (= v1-20 8)) + 'group-run-poof-pcmetal + ) + ((or (= v1-20 16) (= v1-20 21)) + 'group-run-poof-metal + ) + ((= v1-20 1) + 'group-run-poof-ice + ) + ((= v1-20 9) + 'group-run-poof-snow + ) + ((= v1-20 10) + 'group-run-poof-dpsnow + ) + ((= v1-20 14) + 'group-run-poof-gravel + ) + ((= v1-20 15) + 'group-run-poof-dirt + ) + ((zero? v1-20) + 'group-run-poof-stone + ) + ((= v1-20 3) + 'group-run-poof-water + ) + ((= v1-20 4) + 'group-run-poof-tar + ) + ((= v1-20 17) + 'group-run-poof-straw + ) + ((= v1-20 19) + 'group-run-poof-swamp + ) + ((= v1-20 22) + 'group-run-poof-neutral + ) + (else + 'group-run-poof-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + ) + (('effect-just-footprint) + (let* ((a0-15 obj) + (t9-10 (method-of-object a0-15 dummy-10)) + (v1-24 (shr (shl arg4 52) 58)) + ) + (t9-10 a0-15 (cond + ((= v1-24 5) + 'group-just-footprint-sand + ) + ((= v1-24 6) + 'group-just-footprint-wood + ) + ((= v1-24 13) + 'group-just-footprint-crwood + ) + ((or (= v1-24 18) (= v1-24 8)) + 'group-just-footprint-pcmetal + ) + ((or (= v1-24 16) (= v1-24 21)) + 'group-just-footprint-metal + ) + ((= v1-24 1) + 'group-just-footprint-ice + ) + ((= v1-24 9) + 'group-just-footprint-snow + ) + ((= v1-24 10) + 'group-just-footprint-dpsnow + ) + ((= v1-24 14) + 'group-just-footprint-gravel + ) + ((= v1-24 15) + 'group-just-footprint-dirt + ) + ((zero? v1-24) + 'group-just-footprint-stone + ) + ((= v1-24 3) + 'group-just-footprint-water + ) + ((= v1-24 4) + 'group-just-footprint-tar + ) + ((= v1-24 17) + 'group-just-footprint-straw + ) + ((= v1-24 19) + 'group-just-footprint-swamp + ) + ((= v1-24 22) + 'group-just-footprint-neutral + ) + (else + 'group-just-footprint-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + (('effect-just-poof) + (when (< (the-as int a0-4) 9000) + (let* ((a0-16 obj) + (t9-11 (method-of-object a0-16 dummy-10)) + (v1-29 (shr (shl arg4 52) 58)) + ) + (t9-11 a0-16 (cond + ((= v1-29 5) + 'group-just-poof-sand + ) + ((= v1-29 6) + 'group-just-poof-wood + ) + ((= v1-29 13) + 'group-just-poof-crwood + ) + ((or (= v1-29 18) (= v1-29 8)) + 'group-just-poof-pcmetal + ) + ((or (= v1-29 16) (= v1-29 21)) + 'group-just-poof-metal + ) + ((= v1-29 1) + 'group-just-poof-ice + ) + ((= v1-29 9) + 'group-just-poof-snow + ) + ((= v1-29 10) + 'group-just-poof-dpsnow + ) + ((= v1-29 14) + 'group-just-poof-gravel + ) + ((= v1-29 15) + 'group-just-poof-dirt + ) + ((zero? v1-29) + 'group-just-poof-stone + ) + ((= v1-29 3) + 'group-just-poof-water + ) + ((= v1-29 4) + 'group-just-poof-tar + ) + ((= v1-29 17) + 'group-just-poof-straw + ) + ((= v1-29 19) + 'group-just-poof-swamp + ) + ((= v1-29 22) + 'group-just-poof-neutral + ) + (else + 'group-just-poof-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + ) + (('effect-slide-poof) + (let* ((a0-19 obj) + (t9-12 (method-of-object a0-19 dummy-10)) + (v1-33 (shr (shl arg4 52) 58)) + ) + (t9-12 a0-19 (cond + ((= v1-33 5) + 'group-slide-poof-sand + ) + ((= v1-33 6) + 'group-slide-poof-wood + ) + ((= v1-33 13) + 'group-slide-poof-crwood + ) + ((or (= v1-33 18) (= v1-33 8)) + 'group-slide-poof-pcmetal + ) + ((or (= v1-33 16) (= v1-33 21)) + 'group-slide-poof-metal + ) + ((= v1-33 1) + 'group-slide-poof-ice + ) + ((= v1-33 9) + 'group-slide-poof-snow + ) + ((= v1-33 10) + 'group-slide-poof-dpsnow + ) + ((= v1-33 14) + 'group-slide-poof-gravel + ) + ((= v1-33 15) + 'group-slide-poof-dirt + ) + ((zero? v1-33) + 'group-slide-poof-stone + ) + ((= v1-33 3) + 'group-slide-poof-water + ) + ((= v1-33 4) + 'group-slide-poof-tar + ) + ((= v1-33 17) + 'group-slide-poof-straw + ) + ((= v1-33 19) + 'group-slide-poof-swamp + ) + ((= v1-33 22) + 'group-slide-poof-neutral + ) + (else + 'group-slide-poof-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + (('effect-droppings) + (let* ((v1-36 (shr (shl arg4 52) 58)) + (s0-0 (cond + ((= v1-36 5) + (-> *part-id-table* 95) + ) + ((= v1-36 6) + (-> *part-id-table* 97) + ) + ((= v1-36 13) + (-> *part-id-table* 99) + ) + ((or (= v1-36 18) (= v1-36 8)) + (-> *part-id-table* 2248) + ) + ((or (= v1-36 16) (= v1-36 21)) + (-> *part-id-table* 2334) + ) + ((= v1-36 1) + (-> *part-id-table* 2249) + ) + ((= v1-36 9) + (-> *part-id-table* 2250) + ) + ((= v1-36 10) + (-> *part-id-table* 2251) + ) + ((= v1-36 14) + (-> *part-id-table* 2252) + ) + ((= v1-36 15) + (-> *part-id-table* 2253) + ) + ((zero? v1-36) + (-> *part-id-table* 98) + ) + ((= v1-36 3) + (-> *part-id-table* 2254) + ) + ((= v1-36 4) + (-> *part-id-table* 2255) + ) + ((= v1-36 17) + (-> *part-id-table* 2256) + ) + ((= v1-36 19) + (-> *part-id-table* 2257) + ) + ((= v1-36 22) + (-> *part-id-table* 2773) + ) + (else + (-> *part-id-table* 96) + ) + ) + ) + ) + (when (nonzero? s0-0) + (set! sv-48 sp-launch-particles-var) + (set! sv-64 *sp-particle-system-2d*) + (let + ((a2-36 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data arg2) + ) + ) + (a3-6 #f) + (t0-1 #f) + (t1-1 1.0) + ) + (sv-48 + sv-64 + s0-0 + a2-36 + (the-as sparticle-launch-state a3-6) + (the-as sparticle-launch-control t0-1) + t1-1 + ) + ) + ) + ) + ) + (('effect-jump-droppings) + (let* ((v1-61 (shr (shl arg4 52) 58)) + (s0-1 (cond + ((= v1-61 5) + (-> *part-id-table* 106) + ) + ((= v1-61 6) + (-> *part-id-table* 2258) + ) + ((= v1-61 13) + (-> *part-id-table* 2259) + ) + ((or (= v1-61 18) (= v1-61 8)) + (-> *part-id-table* 2260) + ) + ((or (= v1-61 16) (= v1-61 21)) + (-> *part-id-table* 2335) + ) + ((= v1-61 1) + (-> *part-id-table* 2261) + ) + ((= v1-61 9) + (-> *part-id-table* 2262) + ) + ((= v1-61 10) + (-> *part-id-table* 2263) + ) + ((= v1-61 14) + (-> *part-id-table* 2264) + ) + ((= v1-61 15) + (-> *part-id-table* 2265) + ) + ((zero? v1-61) + (-> *part-id-table* 2266) + ) + ((= v1-61 3) + (-> *part-id-table* 2267) + ) + ((= v1-61 4) + (-> *part-id-table* 2268) + ) + ((= v1-61 17) + (-> *part-id-table* 2269) + ) + ((= v1-61 19) + (-> *part-id-table* 2270) + ) + ((= v1-61 22) + (-> *part-id-table* 2774) + ) + (else + (-> *part-id-table* 107) + ) + ) + ) + ) + (when (nonzero? s0-1) + (set! sv-80 sp-launch-particles-var) + (set! sv-96 *sp-particle-system-2d*) + (let + ((a2-37 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data arg2) + ) + ) + (a3-7 #f) + (t0-2 #f) + (t1-2 1.0) + ) + (sv-80 + sv-96 + s0-1 + a2-37 + (the-as sparticle-launch-state a3-7) + (the-as sparticle-launch-control t0-2) + t1-2 + ) + ) + ) + ) + ) + ) + ) + (if s1-0 + (dummy-12 obj arg0 arg1 arg2 arg3 s1-0) + ) + ) + 0 + (none) + ) + +(defmethod + dummy-12 + effect-control + ((obj effect-control) + (arg0 symbol) + (arg1 basic) + (arg2 int) + (arg3 basic) + (arg4 sound-name) + ) + (local-vars + (r0-0 uint128) + (v1-10 uint128) + (sv-112 int) + (sv-128 sound-name) + (sv-144 basic) + (sv-160 (function vector vector float)) + ) + (set! sv-144 arg3) + (let ((s0-0 arg4) + (gp-0 (new 'stack 'sound-spec)) + (s5-0 (if (< arg2 0) + (the-as vector #f) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data arg2) + ) + ) + ) + ) + (set! (-> gp-0 sound-name) s0-0) + (logior! (-> gp-0 mask) 1) + (set! (-> gp-0 volume) 1024) + (logior! (-> gp-0 mask) 4) + (set! + (-> gp-0 bend) + (the int (* 327.66998 (rand-vu-float-range -100.0 100.0))) + ) + (set! sv-112 0) + (let* ((t9-3 (method-of-type res-lump get-property-data)) + (a1-6 'effect-param) + (a2-1 'exact) + (a3-1 arg1) + (t0-1 #f) + (t1-1 (the-as (pointer int) (& sv-112))) + (t2-0 *res-static-buf*) + (a1-7 + (t9-3 + (the-as res-lump sv-144) + a1-6 + a2-1 + (the-as float a3-1) + (the-as pointer t0-1) + (the-as (pointer res-tag) t1-1) + t2-0 + ) + ) + ) + (when a1-7 + (let ((t9-4 effect-param->sound-spec) + (a0-5 gp-0) + ) + (let ((v1-9 (the-as uint128 sv-112))) + (.pcpyud v1-10 v1-9 r0-0) + ) + (t9-4 + a0-5 + (the-as (pointer float) a1-7) + (shr (* (the-as int v1-10) 2) 49) + ) + ) + ) + ) + (if + (and + (nonzero? (-> gp-0 fo-max)) + (let ((f30-1 (* 4096.0 (the float (-> gp-0 fo-max))))) + (set! sv-160 vector-vector-distance) + (let ((a0-6 (ear-trans)) + (a1-8 s5-0) + ) + (< f30-1 (sv-160 a0-6 a1-8)) + ) + ) + ) + (return 0) + ) + (when *debug-effect-control* + (set! sv-128 s0-0) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (format + #t + "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + *temp-string* + arg1 + arg2 + ) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> gp-0 volume))) + (* 0.000656168 (the float (-> gp-0 pitch-mod))) + ) + ) + (sound-play-by-spec gp-0 (new-sound-id) s5-0) + ) + 0 + ) + +(defbehavior target-land-effect target () + (cond + ((logtest? (-> self control root-prim prim-core action) #x4000) + (dummy-10 (-> self skel effect) 'effect-land-poof -1.0 -1) + (dummy-10 (-> self skel effect) 'effect-flut-land -1.0 -1) + ) + ((logtest? (-> self control root-prim prim-core action) 512) + (sound-play-by-name + (sound-name-with-material + 'zoom-land + (the-as int (-> self control ground-pat)) + "" + ) + (new-sound-id) + (the + int + (* + 10.24 + (* + 100.0 + (the + float + (the + int + (* 10.24 (* 0.000016276043 (-> self control ground-impact-vel))) + ) + ) + ) + ) + ) + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + ((logtest? (-> self water flags) 512) + (dummy-10 (-> self skel effect) 'effect-land-water -1.0 -1) + ) + (else + (dummy-10 (-> self skel effect) 'effect-land-poof -1.0 -1) + (dummy-10 (-> self skel effect) 'effect-land -1.0 -1) + ) + ) + 0 + (none) + ) + + + + diff --git a/goal_src/engine/game/generic-obs.gc b/goal_src/engine/game/generic-obs.gc index 0c3d078074..47d998bebb 100644 --- a/goal_src/engine/game/generic-obs.gc +++ b/goal_src/engine/game/generic-obs.gc @@ -74,7 +74,7 @@ (dummy-17 self) (let ((a0-22 (-> self skel effect))) (if a0-22 - ((method-of-object a0-22 dummy-9)) + (TODO-RENAME-9 a0-22) ) ) (if (logtest? (-> self skel status) 72) diff --git a/goal_src/engine/gfx/merc/merc-death.gc b/goal_src/engine/gfx/merc/merc-death.gc index f617af28df..51859d2191 100644 --- a/goal_src/engine/gfx/merc/merc-death.gc +++ b/goal_src/engine/gfx/merc/merc-death.gc @@ -5,3 +5,15 @@ ;; name in dgo: merc-death ;; dgos: GAME, ENGINE +;; TODO - for effect-control +(deftype death-info (basic) + ((vertex-skip uint16 :offset-assert 4) + (timer uint8 :offset-assert 6) + (overlap uint8 :offset-assert 7) + (effect uint32 :offset-assert 8) + (sound basic :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) diff --git a/goal_src/engine/sound/gsound-h.gc b/goal_src/engine/sound/gsound-h.gc index 717dbc4637..08d8784ef4 100644 --- a/goal_src/engine/sound/gsound-h.gc +++ b/goal_src/engine/sound/gsound-h.gc @@ -389,7 +389,7 @@ (falloff-near int32 :offset-assert 80) (falloff-far int32 :offset-assert 84) (falloff-mode int32 :offset-assert 88) - (params sound-play-parms :offset-assert 92) + (params (pointer float) :offset-assert 92) (param-count int32 :offset-assert 96) (entity entity :offset-assert 100) (sound-count int32 :offset-assert 104) diff --git a/goal_src/engine/sound/gsound.gc b/goal_src/engine/sound/gsound.gc index 39aed02ff3..35bae86ea2 100644 --- a/goal_src/engine/sound/gsound.gc +++ b/goal_src/engine/sound/gsound.gc @@ -583,7 +583,7 @@ (set! (-> obj spec) spec) (set! (-> obj name) name) (set! (-> obj playing-id) (new-sound-id)) - (set! (-> obj params) params) + (set! (-> obj params) (the-as (pointer float) params)) (set! (-> obj param-count) param-count) (set! (-> obj entity) #f) (set! (-> obj sound-count) 1) @@ -616,7 +616,6 @@ ) -(defun-extern effect-param->sound-spec sound-spec sound-play-parms int sound-spec) (define-extern *debug-effect-control* symbol) (defmethod update! ambient-sound ((obj ambient-sound)) "Called once per frame to update the sound playback" @@ -645,7 +644,11 @@ (set! (-> spec fo-max) (-> obj falloff-far)) (set! (-> spec mask) (the-as uint 0)) (if (-> obj params) - (effect-param->sound-spec spec (-> obj params) (-> obj param-count)) + (effect-param->sound-spec + spec + (the-as (pointer float) (-> obj params)) + (-> obj param-count) + ) ) ) (if (and (nonzero? (-> spec fo-max)) diff --git a/test/decompiler/reference/engine/game/effect-control-h_REF.gc b/test/decompiler/reference/engine/game/effect-control-h_REF.gc index 74bab4e068..f634804d75 100644 --- a/test/decompiler/reference/engine/game/effect-control-h_REF.gc +++ b/test/decompiler/reference/engine/game/effect-control-h_REF.gc @@ -3,26 +3,26 @@ ;; definition of type effect-control (deftype effect-control (basic) - ((process process-drawable :offset-assert 4) - (flags uint32 :offset-assert 8) - (last-frame-group art-joint-anim :offset-assert 12) - (last-frame-num float :offset-assert 16) - (channel-offset int32 :offset-assert 20) - (res res-lump :offset-assert 24) - (name uint32 :offset-assert 28) - (param uint32 :offset-assert 32) + ((process process-drawable :offset-assert 4) + (flags uint32 :offset-assert 8) + (last-frame-group art-joint-anim :offset-assert 12) + (last-frame-num float :offset-assert 16) + (channel-offset int32 :offset-assert 20) + (res res-lump :offset-assert 24) + (name (pointer res-tag) :offset-assert 28) + (param uint32 :offset-assert 32) ) :method-count-assert 15 :size-assert #x24 :flag-assert #xf00000024 (:methods (new (symbol type process-drawable) _type_ 0) - (dummy-9 () none 9) - (dummy-10 (_type_ symbol float int) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) + (TODO-RENAME-9 (_type_) none 9) + (dummy-10 (_type_ symbol float int) object 10) + (dummy-11 (_type_ symbol basic int basic int) none 11) + (dummy-12 (_type_ symbol basic int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) - (dummy-14 () none 14) + (TODO-RENAME-14 (_type_ float float float) none 14) ) ) diff --git a/test/decompiler/reference/engine/game/effect-control_REF.gc b/test/decompiler/reference/engine/game/effect-control_REF.gc new file mode 100644 index 0000000000..577c40db73 --- /dev/null +++ b/test/decompiler/reference/engine/game/effect-control_REF.gc @@ -0,0 +1,1399 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *footstep-surface*, type int +(define *footstep-surface* 448) + +;; definition for symbol *debug-effect-control*, type symbol +(define *debug-effect-control* #f) + +;; definition for function sound-name-with-material +(defun sound-name-with-material ((arg0 symbol) (arg1 int) (arg2 string)) + (let ((gp-0 format) + (a0-2 (clear *temp-string*)) + (a1-1 "~S-~S~S") + (v1-1 (shr (shl arg1 52) 58)) + ) + (gp-0 a0-2 a1-1 arg0 (cond + ((= v1-1 5) + "sand" + ) + ((= v1-1 6) + "wood" + ) + ((= v1-1 13) + "crwood" + ) + ((or (= v1-1 18) (= v1-1 8)) + "pcmetal" + ) + ((or (= v1-1 16) (= v1-1 21)) + "metal" + ) + ((= v1-1 9) + "snow" + ) + ((= v1-1 10) + "dpsnow" + ) + ((= v1-1 14) + "gravel" + ) + ((= v1-1 15) + "dirt" + ) + ((zero? v1-1) + "stone" + ) + ((= v1-1 3) + "water" + ) + ((= v1-1 4) + "tar" + ) + ((= v1-1 17) + "straw" + ) + ((= v1-1 1) + "ice" + ) + ((= v1-1 19) + "swamp" + ) + ((= v1-1 22) + "neutral" + ) + (else + "grass" + ) + ) + arg2 + ) + ) + (string->sound-name *temp-string*) + ) + +;; definition for function effect-param->sound-spec +(defun + effect-param->sound-spec + ((arg0 sound-spec) (arg1 (pointer float)) (arg2 int)) + (while (> arg2 0) + (case (the int (-> arg1 0)) + ((3) + (logior! (-> arg0 mask) 1) + (set! (-> arg0 volume) (the int (* 10.24 (-> arg1 1)))) + ) + ((4) + (logior! (-> arg0 mask) 1) + (+! (-> arg0 volume) (the int (* 10.24 (* (-> arg1 1) (rand-vu))))) + ) + ((5) + (logior! (-> arg0 mask) 2) + (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1)))) + ) + ((6) + (logior! (-> arg0 mask) 2) + (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu))))) + ) + ((9) + (logior! (-> arg0 mask) 4) + (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1)))) + ) + ((10) + (logior! (-> arg0 mask) 4) + (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu))))) + ) + ((11) + (logior! (-> arg0 mask) 64) + (set! (-> arg0 fo-min) (the int (-> arg1 1))) + ) + ((12) + (logior! (-> arg0 mask) 128) + (set! (-> arg0 fo-max) (the int (-> arg1 1))) + ) + ((13) + (logior! (-> arg0 mask) 256) + (set! (-> arg0 fo-curve) (the int (-> arg1 1))) + ) + ((19) + (set! (-> arg0 priority) (the int (-> arg1 1))) + ) + ) + (+! arg2 -2) + (set! arg1 (&-> arg1 2)) + ) + arg0 + ) + +;; definition for method 9 of type effect-control +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defmethod TODO-RENAME-9 effect-control ((obj effect-control)) + (let* ((a0-1 (-> obj process skel)) + (v1-3 + (the-as + joint-control-channel + (if (< (-> obj channel-offset) (-> a0-1 active-channels)) + (-> a0-1 root-channel (-> obj channel-offset)) + (the-as joint-control-channel #f) + ) + ) + ) + ) + (cond + ((and v1-3 (-> v1-3 frame-group)) + (let* ((s5-0 (-> v1-3 frame-group)) + (f30-0 + (+ + (* (-> v1-3 frame-num) (-> s5-0 artist-step)) + (-> s5-0 artist-base) + ) + ) + ) + (let ((a0-3 (-> a0-1 root-channel 0 num-func))) + (cond + ((!= s5-0 (-> obj last-frame-group)) + (set! (-> obj res) (-> s5-0 extra)) + (let + ((v1-6 + (-> + ((method-of-type res-lump lookup-tag-idx) + (-> s5-0 extra) + 'effect-name + 'base + -1000000000.0 + ) + lo + ) + ) + ) + (set! + (-> obj name) + (the-as (pointer res-tag) (if (>= (the-as int v1-6) 0) + (&-> (-> s5-0 extra tag) v1-6) + (the-as (pointer res-tag) #f) + ) + ) + ) + ) + (if (and (-> obj name) (= (-> obj name 0 key-frame) -1000000000.0)) + (set! (-> obj name) (&-> (-> obj name) 1)) + ) + (TODO-RENAME-14 obj f30-0 f30-0 f30-0) + ) + ((or (not (-> obj name)) (= f30-0 (-> obj last-frame-num))) + ) + (else + (let ((f28-0 (-> obj last-frame-num)) + (f26-0 f30-0) + ) + (cond + ((= a0-3 num-func-seek!) + (let + ((f0-6 + (+ + (* (-> v1-3 param 0) (-> s5-0 artist-step)) + (-> s5-0 artist-base) + ) + ) + ) + (cond + ((< f26-0 f28-0) + (if (>= f28-0 f0-6) + (TODO-RENAME-14 obj f26-0 f28-0 f30-0) + ) + ) + (else + (if (>= f0-6 f28-0) + (TODO-RENAME-14 obj f28-0 f26-0 f30-0) + ) + ) + ) + ) + ) + ((= a0-3 num-func-loop!) + (cond + ((>= (-> v1-3 param 0) 0.0) + (cond + ((< f26-0 f28-0) + (TODO-RENAME-14 obj f28-0 9999999.0 f30-0) + (TODO-RENAME-14 obj -100000000.0 f26-0 9999999.0) + ) + (else + (TODO-RENAME-14 obj f28-0 f26-0 f30-0) + ) + ) + ) + ((< f28-0 f26-0) + (TODO-RENAME-14 obj f26-0 9999999.0 f30-0) + (TODO-RENAME-14 obj -100000000.0 f28-0 9999999.0) + ) + (else + (TODO-RENAME-14 obj f26-0 f28-0 f30-0) + ) + ) + ) + ((= a0-3 num-func-+!) + (if (>= (-> v1-3 param 0) 0.0) + (TODO-RENAME-14 obj f28-0 f26-0 f30-0) + (TODO-RENAME-14 obj f26-0 f28-0 f30-0) + ) + ) + ((= a0-3 num-func-identity) + (TODO-RENAME-14 obj f30-0 f30-0 f30-0) + ) + ) + ) + ) + ) + ) + (set! (-> obj last-frame-group) s5-0) + (set! (-> obj last-frame-num) f30-0) + ) + ) + (else + (set! (-> obj last-frame-group) #f) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type effect-control +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defmethod + TODO-RENAME-14 + effect-control + ((obj effect-control) (arg0 float) (arg1 float) (arg2 float)) + (let ((s2-0 (-> obj name))) + (while (= (-> s2-0 0 name) 'effect-name) + (let ((f0-0 (-> s2-0 0 key-frame))) + (when (or (and (< f0-0 arg1) (< arg0 f0-0)) (= f0-0 arg2)) + (let* ((a0-1 obj) + (t9-0 (method-of-object a0-1 dummy-10)) + (v1-7 (-> obj res)) + (a1-1 (-> s2-0 0)) + ) + (t9-0 + a0-1 + (the-as + symbol + (-> + (the-as + (pointer uint32) + (&+ (-> v1-7 data-base) (-> a1-1 data-offset)) + ) + ) + ) + f0-0 + -1 + ) + ) + ) + ) + (set! s2-0 (&-> s2-0 1)) + ) + ) + 0 + (none) + ) + +;; definition for method 10 of type effect-control +;; INFO: Return type mismatch int vs object. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; Used lq/sq +(defmethod + dummy-10 + effect-control + ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int)) + (local-vars + (sv-160 int) + (sv-176 symbol) + (sv-192 symbol) + (sv-208 symbol) + (sv-224 int) + (sv-240 symbol) + (sv-256 symbol) + (sv-272 symbol) + (sv-288 res-lump) + ) + (with-pp + (let ((s3-0 (-> arg0 value)) + (s5-0 (cond + ((< arg2 0) + (let + ((v0-0 + (get-property-value + (-> obj res) + 'effect-joint + 'exact + arg1 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (the-as int (if (zero? v0-0) + 0 + (the-as int (+ v0-0 1)) + ) + ) + ) + ) + (else + (empty) + arg2 + ) + ) + ) + ) + (when (logtest? (-> obj flags) 1) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) pp) + (set! (-> a1-2 num-params) 3) + (set! (-> a1-2 message) 'effect) + (set! (-> a1-2 param 0) (the-as uint arg0)) + (set! (-> a1-2 param 1) (the-as uint arg1)) + (set! (-> a1-2 param 2) (the-as uint s5-0)) + (if (send-event-function (-> obj process) a1-2) + (return (the-as object 0)) + ) + ) + ) + (let ((v1-10 (symbol->string arg0))) + (cond + ((and + (= (-> v1-10 data 0) 101) + (= (-> v1-10 data 1) 102) + (= (-> v1-10 data 2) 102) + (= (-> v1-10 data 3) 101) + (= (-> v1-10 data 4) 99) + (= (-> v1-10 data 5) 116) + (= (-> v1-10 data 6) 45) + ) + (let* ((s3-1 (-> obj process root)) + (v1-14 + (if + (and + (nonzero? s3-1) + (type-type? (-> s3-1 type) collide-shape-moving) + ) + s3-1 + ) + ) + (t1-1 (if v1-14 + (the-as + int + (-> (the-as collide-shape-moving v1-14) ground-pat) + ) + *footstep-surface* + ) + ) + ) + (dummy-11 obj arg0 (the-as basic arg1) s5-0 (-> obj res) t1-1) + ) + ) + ((let ((v1-18 (symbol->string arg0))) + (and + (= (-> v1-18 data 0) 103) + (= (-> v1-18 data 1) 114) + (= (-> v1-18 data 2) 111) + (= (-> v1-18 data 3) 117) + (= (-> v1-18 data 4) 112) + (= (-> v1-18 data 5) 45) + ) + ) + (set! s3-0 (cond + ((zero? s3-0) + (let + ((v0-5 + (lookup-part-group-pointer-by-name (symbol->string arg0)) + ) + ) + (when v0-5 + (set! (-> arg0 value) v0-5) + (set! s3-0 (-> v0-5 0)) + ) + ) + (the-as (pointer sparticle-launch-group) s3-0) + ) + (else + (-> (the-as (pointer sparticle-launch-group) s3-0) 0) + ) + ) + ) + (when + (and + (nonzero? s3-0) + (= + (-> (the-as sparticle-launch-group s3-0) type) + sparticle-launch-group + ) + ) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-1 + (let ((t9-7 (method-of-type part-tracker activate))) + (t9-7 + (the-as part-tracker s4-1) + (-> obj process) + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (let ((s2-1 run-function-in-process) + (s1-0 s4-1) + (s0-0 part-tracker-init) + ) + (set! sv-160 -1) + (set! sv-176 (the-as symbol #f)) + (set! sv-192 (the-as symbol #f)) + (set! sv-208 (the-as symbol #f)) + (let + ((t3-0 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-0) + ) + ) + ) + (s2-1 + s1-0 + s0-0 + (the-as sparticle-launch-group s3-0) + sv-160 + sv-176 + sv-192 + sv-208 + t3-0 + ) + ) + ) + (-> s4-1 ppointer) + ) + ) + ) + ) + ((= arg0 'camera-shake) + (activate! *camera-smush-control* 819.2 37 600 1.0 0.995) + ) + ((zero? s3-0) + (dummy-12 + obj + arg0 + (the-as basic arg1) + s5-0 + (-> obj res) + (string->sound-name (symbol->string arg0)) + ) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launcher) + (if *debug-effect-control* + (format + #t + "(~5D) effect part ~A ~A frame ~F joint ~D~%" + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (format + #t + "-----> (~5D) effect part ~A ~A frame ~F joint ~D~%" + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (the-as sparticle-launcher s3-0) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-0) + ) + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launch-group) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-3 + (let ((t9-19 (method-of-type part-tracker activate))) + (t9-19 + (the-as part-tracker s4-3) + (-> obj process) + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (let ((s2-3 run-function-in-process) + (s1-2 s4-3) + (s0-2 part-tracker-init) + ) + (set! sv-224 -1) + (set! sv-240 (the-as symbol #f)) + (set! sv-256 (the-as symbol #f)) + (set! sv-272 (the-as symbol #f)) + (let + ((t3-1 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-0) + ) + ) + ) + (s2-3 s1-2 s0-2 s3-0 sv-224 sv-240 sv-256 sv-272 t3-1) + ) + ) + (-> s4-3 ppointer) + ) + ) + ) + ((= (-> (the-as basic s3-0) type) sound-spec) + (sound-play-by-spec + (the-as sound-spec s3-0) + (new-sound-id) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-0) + ) + ) + ) + ((= (-> (the-as basic s3-0) type) death-info) + (let ((v1-67 (-> obj process draw))) + (let ((a1-42 (-> (the-as death-info s3-0) vertex-skip)) + (a0-55 + (max + 2 + (the-as + int + (/ + (-> (the-as death-info s3-0) timer) + (the-as uint (the int (-> *display* time-factor))) + ) + ) + ) + ) + ) + (when (= (-> *setting-control* current video-mode) 'pal) + (if (< (the-as uint 1) a1-42) + (set! + a1-42 + (/ (the-as uint (* (the-as uint 50) a1-42)) (the-as uint 60)) + ) + ) + ) + (let + ((a2-29 + (-> *display* frames (-> *display* last-screen) frame run-time) + ) + ) + (cond + ((< 9000 (the-as int a2-29)) + (set! a1-42 (* a1-42 4)) + ) + ((< 7000 (the-as int a2-29)) + (set! a1-42 (* a1-42 2)) + ) + ) + ) + (set! (-> v1-67 death-vertex-skip) a1-42) + (set! (-> v1-67 death-effect) (-> (the-as death-info s3-0) effect)) + (set! (-> v1-67 death-timer) (+ a0-55 1)) + ) + (set! (-> v1-67 death-timer-org) (-> v1-67 death-timer)) + (set! + (-> v1-67 death-draw-overlap) + (-> (the-as death-info s3-0) overlap) + ) + ) + (when (-> (the-as death-info s3-0) sound) + (let* ((s2-5 obj) + (s1-3 (method-of-object s2-5 dummy-12)) + (s0-3 (-> (the-as death-info s3-0) sound)) + ) + (set! sv-288 (-> obj res)) + (let + ((t1-11 + (string->sound-name + (the-as + string + (-> + (the-as + (pointer uint32) + (+ #xff38 (the-as int (-> (the-as death-info s3-0) sound))) + ) + ) + ) + ) + ) + ) + (s1-3 s2-5 (the-as symbol s0-3) (the-as basic arg1) s5-0 sv-288 t1-11) + ) + ) + ) + (let ((a1-46 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-46 from) pp) + (set! (-> a1-46 num-params) 1) + (set! (-> a1-46 message) 'death-start) + (set! (-> a1-46 param 0) (the-as uint s3-0)) + (send-event-function (-> obj process) a1-46) + ) + ) + (else + (dummy-12 + obj + arg0 + (the-as basic arg1) + s5-0 + (-> obj res) + (string->sound-name (symbol->string arg0)) + ) + ) + ) + ) + ) + 0 + ) + ) + +;; definition for method 11 of type effect-control +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defmethod + dummy-11 + effect-control + ((obj effect-control) + (arg0 symbol) + (arg1 basic) + (arg2 int) + (arg3 basic) + (arg4 int) + ) + (local-vars + (sv-48 + (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) + ) + (sv-64 sparticle-system) + (sv-80 + (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) + ) + (sv-96 sparticle-system) + ) + (let ((s1-0 (the-as sound-name #f))) + (let ((a0-4 (-> *display* frames (-> *display* last-screen) frame run-time))) + (case arg0 + (('effect-walk-step-left 'effect-run-step-left) + (set! s1-0 (sound-name-with-material 'walk arg4 "1")) + ) + (('effect-walk-step-right 'effect-run-step-right) + (set! s1-0 (sound-name-with-material 'walk arg4 "2")) + ) + (('effect-roll) + (set! s1-0 (sound-name-with-material 'roll arg4 "")) + ) + (('effect-slide) + (set! s1-0 (sound-name-with-material 'slide arg4 "")) + ) + (('effect-land) + (set! s1-0 (sound-name-with-material 'land arg4 "")) + ) + (('effect-zoom-land) + (set! s1-0 (sound-name-with-material 'zoom-land arg4 "")) + ) + (('effect-zoom-hit) + (set! s1-0 (sound-name-with-material 'zoom-hit arg4 "")) + ) + (('effect-flut-land) + (set! s1-0 (sound-name-with-material 'flut-land arg4 "")) + ) + (('effect-land-poof) + (when (< (the-as int a0-4) 9000) + (let* ((a0-13 obj) + (t9-8 (method-of-object a0-13 dummy-10)) + (v1-15 (shr (shl arg4 52) 58)) + ) + (t9-8 a0-13 (cond + ((= v1-15 5) + 'group-land-poof-sand + ) + ((= v1-15 6) + 'group-land-poof-wood + ) + ((= v1-15 13) + 'group-land-poof-crwood + ) + ((or (= v1-15 18) (= v1-15 8)) + 'group-land-poof-pcmetal + ) + ((or (= v1-15 16) (= v1-15 21)) + 'group-land-poof-metal + ) + ((= v1-15 1) + 'group-land-poof-ice + ) + ((= v1-15 9) + 'group-land-poof-snow + ) + ((= v1-15 10) + 'group-land-poof-dpsnow + ) + ((= v1-15 14) + 'group-land-poof-gravel + ) + ((= v1-15 15) + 'group-land-poof-dirt + ) + ((zero? v1-15) + 'group-land-poof-stone + ) + ((= v1-15 3) + 'group-land-poof-water + ) + ((= v1-15 4) + 'group-land-poof-tar + ) + ((= v1-15 17) + 'group-land-poof-straw + ) + ((= v1-15 19) + 'group-land-poof-swamp + ) + ((= v1-15 22) + 'group-land-poof-neutral + ) + (else + 'group-land-poof-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + ) + (('effect-run-poof) + (when (< (the-as int a0-4) 9000) + (let* ((a0-14 obj) + (t9-9 (method-of-object a0-14 dummy-10)) + (v1-20 (shr (shl arg4 52) 58)) + ) + (t9-9 a0-14 (cond + ((= v1-20 5) + 'group-run-poof-sand + ) + ((= v1-20 6) + 'group-run-poof-wood + ) + ((= v1-20 13) + 'group-run-poof-crwood + ) + ((or (= v1-20 18) (= v1-20 8)) + 'group-run-poof-pcmetal + ) + ((or (= v1-20 16) (= v1-20 21)) + 'group-run-poof-metal + ) + ((= v1-20 1) + 'group-run-poof-ice + ) + ((= v1-20 9) + 'group-run-poof-snow + ) + ((= v1-20 10) + 'group-run-poof-dpsnow + ) + ((= v1-20 14) + 'group-run-poof-gravel + ) + ((= v1-20 15) + 'group-run-poof-dirt + ) + ((zero? v1-20) + 'group-run-poof-stone + ) + ((= v1-20 3) + 'group-run-poof-water + ) + ((= v1-20 4) + 'group-run-poof-tar + ) + ((= v1-20 17) + 'group-run-poof-straw + ) + ((= v1-20 19) + 'group-run-poof-swamp + ) + ((= v1-20 22) + 'group-run-poof-neutral + ) + (else + 'group-run-poof-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + ) + (('effect-just-footprint) + (let* ((a0-15 obj) + (t9-10 (method-of-object a0-15 dummy-10)) + (v1-24 (shr (shl arg4 52) 58)) + ) + (t9-10 a0-15 (cond + ((= v1-24 5) + 'group-just-footprint-sand + ) + ((= v1-24 6) + 'group-just-footprint-wood + ) + ((= v1-24 13) + 'group-just-footprint-crwood + ) + ((or (= v1-24 18) (= v1-24 8)) + 'group-just-footprint-pcmetal + ) + ((or (= v1-24 16) (= v1-24 21)) + 'group-just-footprint-metal + ) + ((= v1-24 1) + 'group-just-footprint-ice + ) + ((= v1-24 9) + 'group-just-footprint-snow + ) + ((= v1-24 10) + 'group-just-footprint-dpsnow + ) + ((= v1-24 14) + 'group-just-footprint-gravel + ) + ((= v1-24 15) + 'group-just-footprint-dirt + ) + ((zero? v1-24) + 'group-just-footprint-stone + ) + ((= v1-24 3) + 'group-just-footprint-water + ) + ((= v1-24 4) + 'group-just-footprint-tar + ) + ((= v1-24 17) + 'group-just-footprint-straw + ) + ((= v1-24 19) + 'group-just-footprint-swamp + ) + ((= v1-24 22) + 'group-just-footprint-neutral + ) + (else + 'group-just-footprint-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + (('effect-just-poof) + (when (< (the-as int a0-4) 9000) + (let* ((a0-16 obj) + (t9-11 (method-of-object a0-16 dummy-10)) + (v1-29 (shr (shl arg4 52) 58)) + ) + (t9-11 a0-16 (cond + ((= v1-29 5) + 'group-just-poof-sand + ) + ((= v1-29 6) + 'group-just-poof-wood + ) + ((= v1-29 13) + 'group-just-poof-crwood + ) + ((or (= v1-29 18) (= v1-29 8)) + 'group-just-poof-pcmetal + ) + ((or (= v1-29 16) (= v1-29 21)) + 'group-just-poof-metal + ) + ((= v1-29 1) + 'group-just-poof-ice + ) + ((= v1-29 9) + 'group-just-poof-snow + ) + ((= v1-29 10) + 'group-just-poof-dpsnow + ) + ((= v1-29 14) + 'group-just-poof-gravel + ) + ((= v1-29 15) + 'group-just-poof-dirt + ) + ((zero? v1-29) + 'group-just-poof-stone + ) + ((= v1-29 3) + 'group-just-poof-water + ) + ((= v1-29 4) + 'group-just-poof-tar + ) + ((= v1-29 17) + 'group-just-poof-straw + ) + ((= v1-29 19) + 'group-just-poof-swamp + ) + ((= v1-29 22) + 'group-just-poof-neutral + ) + (else + 'group-just-poof-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + ) + (('effect-slide-poof) + (let* ((a0-19 obj) + (t9-12 (method-of-object a0-19 dummy-10)) + (v1-33 (shr (shl arg4 52) 58)) + ) + (t9-12 a0-19 (cond + ((= v1-33 5) + 'group-slide-poof-sand + ) + ((= v1-33 6) + 'group-slide-poof-wood + ) + ((= v1-33 13) + 'group-slide-poof-crwood + ) + ((or (= v1-33 18) (= v1-33 8)) + 'group-slide-poof-pcmetal + ) + ((or (= v1-33 16) (= v1-33 21)) + 'group-slide-poof-metal + ) + ((= v1-33 1) + 'group-slide-poof-ice + ) + ((= v1-33 9) + 'group-slide-poof-snow + ) + ((= v1-33 10) + 'group-slide-poof-dpsnow + ) + ((= v1-33 14) + 'group-slide-poof-gravel + ) + ((= v1-33 15) + 'group-slide-poof-dirt + ) + ((zero? v1-33) + 'group-slide-poof-stone + ) + ((= v1-33 3) + 'group-slide-poof-water + ) + ((= v1-33 4) + 'group-slide-poof-tar + ) + ((= v1-33 17) + 'group-slide-poof-straw + ) + ((= v1-33 19) + 'group-slide-poof-swamp + ) + ((= v1-33 22) + 'group-slide-poof-neutral + ) + (else + 'group-slide-poof-grass + ) + ) + (the-as float arg1) -1 + ) + ) + ) + (('effect-droppings) + (let* ((v1-36 (shr (shl arg4 52) 58)) + (s0-0 (cond + ((= v1-36 5) + (-> *part-id-table* 95) + ) + ((= v1-36 6) + (-> *part-id-table* 97) + ) + ((= v1-36 13) + (-> *part-id-table* 99) + ) + ((or (= v1-36 18) (= v1-36 8)) + (-> *part-id-table* 2248) + ) + ((or (= v1-36 16) (= v1-36 21)) + (-> *part-id-table* 2334) + ) + ((= v1-36 1) + (-> *part-id-table* 2249) + ) + ((= v1-36 9) + (-> *part-id-table* 2250) + ) + ((= v1-36 10) + (-> *part-id-table* 2251) + ) + ((= v1-36 14) + (-> *part-id-table* 2252) + ) + ((= v1-36 15) + (-> *part-id-table* 2253) + ) + ((zero? v1-36) + (-> *part-id-table* 98) + ) + ((= v1-36 3) + (-> *part-id-table* 2254) + ) + ((= v1-36 4) + (-> *part-id-table* 2255) + ) + ((= v1-36 17) + (-> *part-id-table* 2256) + ) + ((= v1-36 19) + (-> *part-id-table* 2257) + ) + ((= v1-36 22) + (-> *part-id-table* 2773) + ) + (else + (-> *part-id-table* 96) + ) + ) + ) + ) + (when (nonzero? s0-0) + (set! sv-48 sp-launch-particles-var) + (set! sv-64 *sp-particle-system-2d*) + (let + ((a2-36 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data arg2) + ) + ) + (a3-6 #f) + (t0-1 #f) + (t1-1 1.0) + ) + (sv-48 + sv-64 + s0-0 + a2-36 + (the-as sparticle-launch-state a3-6) + (the-as sparticle-launch-control t0-1) + t1-1 + ) + ) + ) + ) + ) + (('effect-jump-droppings) + (let* ((v1-61 (shr (shl arg4 52) 58)) + (s0-1 (cond + ((= v1-61 5) + (-> *part-id-table* 106) + ) + ((= v1-61 6) + (-> *part-id-table* 2258) + ) + ((= v1-61 13) + (-> *part-id-table* 2259) + ) + ((or (= v1-61 18) (= v1-61 8)) + (-> *part-id-table* 2260) + ) + ((or (= v1-61 16) (= v1-61 21)) + (-> *part-id-table* 2335) + ) + ((= v1-61 1) + (-> *part-id-table* 2261) + ) + ((= v1-61 9) + (-> *part-id-table* 2262) + ) + ((= v1-61 10) + (-> *part-id-table* 2263) + ) + ((= v1-61 14) + (-> *part-id-table* 2264) + ) + ((= v1-61 15) + (-> *part-id-table* 2265) + ) + ((zero? v1-61) + (-> *part-id-table* 2266) + ) + ((= v1-61 3) + (-> *part-id-table* 2267) + ) + ((= v1-61 4) + (-> *part-id-table* 2268) + ) + ((= v1-61 17) + (-> *part-id-table* 2269) + ) + ((= v1-61 19) + (-> *part-id-table* 2270) + ) + ((= v1-61 22) + (-> *part-id-table* 2774) + ) + (else + (-> *part-id-table* 107) + ) + ) + ) + ) + (when (nonzero? s0-1) + (set! sv-80 sp-launch-particles-var) + (set! sv-96 *sp-particle-system-2d*) + (let + ((a2-37 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data arg2) + ) + ) + (a3-7 #f) + (t0-2 #f) + (t1-2 1.0) + ) + (sv-80 + sv-96 + s0-1 + a2-37 + (the-as sparticle-launch-state a3-7) + (the-as sparticle-launch-control t0-2) + t1-2 + ) + ) + ) + ) + ) + ) + ) + (if s1-0 + (dummy-12 obj arg0 arg1 arg2 arg3 s1-0) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type effect-control +;; Used lq/sq +(defmethod + dummy-12 + effect-control + ((obj effect-control) + (arg0 symbol) + (arg1 basic) + (arg2 int) + (arg3 basic) + (arg4 sound-name) + ) + (local-vars + (r0-0 uint128) + (v1-10 uint128) + (sv-112 int) + (sv-128 sound-name) + (sv-144 basic) + (sv-160 (function vector vector float)) + ) + (set! sv-144 arg3) + (let ((s0-0 arg4) + (gp-0 (new 'stack 'sound-spec)) + (s5-0 (if (< arg2 0) + (the-as vector #f) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data arg2) + ) + ) + ) + ) + (set! (-> gp-0 sound-name) s0-0) + (logior! (-> gp-0 mask) 1) + (set! (-> gp-0 volume) 1024) + (logior! (-> gp-0 mask) 4) + (set! + (-> gp-0 bend) + (the int (* 327.66998 (rand-vu-float-range -100.0 100.0))) + ) + (set! sv-112 0) + (let* ((t9-3 (method-of-type res-lump get-property-data)) + (a1-6 'effect-param) + (a2-1 'exact) + (a3-1 arg1) + (t0-1 #f) + (t1-1 (the-as (pointer int) (& sv-112))) + (t2-0 *res-static-buf*) + (a1-7 + (t9-3 + (the-as res-lump sv-144) + a1-6 + a2-1 + (the-as float a3-1) + (the-as pointer t0-1) + (the-as (pointer res-tag) t1-1) + t2-0 + ) + ) + ) + (when a1-7 + (let ((t9-4 effect-param->sound-spec) + (a0-5 gp-0) + ) + (let ((v1-9 (the-as uint128 sv-112))) + (.pcpyud v1-10 v1-9 r0-0) + ) + (t9-4 + a0-5 + (the-as (pointer float) a1-7) + (shr (* (the-as int v1-10) 2) 49) + ) + ) + ) + ) + (if + (and + (nonzero? (-> gp-0 fo-max)) + (let ((f30-1 (* 4096.0 (the float (-> gp-0 fo-max))))) + (set! sv-160 vector-vector-distance) + (let ((a0-6 (ear-trans)) + (a1-8 s5-0) + ) + (< f30-1 (sv-160 a0-6 a1-8)) + ) + ) + ) + (return 0) + ) + (when *debug-effect-control* + (set! sv-128 s0-0) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (format + #t + "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " + (-> *display* base-frame-counter) + (-> obj process name) + arg0 + *temp-string* + arg1 + arg2 + ) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> gp-0 volume))) + (* 0.000656168 (the float (-> gp-0 pitch-mod))) + ) + ) + (sound-play-by-spec gp-0 (new-sound-id) s5-0) + ) + 0 + ) + +;; definition for function target-land-effect +;; INFO: Return type mismatch int vs none. +(defbehavior target-land-effect target () + (cond + ((logtest? (-> self control root-prim prim-core action) #x4000) + (dummy-10 (-> self skel effect) 'effect-land-poof -1.0 -1) + (dummy-10 (-> self skel effect) 'effect-flut-land -1.0 -1) + ) + ((logtest? (-> self control root-prim prim-core action) 512) + (sound-play-by-name + (sound-name-with-material + 'zoom-land + (the-as int (-> self control ground-pat)) + "" + ) + (new-sound-id) + (the + int + (* + 10.24 + (* + 100.0 + (the + float + (the + int + (* 10.24 (* 0.000016276043 (-> self control ground-impact-vel))) + ) + ) + ) + ) + ) + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + ((logtest? (-> self water flags) 512) + (dummy-10 (-> self skel effect) 'effect-land-water -1.0 -1) + ) + (else + (dummy-10 (-> self skel effect) 'effect-land-poof -1.0 -1) + (dummy-10 (-> self skel effect) 'effect-land -1.0 -1) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/engine/sound/gsound-h_REF.gc b/test/decompiler/reference/engine/sound/gsound-h_REF.gc index fcfc81059c..715c3d978a 100644 --- a/test/decompiler/reference/engine/sound/gsound-h_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound-h_REF.gc @@ -760,22 +760,22 @@ ;; definition of type ambient-sound (deftype ambient-sound (basic) - ((spec sound-spec :offset-assert 4) - (playing-id sound-id :offset-assert 8) - (trans vector :inline :offset-assert 16) - (name sound-name :offset-assert 32) - (play-time int64 :offset-assert 48) - (time-base int64 :offset-assert 56) - (time-random int64 :offset-assert 64) - (volume int32 :offset-assert 72) - (pitch int32 :offset-assert 76) - (falloff-near int32 :offset-assert 80) - (falloff-far int32 :offset-assert 84) - (falloff-mode int32 :offset-assert 88) - (params sound-play-parms :offset-assert 92) - (param-count int32 :offset-assert 96) - (entity entity :offset-assert 100) - (sound-count int32 :offset-assert 104) + ((spec sound-spec :offset-assert 4) + (playing-id sound-id :offset-assert 8) + (trans vector :inline :offset-assert 16) + (name sound-name :offset-assert 32) + (play-time int64 :offset-assert 48) + (time-base int64 :offset-assert 56) + (time-random int64 :offset-assert 64) + (volume int32 :offset-assert 72) + (pitch int32 :offset-assert 76) + (falloff-near int32 :offset-assert 80) + (falloff-far int32 :offset-assert 84) + (falloff-mode int32 :offset-assert 88) + (params (pointer float) :offset-assert 92) + (param-count int32 :offset-assert 96) + (entity entity :offset-assert 100) + (sound-count int32 :offset-assert 104) ) :method-count-assert 14 :size-assert #x6c diff --git a/test/decompiler/reference/engine/sound/gsound_REF.gc b/test/decompiler/reference/engine/sound/gsound_REF.gc index 5e28183373..de30ff9704 100644 --- a/test/decompiler/reference/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound_REF.gc @@ -762,7 +762,7 @@ (set! (-> obj spec) sv-16) (set! (-> obj name) sv-32) (set! (-> obj playing-id) (new-sound-id)) - (set! (-> obj params) sv-52) + (set! (-> obj params) (the-as (pointer float) sv-52)) (set! (-> obj param-count) sv-56) (set! (-> obj entity) #f) (set! (-> obj sound-count) 1)