decomp: fix some enemy decomp (#3008)

This commit is contained in:
Hat Kid 2023-09-20 11:46:48 +02:00 committed by GitHub
parent cbbbd661d9
commit 697b07abd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 38 additions and 41 deletions

View file

@ -33839,7 +33839,7 @@
(define-extern *enemy-dummy-shadow-control* shadow-control)
(define-extern get-penetrate-using-from-attack-event (function process-drawable event-message-block penetrate))
(define-extern enemy-init-by-other (function process-drawable transformq none :behavior enemy))
(define-extern enemy-init-by-other (function process-drawable enemy-init-by-other-params none :behavior enemy))
(define-extern enemy-event-handler (function process int symbol event-message-block object :behavior enemy))
(define-extern enemy-simple-post (function none :behavior enemy))
(define-extern enemy-falling-post (function none :behavior enemy))
@ -35193,7 +35193,7 @@
(get-spawn-delay (_type_) int 35)
(get-best-spawner (_type_) battle-spawner 36)
(spawner-free? (_type_ battle-spawner) symbol 37)
(spawn-from-breed (_type_ battle-breed transformq) handle 38)
(spawn-from-breed (_type_ battle-breed enemy-init-by-other-params) handle 38)
(spawn-from-spawner (_type_ battle-spawner symbol) none 39)
(spawn-initial-creatures (_type_) none 40)
(get-random-breed (_type_ battle-spawner) battle-breed 41)

View file

@ -1069,7 +1069,7 @@
"(code target-carry-drop)": [[672, ["inline-array", "sphere", 1]]],
"(code target-carry-throw)": [[640, ["inline-array", "sphere", 1]]],
"(code target-hit)": [[16, "vector"]],
"(method 39 battle)": [[64, "transformq"]],
"(method 39 battle)": [[64, "enemy-init-by-other-params"]],
"add-collide-debug-box": [[16, "bounding-box"]],
"collide-list-fill-bg-using-box": [
[32, "matrix"],
@ -1322,7 +1322,7 @@
[176, "vector"]
],
"(method 11 predator-manager)": [
[32, "transformq"],
[32, "enemy-init-by-other-params"],
[80, "vector"],
[112, "vector"]
],

View file

@ -9,7 +9,8 @@
;; NOTE - for battle
(declare-type enemy process-focusable)
(define-extern enemy-init-by-other (function process-drawable transformq none :behavior enemy))
(declare-type enemy-init-by-other-params structure)
(define-extern enemy-init-by-other (function process-drawable enemy-init-by-other-params none :behavior enemy))
;; +++enemy-flag
(defenum enemy-flag

View file

@ -1159,16 +1159,16 @@
(none)
)
(defbehavior enemy-init-by-other enemy ((arg0 process-drawable) (arg1 transformq))
(let ((a1-1 (-> arg1 scale x)))
(defbehavior enemy-init-by-other enemy ((arg0 process-drawable) (arg1 enemy-init-by-other-params))
(let ((a1-1 (-> arg1 entity)))
(if a1-1
(process-entity-set! self (the-as entity a1-1))
(process-entity-set! self a1-1)
)
)
(if (-> arg1 scale y)
(if (-> arg1 directed?)
(logior! (-> self enemy-flags) (enemy-flag alert))
)
(if (-> arg1 scale z)
(if (-> arg1 no-initial-move-to-ground?)
(set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> self enemy-flags))))
)
(init-enemy-collision! self)

View file

@ -161,7 +161,7 @@
(get-spawn-delay (_type_) int 35)
(get-best-spawner (_type_) battle-spawner 36)
(spawner-free? (_type_ battle-spawner) symbol 37)
(spawn-from-breed (_type_ battle-breed transformq) handle 38)
(spawn-from-breed (_type_ battle-breed enemy-init-by-other-params) handle 38)
(spawn-from-spawner (_type_ battle-spawner symbol) none 39)
(spawn-initial-creatures (_type_) none 40)
(get-random-breed (_type_ battle-spawner) battle-breed 41)
@ -841,7 +841,7 @@
(dotimes (s5-1 (-> obj spawners length))
(let ((s4-1 (-> obj spawners data s5-1)))
(#when PC_PORT
;; added. a battle may have enemies from an unloaded level in its ally list (e.g. atoll battle has atollext enemies).
;; og:preserve-this added. a battle may have enemies from an unloaded level in its ally list (e.g. atoll battle has atollext enemies).
(if (not (valid? (-> s4-1 entity) entity-actor "battle spawners" #f *stdcon*))
(deactivate obj))
)
@ -1086,7 +1086,7 @@
)
;; WARN: Return type mismatch int vs handle.
(defmethod spawn-from-breed battle ((obj battle) (arg0 battle-breed) (arg1 transformq))
(defmethod spawn-from-breed battle ((obj battle) (arg0 battle-breed) (arg1 enemy-init-by-other-params))
(let* ((s3-0 (-> arg0 breed-type))
(s4-0 (get-process *default-dead-pool* s3-0 #x4000))
(v1-1 (when s4-0
@ -1146,15 +1146,15 @@
)
)
)
(let ((s1-1 (new 'stack-no-clear 'transformq))
(let ((s1-1 (new 'stack-no-clear 'enemy-init-by-other-params))
(s2-1 (!= s2-0 #f))
(s0-1 (get-random-breed obj arg0))
)
(set! (-> s1-1 trans quad) (-> s3-0 quad))
(quaternion-copy! (-> s1-1 quat) s4-0)
(set! (-> s1-1 scale x) (the-as float (-> arg0 entity)))
(set! (-> s1-1 scale y) (the-as float #t))
(set! (-> s1-1 scale z) (the-as float s2-1))
(set! (-> s1-1 entity) (-> arg0 entity))
(set! (-> s1-1 directed?) #t)
(set! (-> s1-1 no-initial-move-to-ground?) s2-1)
(let ((v0-7 (spawn-from-breed obj s0-1 s1-1)))
(when (handle->process v0-7)
(set! (-> arg0 creature) v0-7)
@ -1422,7 +1422,7 @@
(gp-0 (-> obj allies length))
)
(#when PC_PORT
;; added. a battle may have enemies from an unloaded level in its ally list (e.g. atoll battle has atollext enemies).
;; og:preserve-this added. a battle may have enemies from an unloaded level in its ally list (e.g. atoll battle has atollext enemies).
(dotimes (i gp-0)
(if (not (valid? (-> v1-0 data i entity) entity-actor "battle allies" #f *stdcon*))
(deactivate self)))

View file

@ -1716,7 +1716,7 @@ This commonly includes things such as:
(dotimes (s4-1 (the-as int (-> *predator-graph* node-count)))
(let ((s3-1 (-> *predator-graph* node s4-1)))
(when (logtest? (-> s3-1 flags) (predator-node-flag spawnable))
(let ((s2-1 (new 'stack-no-clear 'transformq)))
(let ((s2-1 (new 'stack-no-clear 'enemy-init-by-other-params)))
(new 'stack-no-clear 'vector)
(let ((s0-0 (new 'stack-no-clear 'vector))
(s1-0 (new 'stack-no-clear 'vector))
@ -1748,9 +1748,9 @@ This commonly includes things such as:
(set! (-> s2-1 trans quad) (-> s1-0 quad))
)
(quaternion-copy! (-> s2-1 quat) *unity-quaternion*)
(set! (-> s2-1 scale x) (the-as float (-> obj actor-group 1 data s5-2 actor)))
(set! (-> s2-1 scale y) (the-as float #f))
(set! (-> s2-1 scale z) (the-as float #f))
(set! (-> s2-1 entity) (-> obj actor-group 1 data s5-2 actor))
(set! (-> s2-1 directed?) #f)
(set! (-> s2-1 no-initial-move-to-ground?) #f)
(let* ((s1-2 (ppointer->process (process-spawn predator :init enemy-init-by-other obj s2-1 :to obj)))
(s2-2 (if (type? s1-2 process-focusable)
s1-2

View file

@ -1238,16 +1238,16 @@
;; definition for function enemy-init-by-other
;; INFO: Used lq/sq
(defbehavior enemy-init-by-other enemy ((arg0 process-drawable) (arg1 transformq))
(let ((a1-1 (-> arg1 scale x)))
(defbehavior enemy-init-by-other enemy ((arg0 process-drawable) (arg1 enemy-init-by-other-params))
(let ((a1-1 (-> arg1 entity)))
(if a1-1
(process-entity-set! self (the-as entity a1-1))
(process-entity-set! self a1-1)
)
)
(if (-> arg1 scale y)
(if (-> arg1 directed?)
(logior! (-> self enemy-flags) (enemy-flag alert))
)
(if (-> arg1 scale z)
(if (-> arg1 no-initial-move-to-ground?)
(set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag vulnerable-backup) (-> self enemy-flags))))
)
(init-enemy-collision! self)
@ -3875,7 +3875,3 @@ This commonly includes things such as:
(defbehavior ja-group-index? enemy ((arg0 int))
(ja-group? (-> self draw art-group data arg0))
)

View file

@ -260,7 +260,7 @@
(get-spawn-delay (_type_) int 35)
(get-best-spawner (_type_) battle-spawner 36)
(spawner-free? (_type_ battle-spawner) symbol 37)
(spawn-from-breed (_type_ battle-breed transformq) handle 38)
(spawn-from-breed (_type_ battle-breed enemy-init-by-other-params) handle 38)
(spawn-from-spawner (_type_ battle-spawner symbol) none 39)
(spawn-initial-creatures (_type_) none 40)
(get-random-breed (_type_ battle-spawner) battle-breed 41)
@ -1219,7 +1219,7 @@
;; definition for method 38 of type battle
;; WARN: Return type mismatch int vs handle.
(defmethod spawn-from-breed battle ((obj battle) (arg0 battle-breed) (arg1 transformq))
(defmethod spawn-from-breed battle ((obj battle) (arg0 battle-breed) (arg1 enemy-init-by-other-params))
(let* ((s3-0 (-> arg0 breed-type))
(s4-0 (get-process *default-dead-pool* s3-0 #x4000))
(v1-1 (when s4-0
@ -1281,15 +1281,15 @@
)
)
)
(let ((s1-1 (new 'stack-no-clear 'transformq))
(let ((s1-1 (new 'stack-no-clear 'enemy-init-by-other-params))
(s2-1 (!= s2-0 #f))
(s0-1 (get-random-breed obj arg0))
)
(set! (-> s1-1 trans quad) (-> s3-0 quad))
(quaternion-copy! (-> s1-1 quat) s4-0)
(set! (-> s1-1 scale x) (the-as float (-> arg0 entity)))
(set! (-> s1-1 scale y) (the-as float #t))
(set! (-> s1-1 scale z) (the-as float s2-1))
(set! (-> s1-1 entity) (-> arg0 entity))
(set! (-> s1-1 directed?) #t)
(set! (-> s1-1 no-initial-move-to-ground?) s2-1)
(let ((v0-7 (spawn-from-breed obj s0-1 s1-1)))
(when (handle->process v0-7)
(set! (-> arg0 creature) v0-7)

View file

@ -1838,7 +1838,7 @@ This commonly includes things such as:
(dotimes (s4-1 (the-as int (-> *predator-graph* node-count)))
(let ((s3-1 (-> *predator-graph* node s4-1)))
(when (logtest? (-> s3-1 flags) (predator-node-flag spawnable))
(let ((s2-1 (new 'stack-no-clear 'transformq)))
(let ((s2-1 (new 'stack-no-clear 'enemy-init-by-other-params)))
(new 'stack-no-clear 'vector)
(let ((s0-0 (new 'stack-no-clear 'vector))
(s1-0 (new 'stack-no-clear 'vector))
@ -1870,9 +1870,9 @@ This commonly includes things such as:
(set! (-> s2-1 trans quad) (-> s1-0 quad))
)
(quaternion-copy! (-> s2-1 quat) *unity-quaternion*)
(set! (-> s2-1 scale x) (the-as float (-> obj actor-group 1 data s5-2 actor)))
(set! (-> s2-1 scale y) (the-as float #f))
(set! (-> s2-1 scale z) (the-as float #f))
(set! (-> s2-1 entity) (-> obj actor-group 1 data s5-2 actor))
(set! (-> s2-1 directed?) #f)
(set! (-> s2-1 no-initial-move-to-ground?) #f)
(let* ((s1-2 (ppointer->process (process-spawn predator :init enemy-init-by-other obj s2-1 :to obj)))
(s2-2 (if (type? s1-2 process-focusable)
s1-2