jak2: fix metalkor regression (#2999)

This commit is contained in:
Hat Kid 2023-09-17 07:57:25 +02:00 committed by GitHub
parent a7056c2704
commit 36213aaedb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 52 deletions

View File

@ -743,7 +743,8 @@ void SSA::make_vars(const Function& function, const DecompilerTypeSystem& dts) {
function.guessed_name.to_string() == "(method 74 hal)" || function.guessed_name.to_string() == "(method 74 hal)" ||
function.guessed_name.to_string() == "water-anim-event-handler" || function.guessed_name.to_string() == "water-anim-event-handler" ||
function.guessed_name.to_string() == "(method 74 civilian)" || function.guessed_name.to_string() == "(method 74 civilian)" ||
function.guessed_name.to_string() == "(method 74 crimson-guard)"; function.guessed_name.to_string() == "(method 74 crimson-guard)" ||
function.guessed_name.to_string() == "metalkor-handler";
} }
if (function.ir2.env.version == GameVersion::Jak1) { if (function.ir2.env.version == GameVersion::Jak1) {

View File

@ -539,19 +539,8 @@
) )
;; WARN: Return type mismatch none vs object. ;; WARN: Return type mismatch none vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 72]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 107]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 143]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 173]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 254]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 266]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 291]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 489]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 571]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 580]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 666]
(defbehavior metalkor-handler metalkor ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (defbehavior metalkor-handler metalkor ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-2 none)) (local-vars (v0-2 object))
(the-as (the-as
object object
(case arg2 (case arg2
@ -570,7 +559,7 @@
) )
) )
) )
(metalkor-go-next-stage) (the-as object (metalkor-go-next-stage))
) )
(('track) (('track)
(-> self trackable) (-> self trackable)
@ -621,11 +610,11 @@
(let ((gp-3 (-> self entity extra))) (let ((gp-3 (-> self entity extra)))
(cond (cond
((send-event (handle->process (-> self flitter-gem-tracker)) 'spawn-with-gem?) ((send-event (handle->process (-> self flitter-gem-tracker)) 'spawn-with-gem?)
(set! v0-2 (the-as none (logclear (-> gp-3 perm status) (entity-perm-status save)))) (set! v0-2 (logclear (-> gp-3 perm status) (entity-perm-status save)))
(set! (-> gp-3 perm status) (the-as entity-perm-status v0-2)) (set! (-> gp-3 perm status) (the-as entity-perm-status v0-2))
) )
(else (else
(set! v0-2 (the-as none (logior (-> gp-3 perm status) (entity-perm-status save)))) (set! v0-2 (logior (-> gp-3 perm status) (entity-perm-status save)))
(set! (-> gp-3 perm status) (the-as entity-perm-status v0-2)) (set! (-> gp-3 perm status) (the-as entity-perm-status v0-2))
) )
) )
@ -655,7 +644,7 @@
(metalkor-all-spinners-on) (metalkor-all-spinners-on)
) )
(else (else
(set! v0-2 (the-as none (+ (-> self countdown-to-roar) -1))) (set! v0-2 (+ (-> self countdown-to-roar) -1))
(set! (-> self countdown-to-roar) (the-as int v0-2)) (set! (-> self countdown-to-roar) (the-as int v0-2))
v0-2 v0-2
) )
@ -717,7 +706,8 @@
(if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode))
(set! f0-4 (* 0.6666667 f0-4)) (set! f0-4 (* 0.6666667 f0-4))
) )
(if (not (and (-> self next-state) (let ((v1-109 (-> self next-state name))) ;; og:preserve-this if -> when
(when (not (and (-> self next-state) (let ((v1-109 (-> self next-state name)))
(or (= v1-109 'fall-down) (or (= v1-109 'fall-down)
(= v1-109 'overload-recover) (= v1-109 'overload-recover)
(= v1-109 'tail-attack) (= v1-109 'tail-attack)
@ -727,6 +717,7 @@
) )
) )
) )
;; og:preserve-this damage number cheat
(#when PC_PORT (#when PC_PORT
(let* ((old-hp (-> self stage-hit-points)) (let* ((old-hp (-> self stage-hit-points))
(dmg-to-use (if (= (-> self stage) 3) (dmg-to-use (if (= (-> self stage) 3)
@ -749,12 +740,12 @@
(logtest? (penetrate dark-bomb) (-> (the-as attack-info s5-2) penetrate-using)) (logtest? (penetrate dark-bomb) (-> (the-as attack-info s5-2) penetrate-using))
(= (-> self stage-hit-points) 0.0) (= (-> self stage-hit-points) 0.0)
) )
(set! v0-2 (the-as none (+ (current-time) (seconds 1)))) (set! v0-2 (+ (current-time) (seconds 1)))
(set! (-> self next-stage-timer) (the-as time-frame v0-2)) (set! (-> self next-stage-timer) (the-as time-frame v0-2))
v0-2 v0-2
) )
((= (-> self stage-hit-points) 0.0) ((= (-> self stage-hit-points) 0.0)
(metalkor-go-next-stage) (the-as object (metalkor-go-next-stage))
) )
((and (-> self next-state) (= (-> self next-state name) 'hang-shoot-n-launch)) ((and (-> self next-state) (= (-> self next-state name) 'hang-shoot-n-launch))
(metalkor-setup-hit-anim (metalkor-setup-hit-anim
@ -771,7 +762,7 @@
(or (not (and v1-139 (= v1-139 (-> self draw art-group data 7)))) (>= (ja-aframe-num 0) 10.0)) (or (not (and v1-139 (= v1-139 (-> self draw art-group data 7)))) (>= (ja-aframe-num 0) 10.0))
) )
) )
(metalkor-setup-hit-anim (the-as object (metalkor-setup-hit-anim
(the-as attack-info s5-2) (the-as attack-info s5-2)
(the-as process-drawable arg0) (the-as process-drawable arg0)
(-> self draw art-group data 25) (-> self draw art-group data 25)
@ -779,6 +770,7 @@
(the-as float (-> self draw art-group data 26)) (the-as float (-> self draw art-group data 26))
) )
) )
)
((and (-> self next-state) (let ((v1-153 (-> self next-state name))) ((and (-> self next-state) (let ((v1-153 (-> self next-state name)))
(or (= v1-153 'chase-target) (or (= v1-153 'chase-target)
(= v1-153 'standing-shot) (= v1-153 'standing-shot)

View File

@ -562,19 +562,8 @@
;; definition for function metalkor-handler ;; definition for function metalkor-handler
;; INFO: Used lq/sq ;; INFO: Used lq/sq
;; WARN: Return type mismatch none vs object. ;; WARN: Return type mismatch none vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 72]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 107]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 143]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 173]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 254]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 266]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 291]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 489]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 571]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 580]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 666]
(defbehavior metalkor-handler metalkor ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (defbehavior metalkor-handler metalkor ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-2 none)) (local-vars (v0-2 object))
(the-as (the-as
object object
(case arg2 (case arg2
@ -593,7 +582,7 @@
) )
) )
) )
(metalkor-go-next-stage) (the-as object (metalkor-go-next-stage))
) )
(('track) (('track)
(-> self trackable) (-> self trackable)
@ -644,11 +633,11 @@
(let ((gp-3 (-> self entity extra))) (let ((gp-3 (-> self entity extra)))
(cond (cond
((send-event (handle->process (-> self flitter-gem-tracker)) 'spawn-with-gem?) ((send-event (handle->process (-> self flitter-gem-tracker)) 'spawn-with-gem?)
(set! v0-2 (the-as none (logclear (-> gp-3 perm status) (entity-perm-status save)))) (set! v0-2 (logclear (-> gp-3 perm status) (entity-perm-status save)))
(set! (-> gp-3 perm status) (the-as entity-perm-status v0-2)) (set! (-> gp-3 perm status) (the-as entity-perm-status v0-2))
) )
(else (else
(set! v0-2 (the-as none (logior (-> gp-3 perm status) (entity-perm-status save)))) (set! v0-2 (logior (-> gp-3 perm status) (entity-perm-status save)))
(set! (-> gp-3 perm status) (the-as entity-perm-status v0-2)) (set! (-> gp-3 perm status) (the-as entity-perm-status v0-2))
) )
) )
@ -678,7 +667,7 @@
(metalkor-all-spinners-on) (metalkor-all-spinners-on)
) )
(else (else
(set! v0-2 (the-as none (+ (-> self countdown-to-roar) -1))) (set! v0-2 (+ (-> self countdown-to-roar) -1))
(set! (-> self countdown-to-roar) (the-as int v0-2)) (set! (-> self countdown-to-roar) (the-as int v0-2))
v0-2 v0-2
) )
@ -759,12 +748,12 @@
(logtest? (penetrate dark-bomb) (-> (the-as attack-info s5-2) penetrate-using)) (logtest? (penetrate dark-bomb) (-> (the-as attack-info s5-2) penetrate-using))
(= (-> self stage-hit-points) 0.0) (= (-> self stage-hit-points) 0.0)
) )
(set! v0-2 (the-as none (+ (current-time) (seconds 1)))) (set! v0-2 (+ (current-time) (seconds 1)))
(set! (-> self next-stage-timer) (the-as time-frame v0-2)) (set! (-> self next-stage-timer) (the-as time-frame v0-2))
v0-2 v0-2
) )
((= (-> self stage-hit-points) 0.0) ((= (-> self stage-hit-points) 0.0)
(metalkor-go-next-stage) (the-as object (metalkor-go-next-stage))
) )
((and (-> self next-state) (= (-> self next-state name) 'hang-shoot-n-launch)) ((and (-> self next-state) (= (-> self next-state name) 'hang-shoot-n-launch))
(metalkor-setup-hit-anim (metalkor-setup-hit-anim
@ -781,7 +770,7 @@
(or (not (and v1-139 (= v1-139 (-> self draw art-group data 7)))) (>= (ja-aframe-num 0) 10.0)) (or (not (and v1-139 (= v1-139 (-> self draw art-group data 7)))) (>= (ja-aframe-num 0) 10.0))
) )
) )
(metalkor-setup-hit-anim (the-as object (metalkor-setup-hit-anim
(the-as attack-info s5-2) (the-as attack-info s5-2)
(the-as process-drawable arg0) (the-as process-drawable arg0)
(-> self draw art-group data 25) (-> self draw art-group data 25)
@ -789,6 +778,7 @@
(the-as float (-> self draw art-group data 26)) (the-as float (-> self draw art-group data 26))
) )
) )
)
((and (-> self next-state) (let ((v1-153 (-> self next-state name))) ((and (-> self next-state) (let ((v1-153 (-> self next-state name)))
(or (= v1-153 'chase-target) (or (= v1-153 'chase-target)
(= v1-153 'standing-shot) (= v1-153 'standing-shot)