This commit is contained in:
Ethan Roseman 2020-10-08 17:45:26 -04:00
parent 1f7e2134e0
commit eb6aaccd73
15 changed files with 137 additions and 242 deletions

View File

@ -1,24 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel disable_npc_blur
/* 161AC 8003ADAC 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 161B0 8003ADB0 AFB00010 */ sw $s0, 0x10($sp)
/* 161B4 8003ADB4 0080802D */ daddu $s0, $a0, $zero
/* 161B8 8003ADB8 AFBF0014 */ sw $ra, 0x14($sp)
/* 161BC 8003ADBC 8E030000 */ lw $v1, ($s0)
/* 161C0 8003ADC0 3C020010 */ lui $v0, 0x10
/* 161C4 8003ADC4 00621024 */ and $v0, $v1, $v0
/* 161C8 8003ADC8 10400007 */ beqz $v0, .L8003ADE8
/* 161CC 8003ADCC 3C02FFEF */ lui $v0, 0xffef
/* 161D0 8003ADD0 3442FFFF */ ori $v0, $v0, 0xffff
/* 161D4 8003ADD4 8E040020 */ lw $a0, 0x20($s0)
/* 161D8 8003ADD8 00621024 */ and $v0, $v1, $v0
/* 161DC 8003ADDC 0C00AB4B */ jal heap_free
/* 161E0 8003ADE0 AE020000 */ sw $v0, ($s0)
/* 161E4 8003ADE4 AE000020 */ sw $zero, 0x20($s0)
.L8003ADE8:
/* 161E8 8003ADE8 8FBF0014 */ lw $ra, 0x14($sp)
/* 161EC 8003ADEC 8FB00010 */ lw $s0, 0x10($sp)
/* 161F0 8003ADF0 03E00008 */ jr $ra
/* 161F4 8003ADF4 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,21 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel mtx_ident_mirror_y
/* 13878 80038478 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 1387C 8003847C AFB00010 */ sw $s0, 0x10($sp)
/* 13880 80038480 AFBF0014 */ sw $ra, 0x14($sp)
/* 13884 80038484 0C019D28 */ jal guMtxIdentF
/* 13888 80038488 0080802D */ daddu $s0, $a0, $zero
/* 1388C 8003848C 3C013F80 */ lui $at, 0x3f80
/* 13890 80038490 44810000 */ mtc1 $at, $f0
/* 13894 80038494 3C01BF80 */ lui $at, 0xbf80
/* 13898 80038498 44811000 */ mtc1 $at, $f2
/* 1389C 8003849C E6000000 */ swc1 $f0, ($s0)
/* 138A0 800384A0 E6020014 */ swc1 $f2, 0x14($s0)
/* 138A4 800384A4 E6000028 */ swc1 $f0, 0x28($s0)
/* 138A8 800384A8 E600003C */ swc1 $f0, 0x3c($s0)
/* 138AC 800384AC 8FBF0014 */ lw $ra, 0x14($sp)
/* 138B0 800384B0 8FB00010 */ lw $s0, 0x10($sp)
/* 138B4 800384B4 03E00008 */ jr $ra
/* 138B8 800384B8 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,21 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel update_npc_blur
/* 161F8 8003ADF8 8C850020 */ lw $a1, 0x20($a0)
/* 161FC 8003ADFC 80A30001 */ lb $v1, 1($a1)
/* 16200 8003AE00 C4800038 */ lwc1 $f0, 0x38($a0)
/* 16204 8003AE04 00031080 */ sll $v0, $v1, 2
/* 16208 8003AE08 00A21021 */ addu $v0, $a1, $v0
/* 1620C 8003AE0C E4400004 */ swc1 $f0, 4($v0)
/* 16210 8003AE10 C480003C */ lwc1 $f0, 0x3c($a0)
/* 16214 8003AE14 E4400054 */ swc1 $f0, 0x54($v0)
/* 16218 8003AE18 C4800040 */ lwc1 $f0, 0x40($a0)
/* 1621C 8003AE1C 24630001 */ addiu $v1, $v1, 1
/* 16220 8003AE20 E44000A4 */ swc1 $f0, 0xa4($v0)
/* 16224 8003AE24 28620014 */ slti $v0, $v1, 0x14
/* 16228 8003AE28 50400001 */ beql $v0, $zero, .L8003AE30
/* 1622C 8003AE2C 0000182D */ daddu $v1, $zero, $zero
.L8003AE30:
/* 16230 8003AE30 03E00008 */ jr $ra
/* 16234 8003AE34 A0A30001 */ sb $v1, 1($a1)

