Added gPlayerActionState, gPlayerAnimation, gPlayerNpc. Modifed PlayerStatus->actionState from u8 to s8. Defined ActionState enum as s8 type. A handful more script functions matched.

This commit is contained in:
Jdog 2020-08-22 16:24:51 -07:00
parent 177a9f0fe6
commit efe89e4486
17 changed files with 126 additions and 305 deletions

View File

@ -1,46 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel WaitForCam
/* 0F0D04 802CC354 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0F0D08 802CC358 AFB00010 */ sw $s0, 0x10($sp)
/* 0F0D0C 802CC35C 0080802D */ daddu $s0, $a0, $zero
/* 0F0D10 802CC360 AFBF001C */ sw $ra, 0x1c($sp)
/* 0F0D14 802CC364 AFB20018 */ sw $s2, 0x18($sp)
/* 0F0D18 802CC368 AFB10014 */ sw $s1, 0x14($sp)
/* 0F0D1C 802CC36C 8E11000C */ lw $s1, 0xc($s0)
/* 0F0D20 802CC370 00A0902D */ daddu $s2, $a1, $zero
/* 0F0D24 802CC374 0C0B1EAF */ jal get_variable
/* 0F0D28 802CC378 8E250000 */ lw $a1, ($s1)
/* 0F0D2C 802CC37C 0200202D */ daddu $a0, $s0, $zero
/* 0F0D30 802CC380 8E250004 */ lw $a1, 4($s1)
/* 0F0D34 802CC384 0C0B210B */ jal get_float_variable
/* 0F0D38 802CC388 0040802D */ daddu $s0, $v0, $zero
/* 0F0D3C 802CC38C 46000086 */ mov.s $f2, $f0
/* 0F0D40 802CC390 3C04800B */ lui $a0, 0x800b
/* 0F0D44 802CC394 24841D80 */ addiu $a0, $a0, 0x1d80
/* 0F0D48 802CC398 00101080 */ sll $v0, $s0, 2
/* 0F0D4C 802CC39C 00501021 */ addu $v0, $v0, $s0
/* 0F0D50 802CC3A0 00021080 */ sll $v0, $v0, 2
/* 0F0D54 802CC3A4 00501023 */ subu $v0, $v0, $s0
/* 0F0D58 802CC3A8 000218C0 */ sll $v1, $v0, 3
/* 0F0D5C 802CC3AC 00431021 */ addu $v0, $v0, $v1
/* 0F0D60 802CC3B0 000210C0 */ sll $v0, $v0, 3
/* 0F0D64 802CC3B4 16400006 */ bnez $s2, .L802CC3D0
/* 0F0D68 802CC3B8 00441021 */ addu $v0, $v0, $a0
/* 0F0D6C 802CC3BC C4400484 */ lwc1 $f0, 0x484($v0)
/* 0F0D70 802CC3C0 4600103E */ c.le.s $f2, $f0
/* 0F0D74 802CC3C4 00000000 */ nop
/* 0F0D78 802CC3C8 45010002 */ bc1t .L802CC3D4
/* 0F0D7C 802CC3CC 24020002 */ addiu $v0, $zero, 2
.L802CC3D0:
/* 0F0D80 802CC3D0 0000102D */ daddu $v0, $zero, $zero
.L802CC3D4:
/* 0F0D84 802CC3D4 8FBF001C */ lw $ra, 0x1c($sp)
/* 0F0D88 802CC3D8 8FB20018 */ lw $s2, 0x18($sp)
/* 0F0D8C 802CC3DC 8FB10014 */ lw $s1, 0x14($sp)
/* 0F0D90 802CC3E0 8FB00010 */ lw $s0, 0x10($sp)
/* 0F0D94 802CC3E4 03E00008 */ jr $ra
/* 0F0D98 802CC3E8 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,60 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel DisablePlayerInput
/* 0F57D8 802D0E28 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F57DC 802D0E2C AFBF0014 */ sw $ra, 0x14($sp)
/* 0F57E0 802D0E30 AFB00010 */ sw $s0, 0x10($sp)
/* 0F57E4 802D0E34 8C82000C */ lw $v0, 0xc($a0)
/* 0F57E8 802D0E38 8C450000 */ lw $a1, ($v0)
/* 0F57EC 802D0E3C 3C108011 */ lui $s0, 0x8011
/* 0F57F0 802D0E40 2610EFC8 */ addiu $s0, $s0, -0x1038
/* 0F57F4 802D0E44 0C0B1EAF */ jal get_variable
/* 0F57F8 802D0E48 00000000 */ nop
/* 0F57FC 802D0E4C 10400016 */ beqz $v0, .L802D0EA8
/* 0F5800 802D0E50 00000000 */ nop
/* 0F5804 802D0E54 0C03805E */ jal func_800E0178
/* 0F5808 802D0E58 00000000 */ nop
/* 0F580C 802D0E5C 0C03BD8A */ jal func_800EF628
/* 0F5810 802D0E60 00000000 */ nop
/* 0F5814 802D0E64 0C03A5EE */ jal func_800E97B8
/* 0F5818 802D0E68 00000000 */ nop
/* 0F581C 802D0E6C 0C03A613 */ jal func_800E984C
/* 0F5820 802D0E70 00000000 */ nop
/* 0F5824 802D0E74 820300B4 */ lb $v1, 0xb4($s0)
/* 0F5828 802D0E78 2402001A */ addiu $v0, $zero, 0x1a
/* 0F582C 802D0E7C 14620004 */ bne $v1, $v0, .L802D0E90
/* 0F5830 802D0E80 3C030004 */ lui $v1, 4
/* 0F5834 802D0E84 8E020004 */ lw $v0, 4($s0)
/* 0F5838 802D0E88 00431025 */ or $v0, $v0, $v1
/* 0F583C 802D0E8C AE020004 */ sw $v0, 4($s0)
.L802D0E90:
/* 0F5840 802D0E90 3C03800A */ lui $v1, 0x800a
/* 0F5844 802D0E94 2463A650 */ addiu $v1, $v1, -0x59b0
/* 0F5848 802D0E98 8C620000 */ lw $v0, ($v1)
/* 0F584C 802D0E9C 34420040 */ ori $v0, $v0, 0x40
/* 0F5850 802D0EA0 080B43B7 */ j .L802D0EDC
/* 0F5854 802D0EA4 AC620000 */ sw $v0, ($v1)
.L802D0EA8:
/* 0F5858 802D0EA8 0C038069 */ jal func_800E01A4
/* 0F585C 802D0EAC 00000000 */ nop
/* 0F5860 802D0EB0 0C03BD80 */ jal func_800EF600
/* 0F5864 802D0EB4 00000000 */ nop
/* 0F5868 802D0EB8 0C038077 */ jal func_800E01DC
/* 0F586C 802D0EBC 00000000 */ nop
/* 0F5870 802D0EC0 3C02800A */ lui $v0, 0x800a
/* 0F5874 802D0EC4 2442A650 */ addiu $v0, $v0, -0x59b0
/* 0F5878 802D0EC8 8C430000 */ lw $v1, ($v0)
/* 0F587C 802D0ECC 2404FFBF */ addiu $a0, $zero, -0x41
/* 0F5880 802D0ED0 00641824 */ and $v1, $v1, $a0
/* 0F5884 802D0ED4 0C03A60F */ jal func_800E983C
/* 0F5888 802D0ED8 AC430000 */ sw $v1, ($v0)
.L802D0EDC:
/* 0F588C 802D0EDC 8FBF0014 */ lw $ra, 0x14($sp)
/* 0F5890 802D0EE0 8FB00010 */ lw $s0, 0x10($sp)
/* 0F5894 802D0EE4 24020002 */ addiu $v0, $zero, 2
/* 0F5898 802D0EE8 03E00008 */ jr $ra
/* 0F589C 802D0EEC 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel DisablePlayerPhysics
/* 0F5794 802D0DE4 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F5798 802D0DE8 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F579C 802D0DEC 8C82000C */ lw $v0, 0xc($a0)
/* 0F57A0 802D0DF0 0C0B1EAF */ jal get_variable
/* 0F57A4 802D0DF4 8C450000 */ lw $a1, ($v0)
/* 0F57A8 802D0DF8 10400005 */ beqz $v0, .L802D0E10
/* 0F57AC 802D0DFC 00000000 */ nop
/* 0F57B0 802D0E00 0C038045 */ jal enable_player_physics
/* 0F57B4 802D0E04 00000000 */ nop
/* 0F57B8 802D0E08 080B4386 */ j .L802D0E18
/* 0F57BC 802D0E0C 00000000 */ nop
.L802D0E10:
/* 0F57C0 802D0E10 0C038050 */ jal disable_player_physics
/* 0F57C4 802D0E14 00000000 */ nop
.L802D0E18:
/* 0F57C8 802D0E18 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F57CC 802D0E1C 24020002 */ addiu $v0, $zero, 2
/* 0F57D0 802D0E20 03E00008 */ jr $ra
/* 0F57D4 802D0E24 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,14 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel FullyRestoreHPandFP
/* 0F6870 802D1EC0 3C028011 */ lui $v0, 0x8011
/* 0F6874 802D1EC4 2442F290 */ addiu $v0, $v0, -0xd70
/* 0F6878 802D1EC8 90430003 */ lbu $v1, 3($v0)
/* 0F687C 802D1ECC 90440006 */ lbu $a0, 6($v0)
/* 0F6880 802D1ED0 A0430002 */ sb $v1, 2($v0)
/* 0F6884 802D1ED4 A0440005 */ sb $a0, 5($v0)
/* 0F6888 802D1ED8 03E00008 */ jr $ra
/* 0F688C 802D1EDC 24020002 */ addiu $v0, $zero, 2

