Skip to content

Commit

Permalink
[jak2] tiny fix to grunt (#2040)
Browse files Browse the repository at this point in the history
  • Loading branch information
water111 authored Nov 30, 2022
1 parent ac3c4e5 commit c983475
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion decompiler/config/jak2/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -34227,7 +34227,7 @@
(wait-for-focus () _type_ :state 182)
(spin-attack () _type_ :state 183)
(grunt-method-184 (_type_ float) process-focusable 184)
(grunt-method-185 () none 185)
(grunt-method-185 (_type_) nav-enemy-info 185)
)
)

Expand Down
11 changes: 0 additions & 11 deletions game/mips2c/jak2_functions/collide_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,15 +948,13 @@ u64 execute(void* ctxt) {
goto block_3;
}

block_6:
cop1_bc = c->fprs[f1] <= c->fprs[f2]; // c.le.s f1, f2
c->lqc2(vf3, 64, s3); // lqc2 vf3, 64(s3)
if (cop1_bc) { // bc1tl L38
c->daddiu(s2, s2, 64); // daddiu s2, s2, 64
goto block_3;
}

block_8:
c->vmul(DEST::xyzw, vf5, vf1, vf2); // vmul.xyzw vf5, vf1, vf2
c->lqc2(vf4, 0, s5); // lqc2 vf4, 0(s5)
// nop // sll r0, r0, 0
Expand Down Expand Up @@ -984,7 +982,6 @@ u64 execute(void* ctxt) {
goto block_3;
}

block_11:
c->vadd_bc(DEST::x, BC::z, vf6, vf6, vf6); // vaddz.x vf6, vf6, vf6
// nop // sll r0, r0, 0
c->mov128_gpr_vf(v1, vf6); // qmfc2.i v1, vf6
Expand Down Expand Up @@ -1026,7 +1023,6 @@ u64 execute(void* ctxt) {
goto block_17;
}

block_16:
c->lui(v0, -13122); // lui v0, -13122
c->ori(v0, v0, 48160); // ori v0, v0, 48160

Expand Down Expand Up @@ -1188,7 +1184,6 @@ u64 execute(void* ctxt) {
goto block_10;
}

block_9:
c->vsub_bc(DEST::x, BC::y, vf2, vf0, vf1); // vsuby.x vf2, vf0, vf1
// nop // sll r0, r0, 0
c->vrsqrt(vf0, BC::w, vf14, BC::x); // vrsqrt Q, vf0.w, vf14.x
Expand Down Expand Up @@ -1381,7 +1376,6 @@ u64 execute(void* ctxt) {
goto block_10;
}

block_9:
c->daddiu(v1, s7, 4); // daddiu v1, s7, 4
c->lwu(a0, 24, s4); // lwu a0, 24(s4)
c->andi(a0, a0, 1); // andi a0, a0, 1
Expand Down Expand Up @@ -1592,7 +1586,6 @@ u64 execute(void* ctxt) {
goto block_1;
}

block_4:
c->vwaitq(); // vwaitq
// nop // sll r0, r0, 0
c->vmulq(DEST::xyz, vf8, vf8); // vmulq.xyz vf8, vf8, Q
Expand All @@ -1608,7 +1601,6 @@ u64 execute(void* ctxt) {
goto block_1;
}

block_7:
c->daddiu(s0, s0, 1); // daddiu s0, s0, 1
c->lq(a1, 16, s2); // lq a1, 16(s2)
// nop // sll r0, r0, 0
Expand All @@ -1632,7 +1624,6 @@ u64 execute(void* ctxt) {
goto block_5;
}

block_9:
c->load_symbol2(t9, cache.closest_pt_in_triangle);// lw t9, closest-pt-in-triangle(s7)
c->daddu(a0, r0, gp); // daddu a0, r0, gp
c->daddu(a1, r0, s2); // daddu a1, r0, s2
Expand All @@ -1658,7 +1649,6 @@ u64 execute(void* ctxt) {
goto block_5;
}

block_11:
c->daddiu(v1, s7, 4); // daddiu v1, s7, #t
c->mov64(v0, v1); // or v0, v1, r0
//beq r0, r0, L16 // beq r0, r0, L16
Expand Down Expand Up @@ -1712,7 +1702,6 @@ namespace method_10_collide_puss_work {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lwu(v1, 116, a2); // lwu v1, 116(a2)
Expand Down
8 changes: 3 additions & 5 deletions goal_src/jak2/levels/common/grunt.gc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
(wait-for-focus () _type_ :state 182)
(spin-attack () _type_ :state 183)
(grunt-method-184 (_type_ float) process-focusable 184)
(grunt-method-185 () none 185)
(grunt-method-185 (_type_) nav-enemy-info 185)
)
)

Expand Down Expand Up @@ -1562,10 +1562,8 @@
(none)
)

;; WARN: Return type mismatch nav-enemy-info vs none.
(defmethod grunt-method-185 grunt ()
(defmethod grunt-method-185 grunt ((obj grunt))
*grunt-nav-enemy-info*
(none)
)

(defmethod enemy-method-115 grunt ((obj grunt))
Expand All @@ -1575,7 +1573,7 @@
(the-as skeleton-group (art-group-get-by-name *level* "skel-grunt" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(enemy-method-113 obj (the-as nav-enemy-info ((method-of-object obj grunt-method-185))))
(enemy-method-113 obj (grunt-method-185 obj))
(let ((v1-6 (-> obj neck)))
(set! (-> v1-6 up) (the-as uint 1))
(set! (-> v1-6 nose) (the-as uint 2))
Expand Down
8 changes: 3 additions & 5 deletions test/decompiler/reference/jak2/levels/common/grunt_REF.gc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c983475

Please sign in to comment.