View File

@ -1,14 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8002B608
/* 6A08 8002B608 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 6A0C 8002B60C 3C038007 */ lui $v1, %hi(gGameStatusPtr)
/* 6A10 8002B610 8C63419C */ lw $v1, %lo(gGameStatusPtr)($v1)
/* 6A14 8002B614 2402000A */ addiu $v0, $zero, 0xa
/* 6A18 8002B618 AFBF0010 */ sw $ra, 0x10($sp)
/* 6A1C 8002B61C 0C00AD8C */ jal fio_serialize_state
/* 6A20 8002B620 A462008E */ sh $v0, 0x8e($v1)
/* 6A24 8002B624 8FBF0010 */ lw $ra, 0x10($sp)
/* 6A28 8002B628 03E00008 */ jr $ra
/* 6A2C 8002B62C 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,29 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel CheckActionState
/* 7E405C 802831DC 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 7E4060 802831E0 AFB00010 */ sw $s0, 0x10($sp)
/* 7E4064 802831E4 0080802D */ daddu $s0, $a0, $zero
/* 7E4068 802831E8 AFBF0018 */ sw $ra, 0x18($sp)
/* 7E406C 802831EC AFB10014 */ sw $s1, 0x14($sp)
/* 7E4070 802831F0 8E02000C */ lw $v0, 0xc($s0)
/* 7E4074 802831F4 8C450004 */ lw $a1, 4($v0)
/* 7E4078 802831F8 0C0B210B */ jal get_float_variable
/* 7E407C 802831FC 8C510000 */ lw $s1, ($v0)
/* 7E4080 80283200 0200202D */ daddu $a0, $s0, $zero
/* 7E4084 80283204 0220282D */ daddu $a1, $s1, $zero
/* 7E4088 80283208 3C068011 */ lui $a2, %hi(gPlayerActionState)
/* 7E408C 8028320C 80C6F07C */ lb $a2, %lo(gPlayerActionState)($a2)
/* 7E4090 80283210 4600008D */ trunc.w.s $f2, $f0
/* 7E4094 80283214 44021000 */ mfc1 $v0, $f2
/* 7E4098 80283218 00000000 */ nop
/* 7E409C 8028321C 00C23026 */ xor $a2, $a2, $v0
/* 7E40A0 80283220 0C0B2026 */ jal set_variable
/* 7E40A4 80283224 2CC60001 */ sltiu $a2, $a2, 1
/* 7E40A8 80283228 8FBF0018 */ lw $ra, 0x18($sp)
/* 7E40AC 8028322C 8FB10014 */ lw $s1, 0x14($sp)
/* 7E40B0 80283230 8FB00010 */ lw $s0, 0x10($sp)
/* 7E40B4 80283234 24020002 */ addiu $v0, $zero, 2
/* 7E40B8 80283238 03E00008 */ jr $ra
/* 7E40BC 8028323C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,41 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel Disable8bitMario
/* F7538 802D2B88 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F753C 802D2B8C AFBF0018 */ sw $ra, 0x18($sp)
/* F7540 802D2B90 AFB10014 */ sw $s1, 0x14($sp)
/* F7544 802D2B94 AFB00010 */ sw $s0, 0x10($sp)
/* F7548 802D2B98 8C82000C */ lw $v0, 0xc($a0)
/* F754C 802D2B9C 3C108011 */ lui $s0, %hi(gPlayerStatus)
/* F7550 802D2BA0 2610EFC8 */ addiu $s0, $s0, %lo(gPlayerStatus)
/* F7554 802D2BA4 8C450000 */ lw $a1, ($v0)
/* F7558 802D2BA8 0C0B1EAF */ jal get_variable
/* F755C 802D2BAC 0200882D */ daddu $s1, $s0, $zero
/* F7560 802D2BB0 10400009 */ beqz $v0, .L802D2BD8
/* F7564 802D2BB4 24020025 */ addiu $v0, $zero, 0x25
/* F7568 802D2BB8 A60200B0 */ sh $v0, 0xb0($s0)
/* F756C 802D2BBC 2402001A */ addiu $v0, $zero, 0x1a
/* F7570 802D2BC0 A60200B2 */ sh $v0, 0xb2($s0)
/* F7574 802D2BC4 8E020004 */ lw $v0, 4($s0)
/* F7578 802D2BC8 2403BFFF */ addiu $v1, $zero, -0x4001
/* F757C 802D2BCC 00431024 */ and $v0, $v0, $v1
/* F7580 802D2BD0 080B4AFF */ j .L802D2BFC
/* F7584 802D2BD4 AE020004 */ sw $v0, 4($s0)
.L802D2BD8:
/* F7588 802D2BD8 3C040004 */ lui $a0, 4
/* F758C 802D2BDC 34844004 */ ori $a0, $a0, 0x4004
/* F7590 802D2BE0 24020013 */ addiu $v0, $zero, 0x13
/* F7594 802D2BE4 A62200B0 */ sh $v0, 0xb0($s1)
/* F7598 802D2BE8 8E220004 */ lw $v0, 4($s1)
/* F759C 802D2BEC 2403001A */ addiu $v1, $zero, 0x1a
/* F75A0 802D2BF0 A62300B2 */ sh $v1, 0xb2($s1)
/* F75A4 802D2BF4 00441025 */ or $v0, $v0, $a0
/* F75A8 802D2BF8 AE220004 */ sw $v0, 4($s1)
.L802D2BFC:
/* F75AC 802D2BFC 8FBF0018 */ lw $ra, 0x18($sp)
/* F75B0 802D2C00 8FB10014 */ lw $s1, 0x14($sp)
/* F75B4 802D2C04 8FB00010 */ lw $s0, 0x10($sp)
/* F75B8 802D2C08 24020002 */ addiu $v0, $zero, 2
/* F75BC 802D2C0C 03E00008 */ jr $ra
/* F75C0 802D2C10 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,33 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetPlayerCollisionSize
/* F5960 802D0FB0 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F5964 802D0FB4 AFB10014 */ sw $s1, 0x14($sp)
/* F5968 802D0FB8 0080882D */ daddu $s1, $a0, $zero
/* F596C 802D0FBC AFBF0018 */ sw $ra, 0x18($sp)
/* F5970 802D0FC0 AFB00010 */ sw $s0, 0x10($sp)
/* F5974 802D0FC4 8E30000C */ lw $s0, 0xc($s1)
/* F5978 802D0FC8 8E050000 */ lw $a1, ($s0)
/* F597C 802D0FCC 0C0B1EAF */ jal get_variable
/* F5980 802D0FD0 26100004 */ addiu $s0, $s0, 4
/* F5984 802D0FD4 0220202D */ daddu $a0, $s1, $zero
/* F5988 802D0FD8 8E050000 */ lw $a1, ($s0)
/* F598C 802D0FDC 0C0B1EAF */ jal get_variable
/* F5990 802D0FE0 0040802D */ daddu $s0, $v0, $zero
/* F5994 802D0FE4 3C03802E */ lui $v1, %hi(gPlayerNpcPtr)
/* F5998 802D0FE8 8C639D20 */ lw $v1, %lo(gPlayerNpcPtr)($v1)
/* F599C 802D0FEC 3C048011 */ lui $a0, %hi(gPlayerStatus)
/* F59A0 802D0FF0 2484EFC8 */ addiu $a0, $a0, %lo(gPlayerStatus)
/* F59A4 802D0FF4 A47000A8 */ sh $s0, 0xa8($v1)
/* F59A8 802D0FF8 A46200A6 */ sh $v0, 0xa6($v1)
/* F59AC 802D0FFC 0200102D */ daddu $v0, $s0, $zero
/* F59B0 802D1000 A48200B0 */ sh $v0, 0xb0($a0)
/* F59B4 802D1004 946300A6 */ lhu $v1, 0xa6($v1)
/* F59B8 802D1008 A48300B2 */ sh $v1, 0xb2($a0)
/* F59BC 802D100C 8FBF0018 */ lw $ra, 0x18($sp)
/* F59C0 802D1010 8FB10014 */ lw $s1, 0x14($sp)
/* F59C4 802D1014 8FB00010 */ lw $s0, 0x10($sp)
/* F59C8 802D1018 24020002 */ addiu $v0, $zero, 2
/* F59CC 802D101C 03E00008 */ jr $ra
/* F59D0 802D1020 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,34 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetPlayerFlagBits
/* F6710 802D1D60 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F6714 802D1D64 AFB10014 */ sw $s1, 0x14($sp)
/* F6718 802D1D68 3C118011 */ lui $s1, %hi(gPlayerStatus)
/* F671C 802D1D6C 2631EFC8 */ addiu $s1, $s1, %lo(gPlayerStatus)
/* F6720 802D1D70 AFBF001C */ sw $ra, 0x1c($sp)
/* F6724 802D1D74 AFB20018 */ sw $s2, 0x18($sp)
/* F6728 802D1D78 AFB00010 */ sw $s0, 0x10($sp)
/* F672C 802D1D7C 8C82000C */ lw $v0, 0xc($a0)
/* F6730 802D1D80 8C450004 */ lw $a1, 4($v0)
/* F6734 802D1D84 8C500000 */ lw $s0, ($v0)
/* F6738 802D1D88 0C0B1EAF */ jal get_variable
/* F673C 802D1D8C 0220902D */ daddu $s2, $s1, $zero
/* F6740 802D1D90 10400005 */ beqz $v0, .L802D1DA8
/* F6744 802D1D94 00101827 */ nor $v1, $zero, $s0
/* F6748 802D1D98 8E220000 */ lw $v0, ($s1)
/* F674C 802D1D9C 00501025 */ or $v0, $v0, $s0
/* F6750 802D1DA0 080B476D */ j .L802D1DB4
/* F6754 802D1DA4 AE220000 */ sw $v0, ($s1)
.L802D1DA8:
/* F6758 802D1DA8 8E420000 */ lw $v0, ($s2)
/* F675C 802D1DAC 00431024 */ and $v0, $v0, $v1
/* F6760 802D1DB0 AE420000 */ sw $v0, ($s2)
.L802D1DB4:
/* F6764 802D1DB4 8FBF001C */ lw $ra, 0x1c($sp)
/* F6768 802D1DB8 8FB20018 */ lw $s2, 0x18($sp)
/* F676C 802D1DBC 8FB10014 */ lw $s1, 0x14($sp)
/* F6770 802D1DC0 8FB00010 */ lw $s0, 0x10($sp)
/* F6774 802D1DC4 24020002 */ addiu $v0, $zero, 2
/* F6778 802D1DC8 03E00008 */ jr $ra
/* F677C 802D1DCC 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -54,7 +54,9 @@ typedef struct HeapNode {
} HeapNode; // size = 0x10 } HeapNode; // size = 0x10
typedef struct NpcBlurData { typedef struct NpcBlurData {
/* 0x00 */ char unk_00[4]; /* 0x00 */ char unk_00;
/* 0x01 */ s8 unk_01;
/* 0x02 */ char unk_02[2];
/* 0x04 */ f32 xpos[20]; /* 0x04 */ f32 xpos[20];
/* 0x54 */ f32 ypos[20]; /* 0x54 */ f32 ypos[20];
/* 0xA4 */ f32 zpos[20]; /* 0xA4 */ f32 zpos[20];