View File

@ -1,17 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetPlayerActionState
/* 0F6780 802D1DD0 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F6784 802D1DD4 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F6788 802D1DD8 8C82000C */ lw $v0, 0xc($a0)
/* 0F678C 802D1DDC 3C068011 */ lui $a2, 0x8011
/* 0F6790 802D1DE0 80C6F07C */ lb $a2, -0xf84($a2)
/* 0F6794 802D1DE4 0C0B2026 */ jal set_variable
/* 0F6798 802D1DE8 8C450000 */ lw $a1, ($v0)
/* 0F679C 802D1DEC 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F67A0 802D1DF0 24020002 */ addiu $v0, $zero, 2
/* 0F67A4 802D1DF4 03E00008 */ jr $ra
/* 0F67A8 802D1DF8 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,17 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetPlayerAnimation
/* 0F6844 802D1E94 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F6848 802D1E98 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F684C 802D1E9C 8C82000C */ lw $v0, 0xc($a0)
/* 0F6850 802D1EA0 3C068011 */ lui $a2, 0x8011
/* 0F6854 802D1EA4 8CC6F080 */ lw $a2, -0xf80($a2)
/* 0F6858 802D1EA8 0C0B2026 */ jal set_variable
/* 0F685C 802D1EAC 8C450000 */ lw $a1, ($v0)
/* 0F6860 802D1EB0 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F6864 802D1EB4 24020002 */ addiu $v0, $zero, 2
/* 0F6868 802D1EB8 03E00008 */ jr $ra
/* 0F686C 802D1EBC 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,44 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetPlayerPos
/* 0F67AC 802D1DFC 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 0F67B0 802D1E00 AFB00010 */ sw $s0, 0x10($sp)
/* 0F67B4 802D1E04 0080802D */ daddu $s0, $a0, $zero
/* 0F67B8 802D1E08 AFB10014 */ sw $s1, 0x14($sp)
/* 0F67BC 802D1E0C 3C118011 */ lui $s1, 0x8011
/* 0F67C0 802D1E10 2631EFC8 */ addiu $s1, $s1, -0x1038
/* 0F67C4 802D1E14 AFBF0020 */ sw $ra, 0x20($sp)
/* 0F67C8 802D1E18 AFB3001C */ sw $s3, 0x1c($sp)
/* 0F67CC 802D1E1C AFB20018 */ sw $s2, 0x18($sp)
/* 0F67D0 802D1E20 8E02000C */ lw $v0, 0xc($s0)
/* 0F67D4 802D1E24 C6200028 */ lwc1 $f0, 0x28($s1)
/* 0F67D8 802D1E28 8C450000 */ lw $a1, ($v0)
/* 0F67DC 802D1E2C 24420004 */ addiu $v0, $v0, 4
/* 0F67E0 802D1E30 4600008D */ trunc.w.s $f2, $f0
/* 0F67E4 802D1E34 44061000 */ mfc1 $a2, $f2
/* 0F67E8 802D1E38 8C520000 */ lw $s2, ($v0)
/* 0F67EC 802D1E3C 0C0B2026 */ jal set_variable
/* 0F67F0 802D1E40 8C530004 */ lw $s3, 4($v0)
/* 0F67F4 802D1E44 0200202D */ daddu $a0, $s0, $zero
/* 0F67F8 802D1E48 C620002C */ lwc1 $f0, 0x2c($s1)
/* 0F67FC 802D1E4C 4600008D */ trunc.w.s $f2, $f0
/* 0F6800 802D1E50 44061000 */ mfc1 $a2, $f2
/* 0F6804 802D1E54 0C0B2026 */ jal set_variable
/* 0F6808 802D1E58 0240282D */ daddu $a1, $s2, $zero
/* 0F680C 802D1E5C 0200202D */ daddu $a0, $s0, $zero
/* 0F6810 802D1E60 C6200030 */ lwc1 $f0, 0x30($s1)
/* 0F6814 802D1E64 4600008D */ trunc.w.s $f2, $f0
/* 0F6818 802D1E68 44061000 */ mfc1 $a2, $f2
/* 0F681C 802D1E6C 0C0B2026 */ jal set_variable
/* 0F6820 802D1E70 0260282D */ daddu $a1, $s3, $zero
/* 0F6824 802D1E74 8FBF0020 */ lw $ra, 0x20($sp)
/* 0F6828 802D1E78 8FB3001C */ lw $s3, 0x1c($sp)
/* 0F682C 802D1E7C 8FB20018 */ lw $s2, 0x18($sp)
/* 0F6830 802D1E80 8FB10014 */ lw $s1, 0x14($sp)
/* 0F6834 802D1E84 8FB00010 */ lw $s0, 0x10($sp)
/* 0F6838 802D1E88 24020002 */ addiu $v0, $zero, 2
/* 0F683C 802D1E8C 03E00008 */ jr $ra
/* 0F6840 802D1E90 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel HidePlayerShadow
/* 0F5750 802D0DA0 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F5754 802D0DA4 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F5758 802D0DA8 8C82000C */ lw $v0, 0xc($a0)
/* 0F575C 802D0DAC 0C0B1EAF */ jal get_variable
/* 0F5760 802D0DB0 8C450000 */ lw $a1, ($v0)
/* 0F5764 802D0DB4 10400005 */ beqz $v0, .L802D0DCC
/* 0F5768 802D0DB8 00000000 */ nop
/* 0F576C 802D0DBC 0C038039 */ jal disable_player_shadow
/* 0F5770 802D0DC0 00000000 */ nop
/* 0F5774 802D0DC4 080B4375 */ j .L802D0DD4
/* 0F5778 802D0DC8 00000000 */ nop
.L802D0DCC:
/* 0F577C 802D0DCC 0C03802C */ jal enable_player_shadow
/* 0F5780 802D0DD0 00000000 */ nop
.L802D0DD4:
/* 0F5784 802D0DD4 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F5788 802D0DD8 24020002 */ addiu $v0, $zero, 2
/* 0F578C 802D0DDC 03E00008 */ jr $ra
/* 0F5790 802D0DE0 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 PlayerJump
/* 0F6298 802D18E8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F629C 802D18EC AFBF0010 */ sw $ra, 0x10($sp)
/* 0F62A0 802D18F0 0C0B4538 */ jal player_jump
/* 0F62A4 802D18F4 0000302D */ daddu $a2, $zero, $zero
/* 0F62A8 802D18F8 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F62AC 802D18FC 03E00008 */ jr $ra
/* 0F62B0 802D1900 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 PlayerJump1
/* 0F62B4 802D1904 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F62B8 802D1908 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F62BC 802D190C 0C0B4538 */ jal player_jump
/* 0F62C0 802D1910 24060001 */ addiu $a2, $zero, 1
/* 0F62C4 802D1914 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F62C8 802D1918 03E00008 */ jr $ra
/* 0F62CC 802D191C 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 PlayerJump2
/* 0F62D0 802D1920 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F62D4 802D1924 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F62D8 802D1928 0C0B4538 */ jal player_jump
/* 0F62DC 802D192C 24060002 */ addiu $a2, $zero, 2
/* 0F62E0 802D1930 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F62E4 802D1934 03E00008 */ jr $ra
/* 0F62E8 802D1938 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1355,7 +1355,7 @@ typedef struct PlayerStatus {
/* 0x0AC */ char unk_AC[4]; /* 0x0AC */ char unk_AC[4];
/* 0x0B0 */ s16 colliderHeight; /* 0x0B0 */ s16 colliderHeight;
/* 0x0B2 */ s16 colliderDiameter; /* 0x0B2 */ s16 colliderDiameter;
/* 0x0B4 */ u8 actionState; /* 0x0B4 */ s8 actionState;
/* 0x0B5 */ u8 prevActionState; /* 0x0B5 */ u8 prevActionState;
/* 0x0B6 */ u8 fallState; /* 0x0B6 */ u8 fallState;
/* 0x0B7 */ char unk_B7; /* 0x0B7 */ char unk_B7;

