Decompile chrDoFlinchcntThing

This commit is contained in:
Ryan Dwyer 2020-05-18 22:06:33 +10:00
parent 401470e603
commit 0f146a4145
4 changed files with 30 additions and 58 deletions

View File

@ -3108,58 +3108,30 @@ void func0f02133c(struct chrdata *chr)
}
}
GLOBAL_ASM(
glabel func0f0213a0
.late_rodata
glabel var7f1a8728
.word 0x3ec907a9
glabel var7f1a872c
.word 0x40c907a9
.text
/* f0213a0: 80820012 */ lb $v0,0x12($a0)
/* f0213a4: 44856000 */ mtc1 $a1,$f12
/* f0213a8: 240e0001 */ addiu $t6,$zero,0x1
/* f0213ac: 04410003 */ bgez $v0,.L0f0213bc
/* f0213b0: 28410009 */ slti $at,$v0,0x9
/* f0213b4: 10000004 */ beqz $zero,.L0f0213c8
/* f0213b8: a08e0012 */ sb $t6,0x12($a0)
.L0f0213bc:
/* f0213bc: 14200002 */ bnez $at,.L0f0213c8
/* f0213c0: 240f0004 */ addiu $t7,$zero,0x4
/* f0213c4: a08f0012 */ sb $t7,0x12($a0)
.L0f0213c8:
/* f0213c8: 94980192 */ lhu $t8,0x192($a0)
/* f0213cc: 3c017f1b */ lui $at,%hi(var7f1a8728)
/* f0213d0: 33080fff */ andi $t0,$t8,0xfff
/* f0213d4: a4880192 */ sh $t0,0x192($a0)
/* f0213d8: 35091000 */ ori $t1,$t0,0x1000
/* f0213dc: a4890192 */ sh $t1,0x192($a0)
/* f0213e0: c4248728 */ lwc1 $f4,%lo(var7f1a8728)($at)
/* f0213e4: 3c014100 */ lui $at,0x4100
/* f0213e8: 44814000 */ mtc1 $at,$f8
/* f0213ec: 46046180 */ add.s $f6,$f12,$f4
/* f0213f0: 3c017f1b */ lui $at,%hi(var7f1a872c)
/* f0213f4: c430872c */ lwc1 $f16,%lo(var7f1a872c)($at)
/* f0213f8: 46083282 */ mul.s $f10,$f6,$f8
/* f0213fc: 46105483 */ div.s $f18,$f10,$f16
/* f021400: 4600910d */ trunc.w.s $f4,$f18
/* f021404: 44022000 */ mfc1 $v0,$f4
/* f021408: 00000000 */ sll $zero,$zero,0x0
/* f02140c: 04430003 */ bgezl $v0,.L0f02141c
/* f021410: 28410008 */ slti $at,$v0,0x8
/* f021414: 00001025 */ or $v0,$zero,$zero
/* f021418: 28410008 */ slti $at,$v0,0x8
.L0f02141c:
/* f02141c: 54200003 */ bnezl $at,.L0f02142c
/* f021420: 948b0192 */ lhu $t3,0x192($a0)
/* f021424: 24020007 */ addiu $v0,$zero,0x7
/* f021428: 948b0192 */ lhu $t3,0x192($a0)
.L0f02142c:
/* f02142c: 00026340 */ sll $t4,$v0,0xd
/* f021430: 016c6825 */ or $t5,$t3,$t4
/* f021434: 03e00008 */ jr $ra
/* f021438: a48d0192 */ sh $t5,0x192($a0)
);
void chrDoFlinchcntThing(struct chrdata *chr, f32 arg1)
{
s32 value;
if (chr->flinchcnt < 0) {
chr->flinchcnt = 1;
} else if (chr->flinchcnt > 8) {
chr->flinchcnt = 4;
}
chr->hidden2 &= 0x0fff;
chr->hidden2 |= CHRH2FLAG_1000;
value = (arg1 + 0.3926365673542f) * 8.0f / M_BADTAU;
if (value < 0) {
value = 0;
}
if (value > 7) {
value = 7;
}
chr->hidden2 |= value << 13;
}
GLOBAL_ASM(
glabel func0f02143c
@ -4776,7 +4748,7 @@ glabel var7f1a87b8
/* f022ee4: afa80010 */ sw $t0,0x10($sp)
/* f022ee8: 3c054049 */ lui $a1,0x4049
/* f022eec: 34a50fdb */ ori $a1,$a1,0xfdb
/* f022ef0: 0fc084e8 */ jal func0f0213a0
/* f022ef0: 0fc084e8 */ jal chrDoFlinchcntThing
/* f022ef4: 02002025 */ or $a0,$s0,$zero
/* f022ef8: 3c03800a */ lui $v1,%hi(g_Vars)
/* f022efc: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars)

View File

@ -8062,7 +8062,7 @@ glabel var7f1a8d98
/* f035418: 0fc122a1 */ jal chrGetAngleToPos
/* f03541c: e7a400b4 */ swc1 $f4,0xb4($sp)
/* f035420: 44050000 */ mfc1 $a1,$f0
/* f035424: 0fc084e8 */ jal func0f0213a0
/* f035424: 0fc084e8 */ jal chrDoFlinchcntThing
/* f035428: 02002025 */ or $a0,$s0,$zero
/* f03542c: 100003c5 */ beqz $zero,.L0f036344
/* f035430: 8fbf0054 */ lw $ra,0x54($sp)
@ -8234,7 +8234,7 @@ glabel var7f1a8d98
/* f035688: 02002025 */ or $a0,$s0,$zero
/* f03568c: 15e10005 */ bne $t7,$at,.L0f0356a4
/* f035690: 8fa50098 */ lw $a1,0x98($sp)
/* f035694: 0fc084e8 */ jal func0f0213a0
/* f035694: 0fc084e8 */ jal chrDoFlinchcntThing
/* f035698: 4614a500 */ add.s $f20,$f20,$f20
/* f03569c: 1000002a */ beqz $zero,.L0f035748
/* f0356a0: 8fad0128 */ lw $t5,0x128($sp)
@ -8248,7 +8248,7 @@ glabel var7f1a8d98
/* f0356bc: 8fad0128 */ lw $t5,0x128($sp)
/* f0356c0: 17200020 */ bnez $t9,.L0f035744
/* f0356c4: 02002025 */ or $a0,$s0,$zero
/* f0356c8: 0fc084e8 */ jal func0f0213a0
/* f0356c8: 0fc084e8 */ jal chrDoFlinchcntThing
/* f0356cc: 8fa50098 */ lw $a1,0x98($sp)
/* f0356d0: 8fa8014c */ lw $t0,0x14c($sp)
/* f0356d4: c7b00124 */ lwc1 $f16,0x124($sp)

View File

@ -15,7 +15,7 @@ struct prop *func0f020b14(struct prop *prop, struct animdata *animdata, struct c
void func0f020d44(struct prop *prop, bool arg1);
u32 func0f021258(void);
void func0f02133c(struct chrdata *chr);
u32 func0f0213a0(void);
void chrDoFlinchcntThing(struct chrdata *chr, f32 arg1);
u32 func0f02143c(void);
void func0f021fa8(struct chrdata *chr, struct coord *pos, s16 *room);
void func0f0220ec(struct chrdata *chr, s32 arg1, s32 arg2);

View File

@ -668,7 +668,7 @@ struct chrdata {
/*0x18c*/ f32 oldframe;
/*0x190*/ s8 footstep;
/*0x191*/ u8 floortype;
/*0x192*/ u16 hidden2;
/*0x192*/ u16 hidden2; // First 3 bits are a number
/*0x194*/ f32 magicframe;
/*0x198*/ f32 magicspeed;
/*0x19c*/ s16 magicanim;