d/jak2: decompile fodder and nav-enemy (#2080)

fixes #1983 

First functioning enemy!


https://user-images.githubusercontent.com/13153231/210184845-f1d93491-11f5-4a64-b69c-41e535992ebc.mp4
This commit is contained in:
Tyler Wilding
2023-01-01 21:03:07 -05:00
committed by GitHub
parent a77d9fac01
commit 284fb09997
27 changed files with 8878 additions and 328 deletions
+25 -29
View File
@@ -22473,11 +22473,11 @@
(handle-birth "Handle the parent nav-mesh-entity birth." (_type_) none 24)
(handle-kill "Handle the parent nav-mesh-entity kill." (_type_) none 25)
(update-navigation (_type_) none 26)
(new-nav-control (_type_ process-drawable int) nav-control 27)
(new-nav-control (_type_ process-drawable) nav-control 27)
(remove-nav-control (_type_ nav-control) none 28)
(add-process-drawable-to-navmesh (_type_ process-drawable symbol) none 29)
(remove-process-drawable (_type_ process-drawable) none 30)
(change-to (_type_ process-drawable symbol) none 31)
(change-to (_type_ process-drawable) none 31)
(link-by-id "arg1 is a [[nav-mesh-link]] `id`" (_type_ uint) symbol 32)
(unlink-by-id "arg1 is a [[nav-mesh-link]] `id`" (_type_ uint) symbol 33)
(nav-mesh-method-34 (_type_ vector vector float) float 34)
@@ -32240,7 +32240,7 @@
:flag-assert #xb00000010
(:methods
(idle-control-method-9 (_type_ (pointer uint32)) none 9)
(idle-control-method-10 (_type_ process-drawable) none 10)
(idle-control-method-10 (_type_ process-drawable) none :behavior process-drawable 10)
)
)
@@ -32535,7 +32535,7 @@
(jump-dest vector :inline :offset 368)
(focus enemy-focus :inline :offset-assert 384)
(incoming enemy-attack-info :inline :offset-assert 416)
(actor-group actor-group :offset-assert 480)
(actor-group (pointer actor-group) :offset-assert 480)
(actor-group-count int32 :offset-assert 484)
(neck joint-mod :offset-assert 488)
(on-notice symbol :offset-assert 492)
@@ -32751,6 +32751,7 @@
:size-assert #x25c
:flag-assert #xb201e0025c
(:methods
(enemy-method-112 (_type_ nav-enemy-info) float :replace 112)
(enemy-method-113 (_type_ nav-enemy-info) none :replace 113)
(taunt () _type_ :state 137)
(pacing () _type_ :state 138)
@@ -40399,56 +40400,51 @@
;; fodder ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#|
(deftype fodder-anim-info (structure)
((anim-index int32 :offset-assert 0)
)
:pack-me
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
|#
#|
(deftype fodder-global-info (basic)
((prev-blue-hit int8 :offset-assert 4)
(blue-hit-anim UNKNOWN 3 :offset-assert 8)
(blue-hit-anim fodder-anim-info 3 :inline :offset-assert 8)
)
:method-count-assert 9
:size-assert #x14
:flag-assert #x900000014
)
|#
#|
(deftype fodder (nav-enemy)
((left-eye basic :offset-assert 600)
(right-eye basic :offset-assert 604)
(look-at-other uint64 :offset-assert 612)
(neck-away-from basic :offset-assert 620)
(look-at-other-time time-frame :offset-assert 628)
(focus-pos vector :inline :offset-assert 348)
(slow-timer uint64 :offset-assert 652)
(fast-timer uint64 :offset-assert 660)
(attack-type uint64 :offset-assert 668)
(test-vec vector :inline :offset-assert 684)
((left-eye joint-mod :offset-assert 604)
(right-eye joint-mod :offset-assert 608)
(look-at-other handle :offset-assert 616)
(neck-away-from basic :offset-assert 624)
(look-at-other-time time-frame :offset-assert 632)
(pad-iuj1n23i1 uint32 3 :offset-assert 640)
(slow-timer time-frame :offset-assert 656)
(fast-timer time-frame :offset-assert 664)
(attack-type uint64 :offset-assert 672)
(test-vec vector :inline :offset-assert 688)
)
:method-count-assert 183
:size-assert #x2c0
:flag-assert #xb7024002c0
(:methods
(fodder-method-178 () none 178)
(fodder-method-179 () none 179)
(fodder-method-180 () none 180)
(fodder-method-181 () none 181)
(fodder-method-182 () none 182)
(fodder-method-178 (_type_) none 178)
(fodder-method-179 (_type_ vector) float 179)
(fodder-method-180 (_type_) symbol 180)
(fodder-method-181 (_type_ symbol) none 181)
(fodder-method-182 (_type_) float 182)
)
)
|#
;; (define-extern *fodder-global-info* fodder-global-info)
;; (define-extern *fodder-nav-enemy-info* nav-enemy-info)
;; (define-extern fodder-setup-eye-control function)
(define-extern *fodder-global-info* fodder-global-info)
(define-extern *fodder-nav-enemy-info* nav-enemy-info)
(define-extern fodder-setup-eye-control (function joint-mod float))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; hal-h ;;
+1 -1
View File
@@ -200,7 +200,7 @@
"HIDEOUT.DGO",
"KIOSK.DGO",
"DMI.DGO",
// "RUI.DGO",
"RUI.DGO",
"VI1.DGO",
"CIB.DGO"
]
@@ -1273,5 +1273,6 @@
"(method 18 nav-mesh)": [[16, "nav-ray"]],
"(post idle gun-dummy)": [[16, "event-message-block"]],
"(method 23 training-manager)": [[16, "vector"]],
"birth-pickup-at-point": [[16, "vector"]]
"birth-pickup-at-point": [[16, "vector"]],
"(code notice fodder)": [[112, "vector"]]
}
+46 -14
View File
@@ -3918,34 +3918,34 @@
"(method 7 enemy)": [
[14, "t9", "(function process-focusable int process-focusable)"]
],
"nav-enemy-chase-post": [[15, "a0", "process-focusable"]],
"nav-enemy-flee-post": [[16, "a0", "process-focusable"]],
"nav-enemy-face-focus-post": [[24, "a0", "process-focusable"]],
"nav-enemy-stare-post": [[24, "a0", "process-focusable"]],
"nav-enemy-chase-post": [[[15, 19], "a0", "process-focusable"]],
"nav-enemy-flee-post": [[[16, 20], "a0", "process-focusable"]],
"nav-enemy-face-focus-post": [[[24, 28], "a0", "process-focusable"]],
"nav-enemy-stare-post": [[[24, 28], "a0", "process-focusable"]],
"(code active nav-enemy)": [
[30, "v1", "art-joint-anim"],
[127, "v1", "art-joint-anim"],
[189, "v1", "art-joint-anim"],
[298, "v1", "art-joint-anim"]
],
"(enter notice nav-enemy)": [[21, "a0", "process-focusable"]],
"(enter notice nav-enemy)": [[[21, 25], "a0", "process-focusable"]],
"(code notice nav-enemy)": [[31, "v1", "art-joint-anim"]],
"(code stare nav-enemy)": [[23, "gp", "art-joint-anim"]],
"(enter taunt nav-enemy)": [[37, "gp", "process-focusable"]],
"(enter taunt nav-enemy)": [[[37, 42], "gp", "process-focusable"]],
"(code taunt nav-enemy)": [[84, "v1", "art-joint-anim"]],
"(enter pacing nav-enemy)": [[103, "gp", "process-focusable"]],
"(trans pacing nav-enemy)": [[14, "a0", "process-focusable"]],
"(enter pacing nav-enemy)": [[[103, 108], "gp", "process-focusable"]],
"(trans pacing nav-enemy)": [[[14, 18], "a0", "process-focusable"]],
"(code pacing nav-enemy)": [[34, "gp", "art-joint-anim"]],
"(enter circling nav-enemy)": [[69, "gp", "process-focusable"]],
"(trans circling nav-enemy)": [[14, "a0", "process-focusable"]],
"(enter circling nav-enemy)": [[[69, 74], "gp", "process-focusable"]],
"(trans circling nav-enemy)": [[[14, 18], "a0", "process-focusable"]],
"(code circling nav-enemy)": [[34, "gp", "art-joint-anim"]],
"(code hit nav-enemy)": [[30, "v1", "art-joint-anim"]],
"(code debug-control nav-enemy)": [[28, "v1", "art-joint-anim"]],
"(method 55 nav-enemy)": [[[74, 78], "a0", "process-focusable"]],
"(method 161 nav-enemy)": [[22, "v1", "process-focusable"]],
"(method 161 nav-enemy)": [[[22, 27], "v1", "process-focusable"]],
"(method 160 nav-enemy)": [
[19, "a0", "process-focusable"],
[35, "s5", "process-focusable"]
[18, "s5", "process-focusable"],
[[35, 40], "s5", "process-focusable"]
],
"(method 32 youngsamos-npc)": [
[61, "t9", "(function process-taskable none)"]
@@ -5002,6 +5002,7 @@
"(method 108 enemy)": [[[2, 51], "s4", "touching-shapes-entry"]],
"(method 130 enemy)": [[37, "t1", "int"]],
"(method 113 enemy)": [["_stack_", 16, "res-tag"]],
"(method 113 nav-enemy)": [["_stack_", 16, "res-tag"]],
"(code falling-ambush grunt)": [[53, "v1", "art-joint-anim"]],
"(code active grunt)": [
[227, "gp", "art-joint-anim"],
@@ -5511,5 +5512,36 @@
"(method 9 fact-info)": [
[245, "a0", "process-drawable"],
[293, "a0", "process-drawable"]
]
],
"(method 179 fodder)": [[[16, 20], "a0", "process-focusable"]],
"(code notice fodder)": [
[78, "v1", "art-joint-anim"],
[54, "v1", "float"],
[150, "v1", "float"]
],
"(code active fodder)": [
[26, "v1", "art-joint-anim"],
[112, "v1", "art-joint-anim"],
[283, "v1", "art-joint-anim"],
[179, "v1", "art-joint-anim"]
],
"(method 182 fodder)": [[34, "v1", "float"]],
"(trans hostile fodder)": [
[[25, 29], "a0", "process-focusable"],
[105, "v1", "float"]
],
"(code circling fodder)": [
[243, "v1", "art-joint-anim"],
[129, "gp", "art-joint-anim"]
],
"(method 77 fodder)": [
[57, "s5", "art-joint-anim"],
[85, "s4", "art-joint-anim"]
],
"(method 78 fodder)": [[16, "v1", "art-joint-anim"]],
"(method 181 fodder)": [[2, "v1", "collide-shape-prim-group"]],
"(method 7 fodder)": [[19, "t9", "(function nav-enemy int nav-enemy)"]],
"(post idle fodder)": [[4, "t9", "(function none)"]],
"(method 180 fodder)": [[24, "s1", "fodder"]],
"(method 55 fodder)": [[29, "s5", "process-drawable"]]
}
+2 -1
View File
@@ -2056,7 +2056,8 @@ void add_vertices_and_static_draw(tfrag3::TieTree& tree,
for (auto& vert : strip.verts) {
tree.packed_vertices.vertices.push_back(
{vert.pos.x(), vert.pos.y(), vert.pos.z(), vert.tex.x(), vert.tex.y()});
ASSERT(vert.tex.z() == 1.);
lg::warn("SKIPPING ASSERT in extract_tie! TODO!");
// ASSERT(vert.tex.z() == 1.);
}
int end = tree.packed_vertices.vertices.size();
frag_vert_indices.emplace_back(start, end);
+5 -5
View File
@@ -1533,9 +1533,13 @@ inline void get_fake_spad_addr2(int dst, void* sym_addr, u32 offset, ExecutionCo
c->gprs[dst].du64[0] = val + offset;
}
inline void* align4_ptr(void* spad_sym_addr) {
return (void*)align4(((uintptr_t)spad_sym_addr - 3));
}
inline void spad_to_dma(void* spad_sym_addr, u32 madr, u32 sadr, u32 qwc) {
u32 spad_addr_goal;
memcpy(&spad_addr_goal, spad_sym_addr, 4);
memcpy(&spad_addr_goal, align4_ptr(spad_sym_addr), 4);
sadr -= spad_addr_goal;
ASSERT((madr & 0xf) == 0);
@@ -1549,10 +1553,6 @@ inline void spad_to_dma(void* spad_sym_addr, u32 madr, u32 sadr, u32 qwc) {
memcpy(spad_addr_c, g_ee_main_mem + madr, qwc * 16);
}
inline void* align4_ptr(void* spad_sym_addr) {
return (void*)align4(((uintptr_t)spad_sym_addr - 3));
}
inline void spad_to_dma_no_sadr_off(void* spad_sym_addr, u32 madr, u32 sadr, u32 qwc) {
u32 spad_addr_goal;
memcpy(&spad_addr_goal, align4_ptr(spad_sym_addr), 4);
+37 -37
View File
@@ -263,43 +263,43 @@
(deftype enemy (process-focusable)
((root-override2 collide-shape-moving :offset 128)
(fact-info-override fact-info-enemy :offset 160)
(enemy-flags enemy-flag :offset-assert 208)
(enemy-info enemy-info :offset-assert 216)
(hit-points int32 :offset-assert 220)
(gnd-collide uint32 :offset-assert 224)
(attack-id uint32 :offset-assert 228)
(persistent-attack-id uint32 :offset-assert 232)
(water-max-height meters :offset-assert 236)
(water-surface-height meters :offset-assert 240)
(desired-angle degrees :offset-assert 244)
(jump-why uint64 :offset-assert 248)
(penetrated-by-all penetrate :offset-assert 256)
(penetrated-flinch penetrate :offset-assert 264)
(penetrated-knocked penetrate :offset-assert 272)
(reaction-time uint64 :offset-assert 280)
(notice-time uint64 :offset-assert 288)
(state-timeout uint64 :offset-assert 296)
(auto-reset-penetrate-time uint64 :offset-assert 304)
(hit-focus-time uint64 :offset-assert 312)
(last-draw-time uint64 :offset-assert 320)
(starting-time uint64 :offset-assert 328)
(fated-time uint64 :offset-assert 336)
(focus-pos vector :inline :offset-assert 352)
(event-param-point vector :inline :offset-assert 368)
(jump-dest vector :inline :offset 368)
(focus enemy-focus :inline :offset-assert 384)
(incoming enemy-attack-info :inline :offset-assert 416)
(actor-group actor-group :offset-assert 480)
(actor-group-count int32 :offset-assert 484)
(neck joint-mod :offset-assert 488)
(on-notice symbol :offset-assert 492)
(on-active symbol :offset-assert 496)
(on-hostile symbol :offset-assert 500)
(on-death symbol :offset-assert 504)
(idle-anim-player idle-control :inline :offset-assert 512)
(rand-gen symbol :offset-assert 528)
((root-override2 collide-shape-moving :offset 128)
(fact-info-override fact-info-enemy :offset 160)
(enemy-flags enemy-flag :offset-assert 208)
(enemy-info enemy-info :offset-assert 216)
(hit-points int32 :offset-assert 220)
(gnd-collide uint32 :offset-assert 224)
(attack-id uint32 :offset-assert 228)
(persistent-attack-id uint32 :offset-assert 232)
(water-max-height meters :offset-assert 236)
(water-surface-height meters :offset-assert 240)
(desired-angle degrees :offset-assert 244)
(jump-why uint64 :offset-assert 248)
(penetrated-by-all penetrate :offset-assert 256)
(penetrated-flinch penetrate :offset-assert 264)
(penetrated-knocked penetrate :offset-assert 272)
(reaction-time uint64 :offset-assert 280)
(notice-time uint64 :offset-assert 288)
(state-timeout uint64 :offset-assert 296)
(auto-reset-penetrate-time uint64 :offset-assert 304)
(hit-focus-time uint64 :offset-assert 312)
(last-draw-time uint64 :offset-assert 320)
(starting-time uint64 :offset-assert 328)
(fated-time uint64 :offset-assert 336)
(focus-pos vector :inline :offset-assert 352)
(event-param-point vector :inline :offset-assert 368)
(jump-dest vector :inline :offset 368)
(focus enemy-focus :inline :offset-assert 384)
(incoming enemy-attack-info :inline :offset-assert 416)
(actor-group (pointer actor-group) :offset-assert 480)
(actor-group-count int32 :offset-assert 484)
(neck joint-mod :offset-assert 488)
(on-notice symbol :offset-assert 492)
(on-active symbol :offset-assert 496)
(on-hostile symbol :offset-assert 500)
(on-death symbol :offset-assert 504)
(idle-anim-player idle-control :inline :offset-assert 512)
(rand-gen symbol :offset-assert 528)
)
:heap-base #x1a0
:method-count-assert 137
+2 -2
View File
@@ -1100,11 +1100,11 @@
(let ((v1-49 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16))))
(cond
((and v1-49 (nonzero? (-> sv-16 elt-count)))
(set! (-> obj actor-group) (the-as actor-group v1-49))
(set! (-> obj actor-group) (the-as (pointer actor-group) v1-49))
(set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count)))
)
(else
(set! (-> obj actor-group) #f)
(set! (-> obj actor-group) (the-as (pointer actor-group) #f))
(set! (-> obj actor-group-count) 0)
0
)
+93 -1
View File
@@ -30,6 +30,98 @@
:flag-assert #xb00000010
(:methods
(idle-control-method-9 (_type_ (pointer uint32)) none 9)
(idle-control-method-10 (_type_ process-drawable) none 10)
(idle-control-method-10 (_type_ process-drawable) none :behavior process-drawable 10)
)
)
;; WARN: Return type mismatch idle-control vs none.
(defmethod idle-control-method-9 idle-control ((obj idle-control) (arg0 (pointer uint32)))
(set! (-> obj anim) arg0)
(set! (-> obj current) arg0)
(set! (-> obj counter) 0)
(set! (-> obj target) 0)
(none)
)
;; TODO - method manually patched (maybe incorrectly) around `self` changing
;; WARN: Function (method 10 idle-control) has a return type of none, but the expression builder found a return statement.
(defmethod idle-control-method-10 idle-control ((obj idle-control) (arg0 process-drawable))
(with-pp arg0
(local-vars (a1-1 int))
(when (nonzero? (-> obj anim))
(let ((s5-0 self))
(loop
(let* ((s4-0 (-> obj current 0))
(v1-4 (shr (shl s4-0 56) 56))
)
(cond
((= v1-4 1)
(if (< (shr (shl s4-0 48) 56) 0)
(return #f)
)
(when (zero? (-> obj target))
(let ((t9-0 rand-vu-int-range)
(a0-3 (sar (shl s4-0 40) 56))
)
(shift-arith-right-32 a1-1 s4-0 24)
(set! (-> obj target) (t9-0 (the-as int a0-3) a1-1))
)
(ja :group! (-> (the-as process-drawable arg0) draw art-group data (shr (shl s4-0 48) 56)) :num! min)
(return #f)
)
(ja :group! (-> (the-as process-drawable arg0) draw art-group data (shr (shl s4-0 48) 56))
:num! (seek!
(the float
(+ (-> (the-as art-joint-anim (-> (the-as process-drawable arg0) draw art-group data (shr (shl s4-0 48) 56)))
frames
num-frames
)
-1
)
)
)
)
(cond
((ja-done? 0)
(+! (-> obj counter) 1)
(cond
((>= (-> obj counter) (-> obj target))
(set! (-> obj current) (&-> (-> obj current) 1))
(set! (-> obj counter) 0)
(set! (-> obj target) 0)
0
)
(else
(ja :num-func num-func-identity :frame-num 0.0)
(return #f)
)
)
)
(else
(return #f)
)
)
)
((= v1-4 2)
(ja-channel-push! 1 (the-as time-frame (sar (shl s4-0 40) 56)))
(set! (-> obj current) (&-> (-> obj current) 1))
(set! (-> obj counter) 0)
(set! (-> obj target) 0)
0
)
((zero? v1-4)
(set! (-> obj current) (-> obj anim))
(set! (-> obj counter) 0)
(set! (-> obj target) 0)
0
)
)
)
)
)
)
0
(none)
)
)
+1
View File
@@ -69,6 +69,7 @@
:size-assert #x25c
:flag-assert #xb201e0025c
(:methods
(enemy-method-112 (_type_ nav-enemy-info) float :replace 112)
(enemy-method-113 (_type_ nav-enemy-info) none :replace 113)
(taunt () _type_ :state 137)
(pacing () _type_ :state 138)
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -239,11 +239,11 @@
(handle-birth (_type_) none 24)
(handle-kill (_type_) none 25)
(update-navigation (_type_) none 26)
(new-nav-control (_type_ process-drawable int) nav-control 27)
(new-nav-control (_type_ process-drawable) nav-control 27)
(remove-nav-control (_type_ nav-control) none 28)
(add-process-drawable-to-navmesh (_type_ process-drawable symbol) none 29)
(remove-process-drawable (_type_ process-drawable) none 30)
(change-to (_type_ process-drawable symbol) none 31)
(change-to (_type_ process-drawable) none 31)
(link-by-id (_type_ uint) symbol 32)
(unlink-by-id (_type_ uint) symbol 33)
(nav-mesh-method-34 (_type_ vector vector float) float 34)
+8 -183
View File
@@ -7,29 +7,21 @@
;; DECOMP BEGINS
(rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf))
(init-vf0-vector)
;; definition for symbol *debug-nav-control-output*, type symbol
(define *debug-nav-control-output* #f)
;; definition for symbol *debug-nav-control*, type symbol
(define *debug-nav-control* #f)
;; definition for symbol *debug-nav-mesh-output*, type symbol
(define *debug-nav-mesh-output* #f)
;; definition for symbol *debug-nav-ray*, type nav-ray
(define *debug-nav-ray* (the-as nav-ray #f))
;; definition for symbol *debug-ray-offset*, type vector
(define *debug-ray-offset* (new 'static 'vector))
;; definition for symbol *debug-offset*, type vector
(define *debug-offset* (new 'static 'vector :y 4096.0 :w 1.0))
;; definition for symbol *nav-mesh-work*, type nav-mesh-work
(define *nav-mesh-work* (new 'static 'nav-mesh-work
:vert0-table (new 'static 'array int8 4 0 1 2 3)
:vert1-table (new 'static 'array int8 4 1 2 3 0)
@@ -45,7 +37,6 @@
)
)
;; definition for symbol *default-nav-mesh*, type nav-mesh
(define *default-nav-mesh* (new 'static 'nav-mesh
:poly-array (new 'static 'inline-array nav-poly 1
(new 'static 'nav-poly
@@ -192,10 +183,8 @@
)
)
;; failed to figure out what this is:
(kmemopen global "nav-mesh")
;; failed to figure out what this is:
(let ((gp-0 *default-nav-mesh*))
(set! (-> gp-0 work) *nav-mesh-work*)
(if (zero? (-> gp-0 user-list))
@@ -238,10 +227,8 @@
)
)
;; failed to figure out what this is:
(kmemclose)
;; definition for function nav-mesh-connect-from-ent
(defun nav-mesh-connect-from-ent ((arg0 process-drawable))
"Connect this process to the nav-mesh associate with the entity that spawned the process"
(let ((s5-0 (nav-mesh-from-res-tag (-> arg0 entity) 'nav-mesh-actor 0)))
@@ -264,8 +251,6 @@
)
)
;; definition (debug) for function connection-validate
;; WARN: Return type mismatch int vs none.
(defun-debug connection-validate ((arg0 connection))
(when (zero? arg0)
(break!)
@@ -295,7 +280,6 @@
(none)
)
;; definition (debug) for function connection-list-validate
(defun-debug connection-list-validate ((arg0 (inline-array connection)))
(let ((gp-0 (the-as object (&-> arg0 3 prev1))))
(while gp-0
@@ -306,8 +290,6 @@
#f
)
;; definition (debug) for function nav-control-validate
;; WARN: Return type mismatch int vs none.
(defun-debug nav-control-validate ((arg0 process-drawable))
(let ((s5-0 (the-as object (-> arg0 nav))))
(when (and (-> arg0 nav) (!= arg0 (-> arg0 nav process)))
@@ -338,8 +320,6 @@
(none)
)
;; definition (debug) for function debug-validate-nav-poly
;; WARN: Return type mismatch int vs none.
(defun-debug debug-validate-nav-poly ((arg0 nav-mesh-link) (arg1 nav-poly))
(set! (-> *nav-mesh-work* poly1) (-> *nav-mesh-work* poly0))
(set! (-> *nav-mesh-work* poly0) arg1)
@@ -359,8 +339,6 @@
(none)
)
;; definition for method 27 of type entity-nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod initialize-nav-mesh! entity-nav-mesh ((obj entity-nav-mesh))
"Initialize the nav-mesh in this entity."
(let ((v1-0 (-> obj nav-mesh)))
@@ -372,7 +350,6 @@
(none)
)
;; definition for method 22 of type entity-nav-mesh
(defmethod birth! entity-nav-mesh ((obj entity-nav-mesh))
(let ((a0-1 (-> obj nav-mesh)))
(if (nonzero? a0-1)
@@ -382,7 +359,6 @@
obj
)
;; definition for method 23 of type entity-nav-mesh
(defmethod kill! entity-nav-mesh ((obj entity-nav-mesh))
(if (-> obj nav-mesh)
(handle-kill (-> obj nav-mesh))
@@ -390,9 +366,6 @@
obj
)
;; definition for method 28 of type entity-nav-mesh
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod debug-draw entity-nav-mesh ((obj entity-nav-mesh))
(add-debug-x
#t
@@ -439,8 +412,6 @@
(none)
)
;; definition for method 31 of type entity-actor
;; INFO: Used lq/sq
(defmethod get-simple-travel-vector entity-actor ((obj entity-actor) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 object) (arg4 float))
(local-vars (at-0 int) (at-1 int))
(with-pp
@@ -509,8 +480,6 @@
)
)
;; definition for method 32 of type entity-actor
;; INFO: Used lq/sq
(defmethod project-point-to-nav-mesh entity-actor ((obj entity-actor) (arg0 vector) (arg1 vector) (arg2 nav-poly) (arg3 float))
(local-vars (sv-16 vector))
(let ((gp-0 (nav-mesh-from-res-tag obj 'nav-mesh-actor 0)))
@@ -540,15 +509,11 @@
)
)
;; definition for method 4 of type nav-mesh
;; WARN: Return type mismatch uint vs int.
(defmethod length nav-mesh ((obj nav-mesh))
(the-as int (-> obj poly-count))
)
;; definition for method 36 of type nav-mesh
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod debug-draw-poly nav-mesh ((obj nav-mesh) (arg0 nav-poly) (arg1 rgba))
(let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 3)))
(set! (-> gp-0 0 quad) (-> obj bounds quad))
@@ -594,8 +559,7 @@
(none)
)
;; definition for method 27 of type nav-mesh
(defmethod new-nav-control nav-mesh ((obj nav-mesh) (arg0 process-drawable) (arg1 int))
(defmethod new-nav-control nav-mesh ((obj nav-mesh) (arg0 process-drawable))
(let ((gp-0 (the-as nav-control #f)))
(dotimes (v1-0 (the-as int (-> obj nav-control-count)))
(let ((a1-2 (-> obj nav-control-array v1-0)))
@@ -628,8 +592,6 @@
)
)
;; definition for method 28 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod remove-nav-control nav-mesh ((obj nav-mesh) (arg0 nav-control))
(set! (-> arg0 process) #f)
(let ((v1-1 (+ (-> obj nav-control-count) -1)))
@@ -642,19 +604,15 @@
(none)
)
;; definition for method 29 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod add-process-drawable-to-navmesh nav-mesh ((obj nav-mesh) (arg0 process-drawable) (arg1 symbol))
(if arg1
(change-to obj arg0 arg1)
(change-to obj arg0)
(add-connection (-> obj user-list) arg0 nothing arg0 #f (-> arg0 root))
)
0
(none)
)
;; definition for method 30 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod remove-process-drawable nav-mesh ((obj nav-mesh) (arg0 process-drawable))
(remove-from-process (-> obj user-list) arg0)
(let ((a1-2 (-> arg0 nav)))
@@ -667,9 +625,7 @@
(none)
)
;; definition for method 31 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod change-to nav-mesh ((obj nav-mesh) (arg0 process-drawable) (arg1 symbol))
(defmethod change-to nav-mesh ((obj nav-mesh) (arg0 process-drawable))
(local-vars (v1-5 symbol))
(let ((gp-0 arg0))
(b! (nonzero? (-> obj user-list)) cfg-2 :delay (empty-form))
@@ -684,7 +640,7 @@
(set! v1-5 (!= obj (-> s3-0 state mesh)))
(label cfg-7)
(b! (not v1-5) cfg-18 :delay (empty-form))
(let ((s4-0 (new-nav-control obj arg0 (the-as int arg1))))
(let ((s4-0 (new-nav-control obj arg0)))
(b! s4-0 cfg-12 :delay (empty-form))
(b! (not *debug-segment*) cfg-11 :delay (empty-form))
(format 0 "ERROR: nav-mesh::change-to: unable to allocate nav-mesh for ~s~%" gp-0)
@@ -722,7 +678,6 @@
(none)
)
;; definition for method 45 of type nav-mesh
(defmethod link-to-other-mesh nav-mesh ((obj nav-mesh) (arg0 nav-mesh-link))
(when (not (-> arg0 dest-mesh))
(let* ((s4-0 (entity-nav-mesh-by-aid (the-as actor-id (-> arg0 dest-mesh-id))))
@@ -761,8 +716,6 @@
)
)
;; definition for method 46 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod unlink-mesh nav-mesh ((obj nav-mesh) (arg0 nav-mesh-link))
(let ((a0-1 (-> arg0 dest-mesh)))
(when a0-1
@@ -789,7 +742,6 @@
(none)
)
;; definition for method 32 of type nav-mesh
(defmethod link-by-id nav-mesh ((obj nav-mesh) (arg0 uint))
"arg1 is a [[nav-mesh-link]] `id`"
(let ((v1-0 (the-as nav-mesh-link #f)))
@@ -808,7 +760,6 @@
)
)
;; definition for method 33 of type nav-mesh
(defmethod unlink-by-id nav-mesh ((obj nav-mesh) (arg0 uint))
"arg1 is a [[nav-mesh-link]] `id`"
(let ((v1-0 (the-as nav-mesh-link #f)))
@@ -828,9 +779,6 @@
)
)
;; definition for method 23 of type nav-mesh
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod init-from-entity nav-mesh ((obj nav-mesh) (arg0 entity-nav-mesh))
"Initialize this mesh from an entity."
(local-vars (sv-16 res-tag))
@@ -865,8 +813,6 @@
(none)
)
;; definition for method 24 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod handle-birth nav-mesh ((obj nav-mesh))
"Handle the parent nav-mesh-entity birth."
(dotimes (s5-0 (the-as int (-> obj link-count)))
@@ -880,8 +826,6 @@
(none)
)
;; definition for method 25 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod handle-kill nav-mesh ((obj nav-mesh))
"Handle the parent nav-mesh-entity kill."
(when (nonzero? (-> obj user-list))
@@ -909,7 +853,6 @@
(none)
)
;; definition of type nav-engine-spr-buffer
(deftype nav-engine-spr-buffer (structure)
((mem-addr (pointer nav-mesh) :offset-assert 0)
(mem-nav uint32 :offset 0)
@@ -927,7 +870,6 @@
:flag-assert #x900000010
)
;; definition for method 3 of type nav-engine-spr-buffer
(defmethod inspect nav-engine-spr-buffer ((obj nav-engine-spr-buffer))
(when (not obj)
(set! obj obj)
@@ -947,7 +889,6 @@
obj
)
;; definition of type nav-engine
(deftype nav-engine (structure)
((spr-addr uint32 :offset-assert 0)
(nav-work-addr uint32 :offset-assert 4)
@@ -990,7 +931,6 @@
)
)
;; definition for method 3 of type nav-engine
(defmethod inspect nav-engine ((obj nav-engine))
(when (not obj)
(set! obj obj)
@@ -1021,7 +961,6 @@
obj
)
;; definition for method 9 of type nav-engine
(defmethod inc-spr-addr! nav-engine ((obj nav-engine) (arg0 uint))
"Adds the given integer to `spr-addr` and returns it"
(let ((v0-0 (-> obj spr-addr)))
@@ -1030,11 +969,9 @@
)
)
;; definition for method 10 of type nav-engine
;; WARN: Return type mismatch int vs none.
(defmethod lay-out-spad-memory nav-engine ((obj nav-engine) (arg0 nav-mesh))
(let ((s5-0 0))
(set! (-> obj spr-addr) (the-as uint #x70000060))
(set! (-> obj spr-addr) (scratchpad-object uint :offset #x60))
(let* ((v1-1 obj)
(a1-1 320)
(a0-1 (-> v1-1 spr-addr))
@@ -1116,8 +1053,6 @@
(none)
)
;; definition for method 11 of type nav-engine
;; WARN: Return type mismatch int vs none.
(defmethod set-up-mem-work nav-engine ((obj nav-engine))
(let ((v1-0 (-> obj mem-mesh)))
(set! (-> v1-0 poly-array) (-> obj mem-poly-array))
@@ -1127,9 +1062,6 @@
(none)
)
;; definition for method 12 of type nav-engine
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod add-spheres-from-mesh-user-list nav-engine ((obj nav-engine) (arg0 sphere-hash) (arg1 nav-mesh))
(countdown (s3-0 (-> arg1 static-sphere-count))
(add-a-sphere-with-flag arg0 (-> arg1 static-sphere s3-0) 64)
@@ -1214,9 +1146,6 @@
(none)
)
;; definition for method 13 of type nav-engine
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod add-all-spheres nav-engine ((obj nav-engine))
(let ((s4-0 (-> obj nav-mesh-addr))
(gp-0 (-> obj nav-mesh-addr sphere-hash))
@@ -1252,8 +1181,6 @@
(none)
)
;; definition for method 14 of type nav-engine
;; WARN: Return type mismatch int vs none.
(defmethod do-sphere-lookups nav-engine ((obj nav-engine))
(let ((s5-0 (-> obj nav-mesh-addr)))
(dotimes (s4-0 (the-as int (-> s5-0 nav-control-count)))
@@ -1272,15 +1199,10 @@
(none)
)
;; definition for function nav-dma-send-to-spr-no-flush
;; INFO: function output is handled by mips2c
(def-mips2c nav-dma-send-to-spr-no-flush (function pointer pointer int none))
;; definition for function nav-dma-send-from-spr-no-flush
;; INFO: function output is handled by mips2c
(def-mips2c nav-dma-send-from-spr-no-flush (function pointer pointer int none))
;; definition for function inc-mod3
(defun inc-mod3 ((arg0 int))
"Increments and returns the provided [[int]], if the value exceeds `2`, wrap back to `0`"
(local-vars (v0-1 int) (v1-1 int))
@@ -1293,20 +1215,12 @@
v0-1
)
;; definition for function nav-state-patch-pointers
;; INFO: function output is handled by mips2c
(def-mips2c nav-state-patch-pointers (function nav-state int none))
;; definition for method 17 of type nav-engine
;; INFO: function output is handled by mips2c
(defmethod-mips2c "(method 17 nav-engine)" 17 nav-engine)
;; definition for method 18 of type nav-engine
;; INFO: function output is handled by mips2c
(defmethod-mips2c "(method 18 nav-engine)" 18 nav-engine)
;; definition for method 19 of type nav-engine
;; WARN: Return type mismatch int vs none.
(defmethod do-callbacks nav-engine ((obj nav-engine) (arg0 nav-engine-spr-buffer))
(local-vars (sv-16 nav-callback-info))
(with-pp
@@ -1339,16 +1253,10 @@
)
)
;; definition for method 20 of type nav-engine
;; INFO: function output is handled by mips2c
(defmethod-mips2c "(method 20 nav-engine)" 20 nav-engine)
;; definition for method 21 of type nav-engine
;; INFO: function output is handled by mips2c
(defmethod-mips2c "(method 21 nav-engine)" 21 nav-engine)
;; definition for method 15 of type nav-engine
;; WARN: Return type mismatch int vs none.
(defmethod update-nav-controls-pipelined-in-spr nav-engine ((obj nav-engine))
(local-vars
(v1-33 int)
@@ -1446,8 +1354,6 @@
(none)
)
;; definition for method 16 of type nav-engine
;; WARN: Return type mismatch int vs none.
(defmethod update-nav-controls-in-spr nav-engine ((obj nav-engine))
(flush-cache 0)
(set! (-> obj max-pass-count) 1)
@@ -1475,7 +1381,7 @@
(reloc-ptrs-to-mem obj (the-as nav-engine-spr-buffer gp-0))
(dotimes (s4-0 (-> (the-as (inline-array nav-engine-spr-buffer) gp-0) 0 nav-count))
(let ((a2-1 (-> (the-as (inline-array nav-engine-spr-buffer) gp-0) 0 spr-addr s4-0 state mesh)))
(when (>= (the-as uint a2-1) (the-as uint #x70000000))
(when (in-scratchpad? a2-1)
(format 0 "nav-engine::update-nav-controls-in-spr: (pre-dma) bad mesh pointer found (#x0~x)~%" a2-1)
(break!)
0
@@ -1486,7 +1392,7 @@
(dma-sync (the-as pointer #x1000d000) 0 0)
(dotimes (s5-1 (-> (the-as (inline-array nav-engine-spr-buffer) gp-0) 0 nav-count))
(let ((a2-3 (-> (&+ (-> (the-as nav-engine-spr-buffer gp-0) mem-addr) (* 288 s5-1)) 31)))
(when (>= (the-as uint a2-3) (the-as uint #x70000000))
(when (in-scratchpad? a2-3)
(format 0 "nav-engine::update-nav-controls-in-spr: (post-dma) bad mesh pointer found (#x0~x)~%" a2-3)
(break!)
0
@@ -1499,8 +1405,6 @@
(none)
)
;; definition for method 26 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod update-navigation nav-mesh ((obj nav-mesh))
(local-vars (sp-0 int))
(when (zero? (-> obj next-nav-mesh))
@@ -1511,7 +1415,7 @@
(the-as none sp-0)
(set! sp-0 #x70003fc0)
(set! (-> obj work mesh) obj)
(let ((s4-0 (the-as nav-engine #x70000000)))
(let ((s4-0 (scratchpad-object nav-engine)))
(lay-out-spad-memory s4-0 obj)
(add-all-spheres s4-0)
(do-sphere-lookups s4-0)
@@ -1538,8 +1442,6 @@
(none)
)
;; definition for method 9 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod debug-draw nav-mesh ((obj nav-mesh))
(local-vars (sv-32 vector) (sv-36 int))
(set! sv-32 (new 'stack-no-clear 'vector))
@@ -1620,7 +1522,6 @@
(none)
)
;; definition for method 12 of type nav-mesh
(defmethod poly-centroid-local nav-mesh ((obj nav-mesh) (arg0 nav-poly) (arg1 vector))
(rlet ((vf0 :class vf))
(init-vf0-vector)
@@ -1634,13 +1535,11 @@
)
)
;; definition for method 11 of type nav-mesh
(defmethod poly-centroid nav-mesh ((obj nav-mesh) (arg0 nav-poly) (arg1 vector))
(poly-centroid-local obj arg0 arg1)
(vector+! arg1 arg1 (-> obj bounds))
)
;; definition for function vu-point-triangle-intersection?
(defun vu-point-triangle-intersection? ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
(local-vars (v1-0 float) (v1-1 int) (v1-3 int) (a0-1 float) (a0-2 int) (a0-4 int) (a1-1 float) (a1-2 int))
(rlet ((acc :class vf)
@@ -1693,12 +1592,10 @@
)
)
;; definition for function poly-in-height-range?
(defun poly-in-height-range? ((arg0 nav-poly) (arg1 float) (arg2 float))
(and (>= (+ (-> arg0 vertex3 w) arg2) arg1) (>= arg1 (- (-> arg0 vertex2 w) arg2)))
)
;; definition for method 42 of type nav-mesh
(defmethod find-poly-containing-point-local nav-mesh ((obj nav-mesh) (arg0 nav-find-poly-parms))
(local-vars (v1-6 symbol) (v1-15 int) (a0-3 symbol) (sv-16 nav-poly))
(let ((s4-0 (search-for-point (-> obj poly-hash) (-> arg0 point)))
@@ -1747,12 +1644,6 @@
(the-as nav-poly #f)
)
;; definition for method 44 of type nav-mesh
;; INFO: Used lq/sq
;; WARN: Stack slot offset 24 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 24 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
(defmethod is-in-mesh-local? nav-mesh ((obj nav-mesh) (arg0 vector) (arg1 float) (arg2 float))
(local-vars (v1-3 float) (sv-16 float) (sv-20 vector) (sv-24 float))
(rlet ((acc :class vf)
@@ -1801,9 +1692,6 @@
)
)
;; definition for function init-ray-local
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defun init-ray-local ((arg0 nav-ray) (arg1 nav-poly) (arg2 vector) (arg3 vector))
(rlet ((acc :class vf)
(Q :class vf)
@@ -1852,9 +1740,6 @@
)
)
;; definition for function init-ray-dir-local
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defun init-ray-dir-local ((arg0 nav-ray) (arg1 nav-poly) (arg2 vector) (arg3 vector) (arg4 float))
(rlet ((acc :class vf)
(Q :class vf)
@@ -1921,7 +1806,6 @@
)
)
;; definition for method 17 of type nav-mesh
(defmethod try-move-along-ray nav-mesh ((obj nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector) (arg3 float))
(local-vars (v1-2 symbol))
(let ((gp-0 (new 'stack-no-clear 'nav-ray)))
@@ -1937,7 +1821,6 @@
)
)
;; definition for function nav-ray-test
(defun nav-ray-test ((arg0 nav-mesh) (arg1 nav-poly) (arg2 vector) (arg3 vector))
(let ((s4-1 (vector-! (new 'stack-no-clear 'vector) arg2 (-> arg0 bounds)))
(s3-1 (vector-! (new 'stack-no-clear 'vector) arg3 arg2))
@@ -1951,7 +1834,6 @@
)
)
;; definition for function point-poly-distance-min
(defun point-poly-distance-min ((arg0 nav-mesh-work) (arg1 nav-poly) (arg2 float) (arg3 nav-poly))
(let ((t0-0 (-> arg3 vertex-count))
(a3-1 (-> arg3 vertex))
@@ -2021,27 +1903,6 @@
)
)
;; definition for method 43 of type nav-mesh
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
;; WARN: Stack slot offset 52 signed mismatch
;; WARN: Stack slot offset 28 signed mismatch
(defmethod find-nearest-poly-to-point-local nav-mesh ((obj nav-mesh) (arg0 nav-find-poly-parms))
(local-vars
(v1-16 int)
@@ -2160,13 +2021,10 @@
arg0
)
;; definition for function nav-mesh-route-table-bit-index
(defun nav-mesh-route-table-bit-index ((arg0 nav-mesh) (arg1 uint) (arg2 int))
(* (+ arg2 (* arg1 (-> arg0 poly-count))) 2)
)
;; definition for method 14 of type nav-mesh
;; INFO: Used lq/sq
(defmethod get-route-portal nav-mesh ((obj nav-mesh) (arg0 nav-poly) (arg1 nav-poly) (arg2 nav-route-portal))
(set! (-> arg2 next-poly) #f)
(cond
@@ -2210,7 +2068,6 @@
)
)
;; definition for method 13 of type nav-mesh
(defmethod lookup-poly-on-route-to-target nav-mesh ((obj nav-mesh) (arg0 nav-poly) (arg1 nav-poly))
(cond
((and arg0 arg1 (!= arg0 arg1))
@@ -2242,8 +2099,6 @@
)
)
;; definition for method 22 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod compute-bounding-box-from-vertices nav-mesh ((obj nav-mesh) (arg0 vector) (arg1 vector))
(let ((f0-0 10000000000000000000000000000000000000.0)
(f1-0 -10000000000000000000000000000000000000.0)
@@ -2275,8 +2130,6 @@
(none)
)
;; definition for method 15 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod initialize-mesh! nav-mesh ((obj nav-mesh))
(local-vars
(sv-32 vector)
@@ -2376,7 +2229,6 @@
)
)
;; definition for function ray-ccw-line-segment-intersection?
(defun ray-ccw-line-segment-intersection? ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
(let ((f0-2 (- (* (-> arg2 x) (-> arg1 z)) (* (-> arg2 z) (-> arg1 x))))
(f2-4 (- (* (-> arg3 x) (-> arg1 z)) (* (-> arg3 z) (-> arg1 x))))
@@ -2397,7 +2249,6 @@
)
)
;; definition for function ray-line-segment-intersection?
(defun ray-line-segment-intersection? ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
(let ((f1-3 (- (* (-> arg2 x) (-> arg1 z)) (* (-> arg2 z) (-> arg1 x))))
(f0-4 (- (* (-> arg3 x) (-> arg1 z)) (* (-> arg3 z) (-> arg1 x))))
@@ -2423,8 +2274,6 @@
)
)
;; definition for method 38 of type nav-mesh
;; INFO: Used lq/sq
(defmethod nav-mesh-method-38 nav-mesh ((obj nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 (pointer nav-poly)))
(local-vars
(s1-0 vector)
@@ -2502,13 +2351,10 @@
arg2
)
;; definition for function plane-height-at-xz-point
(defun plane-height-at-xz-point ((arg0 plane) (arg1 vector))
(/ (- (+ (* (-> arg1 x) (-> arg0 x)) (* (-> arg1 z) (-> arg0 z)) (-> arg0 w))) (-> arg0 y))
)
;; definition for function nav-normal-from-3-points
;; WARN: Return type mismatch int vs none.
(defun nav-normal-from-3-points ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
(rlet ((acc :class vf)
(Q :class vf)
@@ -2548,9 +2394,6 @@
)
)
;; definition for method 40 of type nav-mesh
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod project-point-onto-plane-of-poly-local nav-mesh ((obj nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector) (arg3 vector))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(let ((s4-0 (new 'stack-no-clear 'vector)))
@@ -2584,7 +2427,6 @@
(none)
)
;; definition for method 8 of type nav-mesh
;; WARN: Return type mismatch int vs nav-mesh.
(defmethod mem-usage nav-mesh ((obj nav-mesh) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 46 (-> arg0 length)))
@@ -2613,7 +2455,6 @@
(the-as nav-mesh 0)
)
;; definition for function get-nav-mesh
(defun get-nav-mesh ((arg0 actor-id))
(let ((gp-0 (the-as nav-mesh #f)))
(let* ((s5-0 (entity-nav-mesh-by-aid arg0))
@@ -2630,11 +2471,6 @@
)
)
;; definition for function find-nearest-nav-mesh
;; WARN: Stack slot offset 72 signed mismatch
;; WARN: Stack slot offset 72 signed mismatch
;; WARN: Stack slot offset 72 signed mismatch
;; WARN: Stack slot offset 72 signed mismatch
(defun find-nearest-nav-mesh ((arg0 vector) (arg1 float))
(local-vars (v1-15 float) (sv-64 nav-find-poly-parms) (sv-68 nav-mesh) (sv-72 float) (sv-76 vector))
(rlet ((acc :class vf)
@@ -2688,7 +2524,6 @@
)
)
;; definition for method 10 of type nav-mesh
(defmethod nav-mesh-method-10 nav-mesh ((obj nav-mesh) (arg0 vector) (arg1 vector) (arg2 nav-poly))
(local-vars (sv-16 vector))
(set! sv-16 arg0)
@@ -2708,8 +2543,6 @@
)
)
;; definition for function point-to-poly-boundary
;; INFO: Used lq/sq
(defun point-to-poly-boundary ((arg0 nav-poly) (arg1 vector) (arg2 vector))
(let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 4)))
(set! (-> gp-0 4 x) (the-as float #x7f800000))
@@ -2739,8 +2572,6 @@
)
)
;; definition for method 34 of type nav-mesh
;; INFO: Used lq/sq
(defmethod nav-mesh-method-34 nav-mesh ((obj nav-mesh) (arg0 vector) (arg1 vector) (arg2 float))
(local-vars (v1-8 symbol) (v1-13 int) (a1-2 symbol) (sv-80 vector) (sv-84 (pointer uint8)))
(let ((gp-0 (new 'stack-no-clear 'nav-poly)))
@@ -2801,8 +2632,6 @@
)
)
;; definition for method 35 of type nav-mesh
;; INFO: Used lq/sq
;; WARN: Return type mismatch float vs none.
;; WARN: new jak 2 until loop case, check carefully
(defmethod nav-mesh-method-35 nav-mesh ((obj nav-mesh) (arg0 vector) (arg1 vector) (arg2 float))
@@ -2844,10 +2673,6 @@
(none)
)
;; failed to figure out what this is:
(none)
)
+36
View File
@@ -10,3 +10,39 @@
;; DECOMP BEGINS
(defmethod minimap-method-12 minimap ((obj minimap) (arg0 process) (arg1 uint) (arg2 int) (arg3 vector) (arg4 int))
(the-as connection-minimap #f) ;; TODO - stubbed!
;; (when (not arg2)
;; (let ((v1-3 (+ (-> *minimap* engine-key) 1)))
;; (set! (-> *minimap* engine-key) v1-3)
;; (set! arg2 (the-as int v1-3))
;; )
;; )
;; (let ((s3-0 (the-as connection-minimap (schedule-callback (-> obj engine) arg2 0))))
;; (let ((s2-1 (-> *minimap-class-list* arg1)))
;; (when s3-0
;; (when (not (logtest? (-> s3-0 flags) (minimap-flag active)))
;; (set! (-> s3-0 class) s2-1)
;; (set! (-> s3-0 last-world-pos quad) (-> s2-1 default-position quad))
;; (vector-! (-> s3-0 last-relative-pos) (target-pos 0) (-> s3-0 last-world-pos))
;; (set! (-> s3-0 edge-ry) -131072.0)
;; )
;; (set! (-> s3-0 handle) (process->handle arg0))
;; (set! arg3 (cond
;; (arg3
;; (empty)
;; arg3
;; )
;; (else
;; (-> s2-1 default-position)
;; )
;; )
;; )
;; (set! (-> s3-0 position) arg3)
;; (set! (-> s3-0 flags) (minimap-flag active fade-in))
;; (set! (-> s3-0 node) (the-as uint arg4))
;; )
;; )
;; s3-0
;; )
)
File diff suppressed because it is too large Load Diff
+4
View File
@@ -883,6 +883,10 @@ void Compiler::fill_static_array_inline(const goos::Object& form,
throw_compiler_error(form, "The integer {} doesn't fit in element {} of array of {}",
sr.constant().print(), arg_idx, content_type.print());
}
} // TODO - handle type case here as well
else if (sr.is_func()) {
ASSERT(deref_info.stride == 4);
structure->add_function_record(sr.function(), elt_offset);
} else {
ASSERT(false);
}
+38 -43
View File
@@ -364,43 +364,43 @@
;; definition of type enemy
(deftype enemy (process-focusable)
((root-override2 collide-shape-moving :offset 128)
(fact-info-override fact-info-enemy :offset 160)
(enemy-flags enemy-flag :offset-assert 208)
(enemy-info enemy-info :offset-assert 216)
(hit-points int32 :offset-assert 220)
(gnd-collide uint32 :offset-assert 224)
(attack-id uint32 :offset-assert 228)
(persistent-attack-id uint32 :offset-assert 232)
(water-max-height meters :offset-assert 236)
(water-surface-height meters :offset-assert 240)
(desired-angle degrees :offset-assert 244)
(jump-why uint64 :offset-assert 248)
(penetrated-by-all penetrate :offset-assert 256)
(penetrated-flinch penetrate :offset-assert 264)
(penetrated-knocked penetrate :offset-assert 272)
(reaction-time uint64 :offset-assert 280)
(notice-time uint64 :offset-assert 288)
(state-timeout uint64 :offset-assert 296)
(auto-reset-penetrate-time uint64 :offset-assert 304)
(hit-focus-time uint64 :offset-assert 312)
(last-draw-time uint64 :offset-assert 320)
(starting-time uint64 :offset-assert 328)
(fated-time uint64 :offset-assert 336)
(focus-pos vector :inline :offset-assert 352)
(event-param-point vector :inline :offset-assert 368)
(jump-dest vector :inline :offset 368)
(focus enemy-focus :inline :offset-assert 384)
(incoming enemy-attack-info :inline :offset-assert 416)
(actor-group actor-group :offset-assert 480)
(actor-group-count int32 :offset-assert 484)
(neck joint-mod :offset-assert 488)
(on-notice symbol :offset-assert 492)
(on-active symbol :offset-assert 496)
(on-hostile symbol :offset-assert 500)
(on-death symbol :offset-assert 504)
(idle-anim-player idle-control :inline :offset-assert 512)
(rand-gen symbol :offset-assert 528)
((root-override2 collide-shape-moving :offset 128)
(fact-info-override fact-info-enemy :offset 160)
(enemy-flags enemy-flag :offset-assert 208)
(enemy-info enemy-info :offset-assert 216)
(hit-points int32 :offset-assert 220)
(gnd-collide uint32 :offset-assert 224)
(attack-id uint32 :offset-assert 228)
(persistent-attack-id uint32 :offset-assert 232)
(water-max-height meters :offset-assert 236)
(water-surface-height meters :offset-assert 240)
(desired-angle degrees :offset-assert 244)
(jump-why uint64 :offset-assert 248)
(penetrated-by-all penetrate :offset-assert 256)
(penetrated-flinch penetrate :offset-assert 264)
(penetrated-knocked penetrate :offset-assert 272)
(reaction-time uint64 :offset-assert 280)
(notice-time uint64 :offset-assert 288)
(state-timeout uint64 :offset-assert 296)
(auto-reset-penetrate-time uint64 :offset-assert 304)
(hit-focus-time uint64 :offset-assert 312)
(last-draw-time uint64 :offset-assert 320)
(starting-time uint64 :offset-assert 328)
(fated-time uint64 :offset-assert 336)
(focus-pos vector :inline :offset-assert 352)
(event-param-point vector :inline :offset-assert 368)
(jump-dest vector :inline :offset 368)
(focus enemy-focus :inline :offset-assert 384)
(incoming enemy-attack-info :inline :offset-assert 416)
(actor-group (pointer actor-group) :offset-assert 480)
(actor-group-count int32 :offset-assert 484)
(neck joint-mod :offset-assert 488)
(on-notice symbol :offset-assert 492)
(on-active symbol :offset-assert 496)
(on-hostile symbol :offset-assert 500)
(on-death symbol :offset-assert 504)
(idle-anim-player idle-control :inline :offset-assert 512)
(rand-gen symbol :offset-assert 528)
)
:heap-base #x1a0
:method-count-assert 137
@@ -668,12 +668,7 @@
(format #t "~2Tincoming: #<enemy-attack-info @ #x~X>~%" (-> obj incoming))
(format #t "~2Tactor-group: #x~X~%" (-> obj actor-group))
(dotimes (s5-1 (-> obj actor-group-count))
(format
#t
"~T [~D]~2Tactor-group: ~`actor-group`P~%"
s5-1
(-> (the-as (pointer uint32) (+ (the-as uint (-> obj actor-group)) (* s5-1 4))))
)
(format #t "~T [~D]~2Tactor-group: ~`actor-group`P~%" s5-1 (-> obj actor-group s5-1))
)
(format #t "~2Tactor-group-count: ~D~%" (-> obj actor-group-count))
(format #t "~2Tneck: ~A~%" (-> obj neck))
+2 -2
View File
@@ -1172,11 +1172,11 @@
(let ((v1-49 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16))))
(cond
((and v1-49 (nonzero? (-> sv-16 elt-count)))
(set! (-> obj actor-group) (the-as actor-group v1-49))
(set! (-> obj actor-group) (the-as (pointer actor-group) v1-49))
(set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count)))
)
(else
(set! (-> obj actor-group) #f)
(set! (-> obj actor-group) (the-as (pointer actor-group) #f))
(set! (-> obj actor-group-count) 0)
0
)
+181
View File
@@ -0,0 +1,181 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type idle-control-frame
(deftype idle-control-frame (uint32)
((command uint8 :offset 0 :size 8)
(anim uint8 :offset 8 :size 8)
(param0 uint8 :offset 16 :size 8)
(param1 uint8 :offset 24 :size 8)
)
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
;; definition for method 3 of type idle-control-frame
(defmethod inspect idle-control-frame ((obj idle-control-frame))
(local-vars (a2-4 int))
(when (not obj)
(set! obj obj)
(goto cfg-11)
)
(format #t "[~8x] ~A~%" obj 'idle-control-frame)
(let ((t9-1 format)
(a0-2 #t)
(a1-1 "~1Tcommand: #x~X : ~S~%")
(a2-1 (-> obj command))
(v1-4 (-> obj command))
)
(t9-1 a0-2 a1-1 a2-1 (cond
((= v1-4 1)
"play"
)
((= v1-4 2)
"push"
)
((zero? v1-4)
"restart"
)
(else
"*unknown*"
)
)
)
)
(format #t "~1Tanim: ~D~%" (-> obj anim))
(format #t "~1Tparam0: ~D~%" (-> obj param0))
(let ((t9-4 format)
(a0-5 #t)
(a1-4 "~1Tparam1: ~D~%")
)
(shift-arith-right-32 a2-4 obj 24)
(t9-4 a0-5 a1-4 a2-4)
)
(label cfg-11)
obj
)
;; definition of type idle-control
(deftype idle-control (structure)
((anim (pointer uint32) :offset-assert 0)
(current (pointer uint32) :offset-assert 4)
(counter int32 :offset-assert 8)
(target int32 :offset-assert 12)
)
:method-count-assert 11
:size-assert #x10
:flag-assert #xb00000010
(:methods
(idle-control-method-9 (_type_ (pointer uint32)) none 9)
(idle-control-method-10 (_type_ process-drawable) none :behavior process-drawable 10)
)
)
;; definition for method 3 of type idle-control
(defmethod inspect idle-control ((obj idle-control))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'idle-control)
(format #t "~1Tanim: #x~X~%" (-> obj anim))
(format #t "~1Tcurrent: #x~X~%" (-> obj current))
(format #t "~1Tcounter: ~D~%" (-> obj counter))
(format #t "~1Ttarget: ~D~%" (-> obj target))
(label cfg-4)
obj
)
;; definition for method 9 of type idle-control
;; WARN: Return type mismatch idle-control vs none.
(defmethod idle-control-method-9 idle-control ((obj idle-control) (arg0 (pointer uint32)))
(set! (-> obj anim) arg0)
(set! (-> obj current) arg0)
(set! (-> obj counter) 0)
(set! (-> obj target) 0)
(none)
)
;; definition for method 10 of type idle-control
;; WARN: Return type mismatch int vs none.
;; WARN: Function (method 10 idle-control) has a return type of none, but the expression builder found a return statement.
(defmethod idle-control-method-10 idle-control ((obj idle-control) (arg0 process-drawable))
(local-vars (a1-1 int))
(when (nonzero? (-> obj anim))
(let ((s5-0 self))
(set! self arg0)
(loop
(let* ((s4-0 (-> obj current 0))
(v1-4 (shr (shl s4-0 56) 56))
)
(cond
((= v1-4 1)
(if (< (shr (shl s4-0 48) 56) 0)
(return #f)
)
(when (zero? (-> obj target))
(let ((t9-0 rand-vu-int-range)
(a0-3 (sar (shl s4-0 40) 56))
)
(shift-arith-right-32 a1-1 s4-0 24)
(set! (-> obj target) (t9-0 (the-as int a0-3) a1-1))
)
(ja :group! (-> (the-as process-drawable self) draw art-group data (shr (shl s4-0 48) 56)) :num! min)
(return #f)
)
(ja :group! (-> (the-as process-drawable self) draw art-group data (shr (shl s4-0 48) 56))
:num! (seek!
(the float
(+ (-> (the-as art-joint-anim (-> (the-as process-drawable self) draw art-group data (shr (shl s4-0 48) 56)))
frames
num-frames
)
-1
)
)
)
)
(cond
((ja-done? 0)
(+! (-> obj counter) 1)
(cond
((>= (-> obj counter) (-> obj target))
(set! (-> obj current) (&-> (-> obj current) 1))
(set! (-> obj counter) 0)
(set! (-> obj target) 0)
0
)
(else
(ja :num-func num-func-identity :frame-num 0.0)
(return #f)
)
)
)
(else
(return #f)
)
)
)
((= v1-4 2)
(ja-channel-push! 1 (the-as time-frame (sar (shl s4-0 40) 56)))
(set! (-> obj current) (&-> (-> obj current) 1))
(set! (-> obj counter) 0)
(set! (-> obj target) 0)
0
)
((zero? v1-4)
(set! (-> obj current) (-> obj anim))
(set! (-> obj counter) 0)
(set! (-> obj target) 0)
0
)
)
)
)
(set! self s5-0)
)
)
0
(none)
)
+1
View File
@@ -169,6 +169,7 @@
:size-assert #x25c
:flag-assert #xb201e0025c
(:methods
(enemy-method-112 (_type_ nav-enemy-info) float :replace 112)
(enemy-method-113 (_type_ nav-enemy-info) none :replace 113)
(taunt () _type_ :state 137)
(pacing () _type_ :state 138)
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -429,11 +429,11 @@
(handle-birth (_type_) none 24)
(handle-kill (_type_) none 25)
(update-navigation (_type_) none 26)
(new-nav-control (_type_ process-drawable int) nav-control 27)
(new-nav-control (_type_ process-drawable) nav-control 27)
(remove-nav-control (_type_ nav-control) none 28)
(add-process-drawable-to-navmesh (_type_ process-drawable symbol) none 29)
(remove-process-drawable (_type_ process-drawable) none 30)
(change-to (_type_ process-drawable symbol) none 31)
(change-to (_type_ process-drawable) none 31)
(link-by-id (_type_ uint) symbol 32)
(unlink-by-id (_type_ uint) symbol 33)
(nav-mesh-method-34 (_type_ vector vector float) float 34)
+4 -4
View File
@@ -588,7 +588,7 @@
)
;; definition for method 27 of type nav-mesh
(defmethod new-nav-control nav-mesh ((obj nav-mesh) (arg0 process-drawable) (arg1 int))
(defmethod new-nav-control nav-mesh ((obj nav-mesh) (arg0 process-drawable))
(let ((gp-0 (the-as nav-control #f)))
(dotimes (v1-0 (the-as int (-> obj nav-control-count)))
(let ((a1-2 (-> obj nav-control-array v1-0)))
@@ -639,7 +639,7 @@
;; WARN: Return type mismatch int vs none.
(defmethod add-process-drawable-to-navmesh nav-mesh ((obj nav-mesh) (arg0 process-drawable) (arg1 symbol))
(if arg1
(change-to obj arg0 arg1)
(change-to obj arg0)
(add-connection (-> obj user-list) arg0 nothing arg0 #f (-> arg0 root))
)
0
@@ -662,7 +662,7 @@
;; definition for method 31 of type nav-mesh
;; WARN: Return type mismatch int vs none.
(defmethod change-to nav-mesh ((obj nav-mesh) (arg0 process-drawable) (arg1 symbol))
(defmethod change-to nav-mesh ((obj nav-mesh) (arg0 process-drawable))
(local-vars (v1-5 symbol))
(let ((gp-0 arg0))
(b! (nonzero? (-> obj user-list)) cfg-2 :delay (empty-form))
@@ -677,7 +677,7 @@
(set! v1-5 (!= obj (-> s3-0 state mesh)))
(label cfg-7)
(b! (not v1-5) cfg-18 :delay (empty-form))
(let ((s4-0 (new-nav-control obj arg0 (the-as int arg1))))
(let ((s4-0 (new-nav-control obj arg0)))
(b! s4-0 cfg-12 :delay (empty-form))
(b! (not *debug-segment*) cfg-11 :delay (empty-form))
(format 0 "ERROR: nav-mesh::change-to: unable to allocate nav-mesh for ~s~%" gp-0)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,13 @@
;; make a type
(deftype test-struct (structure)
((func-arr (function object) 2 :offset-assert 0)))
;; declare an instance of it
(define *test-instance*
(new 'static 'test-struct
:func-arr (new 'static 'array (function object) 2
(lambda () (format #t "1~%"))
(lambda () (format #t "2~%")))))
((-> *test-instance* func-arr 1))
((-> *test-instance* func-arr 0))
+5
View File
@@ -766,6 +766,11 @@ TEST_F(WithGameTests, StaticLambda) {
{"Add: 30 sub: -10\n0\n"});
}
TEST_F(WithGameTests, StaticLambdaArrayDraft) {
shared_compiler->runner.run_static_test(testCategory, "test-static-array-of-lambdas.gc",
{"2\n1\n0\n"});
}
TEST_F(WithGameTests, MethodReplace) {
shared_compiler->runner.run_static_test(testCategory, "test-method-replace.gc",
{"relocate! foo: 123 heap: 1 name: 2\n0\n"});
+2 -1
View File
@@ -262,7 +262,8 @@
"(method 42 nav-mesh)",
"(method 43 nav-mesh)",
"(method 34 nav-mesh)",
"(method 18 nav-control)"
"(method 18 nav-control)",
"(method 10 idle-control)" // re-assigns `self`
],
"skip_compile_states": {