View File

@ -3,7 +3,13 @@
void NOP_npc_callback(void) { void NOP_npc_callback(void) {
} }
INCLUDE_ASM(s32, "code_13870_len_6980", mtx_ident_mirror_y); void mtx_ident_mirror_y(Matrix4f* mtx) {
guMtxIdentF(mtx);
mtx->mtx[0][0] = 1.0f;
mtx->mtx[1][1] = -1.0f;
mtx->mtx[2][2] = 1.0f;
mtx->mtx[3][3] = 1.0f;
}
INCLUDE_ASM(s32, "code_13870_len_6980", clear_npcs); INCLUDE_ASM(s32, "code_13870_len_6980", clear_npcs);
@ -59,9 +65,29 @@ INCLUDE_ASM(s32, "code_13870_len_6980", func_8003AC5C);
INCLUDE_ASM(s32, "code_13870_len_6980", enable_npc_blur); INCLUDE_ASM(s32, "code_13870_len_6980", enable_npc_blur);
INCLUDE_ASM(s32, "code_13870_len_6980", disable_npc_blur); void disable_npc_blur(Npc *npc) {
if (npc->flags & 0x100000) {
npc->flags &= ~0x100000;
heap_free(npc->blurData);
npc->blurData = NULL;
}
}
INCLUDE_ASM(s32, "code_13870_len_6980", update_npc_blur); void update_npc_blur(Npc *npc) {
NpcBlurData* blurData = npc->blurData;
s32 index = blurData->unk_01;
blurData->xpos[index] = npc->pos.x;
blurData->ypos[index] = npc->pos.y;
blurData->zpos[index] = npc->pos.z;
index++;
if (index >= 20) {
index = 0;
}
blurData->unk_01 = index;
}
INCLUDE_ASM(s32, "code_13870_len_6980", appedGfx_npc_blur); INCLUDE_ASM(s32, "code_13870_len_6980", appedGfx_npc_blur);

