decomp func_8003F4CC and BindIdle (also decomp func_8003F414 but it shares a name with another function causing issues, so it's commented out)

This commit is contained in:
Rain 2020-12-03 08:11:20 -06:00
parent 0af28fdb74
commit f517de6651
6 changed files with 60 additions and 104 deletions

View File

@ -1,52 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel BindIdle
/* 1A7374 80278A94 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 1A7378 80278A98 AFB10014 */ sw $s1, 0x14($sp)
/* 1A737C 80278A9C 0080882D */ daddu $s1, $a0, $zero
/* 1A7380 80278AA0 AFBF001C */ sw $ra, 0x1c($sp)
/* 1A7384 80278AA4 AFB20018 */ sw $s2, 0x18($sp)
/* 1A7388 80278AA8 AFB00010 */ sw $s0, 0x10($sp)
/* 1A738C 80278AAC 8E30000C */ lw $s0, 0xc($s1)
/* 1A7390 80278AB0 8E050000 */ lw $a1, ($s0)
/* 1A7394 80278AB4 0C0B1EAF */ jal get_variable
/* 1A7398 80278AB8 26100004 */ addiu $s0, $s0, 4
/* 1A739C 80278ABC 0040902D */ daddu $s2, $v0, $zero
/* 1A73A0 80278AC0 2402FF81 */ addiu $v0, $zero, -0x7f
/* 1A73A4 80278AC4 16420002 */ bne $s2, $v0, .L80278AD0
/* 1A73A8 80278AC8 00000000 */ nop
/* 1A73AC 80278ACC 8E320148 */ lw $s2, 0x148($s1)
.L80278AD0:
/* 1A73B0 80278AD0 8E050000 */ lw $a1, ($s0)
/* 1A73B4 80278AD4 0C0B1EAF */ jal get_variable
/* 1A73B8 80278AD8 0220202D */ daddu $a0, $s1, $zero
/* 1A73BC 80278ADC 0240202D */ daddu $a0, $s2, $zero
/* 1A73C0 80278AE0 0C09A75B */ jal get_actor
/* 1A73C4 80278AE4 0040882D */ daddu $s1, $v0, $zero
/* 1A73C8 80278AE8 0040802D */ daddu $s0, $v0, $zero
/* 1A73CC 80278AEC 8E0201D0 */ lw $v0, 0x1d0($s0)
/* 1A73D0 80278AF0 10400006 */ beqz $v0, .L80278B0C
/* 1A73D4 80278AF4 0220202D */ daddu $a0, $s1, $zero
/* 1A73D8 80278AF8 8E0401E0 */ lw $a0, 0x1e0($s0)
/* 1A73DC 80278AFC 0C0B102B */ jal kill_script_by_ID
/* 1A73E0 80278B00 00000000 */ nop
/* 1A73E4 80278B04 AE0001D0 */ sw $zero, 0x1d0($s0)
/* 1A73E8 80278B08 0220202D */ daddu $a0, $s1, $zero
.L80278B0C:
/* 1A73EC 80278B0C 2405000A */ addiu $a1, $zero, 0xa
/* 1A73F0 80278B10 0000302D */ daddu $a2, $zero, $zero
/* 1A73F4 80278B14 0C0B0CF8 */ jal start_script
/* 1A73F8 80278B18 AE0401C0 */ sw $a0, 0x1c0($s0)
/* 1A73FC 80278B1C 0040182D */ daddu $v1, $v0, $zero
/* 1A7400 80278B20 AE0301D0 */ sw $v1, 0x1d0($s0)
/* 1A7404 80278B24 8C640144 */ lw $a0, 0x144($v1)
/* 1A7408 80278B28 AE0401E0 */ sw $a0, 0x1e0($s0)
/* 1A740C 80278B2C AC720148 */ sw $s2, 0x148($v1)
/* 1A7410 80278B30 8FBF001C */ lw $ra, 0x1c($sp)
/* 1A7414 80278B34 8FB20018 */ lw $s2, 0x18($sp)
/* 1A7418 80278B38 8FB10014 */ lw $s1, 0x14($sp)
/* 1A741C 80278B3C 8FB00010 */ lw $s0, 0x10($sp)
/* 1A7420 80278B40 24020002 */ addiu $v0, $zero, 2
/* 1A7424 80278B44 03E00008 */ jr $ra
/* 1A7428 80278B48 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,49 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8003F4CC
/* 1A8CC 8003F4CC 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 1A8D0 8003F4D0 AFB1001C */ sw $s1, 0x1c($sp)
/* 1A8D4 8003F4D4 0080882D */ daddu $s1, $a0, $zero
/* 1A8D8 8003F4D8 AFBF0024 */ sw $ra, 0x24($sp)
/* 1A8DC 8003F4DC AFB20020 */ sw $s2, 0x20($sp)
/* 1A8E0 8003F4E0 AFB00018 */ sw $s0, 0x18($sp)
/* 1A8E4 8003F4E4 8E30000C */ lw $s0, 0xc($s1)
/* 1A8E8 8003F4E8 8E050000 */ lw $a1, ($s0)
/* 1A8EC 8003F4EC 0C0B1EAF */ jal get_variable
/* 1A8F0 8003F4F0 26100004 */ addiu $s0, $s0, 4
/* 1A8F4 8003F4F4 8E050000 */ lw $a1, ($s0)
/* 1A8F8 8003F4F8 26100004 */ addiu $s0, $s0, 4
/* 1A8FC 8003F4FC 0220202D */ daddu $a0, $s1, $zero
/* 1A900 8003F500 0C0B1EAF */ jal get_variable
/* 1A904 8003F504 0040902D */ daddu $s2, $v0, $zero
/* 1A908 8003F508 0220202D */ daddu $a0, $s1, $zero
/* 1A90C 8003F50C 8E050000 */ lw $a1, ($s0)
/* 1A910 8003F510 0C0B1EAF */ jal get_variable
/* 1A914 8003F514 0040802D */ daddu $s0, $v0, $zero
/* 1A918 8003F518 24040009 */ addiu $a0, $zero, 9
/* 1A91C 8003F51C 44921000 */ mtc1 $s2, $f2
/* 1A920 8003F520 00000000 */ nop
/* 1A924 8003F524 468010A0 */ cvt.s.w $f2, $f2
/* 1A928 8003F528 44051000 */ mfc1 $a1, $f2
/* 1A92C 8003F52C 44901000 */ mtc1 $s0, $f2
/* 1A930 8003F530 00000000 */ nop
/* 1A934 8003F534 468010A0 */ cvt.s.w $f2, $f2
/* 1A938 8003F538 44061000 */ mfc1 $a2, $f2
/* 1A93C 8003F53C 44821000 */ mtc1 $v0, $f2
/* 1A940 8003F540 00000000 */ nop
/* 1A944 8003F544 468010A0 */ cvt.s.w $f2, $f2
/* 1A948 8003F548 3C0140A0 */ lui $at, 0x40a0
/* 1A94C 8003F54C 44810000 */ mtc1 $at, $f0
/* 1A950 8003F550 44071000 */ mfc1 $a3, $f2
/* 1A954 8003F554 2403000F */ addiu $v1, $zero, 0xf
/* 1A958 8003F558 AFA30014 */ sw $v1, 0x14($sp)
/* 1A95C 8003F55C 0C01C5D4 */ jal func_80071750
/* 1A960 8003F560 E7A00010 */ swc1 $f0, 0x10($sp)
/* 1A964 8003F564 8FBF0024 */ lw $ra, 0x24($sp)
/* 1A968 8003F568 8FB20020 */ lw $s2, 0x20($sp)
/* 1A96C 8003F56C 8FB1001C */ lw $s1, 0x1c($sp)
/* 1A970 8003F570 8FB00018 */ lw $s0, 0x18($sp)
/* 1A974 8003F574 24020002 */ addiu $v0, $zero, 2
/* 1A978 8003F578 03E00008 */ jr $ra
/* 1A97C 8003F57C 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -120,6 +120,7 @@ extern s16 D_800A095E;
extern u8 D_800A095F;
extern s32 D_800A0960;
extern s32 D_800A0964;
extern s16 D_800A0BB8;
extern UIPanel gUIPanels[64];

View File

@ -98,7 +98,33 @@ ApiStatus ResumeTakeTurn(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_1A5830", BindIdle);
ApiStatus BindIdle(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
ActorID actorID = get_variable(script, *args++);
s32 var1;
Actor* actor;
Actor* actorIdleScript;
ScriptInstance* newScriptContext;
if (actorID == ActorID_SELF) {
actorID = script->owner1.actorID;
}
var1 = get_variable(script, *args++);
actor = get_actor(actorID);
actorIdleScript = actor->idleScript;
if (actorIdleScript != 0) {
kill_script_by_ID(actor->idleScriptID);
actor->idleScript = 0;
}
actor->idleCode = var1;
newScriptContext = start_script(var1, 0x0A, 0);
actor->idleScript = newScriptContext;
actor->idleScriptID = newScriptContext->id;
newScriptContext->owner1.enemyID = actorID;
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_1A5830", EnableIdleScript);

View File

@ -102,7 +102,10 @@ ApiStatus func_8003F084(ScriptInstance* script, s32 isInitialCall) {
INCLUDE_ASM(s32, "code_1a1f0_len_5390", func_8003F0C4);
INCLUDE_ASM(s32, "code_1a1f0_len_5390", func_8003F384);
ApiStatus func_8003F384() {
D_800A0BB8 = 1;
return ApiStatus_DONE2;
}
ApiStatus GetCamLookAtObjVector(ScriptInstance* script, s32 isInitialCall) {
script->varTable[0] = CURRENT_CAM->lookAt_obj.x;
@ -122,8 +125,34 @@ ApiStatus HasMerleeCasts(ScriptInstance* script, s32 isInitialCall) {
}
INCLUDE_ASM(s32, "code_1a1f0_len_5390", func_8003F414);
/*
matches, but another function has the same name causing issues
ApiStatus func_8003F414(ScriptInstance* script, s32 isInitialCall) {
s32 tempVar0;
s32 tempVar1;
s32 tempVar2;
Bytecode* args = script->ptrReadPos;
INCLUDE_ASM(s32, "code_1a1f0_len_5390", func_8003F4CC);
tempVar0 = get_variable(script, *args++);
tempVar1 = get_variable(script, *args++);
tempVar2 = get_variable(script, *args++);
func_800720B0(6, tempVar0, tempVar1, tempVar2, 1.2f, 0x1E);
return ApiStatus_DONE2;
}
*/
ApiStatus func_8003F4CC(ScriptInstance* script, s32 isInitialCall) {
s32 tempVar0;
s32 tempVar1;
s32 tempVar2;
Bytecode* args = script->ptrReadPos;
tempVar0 = get_variable(script, *args++);
tempVar1 = get_variable(script, *args++);
tempVar2 = get_variable(script, *args++);
func_80071750(9, tempVar0, tempVar1, tempVar2, 5.0f, 0xF);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_1a1f0_len_5390", OnDefeatEnemy, ScriptInstance* script, s32 isInitialCall);

View File

@ -42,6 +42,7 @@ D_800A095F = 0x800A095D;
D_800A0960 = 0x800A0960;
D_800A0963 = 0x800A0963;
D_800A0964 = 0x800A0964;
D_800A0BB8 = 0x800A0BB8;
D_800E92D8 = 0x800E92D8;