From 297ad6c721696adfc2dee026d0e9fd1558fe9958 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 23 Jun 2020 23:33:43 +1000 Subject: [PATCH] Decompile func0f021fa8 --- src/game/chr/chr.c | 87 ++++++++++---------------------- src/include/game/chr/chr.h | 2 +- src/include/game/chr/chraction.h | 2 +- src/include/game/game_157db0.h | 2 +- 4 files changed, 29 insertions(+), 64 deletions(-) diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 20357ab8f..750e25790 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -3930,67 +3930,32 @@ glabel var7f1a879c /* f021fa4: 00000000 */ nop ); -GLOBAL_ASM( -glabel func0f021fa8 -/* f021fa8: 27bdffb8 */ addiu $sp,$sp,-72 -/* f021fac: 3c0142dc */ lui $at,0x42dc -/* f021fb0: afb00020 */ sw $s0,0x20($sp) -/* f021fb4: 44811000 */ mtc1 $at,$f2 -/* f021fb8: 00a08025 */ or $s0,$a1,$zero -/* f021fbc: afbf0024 */ sw $ra,0x24($sp) -/* f021fc0: 10800010 */ beqz $a0,.L0f022004 -/* f021fc4: afa60050 */ sw $a2,0x50($sp) -/* f021fc8: 908e02fe */ lbu $t6,0x2fe($a0) -/* f021fcc: 24010003 */ addiu $at,$zero,0x3 -/* f021fd0: 55c1000d */ bnel $t6,$at,.L0f022008 -/* f021fd4: 3c014248 */ lui $at,0x4248 -/* f021fd8: 0fc0f011 */ jal func0f03c044 -/* f021fdc: 00000000 */ nop -/* f021fe0: 10400006 */ beqz $v0,.L0f021ffc -/* f021fe4: 3c014366 */ lui $at,0x4366 -/* f021fe8: 3c0141f0 */ lui $at,0x41f0 -/* f021fec: 44813000 */ mtc1 $at,$f6 -/* f021ff0: c4440060 */ lwc1 $f4,0x60($v0) -/* f021ff4: 10000003 */ b .L0f022004 -/* f021ff8: 46062080 */ add.s $f2,$f4,$f6 -.L0f021ffc: -/* f021ffc: 44811000 */ mtc1 $at,$f2 -/* f022000: 00000000 */ nop -.L0f022004: -/* f022004: 3c014248 */ lui $at,0x4248 -.L0f022008: -/* f022008: 44810000 */ mtc1 $at,$f0 -/* f02200c: c6080000 */ lwc1 $f8,0x0($s0) -/* f022010: 240f0001 */ addiu $t7,$zero,0x1 -/* f022014: 27a4003c */ addiu $a0,$sp,0x3c -/* f022018: 46004281 */ sub.s $f10,$f8,$f0 -/* f02201c: 27a50030 */ addiu $a1,$sp,0x30 -/* f022020: 8fa60050 */ lw $a2,0x50($sp) -/* f022024: 24070007 */ addiu $a3,$zero,0x7 -/* f022028: e7aa003c */ swc1 $f10,0x3c($sp) -/* f02202c: c6100004 */ lwc1 $f16,0x4($s0) -/* f022030: 46028481 */ sub.s $f18,$f16,$f2 -/* f022034: e7b20040 */ swc1 $f18,0x40($sp) -/* f022038: c6040008 */ lwc1 $f4,0x8($s0) -/* f02203c: 46002181 */ sub.s $f6,$f4,$f0 -/* f022040: e7a60044 */ swc1 $f6,0x44($sp) -/* f022044: c6080000 */ lwc1 $f8,0x0($s0) -/* f022048: 46004280 */ add.s $f10,$f8,$f0 -/* f02204c: e7aa0030 */ swc1 $f10,0x30($sp) -/* f022050: c6100004 */ lwc1 $f16,0x4($s0) -/* f022054: 46028480 */ add.s $f18,$f16,$f2 -/* f022058: e7b20034 */ swc1 $f18,0x34($sp) -/* f02205c: c6040008 */ lwc1 $f4,0x8($s0) -/* f022060: afaf0010 */ sw $t7,0x10($sp) -/* f022064: 46002180 */ add.s $f6,$f4,$f0 -/* f022068: 0fc59434 */ jal func0f1650d0 -/* f02206c: e7a60038 */ swc1 $f6,0x38($sp) -/* f022070: 8fbf0024 */ lw $ra,0x24($sp) -/* f022074: 8fb00020 */ lw $s0,0x20($sp) -/* f022078: 27bd0048 */ addiu $sp,$sp,0x48 -/* f02207c: 03e00008 */ jr $ra -/* f022080: 00000000 */ nop -); +void func0f021fa8(struct chrdata *chr, struct coord *pos, s16 *rooms) +{ + struct coord lower; + struct coord upper; + f32 height = 110; + + if (chr && chr->race == RACE_EYESPY) { + struct eyespy *eyespy = func0f03c044(chr); + + if (eyespy) { + height = eyespy->height + 30.0f; + } else { + height = 230; + } + } + + lower.x = pos->x - 50.0f; + lower.y = pos->y - height; + lower.z = pos->z - 50.0f; + + upper.x = pos->x + 50.0f; + upper.y = pos->y + height; + upper.z = pos->z + 50.0f; + + func0f1650d0(&lower, &upper, rooms, 7, 1); +} void func0f022084(struct chrdata *chr, s16 *room) { diff --git a/src/include/game/chr/chr.h b/src/include/game/chr/chr.h index ae8fdb62d..a599569d9 100644 --- a/src/include/game/chr/chr.h +++ b/src/include/game/chr/chr.h @@ -17,7 +17,7 @@ u32 func0f021258(void); void func0f02133c(struct chrdata *chr); void chrDoFlinchcntThing(struct chrdata *chr, f32 arg1); u32 func0f02143c(void); -void func0f021fa8(struct chrdata *chr, struct coord *pos, s16 *room); +void func0f021fa8(struct chrdata *chr, struct coord *pos, s16 *rooms); void func0f0220ec(struct chrdata *chr, s32 arg1, s32 arg2); u32 func0f022214(void); void chrUpdateCloak(struct chrdata *chr); diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index a2189798a..01a3236c9 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -107,7 +107,7 @@ u32 func0f03b1e0(struct chrdata *chr); bool chrDropItem(struct chrdata *chr, u32 modelnum, u32 weaponnum); void func0f03ba44(struct chrdata *chr, u32 arg1, u32 arg2, u32 arg3); u32 chrTryPunchOrKick(struct chrdata *chr, u32 arg1); -u32 func0f03c044(void); +struct eyespy *func0f03c044(struct chrdata *chr); void chrTickStand(struct chrdata *chr); void chrTickAnim(struct chrdata *chr); void chrTickSurrender(struct chrdata *chr); diff --git a/src/include/game/game_157db0.h b/src/include/game/game_157db0.h index e12fc83f7..336e96d76 100644 --- a/src/include/game/game_157db0.h +++ b/src/include/game/game_157db0.h @@ -100,6 +100,6 @@ void portalSetEnabled(s32 portal, bool enable); u32 func0f164e8c(void); u32 func0f164f9c(void); u32 func0f165004(void); -void func0f1650d0(struct coord *arg0, struct coord *arg1, s16 *rooms, s32 arg3, s32 arg4); +void func0f1650d0(struct coord *lower, struct coord *upper, s16 *rooms, s32 arg3, s32 arg4); #endif