Match func_8003DFA0 and func_8003E1D0 (#316)

* match func_8003DFA0 and func_8003E1D0

* update return types

* Delete func_8003DFA0.s

* Delete func_8003E1D0.s

* made requested changed to npc.c

* moved prototypes and changed return type to void

* Correcting a couple mistakes 

My bad I think void should have been an EffectInstance* which I got from looking at the matching INCLUDE ASM in src/4ac90_len_3910.c and I forgot to modify src/evt/fx_api.c as it has a prototype for these functions in it

* Update fx_api.c

* further cleanup

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
This commit is contained in:
ThreeMustyFears 2021-07-17 11:45:08 -03:00 committed by GitHub
parent 1beee32dc6
commit 3d2798422a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 161 deletions

View File

@ -421,6 +421,8 @@ void fx_land(s32, f32, f32, f32, f32);
EffectInstance* playFX_6F(s32, f32, f32, f32, f32, s32);
EffectInstance* playFX_72(s32, f32, f32, f32, f32, f32, f32, s32, s32);
void playFX_26(s32, f32, f32, f32);
EffectInstance* playFX_0C(f32, f32, f32, f32, f32);
EffectInstance* playFX_23(u32, f32, f32, f32, f32);
void func_802B2078(void);
extern f32 gCurtainScale;

View File

@ -129,7 +129,6 @@ INCLUDE_ASM(ApiStatus, "evt/fx_api", func_802D8248, ScriptInstance* script, s32
s32 fx_sleep_bubble(s32, f32, f32, f32, f32, f32, EffectInstanceData**); // extern
s32 playFX_0A(f32, f32, s32, s32, f32, f32); // extern
s32 playFX_0B(s32, f32, f32, f32); // extern
s32 playFX_0C(f32, f32, s32, s32, f32, f32, f32); // extern
s32 playFX_0D(s32, f32, f32, f32, s32); // extern
s32 playFX_0E(f32, f32, s32, s32, f32, s32); // extern
s32 playFX_0F(s32, f32, f32, f32, f32, f32, f32, f32); // extern
@ -145,7 +144,6 @@ s32 playFX_1E(s32, f32, f32, f32, f32, f32, s32, s32*); // extern
s32 playFX_1F(s32, f32, f32, f32, f32, f32, f32, f32); // extern
s32 playFX_20(s32, f32, f32, f32, f32, EffectInstanceData**); // extern
s32 playFX_21(s32, f32, f32, f32, f32, f32, s32); // extern
s32 playFX_23(s32, f32, f32, f32, f32); // extern
s32 playFX_24(s32, f32, f32, f32, f32, s32); // extern
s32 playFX_25(s32, f32, f32, f32); // extern
s32 playFX_27(s32, f32, f32, f32, f32, s32); // extern

View File

@ -13,6 +13,10 @@ extern s16 D_80077C1C;
extern s16 D_80077C1E;
extern s32 D_80077C20;
extern s16 D_80077C30;
extern s32 D_80077C34;
extern s16 D_80077C3A;
void STUB_npc_callback(void) {
}
@ -1331,11 +1335,39 @@ INCLUDE_ASM(void, "npc", func_8003DA38, Npc* npc, s32 arg1);
INCLUDE_ASM(s32, "npc", func_8003DC38);
INCLUDE_ASM(s32, "npc", func_8003DFA0);
void func_8003DFA0(Npc* npc) {
if (D_80077C30++ >= 4) {
f32 temp_f20;
f32 x;
f32 z;
D_80077C30 = 0;
temp_f20 = (clamp_angle(-npc->yaw) * TAU) / 360.0f;
x = sin_rad(temp_f20);
z = cos_rad(temp_f20);
playFX_0C(npc->pos.x + (npc->collisionRadius * x * 0.2f), npc->pos.y + 1.5f,
npc->pos.z + (npc->collisionRadius * z * 0.2f), -npc->yaw, D_80077C34);
D_80077C34 = !D_80077C34;
}
}
INCLUDE_ASM(s32, "npc", func_8003E0D4);
INCLUDE_ASM(s32, "npc", func_8003E1D0);
void func_8003E1D0(Npc* npc) {
if (D_80077C3A++ >= 4) {
f32 temp_f20;
f32 x;
f32 z;
D_80077C3A = 0;
temp_f20 = (clamp_angle(-npc->yaw) * TAU) / 360.0f;
x = sin_rad(temp_f20);
z = cos_rad(temp_f20);
playFX_23(0, npc->pos.x + (npc->collisionRadius * x * 0.2f), npc->pos.y + 0.0f,
npc->pos.z + (npc->collisionRadius * z * 0.2f), 0.0f);
}
}
void COPY_set_defeated(s32 mapID, s32 encounterID) {
EncounterStatus* currentEncounter = &gCurrentEncounter;

View File

@ -184,11 +184,11 @@ void func_8003DA38(Npc* npc, s32 arg1);
s32 func_8003DC38();
s32 func_8003DFA0();
void func_8003DFA0(Npc* npc);
s32 func_8003E0D4();
s32 func_8003E1D0();
void func_8003E1D0(Npc* npc);
/// Duplicate of set_defeated().
void COPY_set_defeated(s32 mapID, s32 encounterID);

View File

@ -1,82 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8003DFA0
/* 193A0 8003DFA0 27BDFFD0 */ addiu $sp, $sp, -0x30
/* 193A4 8003DFA4 AFB1001C */ sw $s1, 0x1c($sp)
/* 193A8 8003DFA8 0080882D */ daddu $s1, $a0, $zero
/* 193AC 8003DFAC 3C048007 */ lui $a0, %hi(D_80077C30)
/* 193B0 8003DFB0 24847C30 */ addiu $a0, $a0, %lo(D_80077C30)
/* 193B4 8003DFB4 AFBF0020 */ sw $ra, 0x20($sp)
/* 193B8 8003DFB8 AFB00018 */ sw $s0, 0x18($sp)
/* 193BC 8003DFBC F7B40028 */ sdc1 $f20, 0x28($sp)
/* 193C0 8003DFC0 94820000 */ lhu $v0, ($a0)
/* 193C4 8003DFC4 24430001 */ addiu $v1, $v0, 1
/* 193C8 8003DFC8 00021400 */ sll $v0, $v0, 0x10
/* 193CC 8003DFCC 00021403 */ sra $v0, $v0, 0x10
/* 193D0 8003DFD0 28420004 */ slti $v0, $v0, 4
/* 193D4 8003DFD4 14400039 */ bnez $v0, .L8003E0BC
/* 193D8 8003DFD8 A4830000 */ sh $v1, ($a0)
/* 193DC 8003DFDC C62C000C */ lwc1 $f12, 0xc($s1)
/* 193E0 8003DFE0 A4800000 */ sh $zero, ($a0)
/* 193E4 8003DFE4 0C00A6C9 */ jal clamp_angle
/* 193E8 8003DFE8 46006307 */ neg.s $f12, $f12
/* 193EC 8003DFEC 3C0140C9 */ lui $at, 0x40c9
/* 193F0 8003DFF0 34210FD0 */ ori $at, $at, 0xfd0
/* 193F4 8003DFF4 44811000 */ mtc1 $at, $f2
/* 193F8 8003DFF8 00000000 */ nop
/* 193FC 8003DFFC 46020502 */ mul.s $f20, $f0, $f2
/* 19400 8003E000 00000000 */ nop
/* 19404 8003E004 3C0143B4 */ lui $at, 0x43b4
/* 19408 8003E008 44810000 */ mtc1 $at, $f0
/* 1940C 8003E00C 00000000 */ nop
/* 19410 8003E010 4600A503 */ div.s $f20, $f20, $f0
/* 19414 8003E014 0C00A85B */ jal sin_rad
/* 19418 8003E018 4600A306 */ mov.s $f12, $f20
/* 1941C 8003E01C 4600A306 */ mov.s $f12, $f20
/* 19420 8003E020 0C00A874 */ jal cos_rad
/* 19424 8003E024 46000506 */ mov.s $f20, $f0
/* 19428 8003E028 862200A6 */ lh $v0, 0xa6($s1)
/* 1942C 8003E02C 44821000 */ mtc1 $v0, $f2
/* 19430 8003E030 00000000 */ nop
/* 19434 8003E034 468010A0 */ cvt.s.w $f2, $f2
/* 19438 8003E038 46141502 */ mul.s $f20, $f2, $f20
/* 1943C 8003E03C 00000000 */ nop
/* 19440 8003E040 46001082 */ mul.s $f2, $f2, $f0
/* 19444 8003E044 00000000 */ nop
/* 19448 8003E048 3C013E4C */ lui $at, 0x3e4c
/* 1944C 8003E04C 3421CCCD */ ori $at, $at, 0xcccd
/* 19450 8003E050 44810000 */ mtc1 $at, $f0
/* 19454 8003E054 00000000 */ nop
/* 19458 8003E058 4600A502 */ mul.s $f20, $f20, $f0
/* 1945C 8003E05C 00000000 */ nop
/* 19460 8003E060 46001082 */ mul.s $f2, $f2, $f0
/* 19464 8003E064 00000000 */ nop
/* 19468 8003E068 3C013FC0 */ lui $at, 0x3fc0
/* 1946C 8003E06C 44817000 */ mtc1 $at, $f14
/* 19470 8003E070 C620003C */ lwc1 $f0, 0x3c($s1)
/* 19474 8003E074 460E0380 */ add.s $f14, $f0, $f14
/* 19478 8003E078 C6200040 */ lwc1 $f0, 0x40($s1)
/* 1947C 8003E07C 3C108007 */ lui $s0, %hi(D_80077C34)
/* 19480 8003E080 26107C34 */ addiu $s0, $s0, %lo(D_80077C34)
/* 19484 8003E084 46020000 */ add.s $f0, $f0, $f2
/* 19488 8003E088 C624000C */ lwc1 $f4, 0xc($s1)
/* 1948C 8003E08C C62C0038 */ lwc1 $f12, 0x38($s1)
/* 19490 8003E090 46002107 */ neg.s $f4, $f4
/* 19494 8003E094 44072000 */ mfc1 $a3, $f4
/* 19498 8003E098 46146300 */ add.s $f12, $f12, $f20
/* 1949C 8003E09C 44060000 */ mfc1 $a2, $f0
/* 194A0 8003E0A0 C6000000 */ lwc1 $f0, ($s0)
/* 194A4 8003E0A4 46800020 */ cvt.s.w $f0, $f0
/* 194A8 8003E0A8 0C01BF44 */ jal playFX_0C
/* 194AC 8003E0AC E7A00010 */ swc1 $f0, 0x10($sp)
/* 194B0 8003E0B0 8E020000 */ lw $v0, ($s0)
/* 194B4 8003E0B4 2C420001 */ sltiu $v0, $v0, 1
/* 194B8 8003E0B8 AE020000 */ sw $v0, ($s0)
.L8003E0BC:
/* 194BC 8003E0BC 8FBF0020 */ lw $ra, 0x20($sp)
/* 194C0 8003E0C0 8FB1001C */ lw $s1, 0x1c($sp)
/* 194C4 8003E0C4 8FB00018 */ lw $s0, 0x18($sp)
/* 194C8 8003E0C8 D7B40028 */ ldc1 $f20, 0x28($sp)
/* 194CC 8003E0CC 03E00008 */ jr $ra
/* 194D0 8003E0D0 27BD0030 */ addiu $sp, $sp, 0x30

View File

@ -1,73 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8003E1D0
/* 195D0 8003E1D0 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 195D4 8003E1D4 AFB00018 */ sw $s0, 0x18($sp)
/* 195D8 8003E1D8 0080802D */ daddu $s0, $a0, $zero
/* 195DC 8003E1DC 3C048007 */ lui $a0, %hi(D_80077C3A)
/* 195E0 8003E1E0 24847C3A */ addiu $a0, $a0, %lo(D_80077C3A)
/* 195E4 8003E1E4 AFBF001C */ sw $ra, 0x1c($sp)
/* 195E8 8003E1E8 F7B40020 */ sdc1 $f20, 0x20($sp)
/* 195EC 8003E1EC 94820000 */ lhu $v0, ($a0)
/* 195F0 8003E1F0 24430001 */ addiu $v1, $v0, 1
/* 195F4 8003E1F4 00021400 */ sll $v0, $v0, 0x10
/* 195F8 8003E1F8 00021403 */ sra $v0, $v0, 0x10
/* 195FC 8003E1FC 28420004 */ slti $v0, $v0, 4
/* 19600 8003E200 14400032 */ bnez $v0, .L8003E2CC
/* 19604 8003E204 A4830000 */ sh $v1, ($a0)
/* 19608 8003E208 C60C000C */ lwc1 $f12, 0xc($s0)
/* 1960C 8003E20C A4800000 */ sh $zero, ($a0)
/* 19610 8003E210 0C00A6C9 */ jal clamp_angle
/* 19614 8003E214 46006307 */ neg.s $f12, $f12
/* 19618 8003E218 3C0140C9 */ lui $at, 0x40c9
/* 1961C 8003E21C 34210FD0 */ ori $at, $at, 0xfd0
/* 19620 8003E220 44811000 */ mtc1 $at, $f2
/* 19624 8003E224 00000000 */ nop
/* 19628 8003E228 46020502 */ mul.s $f20, $f0, $f2
/* 1962C 8003E22C 00000000 */ nop
/* 19630 8003E230 3C0143B4 */ lui $at, 0x43b4
/* 19634 8003E234 44810000 */ mtc1 $at, $f0
/* 19638 8003E238 00000000 */ nop
/* 1963C 8003E23C 4600A503 */ div.s $f20, $f20, $f0
/* 19640 8003E240 0C00A85B */ jal sin_rad
/* 19644 8003E244 4600A306 */ mov.s $f12, $f20
/* 19648 8003E248 4600A306 */ mov.s $f12, $f20
/* 1964C 8003E24C 0C00A874 */ jal cos_rad
/* 19650 8003E250 46000506 */ mov.s $f20, $f0
/* 19654 8003E254 860200A6 */ lh $v0, 0xa6($s0)
/* 19658 8003E258 44821000 */ mtc1 $v0, $f2
/* 1965C 8003E25C 00000000 */ nop
/* 19660 8003E260 468010A0 */ cvt.s.w $f2, $f2
/* 19664 8003E264 46141502 */ mul.s $f20, $f2, $f20
/* 19668 8003E268 00000000 */ nop
/* 1966C 8003E26C 46001082 */ mul.s $f2, $f2, $f0
/* 19670 8003E270 00000000 */ nop
/* 19674 8003E274 3C013E4C */ lui $at, 0x3e4c
/* 19678 8003E278 3421CCCD */ ori $at, $at, 0xcccd
/* 1967C 8003E27C 44810000 */ mtc1 $at, $f0
/* 19680 8003E280 00000000 */ nop
/* 19684 8003E284 4600A502 */ mul.s $f20, $f20, $f0
/* 19688 8003E288 00000000 */ nop
/* 1968C 8003E28C 46001082 */ mul.s $f2, $f2, $f0
/* 19690 8003E290 00000000 */ nop
/* 19694 8003E294 C6000038 */ lwc1 $f0, 0x38($s0)
/* 19698 8003E298 C606003C */ lwc1 $f6, 0x3c($s0)
/* 1969C 8003E29C 46140000 */ add.s $f0, $f0, $f20
/* 196A0 8003E2A0 44802000 */ mtc1 $zero, $f4
/* 196A4 8003E2A4 00000000 */ nop
/* 196A8 8003E2A8 46043180 */ add.s $f6, $f6, $f4
/* 196AC 8003E2AC 44050000 */ mfc1 $a1, $f0
/* 196B0 8003E2B0 C6000040 */ lwc1 $f0, 0x40($s0)
/* 196B4 8003E2B4 46020000 */ add.s $f0, $f0, $f2
/* 196B8 8003E2B8 44063000 */ mfc1 $a2, $f6
/* 196BC 8003E2BC 44070000 */ mfc1 $a3, $f0
/* 196C0 8003E2C0 0000202D */ daddu $a0, $zero, $zero
/* 196C4 8003E2C4 0C01C16C */ jal playFX_23
/* 196C8 8003E2C8 E7A40010 */ swc1 $f4, 0x10($sp)
.L8003E2CC:
/* 196CC 8003E2CC 8FBF001C */ lw $ra, 0x1c($sp)
/* 196D0 8003E2D0 8FB00018 */ lw $s0, 0x18($sp)
/* 196D4 8003E2D4 D7B40020 */ ldc1 $f20, 0x20($sp)
/* 196D8 8003E2D8 03E00008 */ jr $ra
/* 196DC 8003E2DC 27BD0028 */ addiu $sp, $sp, 0x28