View File

@ -1224,7 +1224,7 @@ typedef UNK_TYPE DoorSounds;
#define DoorSounds_CREAKY 0x00000003 #define DoorSounds_CREAKY 0x00000003
#define DoorSounds_GATE 0x00000004 #define DoorSounds_GATE 0x00000004
typedef UNK_TYPE ActionState; typedef s8 ActionState;
#define ActionState_IDLE 0x00000000 #define ActionState_IDLE 0x00000000
#define ActionState_WALK 0x00000001 #define ActionState_WALK 0x00000001
#define ActionState_RUN 0x00000002 #define ActionState_RUN 0x00000002

View File

@ -7,6 +7,8 @@
extern UiStatus gUIStatus; extern UiStatus gUIStatus;
extern PlayerData gPlayerData; extern PlayerData gPlayerData;
extern ActionState gPlayerActionState;
extern PlayerAnim gPlayerAnimation;
extern PlayerStatus gPlayerStatus; extern PlayerStatus gPlayerStatus;
extern GameStatus* gGameStatusPtr[1]; extern GameStatus* gGameStatusPtr[1];
extern StaticItem gItemTable[364]; extern StaticItem gItemTable[364];
@ -44,6 +46,8 @@ extern Camera gCameras[4];
extern f32 gGlobalTimeSpace; extern f32 gGlobalTimeSpace;
extern Npc* gPlayerNpc;
extern s8 D_800A0900; extern s8 D_800A0900;
extern s16* D_80151328; extern s16* D_80151328;
extern s16 D_8010CD10; extern s16 D_8010CD10;

