Added function prototype for set_npc_yaw. Match NpcJump0, NpcJump1, GetNpcYaw, SetNpcYaw

This commit is contained in:
Jdog 2020-08-18 17:31:39 -07:00
parent 63f8254227
commit 17d513eeba
7 changed files with 34 additions and 106 deletions

View File

@ -1,36 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetNpcYaw
/* 0F33C0 802CEA10 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0F33C4 802CEA14 AFB10014 */ sw $s1, 0x14($sp)
/* 0F33C8 802CEA18 0080882D */ daddu $s1, $a0, $zero
/* 0F33CC 802CEA1C AFBF0018 */ sw $ra, 0x18($sp)
/* 0F33D0 802CEA20 AFB00010 */ sw $s0, 0x10($sp)
/* 0F33D4 802CEA24 8E30000C */ lw $s0, 0xc($s1)
/* 0F33D8 802CEA28 8E050000 */ lw $a1, ($s0)
/* 0F33DC 802CEA2C 0C0B1EAF */ jal get_variable
/* 0F33E0 802CEA30 26100004 */ addiu $s0, $s0, 4
/* 0F33E4 802CEA34 0220202D */ daddu $a0, $s1, $zero
/* 0F33E8 802CEA38 8E100000 */ lw $s0, ($s0)
/* 0F33EC 802CEA3C 0C0B36B0 */ jal resolve_npc
/* 0F33F0 802CEA40 0040282D */ daddu $a1, $v0, $zero
/* 0F33F4 802CEA44 5040000A */ beql $v0, $zero, .L802CEA70
/* 0F33F8 802CEA48 24020002 */ addiu $v0, $zero, 2
/* 0F33FC 802CEA4C C44C000C */ lwc1 $f12, 0xc($v0)
/* 0F3400 802CEA50 0C00A6C9 */ jal clamp_angle
/* 0F3404 802CEA54 00000000 */ nop
/* 0F3408 802CEA58 0220202D */ daddu $a0, $s1, $zero
/* 0F340C 802CEA5C 4600008D */ trunc.w.s $f2, $f0
/* 0F3410 802CEA60 44061000 */ mfc1 $a2, $f2
/* 0F3414 802CEA64 0C0B2026 */ jal set_variable
/* 0F3418 802CEA68 0200282D */ daddu $a1, $s0, $zero
/* 0F341C 802CEA6C 24020002 */ addiu $v0, $zero, 2
.L802CEA70:
/* 0F3420 802CEA70 8FBF0018 */ lw $ra, 0x18($sp)
/* 0F3424 802CEA74 8FB10014 */ lw $s1, 0x14($sp)
/* 0F3428 802CEA78 8FB00010 */ lw $s0, 0x10($sp)
/* 0F342C 802CEA7C 03E00008 */ jr $ra
/* 0F3430 802CEA80 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,13 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel NpcJump0
/* 0F3074 802CE6C4 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F3078 802CE6C8 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F307C 802CE6CC 0C0B390D */ jal _npc_jump_to
/* 0F3080 802CE6D0 0000302D */ daddu $a2, $zero, $zero
/* 0F3084 802CE6D4 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F3088 802CE6D8 03E00008 */ jr $ra
/* 0F308C 802CE6DC 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,13 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel NpcJump1
/* 0F3090 802CE6E0 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F3094 802CE6E4 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F3098 802CE6E8 0C0B390D */ jal _npc_jump_to
/* 0F309C 802CE6EC 24060001 */ addiu $a2, $zero, 1
/* 0F30A0 802CE6F0 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F30A4 802CE6F4 03E00008 */ jr $ra
/* 0F30A8 802CE6F8 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,39 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetNpcYaw
/* 0F3434 802CEA84 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0F3438 802CEA88 AFB20018 */ sw $s2, 0x18($sp)
/* 0F343C 802CEA8C 0080902D */ daddu $s2, $a0, $zero
/* 0F3440 802CEA90 AFBF001C */ sw $ra, 0x1c($sp)
/* 0F3444 802CEA94 AFB10014 */ sw $s1, 0x14($sp)
/* 0F3448 802CEA98 AFB00010 */ sw $s0, 0x10($sp)
/* 0F344C 802CEA9C 8E50000C */ lw $s0, 0xc($s2)
/* 0F3450 802CEAA0 8E050000 */ lw $a1, ($s0)
/* 0F3454 802CEAA4 0C0B1EAF */ jal get_variable
/* 0F3458 802CEAA8 26100004 */ addiu $s0, $s0, 4
/* 0F345C 802CEAAC 0240202D */ daddu $a0, $s2, $zero
/* 0F3460 802CEAB0 0C0B36B0 */ jal resolve_npc
/* 0F3464 802CEAB4 0040282D */ daddu $a1, $v0, $zero
/* 0F3468 802CEAB8 0040882D */ daddu $s1, $v0, $zero
/* 0F346C 802CEABC 1220000B */ beqz $s1, .L802CEAEC
/* 0F3470 802CEAC0 24020002 */ addiu $v0, $zero, 2
/* 0F3474 802CEAC4 8E050000 */ lw $a1, ($s0)
/* 0F3478 802CEAC8 0C0B1EAF */ jal get_variable
/* 0F347C 802CEACC 0240202D */ daddu $a0, $s2, $zero
/* 0F3480 802CEAD0 44820000 */ mtc1 $v0, $f0
/* 0F3484 802CEAD4 00000000 */ nop
/* 0F3488 802CEAD8 46800020 */ cvt.s.w $f0, $f0
/* 0F348C 802CEADC 44050000 */ mfc1 $a1, $f0
/* 0F3490 802CEAE0 0C00ECD0 */ jal set_npc_yaw
/* 0F3494 802CEAE4 0220202D */ daddu $a0, $s1, $zero
/* 0F3498 802CEAE8 24020002 */ addiu $v0, $zero, 2
.L802CEAEC:
/* 0F349C 802CEAEC 8FBF001C */ lw $ra, 0x1c($sp)
/* 0F34A0 802CEAF0 8FB20018 */ lw $s2, 0x18($sp)
/* 0F34A4 802CEAF4 8FB10014 */ lw $s1, 0x14($sp)
/* 0F34A8 802CEAF8 8FB00010 */ lw $s0, 0x10($sp)
/* 0F34AC 802CEAFC 03E00008 */ jr $ra
/* 0F34B0 802CEB00 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -35,6 +35,7 @@ f32 update_lerp(Easing easing, f32 start, f32 end, s32 elapsed, s32 duration);
Npc* get_npc_safe(NpcId npcId);
Npc* get_npc_unsafe(NpcId npcId);
Npc* resolve_npc(ScriptInstance* script, NpcId npcIdOrPtr);
void set_npc_yaw(Npc* npcPtr, f32 angle);
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by);
f32 dist3D(f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz);

View File

@ -64,7 +64,7 @@ INCLUDE_ASM(code_13870_len_6980, func_8003B1A8);
INCLUDE_ASM(code_13870_len_6980, func_8003B1B0);
INCLUDE_ASM(code_13870_len_6980, set_npc_yaw);
void INCLUDE_ASM(code_13870_len_6980, set_npc_yaw, Npc* npcPtr, f32 angle);
INCLUDE_ASM(code_13870_len_6980, func_8003B3D0);

View File

@ -143,15 +143,43 @@ INCLUDE_API_ASM(code_f2470_len_27f0, NpcMoveTo);
INCLUDE_ASM(code_f2470_len_27f0, _npc_jump_to);
INCLUDE_API_ASM(code_f2470_len_27f0, NpcJump0);
void NpcJump0(ScriptInstance* script, s32 isInitialCall) {
_npc_jump_to(script, isInitialCall, 0);
}
INCLUDE_API_ASM(code_f2470_len_27f0, NpcJump1);
void NpcJump1(ScriptInstance* script, s32 isInitialCall) {
_npc_jump_to(script, isInitialCall, 1);
}
INCLUDE_API_ASM(code_f2470_len_27f0, NpcFlyTo);
INCLUDE_API_ASM(code_f2470_len_27f0, GetNpcYaw);
ApiStatus GetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Bytecode outVar = *ptrReadPos++;
Npc* npcPtr = resolve_npc(script, npcID);
INCLUDE_API_ASM(code_f2470_len_27f0, SetNpcYaw);
if (npcPtr != NULL) {
s32 todo = 1; // TODO: Figure out why this variable and subsequent if block is required for matching
if (todo) {
set_variable(script, outVar, clamp_angle(npcPtr->yaw));
}
return ApiStatus_DONE2; // Doesn't match if omitted
}
return ApiStatus_DONE2;
}
ApiStatus SetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Npc* npcPtr = resolve_npc(script, npcID);
if (npcPtr != NULL) {
set_npc_yaw(npcPtr, get_variable(script, *ptrReadPos++));
return ApiStatus_DONE2; // Doesn't match if omitted
}
return ApiStatus_DONE2;
}
INCLUDE_API_ASM(code_f2470_len_27f0, InterpNpcYaw);