From 2b2c24ffde83a1b88c92e6fc89041d38eeb84bc7 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 16 Jun 2021 20:25:47 +1000 Subject: [PATCH] Decompile chrCheckFootstepMagic --- src/game/chr/chraction.c | 8 +- src/game/game_005fd0.c | 939 ++++----------------------------- src/include/game/game_005fd0.h | 6 +- 3 files changed, 106 insertions(+), 847 deletions(-) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 060daf011..f6bace5c4 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -22876,7 +22876,7 @@ void chrTickPatrol(struct chrdata *chr) chrGoPosTickMagic(chr, &chr->act_patrol.waydata, func0f0370a8(chr), &sp58, sp48); } - func0f006520(chr); + chrCheckFootstepMagic(chr); } else { arrivinglaterally = posIsArrivingLaterallyAtPos(&chr->prevpos, &prop->pos, &sp58, 30); arriving = posIsArrivingAtPos(&chr->prevpos, &prop->pos, &sp58, 30); @@ -22896,7 +22896,7 @@ void chrTickPatrol(struct chrdata *chr) } func0f045b9c(chr, &sp58, &chr->act_patrol.waydata, 1); - func0f0061dc(chr); + chrCheckFootstep(chr); } } @@ -23188,10 +23188,10 @@ void chrTick(struct chrdata *chr) #endif if (pass) { - func0f0061dc(chr); + chrCheckFootstep(chr); } } else { - func0f006520(chr); + chrCheckFootstepMagic(chr); } } diff --git a/src/game/game_005fd0.c b/src/game/game_005fd0.c index 64ed6e0c5..8844bfa6a 100644 --- a/src/game/game_005fd0.c +++ b/src/game/game_005fd0.c @@ -29,7 +29,7 @@ struct footstepframe { u8 frame2; }; -struct footstepframe g_FootstepFrames[] = { +struct footstepframe g_FootstepAnims[] = { { ANIM_002B, 0x08, 0x19 }, { ANIM_0029, 0x05, 0x0e }, { ANIM_006B, 0x08, 0x19 }, @@ -97,7 +97,7 @@ bool func0f005fd0(s32 animnum) return false; } -s32 chrChooseFootstepSound(struct chrdata *chr, u32 arg1) +s32 chrChooseFootstepSound(struct chrdata *chr, s32 footstepindex) { s32 floortype; s32 which; @@ -135,10 +135,10 @@ s32 chrChooseFootstepSound(struct chrdata *chr, u32 arg1) return result; } - which = func0f005fd0(g_FootstepFrames[arg1].animnum); + which = func0f005fd0(g_FootstepAnims[footstepindex].animnum); do { - rand = random() & 7; + rand = random() % 8; index = (which ? 2 : 0) + (rand & 5) + floortype * 8; } while (index == chr->lastfootsample); @@ -149,7 +149,7 @@ s32 chrChooseFootstepSound(struct chrdata *chr, u32 arg1) #if VERSION >= VERSION_PAL_FINAL GLOBAL_ASM( -glabel func0f0061dc +glabel chrCheckFootstep /* f0061dc: 27bdff88 */ addiu $sp,$sp,-120 /* f0061e0: afbf004c */ sw $ra,0x4c($sp) /* f0061e4: afb10048 */ sw $s1,0x48($sp) @@ -382,7 +382,7 @@ glabel func0f0061dc ); #elif VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( -glabel func0f0061dc +glabel chrCheckFootstep /* f0061dc: 27bdff88 */ addiu $sp,$sp,-120 /* f0061e0: afbf004c */ sw $ra,0x4c($sp) /* f0061e4: afb10048 */ sw $s1,0x48($sp) @@ -437,8 +437,8 @@ glabel func0f0061dc /* f006298: 5080009d */ beqzl $a0,.L0f006510 /* f00629c: 8fbf004c */ lw $ra,0x4c($sp) /* f0062a0: c626018c */ lwc1 $f6,0x18c($s1) -/* f0062a4: 3c038006 */ lui $v1,%hi(g_FootstepFrames) -/* f0062a8: 246315a0 */ addiu $v1,$v1,%lo(g_FootstepFrames) +/* f0062a4: 3c038006 */ lui $v1,%hi(g_FootstepAnims) +/* f0062a8: 246315a0 */ addiu $v1,$v1,%lo(g_FootstepAnims) /* f0062ac: e7a60070 */ swc1 $f6,0x70($sp) /* f0062b0: c480000c */ lwc1 $f0,0xc($a0) /* f0062b4: 00008025 */ or $s0,$zero,$zero @@ -618,7 +618,7 @@ glabel func0f0061dc ); #else GLOBAL_ASM( -glabel func0f0061dc +glabel chrCheckFootstep /* f005f2c: 27bdff88 */ addiu $sp,$sp,-120 /* f005f30: afbf004c */ sw $ra,0x4c($sp) /* f005f34: afb10048 */ sw $s1,0x48($sp) @@ -852,8 +852,13 @@ glabel func0f0061dc ); #endif +/** + * Check if a footstep sound should play for the given chr and play it if so. + * + * It is assumed that the chr is moving normally and not via magic. + */ // Mismatch: load of 10.0f into $at is swapped with load of prevframe from stack -//void func0f0061dc(struct chrdata *chr) +//void chrCheckFootstep(struct chrdata *chr) //{ // if (debugEnableFootsteps() && PLAYERCOUNT() == 1 && chr) { // chr->footstep = 0; @@ -869,18 +874,18 @@ glabel func0f0061dc // // chr->oldframe = frame; // -// for (i = 0; i < ARRAYCOUNT(g_FootstepFrames); i++) { -// if (modelGetAnimNum(chr->model) == g_FootstepFrames[i].animnum) { -// if (CHRRACE(chr) == RACE_SKEDAR && g_FootstepFrames[i].animnum == ANIM_SKEDAR_RUNNING) { +// for (i = 0; i < ARRAYCOUNT(g_FootstepAnims); i++) { +// if (modelGetAnimNum(chr->model) == g_FootstepAnims[i].animnum) { +// if (CHRRACE(chr) == RACE_SKEDAR && g_FootstepAnims[i].animnum == ANIM_SKEDAR_RUNNING) { // if ((frame >= 2 && prevframe < 2) || (frame >= 17 && prevframe < 17)) { // chr->footstep = 1; // } else if ((frame >= 10 && prevframe < 10) || (frame >= 25 && prevframe < 25)) { // chr->footstep = 2; // } // } else { -// if (frame >= g_FootstepFrames[i].frame1 && prevframe < g_FootstepFrames[i].frame1) { +// if (frame >= g_FootstepAnims[i].frame1 && prevframe < g_FootstepAnims[i].frame1) { // chr->footstep = 1; -// } else if (frame >= g_FootstepFrames[i].frame2 && prevframe < g_FootstepFrames[i].frame2) { +// } else if (frame >= g_FootstepAnims[i].frame2 && prevframe < g_FootstepAnims[i].frame2) { // chr->footstep = 2; // } // } @@ -905,831 +910,85 @@ glabel func0f0061dc // } //} +/** + * Assuming the given chr is moving using magic, check if a footstep sound + * should play and play it if so. + * + * The "magic" method of movement applies when the chr is off-screen. + * It uses a computationally simple approach to movement. + */ +void chrCheckFootstepMagic(struct chrdata *chr) +{ + s32 index; + f32 frame; + f32 prevframe; + struct prop *playerprop = g_Vars.currentplayer->prop; + f32 xdiff; + f32 ydiff; + f32 zdiff; + s32 soundnum; + + if (debugEnableFootsteps() && PLAYERCOUNT() == 1 && chr->magicanim >= 0) { #if VERSION >= VERSION_PAL_FINAL -GLOBAL_ASM( -glabel func0f006520 -.late_rodata -glabel var7f1a7e6c -.word 0x4a371b00 -.text -/* f006514: 3c05800a */ lui $a1,0x800a -/* f006518: 24a5a510 */ addiu $a1,$a1,-23280 -/* f00651c: 8cae0284 */ lw $t6,0x284($a1) -/* f006520: 27bdffa0 */ addiu $sp,$sp,-96 -/* f006524: afbf004c */ sw $ra,0x4c($sp) -/* f006528: afb00048 */ sw $s0,0x48($sp) -/* f00652c: 8dc700bc */ lw $a3,0xbc($t6) -/* f006530: 00808025 */ move $s0,$a0 -/* f006534: 0fc47e7e */ jal debugEnableFootsteps -/* f006538: afa70050 */ sw $a3,0x50($sp) -/* f00653c: 3c05800a */ lui $a1,0x800a -/* f006540: 24a5a510 */ addiu $a1,$a1,-23280 -/* f006544: 104000e4 */ beqz $v0,.PF0f0068d8 -/* f006548: 8fa70050 */ lw $a3,0x50($sp) -/* f00654c: 8caf006c */ lw $t7,0x6c($a1) -/* f006550: 24080001 */ li $t0,0x1 -/* f006554: 00003025 */ move $a2,$zero -/* f006558: 11e00003 */ beqz $t7,.PF0f006568 -/* f00655c: 00001825 */ move $v1,$zero -/* f006560: 10000001 */ b .PF0f006568 -/* f006564: 24060001 */ li $a2,0x1 -.PF0f006568: -/* f006568: 8cb80068 */ lw $t8,0x68($a1) -/* f00656c: 00002025 */ move $a0,$zero -/* f006570: 00001025 */ move $v0,$zero -/* f006574: 13000003 */ beqz $t8,.PF0f006584 -/* f006578: 00000000 */ nop -/* f00657c: 10000001 */ b .PF0f006584 -/* f006580: 24030001 */ li $v1,0x1 -.PF0f006584: -/* f006584: 8cb90064 */ lw $t9,0x64($a1) -/* f006588: 13200003 */ beqz $t9,.PF0f006598 -/* f00658c: 00000000 */ nop -/* f006590: 10000001 */ b .PF0f006598 -/* f006594: 24040001 */ li $a0,0x1 -.PF0f006598: -/* f006598: 8ca90070 */ lw $t1,0x70($a1) -/* f00659c: 11200003 */ beqz $t1,.PF0f0065ac -/* f0065a0: 00000000 */ nop -/* f0065a4: 10000001 */ b .PF0f0065ac -/* f0065a8: 24020001 */ li $v0,0x1 -.PF0f0065ac: -/* f0065ac: 00445021 */ addu $t2,$v0,$a0 -/* f0065b0: 01435821 */ addu $t3,$t2,$v1 -/* f0065b4: 01666021 */ addu $t4,$t3,$a2 -/* f0065b8: 550c00c8 */ bnel $t0,$t4,.PF0f0068dc -/* f0065bc: 8fbf004c */ lw $ra,0x4c($sp) -/* f0065c0: 860d019c */ lh $t5,0x19c($s0) -/* f0065c4: 05a200c5 */ bltzl $t5,.PF0f0068dc -/* f0065c8: 8fbf004c */ lw $ra,0x4c($sp) -/* f0065cc: c4a4004c */ lwc1 $f4,0x4c($a1) -/* f0065d0: c6060198 */ lwc1 $f6,0x198($s0) -/* f0065d4: c60a0194 */ lwc1 $f10,0x194($s0) -/* f0065d8: 8e02001c */ lw $v0,0x1c($s0) -/* f0065dc: 46062202 */ mul.s $f8,$f4,$f6 -/* f0065e0: 3c01437a */ lui $at,0x437a -/* f0065e4: 46085480 */ add.s $f18,$f10,$f8 -/* f0065e8: 104000bb */ beqz $v0,.PF0f0068d8 -/* f0065ec: e6120194 */ swc1 $f18,0x194($s0) -/* f0065f0: c4ea000c */ lwc1 $f10,0xc($a3) -/* f0065f4: c448000c */ lwc1 $f8,0xc($v0) -/* f0065f8: 44809000 */ mtc1 $zero,$f18 -/* f0065fc: c4e40008 */ lwc1 $f4,0x8($a3) -/* f006600: 46085001 */ sub.s $f0,$f10,$f8 -/* f006604: c4460008 */ lwc1 $f6,0x8($v0) -/* f006608: 44815000 */ mtc1 $at,$f10 -/* f00660c: 4612003c */ c.lt.s $f0,$f18 -/* f006610: 46062081 */ sub.s $f2,$f4,$f6 -/* f006614: 45020003 */ bc1fl .PF0f006624 -/* f006618: 460a003c */ c.lt.s $f0,$f10 -/* f00661c: 46000007 */ neg.s $f0,$f0 -/* f006620: 460a003c */ c.lt.s $f0,$f10 -.PF0f006624: -/* f006624: c4e40010 */ lwc1 $f4,0x10($a3) -/* f006628: c4460010 */ lwc1 $f6,0x10($v0) -/* f00662c: c60e0194 */ lwc1 $f14,0x194($s0) -/* f006630: 8605019c */ lh $a1,0x19c($s0) -/* f006634: c610018c */ lwc1 $f16,0x18c($s0) -/* f006638: a2000190 */ sb $zero,0x190($s0) -/* f00663c: e60e018c */ swc1 $f14,0x18c($s0) -/* f006640: 46062301 */ sub.s $f12,$f4,$f6 -/* f006644: 4500008a */ bc1f .PF0f006870 -/* f006648: afa5005c */ sw $a1,0x5c($sp) -/* f00664c: 46021202 */ mul.s $f8,$f2,$f2 -/* f006650: 3c017f1b */ lui $at,0x7f1b -/* f006654: c426906c */ lwc1 $f6,-0x6f94($at) -/* f006658: 460c6482 */ mul.s $f18,$f12,$f12 -/* f00665c: afa5005c */ sw $a1,0x5c($sp) -/* f006660: 02002025 */ move $a0,$s0 -/* f006664: 46124100 */ add.s $f4,$f8,$f18 -/* f006668: 4606203c */ c.lt.s $f4,$f6 -/* f00666c: 00000000 */ nop -/* f006670: 45020080 */ bc1fl .PF0f006874 -/* f006674: 8fa5005c */ lw $a1,0x5c($sp) -/* f006678: 12000003 */ beqz $s0,.PF0f006688 -/* f00667c: 00001025 */ move $v0,$zero -/* f006680: 10000001 */ b .PF0f006688 -/* f006684: 920202fe */ lbu $v0,0x2fe($s0) -.PF0f006688: -/* f006688: 14480033 */ bne $v0,$t0,.PF0f006758 -/* f00668c: 00057080 */ sll $t6,$a1,0x2 -/* f006690: 3c0f8006 */ lui $t7,0x8006 -/* f006694: 01ee7821 */ addu $t7,$t7,$t6 -/* f006698: 95ef1270 */ lhu $t7,0x1270($t7) -/* f00669c: 24010394 */ li $at,0x394 -/* f0066a0: 15e1002d */ bne $t7,$at,.PF0f006758 -/* f0066a4: 3c014000 */ lui $at,0x4000 -/* f0066a8: 44810000 */ mtc1 $at,$f0 -/* f0066ac: 3c014188 */ lui $at,0x4188 -/* f0066b0: 460e003e */ c.le.s $f0,$f14 -/* f0066b4: 00000000 */ nop -/* f0066b8: 45020006 */ bc1fl .PF0f0066d4 -/* f0066bc: 44810000 */ mtc1 $at,$f0 -/* f0066c0: 4600803c */ c.lt.s $f16,$f0 -/* f0066c4: 00000000 */ nop -/* f0066c8: 4501000b */ bc1t .PF0f0066f8 -/* f0066cc: 00000000 */ nop -/* f0066d0: 44810000 */ mtc1 $at,$f0 -.PF0f0066d4: -/* f0066d4: 3c014120 */ lui $at,0x4120 -/* f0066d8: 460e003e */ c.le.s $f0,$f14 -/* f0066dc: 00000000 */ nop -/* f0066e0: 45020008 */ bc1fl .PF0f006704 -/* f0066e4: 44810000 */ mtc1 $at,$f0 -/* f0066e8: 4600803c */ c.lt.s $f16,$f0 -/* f0066ec: 00000000 */ nop -/* f0066f0: 45020004 */ bc1fl .PF0f006704 -/* f0066f4: 44810000 */ mtc1 $at,$f0 -.PF0f0066f8: -/* f0066f8: 1000003e */ b .PF0f0067f4 -/* f0066fc: a2080190 */ sb $t0,0x190($s0) -/* f006700: 44810000 */ mtc1 $at,$f0 -.PF0f006704: -/* f006704: 3c0141c8 */ lui $at,0x41c8 -/* f006708: 460e003e */ c.le.s $f0,$f14 -/* f00670c: 00000000 */ nop -/* f006710: 45020006 */ bc1fl .PF0f00672c -/* f006714: 44810000 */ mtc1 $at,$f0 -/* f006718: 4600803c */ c.lt.s $f16,$f0 -/* f00671c: 00000000 */ nop -/* f006720: 4503000b */ bc1tl .PF0f006750 -/* f006724: 24180002 */ li $t8,0x2 -/* f006728: 44810000 */ mtc1 $at,$f0 -.PF0f00672c: -/* f00672c: 00000000 */ nop -/* f006730: 460e003e */ c.le.s $f0,$f14 -/* f006734: 00000000 */ nop -/* f006738: 4500002e */ bc1f .PF0f0067f4 -/* f00673c: 00000000 */ nop -/* f006740: 4600803c */ c.lt.s $f16,$f0 -/* f006744: 00000000 */ nop -/* f006748: 4500002a */ bc1f .PF0f0067f4 -/* f00674c: 24180002 */ li $t8,0x2 -.PF0f006750: -/* f006750: 10000028 */ b .PF0f0067f4 -/* f006754: a2180190 */ sb $t8,0x190($s0) -.PF0f006758: -/* f006758: 3c098006 */ lui $t1,0x8006 -/* f00675c: 25291270 */ addiu $t1,$t1,0x1270 -/* f006760: 0005c880 */ sll $t9,$a1,0x2 -/* f006764: 03291021 */ addu $v0,$t9,$t1 -/* f006768: 904a0002 */ lbu $t2,0x2($v0) -/* f00676c: 3c014f80 */ lui $at,0x4f80 -/* f006770: 448a5000 */ mtc1 $t2,$f10 -/* f006774: 05410004 */ bgez $t2,.PF0f006788 -/* f006778: 46805020 */ cvt.s.w $f0,$f10 -/* f00677c: 44814000 */ mtc1 $at,$f8 -/* f006780: 00000000 */ nop -/* f006784: 46080000 */ add.s $f0,$f0,$f8 -.PF0f006788: -/* f006788: 460e003e */ c.le.s $f0,$f14 -/* f00678c: 00000000 */ nop -/* f006790: 45020008 */ bc1fl .PF0f0067b4 -/* f006794: 904b0003 */ lbu $t3,0x3($v0) -/* f006798: 4600803c */ c.lt.s $f16,$f0 -/* f00679c: 00000000 */ nop -/* f0067a0: 45020004 */ bc1fl .PF0f0067b4 -/* f0067a4: 904b0003 */ lbu $t3,0x3($v0) -/* f0067a8: 10000012 */ b .PF0f0067f4 -/* f0067ac: a2080190 */ sb $t0,0x190($s0) -/* f0067b0: 904b0003 */ lbu $t3,0x3($v0) -.PF0f0067b4: -/* f0067b4: 3c014f80 */ lui $at,0x4f80 -/* f0067b8: 448b9000 */ mtc1 $t3,$f18 -/* f0067bc: 05610004 */ bgez $t3,.PF0f0067d0 -/* f0067c0: 46809020 */ cvt.s.w $f0,$f18 -/* f0067c4: 44812000 */ mtc1 $at,$f4 -/* f0067c8: 00000000 */ nop -/* f0067cc: 46040000 */ add.s $f0,$f0,$f4 -.PF0f0067d0: -/* f0067d0: 460e003e */ c.le.s $f0,$f14 -/* f0067d4: 00000000 */ nop -/* f0067d8: 45000006 */ bc1f .PF0f0067f4 -/* f0067dc: 00000000 */ nop -/* f0067e0: 4600803c */ c.lt.s $f16,$f0 -/* f0067e4: 240c0002 */ li $t4,0x2 -/* f0067e8: 45000002 */ bc1f .PF0f0067f4 -/* f0067ec: 00000000 */ nop -/* f0067f0: a20c0190 */ sb $t4,0x190($s0) -.PF0f0067f4: -/* f0067f4: 0fc0181d */ jal chrChooseFootstepSound -/* f0067f8: afa5005c */ sw $a1,0x5c($sp) -/* f0067fc: 2401ffff */ li $at,-1 -/* f006800: 5041001c */ beql $v0,$at,.PF0f006874 -/* f006804: 8fa5005c */ lw $a1,0x5c($sp) -/* f006808: 820d0190 */ lb $t5,0x190($s0) -/* f00680c: 3c01bf80 */ lui $at,0xbf80 -/* f006810: 00002025 */ move $a0,$zero -/* f006814: 11a00016 */ beqz $t5,.PF0f006870 -/* f006818: 00023400 */ sll $a2,$v0,0x10 -/* f00681c: 8e05001c */ lw $a1,0x1c($s0) -/* f006820: 44810000 */ mtc1 $at,$f0 -/* f006824: 00067403 */ sra $t6,$a2,0x10 -/* f006828: 240fffff */ li $t7,-1 -/* f00682c: 24180400 */ li $t8,0x400 -/* f006830: 24190010 */ li $t9,0x10 -/* f006834: 2409ffff */ li $t1,-1 -/* f006838: afa9002c */ sw $t1,0x2c($sp) -/* f00683c: afb9001c */ sw $t9,0x1c($sp) -/* f006840: afb80014 */ sw $t8,0x14($sp) -/* f006844: afaf0010 */ sw $t7,0x10($sp) -/* f006848: 01c03025 */ move $a2,$t6 -/* f00684c: afa00028 */ sw $zero,0x28($sp) -/* f006850: afa00020 */ sw $zero,0x20($sp) -/* f006854: afa00018 */ sw $zero,0x18($sp) -/* f006858: 2407ffff */ li $a3,-1 -/* f00685c: e7a00024 */ swc1 $f0,0x24($sp) -/* f006860: e7a00030 */ swc1 $f0,0x30($sp) -/* f006864: e7a00034 */ swc1 $f0,0x34($sp) -/* f006868: 0fc24e3a */ jal func0f0939f8 -/* f00686c: e7a00038 */ swc1 $f0,0x38($sp) -.PF0f006870: -/* f006870: 8fa5005c */ lw $a1,0x5c($sp) -.PF0f006874: -/* f006874: 3c048006 */ lui $a0,0x8006 -/* f006878: 00055080 */ sll $t2,$a1,0x2 -/* f00687c: 008a2021 */ addu $a0,$a0,$t2 -/* f006880: 0fc017f4 */ jal func0f005fd0 -/* f006884: 94841270 */ lhu $a0,0x1270($a0) -/* f006888: 1040000b */ beqz $v0,.PF0f0068b8 -/* f00688c: 3c014208 */ lui $at,0x4208 -/* f006890: 3c0141b0 */ lui $at,0x41b0 -/* f006894: 44811000 */ mtc1 $at,$f2 -/* f006898: c6000194 */ lwc1 $f0,0x194($s0) -/* f00689c: 4600103c */ c.lt.s $f2,$f0 -/* f0068a0: 00000000 */ nop -/* f0068a4: 4502000d */ bc1fl .PF0f0068dc -/* f0068a8: 8fbf004c */ lw $ra,0x4c($sp) -/* f0068ac: 46020181 */ sub.s $f6,$f0,$f2 -/* f0068b0: 10000009 */ b .PF0f0068d8 -/* f0068b4: e6060194 */ swc1 $f6,0x194($s0) -.PF0f0068b8: -/* f0068b8: 44811000 */ mtc1 $at,$f2 -/* f0068bc: c6000194 */ lwc1 $f0,0x194($s0) -/* f0068c0: 4600103c */ c.lt.s $f2,$f0 -/* f0068c4: 00000000 */ nop -/* f0068c8: 45020004 */ bc1fl .PF0f0068dc -/* f0068cc: 8fbf004c */ lw $ra,0x4c($sp) -/* f0068d0: 46020281 */ sub.s $f10,$f0,$f2 -/* f0068d4: e60a0194 */ swc1 $f10,0x194($s0) -.PF0f0068d8: -/* f0068d8: 8fbf004c */ lw $ra,0x4c($sp) -.PF0f0068dc: -/* f0068dc: 8fb00048 */ lw $s0,0x48($sp) -/* f0068e0: 27bd0060 */ addiu $sp,$sp,0x60 -/* f0068e4: 03e00008 */ jr $ra -/* f0068e8: 00000000 */ nop -); -#elif VERSION >= VERSION_NTSC_1_0 -GLOBAL_ASM( -glabel func0f006520 -.late_rodata -glabel var7f1a7e6c -.word 0x4a371b00 -.text -/* f006520: 3c05800a */ lui $a1,%hi(g_Vars) -/* f006524: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars) -/* f006528: 8cae0284 */ lw $t6,0x284($a1) -/* f00652c: 27bdffa0 */ addiu $sp,$sp,-96 -/* f006530: afbf004c */ sw $ra,0x4c($sp) -/* f006534: afb00048 */ sw $s0,0x48($sp) -/* f006538: 8dc700bc */ lw $a3,0xbc($t6) -/* f00653c: 00808025 */ or $s0,$a0,$zero -/* f006540: 0fc47bbe */ jal debugEnableFootsteps -/* f006544: afa70050 */ sw $a3,0x50($sp) -/* f006548: 3c05800a */ lui $a1,%hi(g_Vars) -/* f00654c: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars) -/* f006550: 104000e6 */ beqz $v0,.L0f0068ec -/* f006554: 8fa70050 */ lw $a3,0x50($sp) -/* f006558: 8caf006c */ lw $t7,0x6c($a1) -/* f00655c: 24080001 */ addiu $t0,$zero,0x1 -/* f006560: 00003025 */ or $a2,$zero,$zero -/* f006564: 11e00003 */ beqz $t7,.L0f006574 -/* f006568: 00001825 */ or $v1,$zero,$zero -/* f00656c: 10000001 */ b .L0f006574 -/* f006570: 24060001 */ addiu $a2,$zero,0x1 -.L0f006574: -/* f006574: 8cb80068 */ lw $t8,0x68($a1) -/* f006578: 00002025 */ or $a0,$zero,$zero -/* f00657c: 00001025 */ or $v0,$zero,$zero -/* f006580: 13000003 */ beqz $t8,.L0f006590 -/* f006584: 00000000 */ nop -/* f006588: 10000001 */ b .L0f006590 -/* f00658c: 24030001 */ addiu $v1,$zero,0x1 -.L0f006590: -/* f006590: 8cb90064 */ lw $t9,0x64($a1) -/* f006594: 13200003 */ beqz $t9,.L0f0065a4 -/* f006598: 00000000 */ nop -/* f00659c: 10000001 */ b .L0f0065a4 -/* f0065a0: 24040001 */ addiu $a0,$zero,0x1 -.L0f0065a4: -/* f0065a4: 8ca90070 */ lw $t1,0x70($a1) -/* f0065a8: 11200003 */ beqz $t1,.L0f0065b8 -/* f0065ac: 00000000 */ nop -/* f0065b0: 10000001 */ b .L0f0065b8 -/* f0065b4: 24020001 */ addiu $v0,$zero,0x1 -.L0f0065b8: -/* f0065b8: 00445021 */ addu $t2,$v0,$a0 -/* f0065bc: 01435821 */ addu $t3,$t2,$v1 -/* f0065c0: 01666021 */ addu $t4,$t3,$a2 -/* f0065c4: 550c00ca */ bnel $t0,$t4,.L0f0068f0 -/* f0065c8: 8fbf004c */ lw $ra,0x4c($sp) -/* f0065cc: 860d019c */ lh $t5,0x19c($s0) -/* f0065d0: 05a200c7 */ bltzl $t5,.L0f0068f0 -/* f0065d4: 8fbf004c */ lw $ra,0x4c($sp) -/* f0065d8: 8cae0034 */ lw $t6,0x34($a1) -/* f0065dc: c6080198 */ lwc1 $f8,0x198($s0) -/* f0065e0: c6120194 */ lwc1 $f18,0x194($s0) -/* f0065e4: 448e2000 */ mtc1 $t6,$f4 -/* f0065e8: 8e02001c */ lw $v0,0x1c($s0) -/* f0065ec: 3c01437a */ lui $at,0x437a -/* f0065f0: 468021a0 */ cvt.s.w $f6,$f4 -/* f0065f4: 46083282 */ mul.s $f10,$f6,$f8 -/* f0065f8: 460a9100 */ add.s $f4,$f18,$f10 -/* f0065fc: 104000bb */ beqz $v0,.L0f0068ec -/* f006600: e6040194 */ swc1 $f4,0x194($s0) -/* f006604: c4f2000c */ lwc1 $f18,0xc($a3) -/* f006608: c44a000c */ lwc1 $f10,0xc($v0) -/* f00660c: 44802000 */ mtc1 $zero,$f4 -/* f006610: c4e60008 */ lwc1 $f6,0x8($a3) -/* f006614: 460a9001 */ sub.s $f0,$f18,$f10 -/* f006618: c4480008 */ lwc1 $f8,0x8($v0) -/* f00661c: 44819000 */ mtc1 $at,$f18 -/* f006620: 4604003c */ c.lt.s $f0,$f4 -/* f006624: 46083081 */ sub.s $f2,$f6,$f8 -/* f006628: 45020003 */ bc1fl .L0f006638 -/* f00662c: 4612003c */ c.lt.s $f0,$f18 -/* f006630: 46000007 */ neg.s $f0,$f0 -/* f006634: 4612003c */ c.lt.s $f0,$f18 -.L0f006638: -/* f006638: c4e60010 */ lwc1 $f6,0x10($a3) -/* f00663c: c4480010 */ lwc1 $f8,0x10($v0) -/* f006640: c60e0194 */ lwc1 $f14,0x194($s0) -/* f006644: 8605019c */ lh $a1,0x19c($s0) -/* f006648: c610018c */ lwc1 $f16,0x18c($s0) -/* f00664c: a2000190 */ sb $zero,0x190($s0) -/* f006650: e60e018c */ swc1 $f14,0x18c($s0) -/* f006654: 46083301 */ sub.s $f12,$f6,$f8 -/* f006658: 4500008a */ bc1f .L0f006884 -/* f00665c: afa5005c */ sw $a1,0x5c($sp) -/* f006660: 46021282 */ mul.s $f10,$f2,$f2 -/* f006664: 3c017f1a */ lui $at,%hi(var7f1a7e6c) -/* f006668: c4287e6c */ lwc1 $f8,%lo(var7f1a7e6c)($at) -/* f00666c: 460c6102 */ mul.s $f4,$f12,$f12 -/* f006670: afa5005c */ sw $a1,0x5c($sp) -/* f006674: 02002025 */ or $a0,$s0,$zero -/* f006678: 46045180 */ add.s $f6,$f10,$f4 -/* f00667c: 4608303c */ c.lt.s $f6,$f8 -/* f006680: 00000000 */ nop -/* f006684: 45020080 */ bc1fl .L0f006888 -/* f006688: 8fa5005c */ lw $a1,0x5c($sp) -/* f00668c: 12000003 */ beqz $s0,.L0f00669c -/* f006690: 00001025 */ or $v0,$zero,$zero -/* f006694: 10000001 */ b .L0f00669c -/* f006698: 920202fe */ lbu $v0,0x2fe($s0) -.L0f00669c: -/* f00669c: 14480033 */ bne $v0,$t0,.L0f00676c -/* f0066a0: 00057880 */ sll $t7,$a1,0x2 -/* f0066a4: 3c188006 */ lui $t8,%hi(g_FootstepFrames) -/* f0066a8: 030fc021 */ addu $t8,$t8,$t7 -/* f0066ac: 971815a0 */ lhu $t8,%lo(g_FootstepFrames)($t8) -/* f0066b0: 24010394 */ addiu $at,$zero,0x394 -/* f0066b4: 1701002d */ bne $t8,$at,.L0f00676c -/* f0066b8: 3c014000 */ lui $at,0x4000 -/* f0066bc: 44810000 */ mtc1 $at,$f0 -/* f0066c0: 3c014188 */ lui $at,0x4188 -/* f0066c4: 460e003e */ c.le.s $f0,$f14 -/* f0066c8: 00000000 */ nop -/* f0066cc: 45020006 */ bc1fl .L0f0066e8 -/* f0066d0: 44810000 */ mtc1 $at,$f0 -/* f0066d4: 4600803c */ c.lt.s $f16,$f0 -/* f0066d8: 00000000 */ nop -/* f0066dc: 4501000b */ bc1t .L0f00670c -/* f0066e0: 00000000 */ nop -/* f0066e4: 44810000 */ mtc1 $at,$f0 -.L0f0066e8: -/* f0066e8: 3c014120 */ lui $at,0x4120 -/* f0066ec: 460e003e */ c.le.s $f0,$f14 -/* f0066f0: 00000000 */ nop -/* f0066f4: 45020008 */ bc1fl .L0f006718 -/* f0066f8: 44810000 */ mtc1 $at,$f0 -/* f0066fc: 4600803c */ c.lt.s $f16,$f0 -/* f006700: 00000000 */ nop -/* f006704: 45020004 */ bc1fl .L0f006718 -/* f006708: 44810000 */ mtc1 $at,$f0 -.L0f00670c: -/* f00670c: 1000003e */ b .L0f006808 -/* f006710: a2080190 */ sb $t0,0x190($s0) -/* f006714: 44810000 */ mtc1 $at,$f0 -.L0f006718: -/* f006718: 3c0141c8 */ lui $at,0x41c8 -/* f00671c: 460e003e */ c.le.s $f0,$f14 -/* f006720: 00000000 */ nop -/* f006724: 45020006 */ bc1fl .L0f006740 -/* f006728: 44810000 */ mtc1 $at,$f0 -/* f00672c: 4600803c */ c.lt.s $f16,$f0 -/* f006730: 00000000 */ nop -/* f006734: 4503000b */ bc1tl .L0f006764 -/* f006738: 24190002 */ addiu $t9,$zero,0x2 -/* f00673c: 44810000 */ mtc1 $at,$f0 -.L0f006740: -/* f006740: 00000000 */ nop -/* f006744: 460e003e */ c.le.s $f0,$f14 -/* f006748: 00000000 */ nop -/* f00674c: 4500002e */ bc1f .L0f006808 -/* f006750: 00000000 */ nop -/* f006754: 4600803c */ c.lt.s $f16,$f0 -/* f006758: 00000000 */ nop -/* f00675c: 4500002a */ bc1f .L0f006808 -/* f006760: 24190002 */ addiu $t9,$zero,0x2 -.L0f006764: -/* f006764: 10000028 */ b .L0f006808 -/* f006768: a2190190 */ sb $t9,0x190($s0) -.L0f00676c: -/* f00676c: 3c0a8006 */ lui $t2,%hi(g_FootstepFrames) -/* f006770: 254a15a0 */ addiu $t2,$t2,%lo(g_FootstepFrames) -/* f006774: 00054880 */ sll $t1,$a1,0x2 -/* f006778: 012a1021 */ addu $v0,$t1,$t2 -/* f00677c: 904b0002 */ lbu $t3,0x2($v0) -/* f006780: 3c014f80 */ lui $at,0x4f80 -/* f006784: 448b9000 */ mtc1 $t3,$f18 -/* f006788: 05610004 */ bgez $t3,.L0f00679c -/* f00678c: 46809020 */ cvt.s.w $f0,$f18 -/* f006790: 44815000 */ mtc1 $at,$f10 -/* f006794: 00000000 */ nop -/* f006798: 460a0000 */ add.s $f0,$f0,$f10 -.L0f00679c: -/* f00679c: 460e003e */ c.le.s $f0,$f14 -/* f0067a0: 00000000 */ nop -/* f0067a4: 45020008 */ bc1fl .L0f0067c8 -/* f0067a8: 904c0003 */ lbu $t4,0x3($v0) -/* f0067ac: 4600803c */ c.lt.s $f16,$f0 -/* f0067b0: 00000000 */ nop -/* f0067b4: 45020004 */ bc1fl .L0f0067c8 -/* f0067b8: 904c0003 */ lbu $t4,0x3($v0) -/* f0067bc: 10000012 */ b .L0f006808 -/* f0067c0: a2080190 */ sb $t0,0x190($s0) -/* f0067c4: 904c0003 */ lbu $t4,0x3($v0) -.L0f0067c8: -/* f0067c8: 3c014f80 */ lui $at,0x4f80 -/* f0067cc: 448c2000 */ mtc1 $t4,$f4 -/* f0067d0: 05810004 */ bgez $t4,.L0f0067e4 -/* f0067d4: 46802020 */ cvt.s.w $f0,$f4 -/* f0067d8: 44813000 */ mtc1 $at,$f6 -/* f0067dc: 00000000 */ nop -/* f0067e0: 46060000 */ add.s $f0,$f0,$f6 -.L0f0067e4: -/* f0067e4: 460e003e */ c.le.s $f0,$f14 -/* f0067e8: 00000000 */ nop -/* f0067ec: 45000006 */ bc1f .L0f006808 -/* f0067f0: 00000000 */ nop -/* f0067f4: 4600803c */ c.lt.s $f16,$f0 -/* f0067f8: 240d0002 */ addiu $t5,$zero,0x2 -/* f0067fc: 45000002 */ bc1f .L0f006808 -/* f006800: 00000000 */ nop -/* f006804: a20d0190 */ sb $t5,0x190($s0) -.L0f006808: -/* f006808: 0fc0181d */ jal chrChooseFootstepSound -/* f00680c: afa5005c */ sw $a1,0x5c($sp) -/* f006810: 2401ffff */ addiu $at,$zero,-1 -/* f006814: 5041001c */ beql $v0,$at,.L0f006888 -/* f006818: 8fa5005c */ lw $a1,0x5c($sp) -/* f00681c: 820e0190 */ lb $t6,0x190($s0) -/* f006820: 3c01bf80 */ lui $at,0xbf80 -/* f006824: 00002025 */ or $a0,$zero,$zero -/* f006828: 11c00016 */ beqz $t6,.L0f006884 -/* f00682c: 00023400 */ sll $a2,$v0,0x10 -/* f006830: 8e05001c */ lw $a1,0x1c($s0) -/* f006834: 44810000 */ mtc1 $at,$f0 -/* f006838: 00067c03 */ sra $t7,$a2,0x10 -/* f00683c: 2418ffff */ addiu $t8,$zero,-1 -/* f006840: 24190400 */ addiu $t9,$zero,0x400 -/* f006844: 24090010 */ addiu $t1,$zero,0x10 -/* f006848: 240affff */ addiu $t2,$zero,-1 -/* f00684c: afaa002c */ sw $t2,0x2c($sp) -/* f006850: afa9001c */ sw $t1,0x1c($sp) -/* f006854: afb90014 */ sw $t9,0x14($sp) -/* f006858: afb80010 */ sw $t8,0x10($sp) -/* f00685c: 01e03025 */ or $a2,$t7,$zero -/* f006860: afa00028 */ sw $zero,0x28($sp) -/* f006864: afa00020 */ sw $zero,0x20($sp) -/* f006868: afa00018 */ sw $zero,0x18($sp) -/* f00686c: 2407ffff */ addiu $a3,$zero,-1 -/* f006870: e7a00024 */ swc1 $f0,0x24($sp) -/* f006874: e7a00030 */ swc1 $f0,0x30($sp) -/* f006878: e7a00034 */ swc1 $f0,0x34($sp) -/* f00687c: 0fc24e7e */ jal func0f0939f8 -/* f006880: e7a00038 */ swc1 $f0,0x38($sp) -.L0f006884: -/* f006884: 8fa5005c */ lw $a1,0x5c($sp) -.L0f006888: -/* f006888: 3c048006 */ lui $a0,%hi(g_FootstepFrames) -/* f00688c: 00055880 */ sll $t3,$a1,0x2 -/* f006890: 008b2021 */ addu $a0,$a0,$t3 -/* f006894: 0fc017f4 */ jal func0f005fd0 -/* f006898: 948415a0 */ lhu $a0,%lo(g_FootstepFrames)($a0) -/* f00689c: 1040000b */ beqz $v0,.L0f0068cc -/* f0068a0: 3c014208 */ lui $at,0x4208 -/* f0068a4: 3c0141b0 */ lui $at,0x41b0 -/* f0068a8: 44811000 */ mtc1 $at,$f2 -/* f0068ac: c6000194 */ lwc1 $f0,0x194($s0) -/* f0068b0: 4600103c */ c.lt.s $f2,$f0 -/* f0068b4: 00000000 */ nop -/* f0068b8: 4502000d */ bc1fl .L0f0068f0 -/* f0068bc: 8fbf004c */ lw $ra,0x4c($sp) -/* f0068c0: 46020201 */ sub.s $f8,$f0,$f2 -/* f0068c4: 10000009 */ b .L0f0068ec -/* f0068c8: e6080194 */ swc1 $f8,0x194($s0) -.L0f0068cc: -/* f0068cc: 44811000 */ mtc1 $at,$f2 -/* f0068d0: c6000194 */ lwc1 $f0,0x194($s0) -/* f0068d4: 4600103c */ c.lt.s $f2,$f0 -/* f0068d8: 00000000 */ nop -/* f0068dc: 45020004 */ bc1fl .L0f0068f0 -/* f0068e0: 8fbf004c */ lw $ra,0x4c($sp) -/* f0068e4: 46020481 */ sub.s $f18,$f0,$f2 -/* f0068e8: e6120194 */ swc1 $f18,0x194($s0) -.L0f0068ec: -/* f0068ec: 8fbf004c */ lw $ra,0x4c($sp) -.L0f0068f0: -/* f0068f0: 8fb00048 */ lw $s0,0x48($sp) -/* f0068f4: 27bd0060 */ addiu $sp,$sp,0x60 -/* f0068f8: 03e00008 */ jr $ra -/* f0068fc: 00000000 */ nop -); + chr->magicframe += g_Vars.lvupdate240freal * chr->magicspeed; #else -GLOBAL_ASM( -glabel func0f006520 -.late_rodata -glabel var7f1a7e6c -.word 0x4a371b00 -.text -/* f006268: 3c05800a */ lui $a1,0x800a -/* f00626c: 24a5e6c0 */ addiu $a1,$a1,-6464 -/* f006270: 8cae0284 */ lw $t6,0x284($a1) -/* f006274: 27bdffa0 */ addiu $sp,$sp,-96 -/* f006278: afbf004c */ sw $ra,0x4c($sp) -/* f00627c: afb00048 */ sw $s0,0x48($sp) -/* f006280: 8dc700bc */ lw $a3,0xbc($t6) -/* f006284: 00808025 */ or $s0,$a0,$zero -/* f006288: 0fc466d2 */ jal debugEnableFootsteps -/* f00628c: afa70050 */ sw $a3,0x50($sp) -/* f006290: 3c05800a */ lui $a1,0x800a -/* f006294: 24a5e6c0 */ addiu $a1,$a1,-6464 -/* f006298: 104000e4 */ beqz $v0,.NB0f00662c -/* f00629c: 8fa70050 */ lw $a3,0x50($sp) -/* f0062a0: 8caf006c */ lw $t7,0x6c($a1) -/* f0062a4: 24080001 */ addiu $t0,$zero,0x1 -/* f0062a8: 00003025 */ or $a2,$zero,$zero -/* f0062ac: 11e00003 */ beqz $t7,.NB0f0062bc -/* f0062b0: 00001825 */ or $v1,$zero,$zero -/* f0062b4: 10000001 */ beqz $zero,.NB0f0062bc -/* f0062b8: 24060001 */ addiu $a2,$zero,0x1 -.NB0f0062bc: -/* f0062bc: 8cb80068 */ lw $t8,0x68($a1) -/* f0062c0: 00002025 */ or $a0,$zero,$zero -/* f0062c4: 00001025 */ or $v0,$zero,$zero -/* f0062c8: 13000003 */ beqz $t8,.NB0f0062d8 -/* f0062cc: 00000000 */ sll $zero,$zero,0x0 -/* f0062d0: 10000001 */ beqz $zero,.NB0f0062d8 -/* f0062d4: 24030001 */ addiu $v1,$zero,0x1 -.NB0f0062d8: -/* f0062d8: 8cb90064 */ lw $t9,0x64($a1) -/* f0062dc: 13200003 */ beqz $t9,.NB0f0062ec -/* f0062e0: 00000000 */ sll $zero,$zero,0x0 -/* f0062e4: 10000001 */ beqz $zero,.NB0f0062ec -/* f0062e8: 24040001 */ addiu $a0,$zero,0x1 -.NB0f0062ec: -/* f0062ec: 8ca90070 */ lw $t1,0x70($a1) -/* f0062f0: 11200003 */ beqz $t1,.NB0f006300 -/* f0062f4: 00000000 */ sll $zero,$zero,0x0 -/* f0062f8: 10000001 */ beqz $zero,.NB0f006300 -/* f0062fc: 24020001 */ addiu $v0,$zero,0x1 -.NB0f006300: -/* f006300: 00445021 */ addu $t2,$v0,$a0 -/* f006304: 01435821 */ addu $t3,$t2,$v1 -/* f006308: 01666021 */ addu $t4,$t3,$a2 -/* f00630c: 550c00c8 */ bnel $t0,$t4,.NB0f006630 -/* f006310: 8fbf004c */ lw $ra,0x4c($sp) -/* f006314: 8e0d019c */ lw $t5,0x19c($s0) -/* f006318: 05a200c5 */ bltzl $t5,.NB0f006630 -/* f00631c: 8fbf004c */ lw $ra,0x4c($sp) -/* f006320: 8cae0034 */ lw $t6,0x34($a1) -/* f006324: c6080198 */ lwc1 $f8,0x198($s0) -/* f006328: c6120194 */ lwc1 $f18,0x194($s0) -/* f00632c: 448e2000 */ mtc1 $t6,$f4 -/* f006330: 8e02001c */ lw $v0,0x1c($s0) -/* f006334: 3c01437a */ lui $at,0x437a -/* f006338: 468021a0 */ cvt.s.w $f6,$f4 -/* f00633c: 46083282 */ mul.s $f10,$f6,$f8 -/* f006340: 460a9100 */ add.s $f4,$f18,$f10 -/* f006344: 104000b9 */ beqz $v0,.NB0f00662c -/* f006348: e6040194 */ swc1 $f4,0x194($s0) -/* f00634c: c4f2000c */ lwc1 $f18,0xc($a3) -/* f006350: c44a000c */ lwc1 $f10,0xc($v0) -/* f006354: 44802000 */ mtc1 $zero,$f4 -/* f006358: c4e60008 */ lwc1 $f6,0x8($a3) -/* f00635c: 460a9001 */ sub.s $f0,$f18,$f10 -/* f006360: c4480008 */ lwc1 $f8,0x8($v0) -/* f006364: 44819000 */ mtc1 $at,$f18 -/* f006368: 4604003c */ c.lt.s $f0,$f4 -/* f00636c: 46083081 */ sub.s $f2,$f6,$f8 -/* f006370: 45020003 */ bc1fl .NB0f006380 -/* f006374: 4612003c */ c.lt.s $f0,$f18 -/* f006378: 46000007 */ neg.s $f0,$f0 -/* f00637c: 4612003c */ c.lt.s $f0,$f18 -.NB0f006380: -/* f006380: c4e60010 */ lwc1 $f6,0x10($a3) -/* f006384: c4480010 */ lwc1 $f8,0x10($v0) -/* f006388: c60e0194 */ lwc1 $f14,0x194($s0) -/* f00638c: 8e05019c */ lw $a1,0x19c($s0) -/* f006390: c610018c */ lwc1 $f16,0x18c($s0) -/* f006394: a2000190 */ sb $zero,0x190($s0) -/* f006398: e60e018c */ swc1 $f14,0x18c($s0) -/* f00639c: 46083301 */ sub.s $f12,$f6,$f8 -/* f0063a0: 45000088 */ bc1f .NB0f0065c4 -/* f0063a4: afa5005c */ sw $a1,0x5c($sp) -/* f0063a8: 46021282 */ mul.s $f10,$f2,$f2 -/* f0063ac: 3c017f1a */ lui $at,0x7f1a -/* f0063b0: c4281b0c */ lwc1 $f8,0x1b0c($at) -/* f0063b4: 460c6102 */ mul.s $f4,$f12,$f12 -/* f0063b8: afa5005c */ sw $a1,0x5c($sp) -/* f0063bc: 02002025 */ or $a0,$s0,$zero -/* f0063c0: 46045180 */ add.s $f6,$f10,$f4 -/* f0063c4: 4608303c */ c.lt.s $f6,$f8 -/* f0063c8: 00000000 */ sll $zero,$zero,0x0 -/* f0063cc: 4502007e */ bc1fl .NB0f0065c8 -/* f0063d0: 8fa5005c */ lw $a1,0x5c($sp) -/* f0063d4: 12000003 */ beqz $s0,.NB0f0063e4 -/* f0063d8: 00001025 */ or $v0,$zero,$zero -/* f0063dc: 10000001 */ beqz $zero,.NB0f0063e4 -/* f0063e0: 920202fe */ lbu $v0,0x2fe($s0) -.NB0f0063e4: -/* f0063e4: 14480033 */ bne $v0,$t0,.NB0f0064b4 -/* f0063e8: 00057880 */ sll $t7,$a1,0x2 -/* f0063ec: 3c188006 */ lui $t8,0x8006 -/* f0063f0: 030fc021 */ addu $t8,$t8,$t7 -/* f0063f4: 97183ab0 */ lhu $t8,0x3ab0($t8) -/* f0063f8: 24010394 */ addiu $at,$zero,0x394 -/* f0063fc: 1701002d */ bne $t8,$at,.NB0f0064b4 -/* f006400: 3c014000 */ lui $at,0x4000 -/* f006404: 44810000 */ mtc1 $at,$f0 -/* f006408: 3c014188 */ lui $at,0x4188 -/* f00640c: 460e003e */ c.le.s $f0,$f14 -/* f006410: 00000000 */ sll $zero,$zero,0x0 -/* f006414: 45020006 */ bc1fl .NB0f006430 -/* f006418: 44810000 */ mtc1 $at,$f0 -/* f00641c: 4600803c */ c.lt.s $f16,$f0 -/* f006420: 00000000 */ sll $zero,$zero,0x0 -/* f006424: 4501000b */ bc1t .NB0f006454 -/* f006428: 00000000 */ sll $zero,$zero,0x0 -/* f00642c: 44810000 */ mtc1 $at,$f0 -.NB0f006430: -/* f006430: 3c014120 */ lui $at,0x4120 -/* f006434: 460e003e */ c.le.s $f0,$f14 -/* f006438: 00000000 */ sll $zero,$zero,0x0 -/* f00643c: 45020008 */ bc1fl .NB0f006460 -/* f006440: 44810000 */ mtc1 $at,$f0 -/* f006444: 4600803c */ c.lt.s $f16,$f0 -/* f006448: 00000000 */ sll $zero,$zero,0x0 -/* f00644c: 45020004 */ bc1fl .NB0f006460 -/* f006450: 44810000 */ mtc1 $at,$f0 -.NB0f006454: -/* f006454: 1000003e */ beqz $zero,.NB0f006550 -/* f006458: a2080190 */ sb $t0,0x190($s0) -/* f00645c: 44810000 */ mtc1 $at,$f0 -.NB0f006460: -/* f006460: 3c0141c8 */ lui $at,0x41c8 -/* f006464: 460e003e */ c.le.s $f0,$f14 -/* f006468: 00000000 */ sll $zero,$zero,0x0 -/* f00646c: 45020006 */ bc1fl .NB0f006488 -/* f006470: 44810000 */ mtc1 $at,$f0 -/* f006474: 4600803c */ c.lt.s $f16,$f0 -/* f006478: 00000000 */ sll $zero,$zero,0x0 -/* f00647c: 4503000b */ bc1tl .NB0f0064ac -/* f006480: 24190002 */ addiu $t9,$zero,0x2 -/* f006484: 44810000 */ mtc1 $at,$f0 -.NB0f006488: -/* f006488: 00000000 */ sll $zero,$zero,0x0 -/* f00648c: 460e003e */ c.le.s $f0,$f14 -/* f006490: 00000000 */ sll $zero,$zero,0x0 -/* f006494: 4500002e */ bc1f .NB0f006550 -/* f006498: 00000000 */ sll $zero,$zero,0x0 -/* f00649c: 4600803c */ c.lt.s $f16,$f0 -/* f0064a0: 00000000 */ sll $zero,$zero,0x0 -/* f0064a4: 4500002a */ bc1f .NB0f006550 -/* f0064a8: 24190002 */ addiu $t9,$zero,0x2 -.NB0f0064ac: -/* f0064ac: 10000028 */ beqz $zero,.NB0f006550 -/* f0064b0: a2190190 */ sb $t9,0x190($s0) -.NB0f0064b4: -/* f0064b4: 3c0a8006 */ lui $t2,0x8006 -/* f0064b8: 254a3ab0 */ addiu $t2,$t2,0x3ab0 -/* f0064bc: 00054880 */ sll $t1,$a1,0x2 -/* f0064c0: 012a1021 */ addu $v0,$t1,$t2 -/* f0064c4: 904b0002 */ lbu $t3,0x2($v0) -/* f0064c8: 3c014f80 */ lui $at,0x4f80 -/* f0064cc: 448b9000 */ mtc1 $t3,$f18 -/* f0064d0: 05610004 */ bgez $t3,.NB0f0064e4 -/* f0064d4: 46809020 */ cvt.s.w $f0,$f18 -/* f0064d8: 44815000 */ mtc1 $at,$f10 -/* f0064dc: 00000000 */ sll $zero,$zero,0x0 -/* f0064e0: 460a0000 */ add.s $f0,$f0,$f10 -.NB0f0064e4: -/* f0064e4: 460e003e */ c.le.s $f0,$f14 -/* f0064e8: 00000000 */ sll $zero,$zero,0x0 -/* f0064ec: 45020008 */ bc1fl .NB0f006510 -/* f0064f0: 904c0003 */ lbu $t4,0x3($v0) -/* f0064f4: 4600803c */ c.lt.s $f16,$f0 -/* f0064f8: 00000000 */ sll $zero,$zero,0x0 -/* f0064fc: 45020004 */ bc1fl .NB0f006510 -/* f006500: 904c0003 */ lbu $t4,0x3($v0) -/* f006504: 10000012 */ beqz $zero,.NB0f006550 -/* f006508: a2080190 */ sb $t0,0x190($s0) -/* f00650c: 904c0003 */ lbu $t4,0x3($v0) -.NB0f006510: -/* f006510: 3c014f80 */ lui $at,0x4f80 -/* f006514: 448c2000 */ mtc1 $t4,$f4 -/* f006518: 05810004 */ bgez $t4,.NB0f00652c -/* f00651c: 46802020 */ cvt.s.w $f0,$f4 -/* f006520: 44813000 */ mtc1 $at,$f6 -/* f006524: 00000000 */ sll $zero,$zero,0x0 -/* f006528: 46060000 */ add.s $f0,$f0,$f6 -.NB0f00652c: -/* f00652c: 460e003e */ c.le.s $f0,$f14 -/* f006530: 00000000 */ sll $zero,$zero,0x0 -/* f006534: 45000006 */ bc1f .NB0f006550 -/* f006538: 00000000 */ sll $zero,$zero,0x0 -/* f00653c: 4600803c */ c.lt.s $f16,$f0 -/* f006540: 240d0002 */ addiu $t5,$zero,0x2 -/* f006544: 45000002 */ bc1f .NB0f006550 -/* f006548: 00000000 */ sll $zero,$zero,0x0 -/* f00654c: a20d0190 */ sb $t5,0x190($s0) -.NB0f006550: -/* f006550: 0fc01771 */ jal chrChooseFootstepSound -/* f006554: afa5005c */ sw $a1,0x5c($sp) -/* f006558: 2401ffff */ addiu $at,$zero,-1 -/* f00655c: 5041001a */ beql $v0,$at,.NB0f0065c8 -/* f006560: 8fa5005c */ lw $a1,0x5c($sp) -/* f006564: 820e0190 */ lb $t6,0x190($s0) -/* f006568: 3c01bf80 */ lui $at,0xbf80 -/* f00656c: 00002025 */ or $a0,$zero,$zero -/* f006570: 11c00014 */ beqz $t6,.NB0f0065c4 -/* f006574: 00023400 */ sll $a2,$v0,0x10 -/* f006578: 8e05001c */ lw $a1,0x1c($s0) -/* f00657c: 44810000 */ mtc1 $at,$f0 -/* f006580: 00067c03 */ sra $t7,$a2,0x10 -/* f006584: 2418ffff */ addiu $t8,$zero,-1 -/* f006588: 2419ffff */ addiu $t9,$zero,-1 -/* f00658c: afb9002c */ sw $t9,0x2c($sp) -/* f006590: afb80010 */ sw $t8,0x10($sp) -/* f006594: 01e03025 */ or $a2,$t7,$zero -/* f006598: afa00028 */ sw $zero,0x28($sp) -/* f00659c: afa00020 */ sw $zero,0x20($sp) -/* f0065a0: afa0001c */ sw $zero,0x1c($sp) -/* f0065a4: afa00018 */ sw $zero,0x18($sp) -/* f0065a8: afa00014 */ sw $zero,0x14($sp) -/* f0065ac: 2407ffff */ addiu $a3,$zero,-1 -/* f0065b0: e7a00024 */ swc1 $f0,0x24($sp) -/* f0065b4: e7a00030 */ swc1 $f0,0x30($sp) -/* f0065b8: e7a00034 */ swc1 $f0,0x34($sp) -/* f0065bc: 0fc24762 */ jal func0f0939f8 -/* f0065c0: e7a00038 */ swc1 $f0,0x38($sp) -.NB0f0065c4: -/* f0065c4: 8fa5005c */ lw $a1,0x5c($sp) -.NB0f0065c8: -/* f0065c8: 3c048006 */ lui $a0,0x8006 -/* f0065cc: 00054880 */ sll $t1,$a1,0x2 -/* f0065d0: 00892021 */ addu $a0,$a0,$t1 -/* f0065d4: 0fc01748 */ jal func0f005fd0 -/* f0065d8: 94843ab0 */ lhu $a0,0x3ab0($a0) -/* f0065dc: 1040000b */ beqz $v0,.NB0f00660c -/* f0065e0: 3c014208 */ lui $at,0x4208 -/* f0065e4: 3c0141b0 */ lui $at,0x41b0 -/* f0065e8: 44811000 */ mtc1 $at,$f2 -/* f0065ec: c6000194 */ lwc1 $f0,0x194($s0) -/* f0065f0: 4600103c */ c.lt.s $f2,$f0 -/* f0065f4: 00000000 */ sll $zero,$zero,0x0 -/* f0065f8: 4502000d */ bc1fl .NB0f006630 -/* f0065fc: 8fbf004c */ lw $ra,0x4c($sp) -/* f006600: 46020201 */ sub.s $f8,$f0,$f2 -/* f006604: 10000009 */ beqz $zero,.NB0f00662c -/* f006608: e6080194 */ swc1 $f8,0x194($s0) -.NB0f00660c: -/* f00660c: 44811000 */ mtc1 $at,$f2 -/* f006610: c6000194 */ lwc1 $f0,0x194($s0) -/* f006614: 4600103c */ c.lt.s $f2,$f0 -/* f006618: 00000000 */ sll $zero,$zero,0x0 -/* f00661c: 45020004 */ bc1fl .NB0f006630 -/* f006620: 8fbf004c */ lw $ra,0x4c($sp) -/* f006624: 46020481 */ sub.s $f18,$f0,$f2 -/* f006628: e6120194 */ swc1 $f18,0x194($s0) -.NB0f00662c: -/* f00662c: 8fbf004c */ lw $ra,0x4c($sp) -.NB0f006630: -/* f006630: 8fb00048 */ lw $s0,0x48($sp) -/* f006634: 27bd0060 */ addiu $sp,$sp,0x60 -/* f006638: 03e00008 */ jr $ra -/* f00663c: 00000000 */ sll $zero,$zero,0x0 -); + chr->magicframe += g_Vars.lvupdate240 * chr->magicspeed; #endif + + if (chr->prop) { + xdiff = playerprop->pos.x - chr->prop->pos.x; + ydiff = playerprop->pos.y - chr->prop->pos.y; + + if (ydiff < 0.0f) { + ydiff = -ydiff; + } + + zdiff = playerprop->pos.z - chr->prop->pos.z; + + frame = chr->magicframe; + index = chr->magicanim; + prevframe = chr->oldframe; + + chr->footstep = 0; + chr->oldframe = frame; + + if (ydiff < 250 && xdiff * xdiff + zdiff * zdiff < 3000000) { + if (CHRRACE(chr) == RACE_SKEDAR && g_FootstepAnims[index].animnum == ANIM_SKEDAR_RUNNING) { + if ((frame >= 2 && prevframe < 2) || (frame >= 17 && prevframe < 17)) { + chr->footstep = 1; + } else if ((frame >= 10 && prevframe < 10) || (frame >= 25 && prevframe < 25)) { + chr->footstep = 2; + } + } else { + if (frame >= g_FootstepAnims[index].frame1 && prevframe < g_FootstepAnims[index].frame1) { + chr->footstep = 1; + } else if (frame >= g_FootstepAnims[index].frame2 && prevframe < g_FootstepAnims[index].frame2) { + chr->footstep = 2; + } + } + + soundnum = chrChooseFootstepSound(chr, index); + + if (soundnum != -1 && chr->footstep != 0) { +#if VERSION >= VERSION_NTSC_1_0 + func0f0939f8(NULL, chr->prop, soundnum, -1, + -1, 1024, 0, 16, NULL, -1, NULL, -1, -1, -1, -1); +#else + func0f0939f8(NULL, chr->prop, soundnum, -1, + -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); +#endif + } + } + + if (func0f005fd0(g_FootstepAnims[index].animnum)) { + if (chr->magicframe > 22) { + chr->magicframe -= 22; + } + } else { + if (chr->magicframe > 34) { + chr->magicframe -= 34; + } + } + } + } +} diff --git a/src/include/game/game_005fd0.h b/src/include/game/game_005fd0.h index feaa33d92..09e20a737 100644 --- a/src/include/game/game_005fd0.h +++ b/src/include/game/game_005fd0.h @@ -5,8 +5,8 @@ #include "types.h" bool func0f005fd0(s32 animnum); -s32 chrChooseFootstepSound(struct chrdata *chr, u32 arg1); -void func0f0061dc(struct chrdata *chr); -void func0f006520(struct chrdata *chr); +s32 chrChooseFootstepSound(struct chrdata *chr, s32 index); +void chrCheckFootstep(struct chrdata *chr); +void chrCheckFootstepMagic(struct chrdata *chr); #endif