View File

@ -439,7 +439,18 @@ ApiStatus GetCamPosition(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
INCLUDE_API_ASM("code_ef070_len_3400", WaitForCam); ApiStatus WaitForCam(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 id = get_variable(script, args[0]);
f32 endInterpValue = get_float_variable(script, args[1]);
Camera* cameras = &gCameras;
Camera* camera = &cameras[id];
if (isInitialCall || !(endInterpValue <= camera->sinInterpAlpha)) {
return ApiStatus_BLOCK;
}
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_ef070_len_3400", SetCamProperties); INCLUDE_API_ASM("code_ef070_len_3400", SetCamProperties);

View File

@ -58,9 +58,9 @@ ApiStatus func_802D0C94(ScriptInstance* script, s32 initialCall) {
} }
ApiStatus SetMessageString(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetMessageString(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
Bytecode string = get_variable(script, *ptrReadPos++); Bytecode string = get_variable(script, *args++);
Bytecode index = get_variable(script, *ptrReadPos++); Bytecode index = get_variable(script, *args++);
set_message_string(string, index); set_message_string(string, index);
return ApiStatus_DONE2; return ApiStatus_DONE2;
@ -81,13 +81,74 @@ ApiStatus SetMessageValue(ScriptInstance* script, s32 initialCall) {
INCLUDE_API_ASM("code_f4c60_len_4300", SetMessageValue); INCLUDE_API_ASM("code_f4c60_len_4300", SetMessageValue);
#endif #endif
INCLUDE_API_ASM("code_f4c60_len_4300", HidePlayerShadow); ApiStatus HidePlayerShadow(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 hideShadow = get_variable(script, *args++);
INCLUDE_API_ASM("code_f4c60_len_4300", DisablePlayerPhysics); if (hideShadow) {
disable_player_shadow();
} else {
enable_player_shadow();
}
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f4c60_len_4300", DisablePlayerInput); ApiStatus DisablePlayerPhysics(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 enable = get_variable(script, *args++);
if (enable) {
enable_player_physics();
} else {
disable_player_physics();
}
return ApiStatus_DONE2;
}
ApiStatus DisablePlayerInput(ScriptInstance* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Bytecode* args = script->ptrReadPos;
s32 enable = get_variable(script, *args++);
if (enable) {
func_800E0178();
func_800EF628();
func_800E97B8();
func_800E984C();
if (playerStatus->actionState == ActionState_SPIN) {
playerStatus->animFlags |= 0x40000;
}
D_8009A650[0] |= 0x40;
} else {
func_800E01A4();
func_800EF600();
func_800E01DC();
D_8009A650[0] &= ~0x40;
func_800E983C();
}
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerPos); INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerPos);
/*
ApiStatus SetPlayerPos(ScriptInstance* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Bytecode* args = script->ptrReadPos;
f32 x = get_variable(script, *args++);
f32 y = get_variable(script, *args++);
f32 z = get_variable(script, *args++);
Npc* playerNpc = gPlayerNpc;
playerNpc->pos.x = x;
playerNpc->pos.z = z;
playerNpc->pos.y = y;
playerStatus->position.x = x;
playerStatus->position.y = y;
playerStatus->position.z = z;
return ApiStatus_DONE2;
}
*/
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerCollisionSize); INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerCollisionSize);
@ -103,11 +164,17 @@ INCLUDE_API_ASM("code_f4c60_len_4300", MovePlayerTo);
INCLUDE_ASM("code_f4c60_len_4300", player_jump); INCLUDE_ASM("code_f4c60_len_4300", player_jump);
INCLUDE_API_ASM("code_f4c60_len_4300", PlayerJump); void PlayerJump(ScriptInstance* script, s32 isInitialCall) {
player_jump(script, isInitialCall, 0);
}
INCLUDE_API_ASM("code_f4c60_len_4300", PlayerJump1); void PlayerJump1(ScriptInstance* script, s32 isInitialCall) {
player_jump(script, isInitialCall, 1);
}
INCLUDE_API_ASM("code_f4c60_len_4300", PlayerJump2); void PlayerJump2(ScriptInstance* script, s32 isInitialCall) {
player_jump(script, isInitialCall, 2);
}
INCLUDE_API_ASM("code_f4c60_len_4300", InterpPlayerYaw); INCLUDE_API_ASM("code_f4c60_len_4300", InterpPlayerYaw);
@ -117,13 +184,38 @@ INCLUDE_API_ASM("code_f4c60_len_4300", GetPlayerTargetYaw);
INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerFlagBits); INCLUDE_API_ASM("code_f4c60_len_4300", SetPlayerFlagBits);
INCLUDE_API_ASM("code_f4c60_len_4300", GetPlayerActionState); ApiStatus GetPlayerActionState(ScriptInstance* script, s32 isInitialCall) {
Bytecode outVar = *script->ptrReadPos;
set_variable(script, outVar, gPlayerActionState);
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f4c60_len_4300", GetPlayerPos); ApiStatus GetPlayerPos(ScriptInstance* script, s32 isInitialCall) {
PlayerStatus* playerStatus = &gPlayerStatus;
Bytecode* args = script->ptrReadPos;
Bytecode outVar1 = *args++;
Bytecode outVar2 = *args++;
Bytecode outVar3 = *args++;
INCLUDE_API_ASM("code_f4c60_len_4300", GetPlayerAnimation); set_variable(script, outVar1, playerStatus->position.x);
set_variable(script, outVar2, playerStatus->position.y);
set_variable(script, outVar3, playerStatus->position.z);
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f4c60_len_4300", FullyRestoreHPandFP); ApiStatus GetPlayerAnimation(ScriptInstance* script, s32 isInitialCall) {
Bytecode outVar = *script->ptrReadPos;
set_variable(script, outVar, gPlayerAnimation);
return ApiStatus_DONE2;
}
ApiStatus FullyRestoreHPandFP(ScriptInstance* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
playerData->curHP = playerData->curMaxHP;
playerData->curFP = playerData->curMaxFP;
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f4c60_len_4300", FullyRestoreSP); INCLUDE_API_ASM("code_f4c60_len_4300", FullyRestoreSP);

View File

@ -1,12 +1,15 @@
gGameStatusPtr = 0x8007419C; gGameStatusPtr = 0x8007419C;
gUIStatus = 0x8010EF58; gUIStatus = 0x8010EF58;
gPlayerData = 0x8010F290; gPlayerData = 0x8010F290;
gPlayerActionState = 0x8010F07C;
gPlayerAnimation = 0x8010F080;
gPlayerStatus = 0x8010EFC8; gPlayerStatus = 0x8010EFC8;
gItemTable = 0x800878E0; gItemTable = 0x800878E0;
gWorldScriptList = 0x802DA490; gWorldScriptList = 0x802DA490;
gBattleScriptList = 0x802DA690; gBattleScriptList = 0x802DA690;
gCurrentScriptListPtr = 0x802DA890; gCurrentScriptListPtr = 0x802DA890;
gGlobalTimeSpace = 0x802D9CA8; gGlobalTimeSpace = 0x802D9CA8;
gPlayerNpc = 0x802D9D20;
D_80147574 = 0x80147574; D_80147574 = 0x80147574;
gMapTransitionAlpha = 0x800A0940; gMapTransitionAlpha = 0x800A0940;