View File

@ -17,6 +17,21 @@ f32 length2D(f32 x, f32 y) {
} }
INCLUDE_ASM(HeapNode*, "code_42e0_len_1f60", _heap_create, void* addr, s32 size); INCLUDE_ASM(HeapNode*, "code_42e0_len_1f60", _heap_create, void* addr, s32 size);
// HeapNode* _heap_create(s32* addr, s32 size) {
// s32 temp_a1;
// HeapNode* temp_v0;
// if (size >= 32) {
// temp_v0 = (arg0 + 0xF) & -0x10;
// temp_a1 = size - (temp_v0 - arg0);
// temp_v0->next = NULL;
// temp_v0->length = temp_a1 - 16;
// temp_v0->allocated = 0;
// temp_v0->capacity = temp_a1;
// return temp_v0;
// }
// return -1;
// }
INCLUDE_ASM(s32, "code_42e0_len_1f60", _heap_malloc); INCLUDE_ASM(s32, "code_42e0_len_1f60", _heap_malloc);

View File

@ -1,5 +1,7 @@
#include "common.h" #include "common.h"
void fio_serialize_state(void);
INCLUDE_ASM(s32, "code_6240_len_c00", get_spirits_rescued); INCLUDE_ASM(s32, "code_6240_len_c00", get_spirits_rescued);
INCLUDE_ASM(s32, "code_6240_len_c00", fio_calc_header_checksum); INCLUDE_ASM(s32, "code_6240_len_c00", fio_calc_header_checksum);
@ -10,7 +12,19 @@ INCLUDE_ASM(s32, "code_6240_len_c00", fio_has_valid_backup);
INCLUDE_ASM(s32, "code_6240_len_c00", fio_flush_backups); INCLUDE_ASM(s32, "code_6240_len_c00", fio_flush_backups);
#ifdef NON_MATCHING
s32 fio_calc_file_checksum(s32* saveData) {
u32 sum = 0;
u32 i = 0;
for (i = 0; i < 0x4E0; i++) {
sum += saveData[i];
}
return sum;
}
#else
INCLUDE_ASM(s32, "code_6240_len_c00", fio_calc_file_checksum); INCLUDE_ASM(s32, "code_6240_len_c00", fio_calc_file_checksum);
#endif
INCLUDE_ASM(s32, "code_6240_len_c00", fio_validate_file_checksum); INCLUDE_ASM(s32, "code_6240_len_c00", fio_validate_file_checksum);
@ -24,9 +38,12 @@ INCLUDE_ASM(s32, "code_6240_len_c00", fio_erase_game);
INCLUDE_ASM(s32, "code_6240_len_c00", fio_deserialize_state); INCLUDE_ASM(s32, "code_6240_len_c00", fio_deserialize_state);
INCLUDE_ASM(s32, "code_6240_len_c00", func_8002B608); void func_8002B608(void) {
GAME_STATUS->entryID = 10;
fio_serialize_state();
}
INCLUDE_ASM(s32, "code_6240_len_c00", fio_serialize_state); INCLUDE_ASM(void, "code_6240_len_c00", fio_serialize_state);
void fio_init_flash(void) { void fio_init_flash(void) {
osFlashInit(); osFlashInit();

View File

@ -12,7 +12,14 @@ INCLUDE_ASM(s32, "code_7E3700", func_80283080);
INCLUDE_ASM(s32, "code_7E3700", func_80283174); INCLUDE_ASM(s32, "code_7E3700", func_80283174);
INCLUDE_ASM(s32, "code_7E3700", CheckActionState); ApiStatus CheckActionState(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
Bytecode a0 = *args++;
s32 var = get_float_variable(script, *args);
set_variable(script, a0, gPlayerActionState == var);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_7E3700", func_80283240); INCLUDE_ASM(s32, "code_7E3700", func_80283240);

View File

@ -162,27 +162,25 @@ ApiStatus func_802C94A0(ScriptInstance* script, s32 isInitialCall) {
} }
#ifdef NON_MATCHING #ifdef NON_MATCHING
/*ApiStatus SetModelFlags(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetModelFlags(ScriptInstance* script, s32 isInitialCall) {
Bytecode* thisPos = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 listIndex; s32 treeIndex = get_variable(script, *args++);
Bytecode zvar; s32 listIndex = get_model_list_index_from_tree_index(treeIndex);
Bytecode avar; s32 a1 = *args++;
Bytecode flag; s32 var2;
Model* model; Model* model;
listIndex = get_model_list_index_from_tree_index(get_variable(script, *thisPos++)); var2 = get_variable(script, *args);
zvar = thisPos[1];
avar = thisPos[0];
flag = get_variable(script, zvar);
model = get_model_from_list_index(listIndex); model = get_model_from_list_index(listIndex);
if (flag != 0) { if (var2 != 0) {
model->flags |= avar; model->flags |= a1;
} else { } else {
model->flags &= ~avar; model->flags &= ~a1;
} }
return ApiStatus_DONE2; return ApiStatus_DONE2;
}*/ }
#else #else
INCLUDE_ASM(s32, "code_ED510", SetModelFlags, ScriptInstance* script, s32 isInitialCall); INCLUDE_ASM(s32, "code_ED510", SetModelFlags, ScriptInstance* script, s32 isInitialCall);
#endif #endif

View File

@ -66,7 +66,21 @@ ApiStatus SetPlayerPos(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
INCLUDE_ASM(s32, "code_F5750", SetPlayerCollisionSize, ScriptInstance* script, s32 isInitialCall); ApiStatus SetPlayerCollisionSize(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 height = get_variable(script, *args++);
s32 radius = get_variable(script, *args);
Npc* player = gPlayerNpcPtr;
PlayerStatus* playerStatus = &gPlayerStatus;
player->collisionHeight = height;
player->collisionRadius = radius;
playerStatus->colliderHeight = player->collisionHeight;
playerStatus->colliderDiameter = player->collisionRadius;
return ApiStatus_DONE2;
}
ApiStatus SetPlayerSpeed(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetPlayerSpeed(ScriptInstance* script, s32 isInitialCall) {
gPlayerNpcPtr->moveSpeed = get_float_variable(script, *script->ptrReadPos); gPlayerNpcPtr->moveSpeed = get_float_variable(script, *script->ptrReadPos);
@ -80,7 +94,10 @@ ApiStatus SetPlayerJumpscale(ScriptInstance* script, s32 isInitialCall) {
#ifdef NON_MATCHING #ifdef NON_MATCHING
ApiStatus SetPlayerAnimation(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetPlayerAnimation(ScriptInstance* script, s32 isInitialCall) {
PlayerAnim animation = get_variable(script, *script->ptrReadPos); Bytecode* args = script->ptrReadPos;
PlayerAnim animation;
animation = get_variable(script, *args);
gPlayerNpcPtr->currentAnim = animation; gPlayerNpcPtr->currentAnim = animation;
gPlayerAnimation = animation; gPlayerAnimation = animation;
@ -134,7 +151,21 @@ ApiStatus GetPlayerTargetYaw(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
INCLUDE_ASM(s32, "code_F5750", SetPlayerFlagBits, ScriptInstance* script, s32 isInitialCall); ApiStatus SetPlayerFlagBits(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
PlayerStatus* playerStatus = &gPlayerStatus;
PlayerStatus* playerStatus2 = &gPlayerStatus;
Bytecode bits = *args++;
Bytecode a1 = *args;
if (get_variable(script, a1)) {
playerStatus->flags |= bits;
} else {
playerStatus2->flags &= ~bits;
}
return ApiStatus_DONE2;
}
ApiStatus GetPlayerActionState(ScriptInstance* script, s32 isInitialCall) { ApiStatus GetPlayerActionState(ScriptInstance* script, s32 isInitialCall) {
Bytecode outVar = *script->ptrReadPos; Bytecode outVar = *script->ptrReadPos;
@ -248,7 +279,23 @@ INCLUDE_ASM(s32, "code_F5750", func_802D2B50);
INCLUDE_ASM(s32, "code_F5750", func_802D2B6C); INCLUDE_ASM(s32, "code_F5750", func_802D2B6C);
INCLUDE_ASM(s32, "code_F5750", Disable8bitMario, ScriptInstance* script, s32 isInitialCall); ApiStatus Disable8bitMario(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
PlayerStatus* playerStatus = &gPlayerStatus;
PlayerStatus* playerStatus2 = &gPlayerStatus;
if (get_variable(script, *args)) {
playerStatus->colliderHeight = 37;
playerStatus->colliderDiameter = 26;
playerStatus->animFlags &= ~0x4000;
} else {
playerStatus2->colliderHeight = 19;
playerStatus2->colliderDiameter = 26;
playerStatus2->animFlags |= 0x44004;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_F5750", func_802D2C14); INCLUDE_ASM(s32, "code_F5750", func_802D2C14);