From e8ed3ae03fa4606baea9a74732e39edabc6b18cc Mon Sep 17 00:00:00 2001 From: Jdog Date: Thu, 20 Aug 2020 09:41:42 -0700 Subject: [PATCH 1/8] Match SetCamEnabled, SetCamFlag80, SetCamPerspective, func_802CA90C. WIP func_802CA988. Modified Camera struct. --- .../code_ef070_len_3400/SetCamEnabled.s | 54 ----------- .../code_ef070_len_3400/SetCamFlag80.s | 54 ----------- .../{SetCamPerspective.s => func_802CA988.s} | 93 +------------------ include/common_structs.h | 13 ++- src/code_ef070_len_3400.c | 92 +++++++++++++++++- tools/n64splitter | 1 + 6 files changed, 101 insertions(+), 206 deletions(-) delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamEnabled.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamFlag80.s rename asm/nonmatchings/code_ef070_len_3400/{SetCamPerspective.s => func_802CA988.s} (53%) create mode 160000 tools/n64splitter diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamEnabled.s b/asm/nonmatchings/code_ef070_len_3400/SetCamEnabled.s deleted file mode 100644 index 0992c90c45..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamEnabled.s +++ /dev/null @@ -1,54 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamEnabled -/* 0EF070 802CA6C0 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0EF074 802CA6C4 AFB00010 */ sw $s0, 0x10($sp) -/* 0EF078 802CA6C8 0080802D */ daddu $s0, $a0, $zero -/* 0EF07C 802CA6CC AFBF0018 */ sw $ra, 0x18($sp) -/* 0EF080 802CA6D0 AFB10014 */ sw $s1, 0x14($sp) -/* 0EF084 802CA6D4 8E11000C */ lw $s1, 0xc($s0) -/* 0EF088 802CA6D8 8E250000 */ lw $a1, ($s1) -/* 0EF08C 802CA6DC 0C0B1EAF */ jal get_variable -/* 0EF090 802CA6E0 26310004 */ addiu $s1, $s1, 4 -/* 0EF094 802CA6E4 0200202D */ daddu $a0, $s0, $zero -/* 0EF098 802CA6E8 8E250000 */ lw $a1, ($s1) -/* 0EF09C 802CA6EC 0C0B1EAF */ jal get_variable -/* 0EF0A0 802CA6F0 0040802D */ daddu $s0, $v0, $zero -/* 0EF0A4 802CA6F4 1440000D */ bnez $v0, .L802CA72C -/* 0EF0A8 802CA6F8 00101080 */ sll $v0, $s0, 2 -/* 0EF0AC 802CA6FC 3C04800B */ lui $a0, 0x800b -/* 0EF0B0 802CA700 24841D80 */ addiu $a0, $a0, 0x1d80 -/* 0EF0B4 802CA704 00501021 */ addu $v0, $v0, $s0 -/* 0EF0B8 802CA708 00021080 */ sll $v0, $v0, 2 -/* 0EF0BC 802CA70C 00501023 */ subu $v0, $v0, $s0 -/* 0EF0C0 802CA710 000218C0 */ sll $v1, $v0, 3 -/* 0EF0C4 802CA714 00431021 */ addu $v0, $v0, $v1 -/* 0EF0C8 802CA718 000210C0 */ sll $v0, $v0, 3 -/* 0EF0CC 802CA71C 00441021 */ addu $v0, $v0, $a0 -/* 0EF0D0 802CA720 94430000 */ lhu $v1, ($v0) -/* 0EF0D4 802CA724 080B29D6 */ j .L802CA758 -/* 0EF0D8 802CA728 34630002 */ ori $v1, $v1, 2 - -.L802CA72C: -/* 0EF0DC 802CA72C 3C04800B */ lui $a0, 0x800b -/* 0EF0E0 802CA730 24841D80 */ addiu $a0, $a0, 0x1d80 -/* 0EF0E4 802CA734 00501021 */ addu $v0, $v0, $s0 -/* 0EF0E8 802CA738 00021080 */ sll $v0, $v0, 2 -/* 0EF0EC 802CA73C 00501023 */ subu $v0, $v0, $s0 -/* 0EF0F0 802CA740 000218C0 */ sll $v1, $v0, 3 -/* 0EF0F4 802CA744 00431021 */ addu $v0, $v0, $v1 -/* 0EF0F8 802CA748 000210C0 */ sll $v0, $v0, 3 -/* 0EF0FC 802CA74C 00441021 */ addu $v0, $v0, $a0 -/* 0EF100 802CA750 94430000 */ lhu $v1, ($v0) -/* 0EF104 802CA754 3063FFFD */ andi $v1, $v1, 0xfffd -.L802CA758: -/* 0EF108 802CA758 A4430000 */ sh $v1, ($v0) -/* 0EF10C 802CA75C 8FBF0018 */ lw $ra, 0x18($sp) -/* 0EF110 802CA760 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF114 802CA764 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF118 802CA768 24020002 */ addiu $v0, $zero, 2 -/* 0EF11C 802CA76C 03E00008 */ jr $ra -/* 0EF120 802CA770 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamFlag80.s b/asm/nonmatchings/code_ef070_len_3400/SetCamFlag80.s deleted file mode 100644 index ae06a1ad63..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamFlag80.s +++ /dev/null @@ -1,54 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamFlag80 -/* 0EF124 802CA774 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0EF128 802CA778 AFB00010 */ sw $s0, 0x10($sp) -/* 0EF12C 802CA77C 0080802D */ daddu $s0, $a0, $zero -/* 0EF130 802CA780 AFBF0018 */ sw $ra, 0x18($sp) -/* 0EF134 802CA784 AFB10014 */ sw $s1, 0x14($sp) -/* 0EF138 802CA788 8E11000C */ lw $s1, 0xc($s0) -/* 0EF13C 802CA78C 8E250000 */ lw $a1, ($s1) -/* 0EF140 802CA790 0C0B1EAF */ jal get_variable -/* 0EF144 802CA794 26310004 */ addiu $s1, $s1, 4 -/* 0EF148 802CA798 0200202D */ daddu $a0, $s0, $zero -/* 0EF14C 802CA79C 8E250000 */ lw $a1, ($s1) -/* 0EF150 802CA7A0 0C0B1EAF */ jal get_variable -/* 0EF154 802CA7A4 0040802D */ daddu $s0, $v0, $zero -/* 0EF158 802CA7A8 1440000D */ bnez $v0, .L802CA7E0 -/* 0EF15C 802CA7AC 00101080 */ sll $v0, $s0, 2 -/* 0EF160 802CA7B0 3C04800B */ lui $a0, 0x800b -/* 0EF164 802CA7B4 24841D80 */ addiu $a0, $a0, 0x1d80 -/* 0EF168 802CA7B8 00501021 */ addu $v0, $v0, $s0 -/* 0EF16C 802CA7BC 00021080 */ sll $v0, $v0, 2 -/* 0EF170 802CA7C0 00501023 */ subu $v0, $v0, $s0 -/* 0EF174 802CA7C4 000218C0 */ sll $v1, $v0, 3 -/* 0EF178 802CA7C8 00431021 */ addu $v0, $v0, $v1 -/* 0EF17C 802CA7CC 000210C0 */ sll $v0, $v0, 3 -/* 0EF180 802CA7D0 00441021 */ addu $v0, $v0, $a0 -/* 0EF184 802CA7D4 94430000 */ lhu $v1, ($v0) -/* 0EF188 802CA7D8 080B2A03 */ j .L802CA80C -/* 0EF18C 802CA7DC 34630080 */ ori $v1, $v1, 0x80 - -.L802CA7E0: -/* 0EF190 802CA7E0 3C04800B */ lui $a0, 0x800b -/* 0EF194 802CA7E4 24841D80 */ addiu $a0, $a0, 0x1d80 -/* 0EF198 802CA7E8 00501021 */ addu $v0, $v0, $s0 -/* 0EF19C 802CA7EC 00021080 */ sll $v0, $v0, 2 -/* 0EF1A0 802CA7F0 00501023 */ subu $v0, $v0, $s0 -/* 0EF1A4 802CA7F4 000218C0 */ sll $v1, $v0, 3 -/* 0EF1A8 802CA7F8 00431021 */ addu $v0, $v0, $v1 -/* 0EF1AC 802CA7FC 000210C0 */ sll $v0, $v0, 3 -/* 0EF1B0 802CA800 00441021 */ addu $v0, $v0, $a0 -/* 0EF1B4 802CA804 94430000 */ lhu $v1, ($v0) -/* 0EF1B8 802CA808 3063FF7F */ andi $v1, $v1, 0xff7f -.L802CA80C: -/* 0EF1BC 802CA80C A4430000 */ sh $v1, ($v0) -/* 0EF1C0 802CA810 8FBF0018 */ lw $ra, 0x18($sp) -/* 0EF1C4 802CA814 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF1C8 802CA818 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF1CC 802CA81C 24020002 */ addiu $v0, $zero, 2 -/* 0EF1D0 802CA820 03E00008 */ jr $ra -/* 0EF1D4 802CA824 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamPerspective.s b/asm/nonmatchings/code_ef070_len_3400/func_802CA988.s similarity index 53% rename from asm/nonmatchings/code_ef070_len_3400/SetCamPerspective.s rename to asm/nonmatchings/code_ef070_len_3400/func_802CA988.s index 71966586a8..8262e457e4 100644 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamPerspective.s +++ b/asm/nonmatchings/code_ef070_len_3400/func_802CA988.s @@ -2,97 +2,7 @@ .set noreorder # don't insert nops after branches -glabel SetCamPerspective -/* 0EF1D8 802CA828 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 0EF1DC 802CA82C AFB10014 */ sw $s1, 0x14($sp) -/* 0EF1E0 802CA830 0080882D */ daddu $s1, $a0, $zero -/* 0EF1E4 802CA834 AFBF0020 */ sw $ra, 0x20($sp) -/* 0EF1E8 802CA838 AFB3001C */ sw $s3, 0x1c($sp) -/* 0EF1EC 802CA83C AFB20018 */ sw $s2, 0x18($sp) -/* 0EF1F0 802CA840 AFB00010 */ sw $s0, 0x10($sp) -/* 0EF1F4 802CA844 F7B40028 */ sdc1 $f20, 0x28($sp) -/* 0EF1F8 802CA848 8E30000C */ lw $s0, 0xc($s1) -/* 0EF1FC 802CA84C 8E050000 */ lw $a1, ($s0) -/* 0EF200 802CA850 0C0B1EAF */ jal get_variable -/* 0EF204 802CA854 26100004 */ addiu $s0, $s0, 4 -/* 0EF208 802CA858 8E050000 */ lw $a1, ($s0) -/* 0EF20C 802CA85C 26100004 */ addiu $s0, $s0, 4 -/* 0EF210 802CA860 0220202D */ daddu $a0, $s1, $zero -/* 0EF214 802CA864 0C0B1EAF */ jal get_variable -/* 0EF218 802CA868 0040902D */ daddu $s2, $v0, $zero -/* 0EF21C 802CA86C 8E050000 */ lw $a1, ($s0) -/* 0EF220 802CA870 26100004 */ addiu $s0, $s0, 4 -/* 0EF224 802CA874 0220202D */ daddu $a0, $s1, $zero -/* 0EF228 802CA878 0C0B210B */ jal get_float_variable -/* 0EF22C 802CA87C 0040982D */ daddu $s3, $v0, $zero -/* 0EF230 802CA880 8E050000 */ lw $a1, ($s0) -/* 0EF234 802CA884 26100004 */ addiu $s0, $s0, 4 -/* 0EF238 802CA888 0220202D */ daddu $a0, $s1, $zero -/* 0EF23C 802CA88C 0C0B1EAF */ jal get_variable -/* 0EF240 802CA890 46000506 */ mov.s $f20, $f0 -/* 0EF244 802CA894 0220202D */ daddu $a0, $s1, $zero -/* 0EF248 802CA898 8E050000 */ lw $a1, ($s0) -/* 0EF24C 802CA89C 0C0B1EAF */ jal get_variable -/* 0EF250 802CA8A0 0040802D */ daddu $s0, $v0, $zero -/* 0EF254 802CA8A4 3C05800B */ lui $a1, 0x800b -/* 0EF258 802CA8A8 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0EF25C 802CA8AC 00121880 */ sll $v1, $s2, 2 -/* 0EF260 802CA8B0 00721821 */ addu $v1, $v1, $s2 -/* 0EF264 802CA8B4 00031880 */ sll $v1, $v1, 2 -/* 0EF268 802CA8B8 00721823 */ subu $v1, $v1, $s2 -/* 0EF26C 802CA8BC 000320C0 */ sll $a0, $v1, 3 -/* 0EF270 802CA8C0 00641821 */ addu $v1, $v1, $a0 -/* 0EF274 802CA8C4 000318C0 */ sll $v1, $v1, 3 -/* 0EF278 802CA8C8 00651821 */ addu $v1, $v1, $a1 -/* 0EF27C 802CA8CC 24040001 */ addiu $a0, $zero, 1 -/* 0EF280 802CA8D0 A4620014 */ sh $v0, 0x14($v1) -/* 0EF284 802CA8D4 A4730004 */ sh $s3, 4($v1) -/* 0EF288 802CA8D8 A4640006 */ sh $a0, 6($v1) -/* 0EF28C 802CA8DC A4640008 */ sh $a0, 8($v1) -/* 0EF290 802CA8E0 E4740018 */ swc1 $f20, 0x18($v1) -/* 0EF294 802CA8E4 A4700012 */ sh $s0, 0x12($v1) -/* 0EF298 802CA8E8 8FBF0020 */ lw $ra, 0x20($sp) -/* 0EF29C 802CA8EC 8FB3001C */ lw $s3, 0x1c($sp) -/* 0EF2A0 802CA8F0 8FB20018 */ lw $s2, 0x18($sp) -/* 0EF2A4 802CA8F4 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF2A8 802CA8F8 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF2AC 802CA8FC D7B40028 */ ldc1 $f20, 0x28($sp) -/* 0EF2B0 802CA900 24020002 */ addiu $v0, $zero, 2 -/* 0EF2B4 802CA904 03E00008 */ jr $ra -/* 0EF2B8 802CA908 27BD0030 */ addiu $sp, $sp, 0x30 - -/* 0EF2BC 802CA90C 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0EF2C0 802CA910 AFB10014 */ sw $s1, 0x14($sp) -/* 0EF2C4 802CA914 0080882D */ daddu $s1, $a0, $zero -/* 0EF2C8 802CA918 AFBF0018 */ sw $ra, 0x18($sp) -/* 0EF2CC 802CA91C AFB00010 */ sw $s0, 0x10($sp) -/* 0EF2D0 802CA920 8E30000C */ lw $s0, 0xc($s1) -/* 0EF2D4 802CA924 8E050000 */ lw $a1, ($s0) -/* 0EF2D8 802CA928 0C0B1EAF */ jal get_variable -/* 0EF2DC 802CA92C 26100004 */ addiu $s0, $s0, 4 -/* 0EF2E0 802CA930 0220202D */ daddu $a0, $s1, $zero -/* 0EF2E4 802CA934 8E050000 */ lw $a1, ($s0) -/* 0EF2E8 802CA938 0C0B1EAF */ jal get_variable -/* 0EF2EC 802CA93C 0040802D */ daddu $s0, $v0, $zero -/* 0EF2F0 802CA940 3C05800B */ lui $a1, 0x800b -/* 0EF2F4 802CA944 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0EF2F8 802CA948 00101880 */ sll $v1, $s0, 2 -/* 0EF2FC 802CA94C 00701821 */ addu $v1, $v1, $s0 -/* 0EF300 802CA950 00031880 */ sll $v1, $v1, 2 -/* 0EF304 802CA954 00701823 */ subu $v1, $v1, $s0 -/* 0EF308 802CA958 000320C0 */ sll $a0, $v1, 3 -/* 0EF30C 802CA95C 00641821 */ addu $v1, $v1, $a0 -/* 0EF310 802CA960 000318C0 */ sll $v1, $v1, 3 -/* 0EF314 802CA964 00651821 */ addu $v1, $v1, $a1 -/* 0EF318 802CA968 A4620004 */ sh $v0, 4($v1) -/* 0EF31C 802CA96C A4600006 */ sh $zero, 6($v1) -/* 0EF320 802CA970 8FBF0018 */ lw $ra, 0x18($sp) -/* 0EF324 802CA974 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF328 802CA978 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF32C 802CA97C 24020002 */ addiu $v0, $zero, 2 -/* 0EF330 802CA980 03E00008 */ jr $ra -/* 0EF334 802CA984 27BD0020 */ addiu $sp, $sp, 0x20 - +glabel func_802CA988 /* 0EF338 802CA988 27BDFFD0 */ addiu $sp, $sp, -0x30 /* 0EF33C 802CA98C AFB20018 */ sw $s2, 0x18($sp) /* 0EF340 802CA990 0080902D */ daddu $s2, $a0, $zero @@ -194,4 +104,3 @@ glabel SetCamPerspective /* 0EF4BC 802CAB0C 24020002 */ addiu $v0, $zero, 2 /* 0EF4C0 802CAB10 03E00008 */ jr $ra /* 0EF4C4 802CAB14 27BD0030 */ addiu $sp, $sp, 0x30 - diff --git a/include/common_structs.h b/include/common_structs.h index df735d4d15..30bbca49fb 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -418,7 +418,8 @@ typedef struct Camera { /* 0x000 */ s16 flags; /* 0x002 */ s16 moveFlags; /* 0x004 */ s16 mode; - /* 0x006 */ char unk_06[4]; + /* 0x006 */ u16 unk_06; + /* 0x008 */ u16 unk_08; /* 0x00A */ s16 viewportW; /* 0x00C */ s16 viewportH; /* 0x00E */ s16 viewportStartX; @@ -427,7 +428,11 @@ typedef struct Camera { /* 0x014 */ s16 farClip; /* 0x016 */ char unk_16[2]; /* 0x018 */ f32 vfov; - /* 0x01C */ char unk_1C[14]; + /* 0x01C */ s16 unk_1C; + /* 0x01E */ s16 unk_1E; + /* 0x020 */ s16 unk_20; + /* 0x022 */ s16 unk_22; + /* 0x024 */ char unk_24[6]; /* 0x02A */ s16 zoomPercent; /* 0x02C */ s16 backgroundColor[3]; /* 0x032 */ s16 targetScreenCoords[3]; @@ -435,7 +440,9 @@ typedef struct Camera { /* 0x03A */ char unk_3A[2]; /* 0x03C */ f32 lookAt_eye[3]; /* 0x048 */ f32 lookAt_obj[3]; - /* 0x054 */ char unk_54[12]; + /* 0x054 */ f32 unk_54; + /* 0x058 */ f32 unk_58; + /* 0x05C */ f32 unk_5C; /* 0x060 */ struct Vec3f targetPos; /* 0x06C */ f32 currentYaw; /* 0x070 */ char unk_70[4]; diff --git a/src/code_ef070_len_3400.c b/src/code_ef070_len_3400.c index 400adc48f8..1ab3f3ea52 100644 --- a/src/code_ef070_len_3400.c +++ b/src/code_ef070_len_3400.c @@ -1,10 +1,96 @@ #include "common.h" -INCLUDE_API_ASM("code_ef070_len_3400", SetCamEnabled); +ApiStatus SetCamEnabled(ScriptInstance* script, s32 isInitialCall) { + Bytecode* ptrReadPos = script->ptrReadPos; + Bytecode id = get_variable(script, *ptrReadPos++); + Bytecode enabled = get_variable(script, *ptrReadPos++); + + if (!enabled) { + (&gCameras[id])->flags |= 0x2; + } else { + (&gCameras[id])->flags &= ~0x2; + } + return ApiStatus_DONE2; +} -INCLUDE_API_ASM("code_ef070_len_3400", SetCamFlag80); +ApiStatus SetCamFlag80(ScriptInstance* script, s32 isInitialCall) { + Bytecode* ptrReadPos = script->ptrReadPos; + Bytecode id = get_variable(script, *ptrReadPos++); + Bytecode enabled = get_variable(script, *ptrReadPos++); -INCLUDE_API_ASM("code_ef070_len_3400", SetCamPerspective); + if (!enabled) { + (&gCameras[id])->flags |= 0x80; + } else { + (&gCameras[id])->flags &= ~0x80; + } + return ApiStatus_DONE2; +} + +ApiStatus SetCamPerspective(ScriptInstance* script, s32 isInitialCall) { + Bytecode* ptrReadPos = script->ptrReadPos; + Bytecode id = get_variable(script, *ptrReadPos++); + Bytecode mode = get_variable(script, *ptrReadPos++); + f32 vfov = get_float_variable(script, *ptrReadPos++); + Bytecode nearClip = get_variable(script, *ptrReadPos++); + Bytecode farClip = get_variable(script, *ptrReadPos++); + + (&gCameras[id])->farClip = farClip; + (&gCameras[id])->mode = mode; + (&gCameras[id])->unk_06 = 1; + (&gCameras[id])->unk_08 = 1; + (&gCameras[id])->vfov = vfov; + (&gCameras[id])->nearClip = nearClip; + return ApiStatus_DONE2; +} + +ApiStatus func_802CA90C(ScriptInstance* script, s32 isInitialCall) { + Bytecode* ptrReadPos = script->ptrReadPos; + Bytecode id = get_variable(script, *ptrReadPos++); + Bytecode mode = get_variable(script, *ptrReadPos++); + + (&gCameras[id])->mode = mode; + (&gCameras[id])->unk_06 = 0; + return ApiStatus_DONE2; +} + +INCLUDE_API_ASM("code_ef070_len_3400", func_802CA988); +/* +ApiStatus func_802CA988(ScriptInstance* script, s32 isInitialCall) { + Bytecode* ptrReadPos = script->ptrReadPos; + Bytecode id = get_variable(script, *ptrReadPos++); + Bytecode outVar1 = *ptrReadPos++; + Bytecode outVar2 = *ptrReadPos++; + Bytecode outVar3 = *ptrReadPos++; + Bytecode outVar4 = *ptrReadPos++; + f32 temp1, temp2, temp3; + f32 tempSqrt; + + (&gCameras[id])->mode = 2; + (&gCameras[id])->unk_06 = 0; + (&gCameras[id])->unk_1C = -1 * round((&gCameras[id])->currentPitch); + (&gCameras[id])->unk_1E = -1 * (&gCameras[id])->currentBlendedYawNegated; + + temp1 = (&gCameras[id])->lookAt_obj[0] - (&gCameras[id])->lookAt_eye[0]; + temp2 = (&gCameras[id])->lookAt_obj[1] - (&gCameras[id])->lookAt_eye[1]; + temp3 = (&gCameras[id])->lookAt_obj[2] - (&gCameras[id])->lookAt_eye[2]; + + tempSqrt = sqrtf((temp1 * temp1) + (temp2 * temp2) + (temp3 * temp3)); + if (tempSqrt != tempSqrt) { + (&gCameras[id])->unk_20 = round(tempSqrt); + } + + (&gCameras[id])->unk_22 = 0; + (&gCameras[id])->unk_54 = (&gCameras[id])->lookAt_obj[0]; + (&gCameras[id])->unk_58 = (&gCameras[id])->lookAt_obj[1]; + (&gCameras[id])->unk_5C = (&gCameras[id])->lookAt_obj[2]; + + set_variable(script, outVar1, (&gCameras[id])->unk_1C); + set_variable(script, outVar2, (&gCameras[id])->unk_1E); + set_variable(script, outVar3, (&gCameras[id])->unk_20); + set_variable(script, outVar4, (&gCameras[id])->unk_22); + return ApiStatus_DONE2; +} +*/ INCLUDE_API_ASM("code_ef070_len_3400", SetCamViewport); diff --git a/tools/n64splitter b/tools/n64splitter new file mode 160000 index 0000000000..678acb2ea0 --- /dev/null +++ b/tools/n64splitter @@ -0,0 +1 @@ +Subproject commit 678acb2ea026162039be6700486499db526dfba6 From e818be1b9fc8c2d706b92bd9ba6e741e03d127cf Mon Sep 17 00:00:00 2001 From: Jdog Date: Thu, 20 Aug 2020 10:09:18 -0700 Subject: [PATCH 2/8] Formatting --- src/code_ef070_len_3400.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/code_ef070_len_3400.c b/src/code_ef070_len_3400.c index 1ab3f3ea52..6eb3157e5c 100644 --- a/src/code_ef070_len_3400.c +++ b/src/code_ef070_len_3400.c @@ -4,7 +4,7 @@ ApiStatus SetCamEnabled(ScriptInstance* script, s32 isInitialCall) { Bytecode* ptrReadPos = script->ptrReadPos; Bytecode id = get_variable(script, *ptrReadPos++); Bytecode enabled = get_variable(script, *ptrReadPos++); - + if (!enabled) { (&gCameras[id])->flags |= 0x2; } else { @@ -64,11 +64,11 @@ ApiStatus func_802CA988(ScriptInstance* script, s32 isInitialCall) { Bytecode outVar4 = *ptrReadPos++; f32 temp1, temp2, temp3; f32 tempSqrt; - + (&gCameras[id])->mode = 2; - (&gCameras[id])->unk_06 = 0; (&gCameras[id])->unk_1C = -1 * round((&gCameras[id])->currentPitch); (&gCameras[id])->unk_1E = -1 * (&gCameras[id])->currentBlendedYawNegated; + (&gCameras[id])->unk_06 = 0; temp1 = (&gCameras[id])->lookAt_obj[0] - (&gCameras[id])->lookAt_eye[0]; temp2 = (&gCameras[id])->lookAt_obj[1] - (&gCameras[id])->lookAt_eye[1]; From fa0fc93187b0c027cf7a9faa284785a03810184f Mon Sep 17 00:00:00 2001 From: Jdog Date: Thu, 20 Aug 2020 10:11:36 -0700 Subject: [PATCH 3/8] Formatting --- src/code_ef070_len_3400.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/code_ef070_len_3400.c b/src/code_ef070_len_3400.c index 1ab3f3ea52..6eb3157e5c 100644 --- a/src/code_ef070_len_3400.c +++ b/src/code_ef070_len_3400.c @@ -4,7 +4,7 @@ ApiStatus SetCamEnabled(ScriptInstance* script, s32 isInitialCall) { Bytecode* ptrReadPos = script->ptrReadPos; Bytecode id = get_variable(script, *ptrReadPos++); Bytecode enabled = get_variable(script, *ptrReadPos++); - + if (!enabled) { (&gCameras[id])->flags |= 0x2; } else { @@ -64,11 +64,11 @@ ApiStatus func_802CA988(ScriptInstance* script, s32 isInitialCall) { Bytecode outVar4 = *ptrReadPos++; f32 temp1, temp2, temp3; f32 tempSqrt; - + (&gCameras[id])->mode = 2; - (&gCameras[id])->unk_06 = 0; (&gCameras[id])->unk_1C = -1 * round((&gCameras[id])->currentPitch); (&gCameras[id])->unk_1E = -1 * (&gCameras[id])->currentBlendedYawNegated; + (&gCameras[id])->unk_06 = 0; temp1 = (&gCameras[id])->lookAt_obj[0] - (&gCameras[id])->lookAt_eye[0]; temp2 = (&gCameras[id])->lookAt_obj[1] - (&gCameras[id])->lookAt_eye[1]; From 89e749a724633a03c0c0c6e7b76d1f11a3dd1575 Mon Sep 17 00:00:00 2001 From: Jdog Date: Thu, 20 Aug 2020 13:01:56 -0700 Subject: [PATCH 4/8] Variable renaming, tweaks with getting camera pointer to make certain functions match. Match SetCamType --- .../code_ef070_len_3400/SetCamType.s | 43 ------------- include/common_structs.h | 2 +- src/code_ef070_len_3400.c | 63 ++++++++++++------- 3 files changed, 40 insertions(+), 68 deletions(-) delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamType.s diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamType.s b/asm/nonmatchings/code_ef070_len_3400/SetCamType.s deleted file mode 100644 index db74fe30ea..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamType.s +++ /dev/null @@ -1,43 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamType -/* 0F0464 802CBAB4 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F0468 802CBAB8 AFB20018 */ sw $s2, 0x18($sp) -/* 0F046C 802CBABC 0080902D */ daddu $s2, $a0, $zero -/* 0F0470 802CBAC0 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F0474 802CBAC4 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0478 802CBAC8 AFB00010 */ sw $s0, 0x10($sp) -/* 0F047C 802CBACC 8E51000C */ lw $s1, 0xc($s2) -/* 0F0480 802CBAD0 8E250000 */ lw $a1, ($s1) -/* 0F0484 802CBAD4 0C0B1EAF */ jal get_variable -/* 0F0488 802CBAD8 26310004 */ addiu $s1, $s1, 4 -/* 0F048C 802CBADC 8E250000 */ lw $a1, ($s1) -/* 0F0490 802CBAE0 26310004 */ addiu $s1, $s1, 4 -/* 0F0494 802CBAE4 0240202D */ daddu $a0, $s2, $zero -/* 0F0498 802CBAE8 3C03800B */ lui $v1, 0x800b -/* 0F049C 802CBAEC 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F04A0 802CBAF0 00028080 */ sll $s0, $v0, 2 -/* 0F04A4 802CBAF4 02028021 */ addu $s0, $s0, $v0 -/* 0F04A8 802CBAF8 00108080 */ sll $s0, $s0, 2 -/* 0F04AC 802CBAFC 02028023 */ subu $s0, $s0, $v0 -/* 0F04B0 802CBB00 001010C0 */ sll $v0, $s0, 3 -/* 0F04B4 802CBB04 02028021 */ addu $s0, $s0, $v0 -/* 0F04B8 802CBB08 001080C0 */ sll $s0, $s0, 3 -/* 0F04BC 802CBB0C 0C0B1EAF */ jal get_variable -/* 0F04C0 802CBB10 02038021 */ addu $s0, $s0, $v1 -/* 0F04C4 802CBB14 0240202D */ daddu $a0, $s2, $zero -/* 0F04C8 802CBB18 8E250000 */ lw $a1, ($s1) -/* 0F04CC 802CBB1C 0C0B1EAF */ jal get_variable -/* 0F04D0 802CBB20 0040882D */ daddu $s1, $v0, $zero -/* 0F04D4 802CBB24 AE020500 */ sw $v0, 0x500($s0) -/* 0F04D8 802CBB28 AE1104D8 */ sw $s1, 0x4d8($s0) -/* 0F04DC 802CBB2C 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F04E0 802CBB30 8FB20018 */ lw $s2, 0x18($sp) -/* 0F04E4 802CBB34 8FB10014 */ lw $s1, 0x14($sp) -/* 0F04E8 802CBB38 8FB00010 */ lw $s0, 0x10($sp) -/* 0F04EC 802CBB3C 24020002 */ addiu $v0, $zero, 2 -/* 0F04F0 802CBB40 03E00008 */ jr $ra -/* 0F04F4 802CBB44 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/include/common_structs.h b/include/common_structs.h index 30bbca49fb..a166db9a8d 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -478,7 +478,7 @@ typedef struct Camera { /* 0x4E4 */ struct Vec3f posA; /* 0x4F0 */ struct Vec3f posB; /* 0x4FC */ f32 controllerViewPitch; - /* 0x500 */ char unk_500[4]; + /* 0x500 */ s32 unk_500; /* 0x504 */ s16 boolTargetPlayer; /* 0x506 */ char unk_506[2]; /* 0x508 */ s32 panPhase; diff --git a/src/code_ef070_len_3400.c b/src/code_ef070_len_3400.c index 6eb3157e5c..83c36aba4a 100644 --- a/src/code_ef070_len_3400.c +++ b/src/code_ef070_len_3400.c @@ -1,9 +1,9 @@ #include "common.h" ApiStatus SetCamEnabled(ScriptInstance* script, s32 isInitialCall) { - Bytecode* ptrReadPos = script->ptrReadPos; - Bytecode id = get_variable(script, *ptrReadPos++); - Bytecode enabled = get_variable(script, *ptrReadPos++); + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s32 enabled = get_variable(script, *args++); if (!enabled) { (&gCameras[id])->flags |= 0x2; @@ -14,9 +14,9 @@ ApiStatus SetCamEnabled(ScriptInstance* script, s32 isInitialCall) { } ApiStatus SetCamFlag80(ScriptInstance* script, s32 isInitialCall) { - Bytecode* ptrReadPos = script->ptrReadPos; - Bytecode id = get_variable(script, *ptrReadPos++); - Bytecode enabled = get_variable(script, *ptrReadPos++); + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s32 enabled = get_variable(script, *args++); if (!enabled) { (&gCameras[id])->flags |= 0x80; @@ -27,29 +27,33 @@ ApiStatus SetCamFlag80(ScriptInstance* script, s32 isInitialCall) { } ApiStatus SetCamPerspective(ScriptInstance* script, s32 isInitialCall) { - Bytecode* ptrReadPos = script->ptrReadPos; - Bytecode id = get_variable(script, *ptrReadPos++); - Bytecode mode = get_variable(script, *ptrReadPos++); - f32 vfov = get_float_variable(script, *ptrReadPos++); - Bytecode nearClip = get_variable(script, *ptrReadPos++); - Bytecode farClip = get_variable(script, *ptrReadPos++); + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s16 mode = get_variable(script, *args++); + f32 vfov = get_float_variable(script, *args++); + s16 nearClip = get_variable(script, *args++); + s16 farClip = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; - (&gCameras[id])->farClip = farClip; - (&gCameras[id])->mode = mode; - (&gCameras[id])->unk_06 = 1; - (&gCameras[id])->unk_08 = 1; - (&gCameras[id])->vfov = vfov; - (&gCameras[id])->nearClip = nearClip; + camera->farClip = farClip; + camera->mode = mode; + camera->unk_06 = 1; + camera->unk_08 = 1; + camera->vfov = vfov; + camera->nearClip = nearClip; return ApiStatus_DONE2; } ApiStatus func_802CA90C(ScriptInstance* script, s32 isInitialCall) { - Bytecode* ptrReadPos = script->ptrReadPos; - Bytecode id = get_variable(script, *ptrReadPos++); - Bytecode mode = get_variable(script, *ptrReadPos++); + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s16 mode = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; - (&gCameras[id])->mode = mode; - (&gCameras[id])->unk_06 = 0; + camera->mode = mode; + camera->unk_06 = 0; return ApiStatus_DONE2; } @@ -112,7 +116,18 @@ INCLUDE_API_ASM("code_ef070_len_3400", UseSettingsFrom); INCLUDE_API_ASM("code_ef070_len_3400", LoadSettings); -INCLUDE_API_ASM("code_ef070_len_3400", SetCamType); +ApiStatus SetCamType(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + s32 controllerType = get_variable(script, *args++); + s32 enabled = get_variable(script, *args++); + + camera->unk_500 = enabled; + camera->controllerType = controllerType; + return ApiStatus_DONE2; +} INCLUDE_API_ASM("code_ef070_len_3400", SetCamPitch); From eb82e98854709476d1928270f708966e828b634b Mon Sep 17 00:00:00 2001 From: Jdog Date: Thu, 20 Aug 2020 14:16:52 -0700 Subject: [PATCH 5/8] Lots more matching Camera-related functions --- .../code_ef070_len_3400/GetCamDistance.s | 34 ---- .../code_ef070_len_3400/GetCamPitch.s | 42 ---- .../code_ef070_len_3400/GetCamPosA.s | 42 ---- .../code_ef070_len_3400/GetCamPosB.s | 42 ---- .../code_ef070_len_3400/GetCamPosC.s | 42 ---- .../code_ef070_len_3400/GetCamPosition.s | 50 ----- .../code_ef070_len_3400/GetCamType.s | 42 ---- .../code_ef070_len_3400/SetCamDistance.s | 35 ---- .../code_ef070_len_3400/SetCamPitch.s | 45 ----- .../code_ef070_len_3400/SetCamPosA.s | 45 ----- .../code_ef070_len_3400/SetCamPosB.s | 45 ----- .../code_ef070_len_3400/SetCamPosC.s | 45 ----- .../code_ef070_len_3400/SetCamSpeed.s | 35 ---- .../code_ef070_len_3400/SetPanTarget.s | 55 ------ include/common_structs.h | 2 +- src/code_ef070_len_3400.c | 183 ++++++++++++++++-- 16 files changed, 169 insertions(+), 615 deletions(-) delete mode 100644 asm/nonmatchings/code_ef070_len_3400/GetCamDistance.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/GetCamPitch.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/GetCamPosA.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/GetCamPosB.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/GetCamPosC.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/GetCamPosition.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/GetCamType.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamDistance.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamPitch.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamPosA.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamPosB.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamPosC.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamSpeed.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetPanTarget.s diff --git a/asm/nonmatchings/code_ef070_len_3400/GetCamDistance.s b/asm/nonmatchings/code_ef070_len_3400/GetCamDistance.s deleted file mode 100644 index 539974112a..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/GetCamDistance.s +++ /dev/null @@ -1,34 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel GetCamDistance -/* 0F0A34 802CC084 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F0A38 802CC088 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0A3C 802CC08C 0080882D */ daddu $s1, $a0, $zero -/* 0F0A40 802CC090 AFBF0018 */ sw $ra, 0x18($sp) -/* 0F0A44 802CC094 AFB00010 */ sw $s0, 0x10($sp) -/* 0F0A48 802CC098 8E30000C */ lw $s0, 0xc($s1) -/* 0F0A4C 802CC09C 8E050000 */ lw $a1, ($s0) -/* 0F0A50 802CC0A0 0C0B1EAF */ jal get_variable -/* 0F0A54 802CC0A4 26100004 */ addiu $s0, $s0, 4 -/* 0F0A58 802CC0A8 00021880 */ sll $v1, $v0, 2 -/* 0F0A5C 802CC0AC 00621821 */ addu $v1, $v1, $v0 -/* 0F0A60 802CC0B0 00031880 */ sll $v1, $v1, 2 -/* 0F0A64 802CC0B4 00621823 */ subu $v1, $v1, $v0 -/* 0F0A68 802CC0B8 000310C0 */ sll $v0, $v1, 3 -/* 0F0A6C 802CC0BC 00621821 */ addu $v1, $v1, $v0 -/* 0F0A70 802CC0C0 000318C0 */ sll $v1, $v1, 3 -/* 0F0A74 802CC0C4 8E050000 */ lw $a1, ($s0) -/* 0F0A78 802CC0C8 3C06800B */ lui $a2, 0x800b -/* 0F0A7C 802CC0CC 00C33021 */ addu $a2, $a2, $v1 -/* 0F0A80 802CC0D0 8CC6225C */ lw $a2, 0x225c($a2) -/* 0F0A84 802CC0D4 0C0B2190 */ jal set_float_variable -/* 0F0A88 802CC0D8 0220202D */ daddu $a0, $s1, $zero -/* 0F0A8C 802CC0DC 8FBF0018 */ lw $ra, 0x18($sp) -/* 0F0A90 802CC0E0 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0A94 802CC0E4 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0A98 802CC0E8 24020002 */ addiu $v0, $zero, 2 -/* 0F0A9C 802CC0EC 03E00008 */ jr $ra -/* 0F0AA0 802CC0F0 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/GetCamPitch.s b/asm/nonmatchings/code_ef070_len_3400/GetCamPitch.s deleted file mode 100644 index c40b1017dc..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/GetCamPitch.s +++ /dev/null @@ -1,42 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel GetCamPitch -/* 0F09A4 802CBFF4 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F09A8 802CBFF8 AFB20018 */ sw $s2, 0x18($sp) -/* 0F09AC 802CBFFC 0080902D */ daddu $s2, $a0, $zero -/* 0F09B0 802CC000 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F09B4 802CC004 AFB10014 */ sw $s1, 0x14($sp) -/* 0F09B8 802CC008 AFB00010 */ sw $s0, 0x10($sp) -/* 0F09BC 802CC00C 8E51000C */ lw $s1, 0xc($s2) -/* 0F09C0 802CC010 8E250000 */ lw $a1, ($s1) -/* 0F09C4 802CC014 0C0B1EAF */ jal get_variable -/* 0F09C8 802CC018 26310004 */ addiu $s1, $s1, 4 -/* 0F09CC 802CC01C 3C03800B */ lui $v1, 0x800b -/* 0F09D0 802CC020 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F09D4 802CC024 00028080 */ sll $s0, $v0, 2 -/* 0F09D8 802CC028 02028021 */ addu $s0, $s0, $v0 -/* 0F09DC 802CC02C 00108080 */ sll $s0, $s0, 2 -/* 0F09E0 802CC030 02028023 */ subu $s0, $s0, $v0 -/* 0F09E4 802CC034 001010C0 */ sll $v0, $s0, 3 -/* 0F09E8 802CC038 02028021 */ addu $s0, $s0, $v0 -/* 0F09EC 802CC03C 001080C0 */ sll $s0, $s0, 3 -/* 0F09F0 802CC040 02038021 */ addu $s0, $s0, $v1 -/* 0F09F4 802CC044 8E250000 */ lw $a1, ($s1) -/* 0F09F8 802CC048 8E0604E0 */ lw $a2, 0x4e0($s0) -/* 0F09FC 802CC04C 8E310004 */ lw $s1, 4($s1) -/* 0F0A00 802CC050 0C0B2190 */ jal set_float_variable -/* 0F0A04 802CC054 0240202D */ daddu $a0, $s2, $zero -/* 0F0A08 802CC058 0240202D */ daddu $a0, $s2, $zero -/* 0F0A0C 802CC05C 8E0604FC */ lw $a2, 0x4fc($s0) -/* 0F0A10 802CC060 0C0B2190 */ jal set_float_variable -/* 0F0A14 802CC064 0220282D */ daddu $a1, $s1, $zero -/* 0F0A18 802CC068 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F0A1C 802CC06C 8FB20018 */ lw $s2, 0x18($sp) -/* 0F0A20 802CC070 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0A24 802CC074 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0A28 802CC078 24020002 */ addiu $v0, $zero, 2 -/* 0F0A2C 802CC07C 03E00008 */ jr $ra -/* 0F0A30 802CC080 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/GetCamPosA.s b/asm/nonmatchings/code_ef070_len_3400/GetCamPosA.s deleted file mode 100644 index edec4f467b..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/GetCamPosA.s +++ /dev/null @@ -1,42 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel GetCamPosA -/* 0F0AA4 802CC0F4 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F0AA8 802CC0F8 AFB20018 */ sw $s2, 0x18($sp) -/* 0F0AAC 802CC0FC 0080902D */ daddu $s2, $a0, $zero -/* 0F0AB0 802CC100 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F0AB4 802CC104 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0AB8 802CC108 AFB00010 */ sw $s0, 0x10($sp) -/* 0F0ABC 802CC10C 8E51000C */ lw $s1, 0xc($s2) -/* 0F0AC0 802CC110 8E250000 */ lw $a1, ($s1) -/* 0F0AC4 802CC114 0C0B1EAF */ jal get_variable -/* 0F0AC8 802CC118 26310004 */ addiu $s1, $s1, 4 -/* 0F0ACC 802CC11C 3C03800B */ lui $v1, 0x800b -/* 0F0AD0 802CC120 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0AD4 802CC124 00028080 */ sll $s0, $v0, 2 -/* 0F0AD8 802CC128 02028021 */ addu $s0, $s0, $v0 -/* 0F0ADC 802CC12C 00108080 */ sll $s0, $s0, 2 -/* 0F0AE0 802CC130 02028023 */ subu $s0, $s0, $v0 -/* 0F0AE4 802CC134 001010C0 */ sll $v0, $s0, 3 -/* 0F0AE8 802CC138 02028021 */ addu $s0, $s0, $v0 -/* 0F0AEC 802CC13C 001080C0 */ sll $s0, $s0, 3 -/* 0F0AF0 802CC140 02038021 */ addu $s0, $s0, $v1 -/* 0F0AF4 802CC144 8E250000 */ lw $a1, ($s1) -/* 0F0AF8 802CC148 8E0604E4 */ lw $a2, 0x4e4($s0) -/* 0F0AFC 802CC14C 8E310004 */ lw $s1, 4($s1) -/* 0F0B00 802CC150 0C0B2190 */ jal set_float_variable -/* 0F0B04 802CC154 0240202D */ daddu $a0, $s2, $zero -/* 0F0B08 802CC158 0240202D */ daddu $a0, $s2, $zero -/* 0F0B0C 802CC15C 8E0604EC */ lw $a2, 0x4ec($s0) -/* 0F0B10 802CC160 0C0B2190 */ jal set_float_variable -/* 0F0B14 802CC164 0220282D */ daddu $a1, $s1, $zero -/* 0F0B18 802CC168 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F0B1C 802CC16C 8FB20018 */ lw $s2, 0x18($sp) -/* 0F0B20 802CC170 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0B24 802CC174 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0B28 802CC178 24020002 */ addiu $v0, $zero, 2 -/* 0F0B2C 802CC17C 03E00008 */ jr $ra -/* 0F0B30 802CC180 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/GetCamPosB.s b/asm/nonmatchings/code_ef070_len_3400/GetCamPosB.s deleted file mode 100644 index e4383ae5ba..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/GetCamPosB.s +++ /dev/null @@ -1,42 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel GetCamPosB -/* 0F0B34 802CC184 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F0B38 802CC188 AFB20018 */ sw $s2, 0x18($sp) -/* 0F0B3C 802CC18C 0080902D */ daddu $s2, $a0, $zero -/* 0F0B40 802CC190 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F0B44 802CC194 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0B48 802CC198 AFB00010 */ sw $s0, 0x10($sp) -/* 0F0B4C 802CC19C 8E51000C */ lw $s1, 0xc($s2) -/* 0F0B50 802CC1A0 8E250000 */ lw $a1, ($s1) -/* 0F0B54 802CC1A4 0C0B1EAF */ jal get_variable -/* 0F0B58 802CC1A8 26310004 */ addiu $s1, $s1, 4 -/* 0F0B5C 802CC1AC 3C03800B */ lui $v1, 0x800b -/* 0F0B60 802CC1B0 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0B64 802CC1B4 00028080 */ sll $s0, $v0, 2 -/* 0F0B68 802CC1B8 02028021 */ addu $s0, $s0, $v0 -/* 0F0B6C 802CC1BC 00108080 */ sll $s0, $s0, 2 -/* 0F0B70 802CC1C0 02028023 */ subu $s0, $s0, $v0 -/* 0F0B74 802CC1C4 001010C0 */ sll $v0, $s0, 3 -/* 0F0B78 802CC1C8 02028021 */ addu $s0, $s0, $v0 -/* 0F0B7C 802CC1CC 001080C0 */ sll $s0, $s0, 3 -/* 0F0B80 802CC1D0 02038021 */ addu $s0, $s0, $v1 -/* 0F0B84 802CC1D4 8E250000 */ lw $a1, ($s1) -/* 0F0B88 802CC1D8 8E0604F0 */ lw $a2, 0x4f0($s0) -/* 0F0B8C 802CC1DC 8E310004 */ lw $s1, 4($s1) -/* 0F0B90 802CC1E0 0C0B2190 */ jal set_float_variable -/* 0F0B94 802CC1E4 0240202D */ daddu $a0, $s2, $zero -/* 0F0B98 802CC1E8 0240202D */ daddu $a0, $s2, $zero -/* 0F0B9C 802CC1EC 8E0604F8 */ lw $a2, 0x4f8($s0) -/* 0F0BA0 802CC1F0 0C0B2190 */ jal set_float_variable -/* 0F0BA4 802CC1F4 0220282D */ daddu $a1, $s1, $zero -/* 0F0BA8 802CC1F8 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F0BAC 802CC1FC 8FB20018 */ lw $s2, 0x18($sp) -/* 0F0BB0 802CC200 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0BB4 802CC204 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0BB8 802CC208 24020002 */ addiu $v0, $zero, 2 -/* 0F0BBC 802CC20C 03E00008 */ jr $ra -/* 0F0BC0 802CC210 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/GetCamPosC.s b/asm/nonmatchings/code_ef070_len_3400/GetCamPosC.s deleted file mode 100644 index 67fa5a98e7..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/GetCamPosC.s +++ /dev/null @@ -1,42 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel GetCamPosC -/* 0F0BC4 802CC214 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F0BC8 802CC218 AFB20018 */ sw $s2, 0x18($sp) -/* 0F0BCC 802CC21C 0080902D */ daddu $s2, $a0, $zero -/* 0F0BD0 802CC220 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F0BD4 802CC224 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0BD8 802CC228 AFB00010 */ sw $s0, 0x10($sp) -/* 0F0BDC 802CC22C 8E51000C */ lw $s1, 0xc($s2) -/* 0F0BE0 802CC230 8E250000 */ lw $a1, ($s1) -/* 0F0BE4 802CC234 0C0B1EAF */ jal get_variable -/* 0F0BE8 802CC238 26310004 */ addiu $s1, $s1, 4 -/* 0F0BEC 802CC23C 3C03800B */ lui $v1, 0x800b -/* 0F0BF0 802CC240 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0BF4 802CC244 00028080 */ sll $s0, $v0, 2 -/* 0F0BF8 802CC248 02028021 */ addu $s0, $s0, $v0 -/* 0F0BFC 802CC24C 00108080 */ sll $s0, $s0, 2 -/* 0F0C00 802CC250 02028023 */ subu $s0, $s0, $v0 -/* 0F0C04 802CC254 001010C0 */ sll $v0, $s0, 3 -/* 0F0C08 802CC258 02028021 */ addu $s0, $s0, $v0 -/* 0F0C0C 802CC25C 001080C0 */ sll $s0, $s0, 3 -/* 0F0C10 802CC260 02038021 */ addu $s0, $s0, $v1 -/* 0F0C14 802CC264 8E250000 */ lw $a1, ($s1) -/* 0F0C18 802CC268 8E0604E8 */ lw $a2, 0x4e8($s0) -/* 0F0C1C 802CC26C 8E310004 */ lw $s1, 4($s1) -/* 0F0C20 802CC270 0C0B2190 */ jal set_float_variable -/* 0F0C24 802CC274 0240202D */ daddu $a0, $s2, $zero -/* 0F0C28 802CC278 0240202D */ daddu $a0, $s2, $zero -/* 0F0C2C 802CC27C 8E0604F4 */ lw $a2, 0x4f4($s0) -/* 0F0C30 802CC280 0C0B2190 */ jal set_float_variable -/* 0F0C34 802CC284 0220282D */ daddu $a1, $s1, $zero -/* 0F0C38 802CC288 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F0C3C 802CC28C 8FB20018 */ lw $s2, 0x18($sp) -/* 0F0C40 802CC290 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0C44 802CC294 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0C48 802CC298 24020002 */ addiu $v0, $zero, 2 -/* 0F0C4C 802CC29C 03E00008 */ jr $ra -/* 0F0C50 802CC2A0 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/GetCamPosition.s b/asm/nonmatchings/code_ef070_len_3400/GetCamPosition.s deleted file mode 100644 index f355fdb285..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/GetCamPosition.s +++ /dev/null @@ -1,50 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel GetCamPosition -/* 0F0C54 802CC2A4 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0F0C58 802CC2A8 AFB20018 */ sw $s2, 0x18($sp) -/* 0F0C5C 802CC2AC 0080902D */ daddu $s2, $a0, $zero -/* 0F0C60 802CC2B0 AFBF0020 */ sw $ra, 0x20($sp) -/* 0F0C64 802CC2B4 AFB3001C */ sw $s3, 0x1c($sp) -/* 0F0C68 802CC2B8 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0C6C 802CC2BC AFB00010 */ sw $s0, 0x10($sp) -/* 0F0C70 802CC2C0 8E51000C */ lw $s1, 0xc($s2) -/* 0F0C74 802CC2C4 8E250000 */ lw $a1, ($s1) -/* 0F0C78 802CC2C8 0C0B1EAF */ jal get_variable -/* 0F0C7C 802CC2CC 26310004 */ addiu $s1, $s1, 4 -/* 0F0C80 802CC2D0 8E250000 */ lw $a1, ($s1) -/* 0F0C84 802CC2D4 26310004 */ addiu $s1, $s1, 4 -/* 0F0C88 802CC2D8 3C03800B */ lui $v1, 0x800b -/* 0F0C8C 802CC2DC 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0C90 802CC2E0 00028080 */ sll $s0, $v0, 2 -/* 0F0C94 802CC2E4 02028021 */ addu $s0, $s0, $v0 -/* 0F0C98 802CC2E8 00108080 */ sll $s0, $s0, 2 -/* 0F0C9C 802CC2EC 02028023 */ subu $s0, $s0, $v0 -/* 0F0CA0 802CC2F0 001010C0 */ sll $v0, $s0, 3 -/* 0F0CA4 802CC2F4 02028021 */ addu $s0, $s0, $v0 -/* 0F0CA8 802CC2F8 001080C0 */ sll $s0, $s0, 3 -/* 0F0CAC 802CC2FC 02038021 */ addu $s0, $s0, $v1 -/* 0F0CB0 802CC300 8E0604B0 */ lw $a2, 0x4b0($s0) -/* 0F0CB4 802CC304 8E330000 */ lw $s3, ($s1) -/* 0F0CB8 802CC308 8E310004 */ lw $s1, 4($s1) -/* 0F0CBC 802CC30C 0C0B2190 */ jal set_float_variable -/* 0F0CC0 802CC310 0240202D */ daddu $a0, $s2, $zero -/* 0F0CC4 802CC314 0240202D */ daddu $a0, $s2, $zero -/* 0F0CC8 802CC318 8E0604B4 */ lw $a2, 0x4b4($s0) -/* 0F0CCC 802CC31C 0C0B2190 */ jal set_float_variable -/* 0F0CD0 802CC320 0260282D */ daddu $a1, $s3, $zero -/* 0F0CD4 802CC324 0240202D */ daddu $a0, $s2, $zero -/* 0F0CD8 802CC328 8E0604B8 */ lw $a2, 0x4b8($s0) -/* 0F0CDC 802CC32C 0C0B2190 */ jal set_float_variable -/* 0F0CE0 802CC330 0220282D */ daddu $a1, $s1, $zero -/* 0F0CE4 802CC334 8FBF0020 */ lw $ra, 0x20($sp) -/* 0F0CE8 802CC338 8FB3001C */ lw $s3, 0x1c($sp) -/* 0F0CEC 802CC33C 8FB20018 */ lw $s2, 0x18($sp) -/* 0F0CF0 802CC340 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0CF4 802CC344 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0CF8 802CC348 24020002 */ addiu $v0, $zero, 2 -/* 0F0CFC 802CC34C 03E00008 */ jr $ra -/* 0F0D00 802CC350 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/asm/nonmatchings/code_ef070_len_3400/GetCamType.s b/asm/nonmatchings/code_ef070_len_3400/GetCamType.s deleted file mode 100644 index 43bb9fcd83..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/GetCamType.s +++ /dev/null @@ -1,42 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel GetCamType -/* 0F0914 802CBF64 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F0918 802CBF68 AFB20018 */ sw $s2, 0x18($sp) -/* 0F091C 802CBF6C 0080902D */ daddu $s2, $a0, $zero -/* 0F0920 802CBF70 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F0924 802CBF74 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0928 802CBF78 AFB00010 */ sw $s0, 0x10($sp) -/* 0F092C 802CBF7C 8E51000C */ lw $s1, 0xc($s2) -/* 0F0930 802CBF80 8E250000 */ lw $a1, ($s1) -/* 0F0934 802CBF84 0C0B1EAF */ jal get_variable -/* 0F0938 802CBF88 26310004 */ addiu $s1, $s1, 4 -/* 0F093C 802CBF8C 3C03800B */ lui $v1, 0x800b -/* 0F0940 802CBF90 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0944 802CBF94 00028080 */ sll $s0, $v0, 2 -/* 0F0948 802CBF98 02028021 */ addu $s0, $s0, $v0 -/* 0F094C 802CBF9C 00108080 */ sll $s0, $s0, 2 -/* 0F0950 802CBFA0 02028023 */ subu $s0, $s0, $v0 -/* 0F0954 802CBFA4 001010C0 */ sll $v0, $s0, 3 -/* 0F0958 802CBFA8 02028021 */ addu $s0, $s0, $v0 -/* 0F095C 802CBFAC 001080C0 */ sll $s0, $s0, 3 -/* 0F0960 802CBFB0 02038021 */ addu $s0, $s0, $v1 -/* 0F0964 802CBFB4 8E250000 */ lw $a1, ($s1) -/* 0F0968 802CBFB8 8E0604D8 */ lw $a2, 0x4d8($s0) -/* 0F096C 802CBFBC 8E310004 */ lw $s1, 4($s1) -/* 0F0970 802CBFC0 0C0B2026 */ jal set_variable -/* 0F0974 802CBFC4 0240202D */ daddu $a0, $s2, $zero -/* 0F0978 802CBFC8 0240202D */ daddu $a0, $s2, $zero -/* 0F097C 802CBFCC 8E060500 */ lw $a2, 0x500($s0) -/* 0F0980 802CBFD0 0C0B2026 */ jal set_variable -/* 0F0984 802CBFD4 0220282D */ daddu $a1, $s1, $zero -/* 0F0988 802CBFD8 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F098C 802CBFDC 8FB20018 */ lw $s2, 0x18($sp) -/* 0F0990 802CBFE0 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0994 802CBFE4 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0998 802CBFE8 24020002 */ addiu $v0, $zero, 2 -/* 0F099C 802CBFEC 03E00008 */ jr $ra -/* 0F09A0 802CBFF0 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamDistance.s b/asm/nonmatchings/code_ef070_len_3400/SetCamDistance.s deleted file mode 100644 index 3906d17a81..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamDistance.s +++ /dev/null @@ -1,35 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamDistance -/* 0F0594 802CBBE4 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F0598 802CBBE8 AFB10014 */ sw $s1, 0x14($sp) -/* 0F059C 802CBBEC 0080882D */ daddu $s1, $a0, $zero -/* 0F05A0 802CBBF0 AFBF0018 */ sw $ra, 0x18($sp) -/* 0F05A4 802CBBF4 AFB00010 */ sw $s0, 0x10($sp) -/* 0F05A8 802CBBF8 8E30000C */ lw $s0, 0xc($s1) -/* 0F05AC 802CBBFC 8E050000 */ lw $a1, ($s0) -/* 0F05B0 802CBC00 0C0B1EAF */ jal get_variable -/* 0F05B4 802CBC04 26100004 */ addiu $s0, $s0, 4 -/* 0F05B8 802CBC08 0220202D */ daddu $a0, $s1, $zero -/* 0F05BC 802CBC0C 3C03800B */ lui $v1, 0x800b -/* 0F05C0 802CBC10 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F05C4 802CBC14 8E050000 */ lw $a1, ($s0) -/* 0F05C8 802CBC18 00028080 */ sll $s0, $v0, 2 -/* 0F05CC 802CBC1C 02028021 */ addu $s0, $s0, $v0 -/* 0F05D0 802CBC20 00108080 */ sll $s0, $s0, 2 -/* 0F05D4 802CBC24 02028023 */ subu $s0, $s0, $v0 -/* 0F05D8 802CBC28 001010C0 */ sll $v0, $s0, 3 -/* 0F05DC 802CBC2C 02028021 */ addu $s0, $s0, $v0 -/* 0F05E0 802CBC30 001080C0 */ sll $s0, $s0, 3 -/* 0F05E4 802CBC34 0C0B210B */ jal get_float_variable -/* 0F05E8 802CBC38 02038021 */ addu $s0, $s0, $v1 -/* 0F05EC 802CBC3C E60004DC */ swc1 $f0, 0x4dc($s0) -/* 0F05F0 802CBC40 8FBF0018 */ lw $ra, 0x18($sp) -/* 0F05F4 802CBC44 8FB10014 */ lw $s1, 0x14($sp) -/* 0F05F8 802CBC48 8FB00010 */ lw $s0, 0x10($sp) -/* 0F05FC 802CBC4C 24020002 */ addiu $v0, $zero, 2 -/* 0F0600 802CBC50 03E00008 */ jr $ra -/* 0F0604 802CBC54 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamPitch.s b/asm/nonmatchings/code_ef070_len_3400/SetCamPitch.s deleted file mode 100644 index 98f60d2b6f..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamPitch.s +++ /dev/null @@ -1,45 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamPitch -/* 0F04F8 802CBB48 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0F04FC 802CBB4C AFB20018 */ sw $s2, 0x18($sp) -/* 0F0500 802CBB50 0080902D */ daddu $s2, $a0, $zero -/* 0F0504 802CBB54 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F0508 802CBB58 AFB10014 */ sw $s1, 0x14($sp) -/* 0F050C 802CBB5C AFB00010 */ sw $s0, 0x10($sp) -/* 0F0510 802CBB60 F7B40020 */ sdc1 $f20, 0x20($sp) -/* 0F0514 802CBB64 8E51000C */ lw $s1, 0xc($s2) -/* 0F0518 802CBB68 8E250000 */ lw $a1, ($s1) -/* 0F051C 802CBB6C 0C0B1EAF */ jal get_variable -/* 0F0520 802CBB70 26310004 */ addiu $s1, $s1, 4 -/* 0F0524 802CBB74 8E250000 */ lw $a1, ($s1) -/* 0F0528 802CBB78 26310004 */ addiu $s1, $s1, 4 -/* 0F052C 802CBB7C 0240202D */ daddu $a0, $s2, $zero -/* 0F0530 802CBB80 3C03800B */ lui $v1, 0x800b -/* 0F0534 802CBB84 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0538 802CBB88 00028080 */ sll $s0, $v0, 2 -/* 0F053C 802CBB8C 02028021 */ addu $s0, $s0, $v0 -/* 0F0540 802CBB90 00108080 */ sll $s0, $s0, 2 -/* 0F0544 802CBB94 02028023 */ subu $s0, $s0, $v0 -/* 0F0548 802CBB98 001010C0 */ sll $v0, $s0, 3 -/* 0F054C 802CBB9C 02028021 */ addu $s0, $s0, $v0 -/* 0F0550 802CBBA0 001080C0 */ sll $s0, $s0, 3 -/* 0F0554 802CBBA4 0C0B210B */ jal get_float_variable -/* 0F0558 802CBBA8 02038021 */ addu $s0, $s0, $v1 -/* 0F055C 802CBBAC 0240202D */ daddu $a0, $s2, $zero -/* 0F0560 802CBBB0 8E250000 */ lw $a1, ($s1) -/* 0F0564 802CBBB4 0C0B210B */ jal get_float_variable -/* 0F0568 802CBBB8 46000506 */ mov.s $f20, $f0 -/* 0F056C 802CBBBC E61404E0 */ swc1 $f20, 0x4e0($s0) -/* 0F0570 802CBBC0 E60004FC */ swc1 $f0, 0x4fc($s0) -/* 0F0574 802CBBC4 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F0578 802CBBC8 8FB20018 */ lw $s2, 0x18($sp) -/* 0F057C 802CBBCC 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0580 802CBBD0 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0584 802CBBD4 D7B40020 */ ldc1 $f20, 0x20($sp) -/* 0F0588 802CBBD8 24020002 */ addiu $v0, $zero, 2 -/* 0F058C 802CBBDC 03E00008 */ jr $ra -/* 0F0590 802CBBE0 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamPosA.s b/asm/nonmatchings/code_ef070_len_3400/SetCamPosA.s deleted file mode 100644 index 54a4acaa14..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamPosA.s +++ /dev/null @@ -1,45 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamPosA -/* 0F0608 802CBC58 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0F060C 802CBC5C AFB20018 */ sw $s2, 0x18($sp) -/* 0F0610 802CBC60 0080902D */ daddu $s2, $a0, $zero -/* 0F0614 802CBC64 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F0618 802CBC68 AFB10014 */ sw $s1, 0x14($sp) -/* 0F061C 802CBC6C AFB00010 */ sw $s0, 0x10($sp) -/* 0F0620 802CBC70 F7B40020 */ sdc1 $f20, 0x20($sp) -/* 0F0624 802CBC74 8E51000C */ lw $s1, 0xc($s2) -/* 0F0628 802CBC78 8E250000 */ lw $a1, ($s1) -/* 0F062C 802CBC7C 0C0B1EAF */ jal get_variable -/* 0F0630 802CBC80 26310004 */ addiu $s1, $s1, 4 -/* 0F0634 802CBC84 8E250000 */ lw $a1, ($s1) -/* 0F0638 802CBC88 26310004 */ addiu $s1, $s1, 4 -/* 0F063C 802CBC8C 0240202D */ daddu $a0, $s2, $zero -/* 0F0640 802CBC90 3C03800B */ lui $v1, 0x800b -/* 0F0644 802CBC94 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0648 802CBC98 00028080 */ sll $s0, $v0, 2 -/* 0F064C 802CBC9C 02028021 */ addu $s0, $s0, $v0 -/* 0F0650 802CBCA0 00108080 */ sll $s0, $s0, 2 -/* 0F0654 802CBCA4 02028023 */ subu $s0, $s0, $v0 -/* 0F0658 802CBCA8 001010C0 */ sll $v0, $s0, 3 -/* 0F065C 802CBCAC 02028021 */ addu $s0, $s0, $v0 -/* 0F0660 802CBCB0 001080C0 */ sll $s0, $s0, 3 -/* 0F0664 802CBCB4 0C0B210B */ jal get_float_variable -/* 0F0668 802CBCB8 02038021 */ addu $s0, $s0, $v1 -/* 0F066C 802CBCBC 0240202D */ daddu $a0, $s2, $zero -/* 0F0670 802CBCC0 8E250000 */ lw $a1, ($s1) -/* 0F0674 802CBCC4 0C0B210B */ jal get_float_variable -/* 0F0678 802CBCC8 46000506 */ mov.s $f20, $f0 -/* 0F067C 802CBCCC E61404E4 */ swc1 $f20, 0x4e4($s0) -/* 0F0680 802CBCD0 E60004EC */ swc1 $f0, 0x4ec($s0) -/* 0F0684 802CBCD4 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F0688 802CBCD8 8FB20018 */ lw $s2, 0x18($sp) -/* 0F068C 802CBCDC 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0690 802CBCE0 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0694 802CBCE4 D7B40020 */ ldc1 $f20, 0x20($sp) -/* 0F0698 802CBCE8 24020002 */ addiu $v0, $zero, 2 -/* 0F069C 802CBCEC 03E00008 */ jr $ra -/* 0F06A0 802CBCF0 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamPosB.s b/asm/nonmatchings/code_ef070_len_3400/SetCamPosB.s deleted file mode 100644 index 76808229f7..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamPosB.s +++ /dev/null @@ -1,45 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamPosB -/* 0F06A4 802CBCF4 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0F06A8 802CBCF8 AFB20018 */ sw $s2, 0x18($sp) -/* 0F06AC 802CBCFC 0080902D */ daddu $s2, $a0, $zero -/* 0F06B0 802CBD00 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F06B4 802CBD04 AFB10014 */ sw $s1, 0x14($sp) -/* 0F06B8 802CBD08 AFB00010 */ sw $s0, 0x10($sp) -/* 0F06BC 802CBD0C F7B40020 */ sdc1 $f20, 0x20($sp) -/* 0F06C0 802CBD10 8E51000C */ lw $s1, 0xc($s2) -/* 0F06C4 802CBD14 8E250000 */ lw $a1, ($s1) -/* 0F06C8 802CBD18 0C0B1EAF */ jal get_variable -/* 0F06CC 802CBD1C 26310004 */ addiu $s1, $s1, 4 -/* 0F06D0 802CBD20 8E250000 */ lw $a1, ($s1) -/* 0F06D4 802CBD24 26310004 */ addiu $s1, $s1, 4 -/* 0F06D8 802CBD28 0240202D */ daddu $a0, $s2, $zero -/* 0F06DC 802CBD2C 3C03800B */ lui $v1, 0x800b -/* 0F06E0 802CBD30 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F06E4 802CBD34 00028080 */ sll $s0, $v0, 2 -/* 0F06E8 802CBD38 02028021 */ addu $s0, $s0, $v0 -/* 0F06EC 802CBD3C 00108080 */ sll $s0, $s0, 2 -/* 0F06F0 802CBD40 02028023 */ subu $s0, $s0, $v0 -/* 0F06F4 802CBD44 001010C0 */ sll $v0, $s0, 3 -/* 0F06F8 802CBD48 02028021 */ addu $s0, $s0, $v0 -/* 0F06FC 802CBD4C 001080C0 */ sll $s0, $s0, 3 -/* 0F0700 802CBD50 0C0B210B */ jal get_float_variable -/* 0F0704 802CBD54 02038021 */ addu $s0, $s0, $v1 -/* 0F0708 802CBD58 0240202D */ daddu $a0, $s2, $zero -/* 0F070C 802CBD5C 8E250000 */ lw $a1, ($s1) -/* 0F0710 802CBD60 0C0B210B */ jal get_float_variable -/* 0F0714 802CBD64 46000506 */ mov.s $f20, $f0 -/* 0F0718 802CBD68 E61404F0 */ swc1 $f20, 0x4f0($s0) -/* 0F071C 802CBD6C E60004F8 */ swc1 $f0, 0x4f8($s0) -/* 0F0720 802CBD70 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F0724 802CBD74 8FB20018 */ lw $s2, 0x18($sp) -/* 0F0728 802CBD78 8FB10014 */ lw $s1, 0x14($sp) -/* 0F072C 802CBD7C 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0730 802CBD80 D7B40020 */ ldc1 $f20, 0x20($sp) -/* 0F0734 802CBD84 24020002 */ addiu $v0, $zero, 2 -/* 0F0738 802CBD88 03E00008 */ jr $ra -/* 0F073C 802CBD8C 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamPosC.s b/asm/nonmatchings/code_ef070_len_3400/SetCamPosC.s deleted file mode 100644 index 1b04e11ce4..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamPosC.s +++ /dev/null @@ -1,45 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamPosC -/* 0F0740 802CBD90 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0F0744 802CBD94 AFB20018 */ sw $s2, 0x18($sp) -/* 0F0748 802CBD98 0080902D */ daddu $s2, $a0, $zero -/* 0F074C 802CBD9C AFBF001C */ sw $ra, 0x1c($sp) -/* 0F0750 802CBDA0 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0754 802CBDA4 AFB00010 */ sw $s0, 0x10($sp) -/* 0F0758 802CBDA8 F7B40020 */ sdc1 $f20, 0x20($sp) -/* 0F075C 802CBDAC 8E51000C */ lw $s1, 0xc($s2) -/* 0F0760 802CBDB0 8E250000 */ lw $a1, ($s1) -/* 0F0764 802CBDB4 0C0B1EAF */ jal get_variable -/* 0F0768 802CBDB8 26310004 */ addiu $s1, $s1, 4 -/* 0F076C 802CBDBC 8E250000 */ lw $a1, ($s1) -/* 0F0770 802CBDC0 26310004 */ addiu $s1, $s1, 4 -/* 0F0774 802CBDC4 0240202D */ daddu $a0, $s2, $zero -/* 0F0778 802CBDC8 3C03800B */ lui $v1, 0x800b -/* 0F077C 802CBDCC 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0780 802CBDD0 00028080 */ sll $s0, $v0, 2 -/* 0F0784 802CBDD4 02028021 */ addu $s0, $s0, $v0 -/* 0F0788 802CBDD8 00108080 */ sll $s0, $s0, 2 -/* 0F078C 802CBDDC 02028023 */ subu $s0, $s0, $v0 -/* 0F0790 802CBDE0 001010C0 */ sll $v0, $s0, 3 -/* 0F0794 802CBDE4 02028021 */ addu $s0, $s0, $v0 -/* 0F0798 802CBDE8 001080C0 */ sll $s0, $s0, 3 -/* 0F079C 802CBDEC 0C0B210B */ jal get_float_variable -/* 0F07A0 802CBDF0 02038021 */ addu $s0, $s0, $v1 -/* 0F07A4 802CBDF4 0240202D */ daddu $a0, $s2, $zero -/* 0F07A8 802CBDF8 8E250000 */ lw $a1, ($s1) -/* 0F07AC 802CBDFC 0C0B210B */ jal get_float_variable -/* 0F07B0 802CBE00 46000506 */ mov.s $f20, $f0 -/* 0F07B4 802CBE04 E61404E8 */ swc1 $f20, 0x4e8($s0) -/* 0F07B8 802CBE08 E60004F4 */ swc1 $f0, 0x4f4($s0) -/* 0F07BC 802CBE0C 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F07C0 802CBE10 8FB20018 */ lw $s2, 0x18($sp) -/* 0F07C4 802CBE14 8FB10014 */ lw $s1, 0x14($sp) -/* 0F07C8 802CBE18 8FB00010 */ lw $s0, 0x10($sp) -/* 0F07CC 802CBE1C D7B40020 */ ldc1 $f20, 0x20($sp) -/* 0F07D0 802CBE20 24020002 */ addiu $v0, $zero, 2 -/* 0F07D4 802CBE24 03E00008 */ jr $ra -/* 0F07D8 802CBE28 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamSpeed.s b/asm/nonmatchings/code_ef070_len_3400/SetCamSpeed.s deleted file mode 100644 index ea9532eacc..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamSpeed.s +++ /dev/null @@ -1,35 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamSpeed -/* 0F08A0 802CBEF0 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F08A4 802CBEF4 AFB10014 */ sw $s1, 0x14($sp) -/* 0F08A8 802CBEF8 0080882D */ daddu $s1, $a0, $zero -/* 0F08AC 802CBEFC AFBF0018 */ sw $ra, 0x18($sp) -/* 0F08B0 802CBF00 AFB00010 */ sw $s0, 0x10($sp) -/* 0F08B4 802CBF04 8E30000C */ lw $s0, 0xc($s1) -/* 0F08B8 802CBF08 8E050000 */ lw $a1, ($s0) -/* 0F08BC 802CBF0C 0C0B1EAF */ jal get_variable -/* 0F08C0 802CBF10 26100004 */ addiu $s0, $s0, 4 -/* 0F08C4 802CBF14 0220202D */ daddu $a0, $s1, $zero -/* 0F08C8 802CBF18 8E050000 */ lw $a1, ($s0) -/* 0F08CC 802CBF1C 0C0B210B */ jal get_float_variable -/* 0F08D0 802CBF20 0040802D */ daddu $s0, $v0, $zero -/* 0F08D4 802CBF24 24020002 */ addiu $v0, $zero, 2 -/* 0F08D8 802CBF28 00501804 */ sllv $v1, $s0, $v0 -/* 0F08DC 802CBF2C 00701821 */ addu $v1, $v1, $s0 -/* 0F08E0 802CBF30 00431804 */ sllv $v1, $v1, $v0 -/* 0F08E4 802CBF34 00701823 */ subu $v1, $v1, $s0 -/* 0F08E8 802CBF38 000320C0 */ sll $a0, $v1, 3 -/* 0F08EC 802CBF3C 00641821 */ addu $v1, $v1, $a0 -/* 0F08F0 802CBF40 000318C0 */ sll $v1, $v1, 3 -/* 0F08F4 802CBF44 3C01800B */ lui $at, 0x800b -/* 0F08F8 802CBF48 00230821 */ addu $at, $at, $v1 -/* 0F08FC 802CBF4C E4202210 */ swc1 $f0, 0x2210($at) -/* 0F0900 802CBF50 8FBF0018 */ lw $ra, 0x18($sp) -/* 0F0904 802CBF54 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0908 802CBF58 8FB00010 */ lw $s0, 0x10($sp) -/* 0F090C 802CBF5C 03E00008 */ jr $ra -/* 0F0910 802CBF60 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetPanTarget.s b/asm/nonmatchings/code_ef070_len_3400/SetPanTarget.s deleted file mode 100644 index 6fbfcd7ba3..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetPanTarget.s +++ /dev/null @@ -1,55 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetPanTarget -/* 0F07DC 802CBE2C 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 0F07E0 802CBE30 AFB20018 */ sw $s2, 0x18($sp) -/* 0F07E4 802CBE34 0080902D */ daddu $s2, $a0, $zero -/* 0F07E8 802CBE38 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F07EC 802CBE3C AFB10014 */ sw $s1, 0x14($sp) -/* 0F07F0 802CBE40 AFB00010 */ sw $s0, 0x10($sp) -/* 0F07F4 802CBE44 F7B60028 */ sdc1 $f22, 0x28($sp) -/* 0F07F8 802CBE48 F7B40020 */ sdc1 $f20, 0x20($sp) -/* 0F07FC 802CBE4C 8E51000C */ lw $s1, 0xc($s2) -/* 0F0800 802CBE50 8E250000 */ lw $a1, ($s1) -/* 0F0804 802CBE54 0C0B1EAF */ jal get_variable -/* 0F0808 802CBE58 26310004 */ addiu $s1, $s1, 4 -/* 0F080C 802CBE5C 8E250000 */ lw $a1, ($s1) -/* 0F0810 802CBE60 26310004 */ addiu $s1, $s1, 4 -/* 0F0814 802CBE64 0240202D */ daddu $a0, $s2, $zero -/* 0F0818 802CBE68 3C03800B */ lui $v1, 0x800b -/* 0F081C 802CBE6C 24631D80 */ addiu $v1, $v1, 0x1d80 -/* 0F0820 802CBE70 00028080 */ sll $s0, $v0, 2 -/* 0F0824 802CBE74 02028021 */ addu $s0, $s0, $v0 -/* 0F0828 802CBE78 00108080 */ sll $s0, $s0, 2 -/* 0F082C 802CBE7C 02028023 */ subu $s0, $s0, $v0 -/* 0F0830 802CBE80 001010C0 */ sll $v0, $s0, 3 -/* 0F0834 802CBE84 02028021 */ addu $s0, $s0, $v0 -/* 0F0838 802CBE88 001080C0 */ sll $s0, $s0, 3 -/* 0F083C 802CBE8C 0C0B210B */ jal get_float_variable -/* 0F0840 802CBE90 02038021 */ addu $s0, $s0, $v1 -/* 0F0844 802CBE94 8E250000 */ lw $a1, ($s1) -/* 0F0848 802CBE98 26310004 */ addiu $s1, $s1, 4 -/* 0F084C 802CBE9C 0240202D */ daddu $a0, $s2, $zero -/* 0F0850 802CBEA0 0C0B210B */ jal get_float_variable -/* 0F0854 802CBEA4 46000586 */ mov.s $f22, $f0 -/* 0F0858 802CBEA8 0240202D */ daddu $a0, $s2, $zero -/* 0F085C 802CBEAC 8E250000 */ lw $a1, ($s1) -/* 0F0860 802CBEB0 0C0B210B */ jal get_float_variable -/* 0F0864 802CBEB4 46000506 */ mov.s $f20, $f0 -/* 0F0868 802CBEB8 24030001 */ addiu $v1, $zero, 1 -/* 0F086C 802CBEBC E61604B0 */ swc1 $f22, 0x4b0($s0) -/* 0F0870 802CBEC0 E61404B4 */ swc1 $f20, 0x4b4($s0) -/* 0F0874 802CBEC4 E60004B8 */ swc1 $f0, 0x4b8($s0) -/* 0F0878 802CBEC8 A6030506 */ sh $v1, 0x506($s0) -/* 0F087C 802CBECC 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F0880 802CBED0 8FB20018 */ lw $s2, 0x18($sp) -/* 0F0884 802CBED4 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0888 802CBED8 8FB00010 */ lw $s0, 0x10($sp) -/* 0F088C 802CBEDC D7B60028 */ ldc1 $f22, 0x28($sp) -/* 0F0890 802CBEE0 D7B40020 */ ldc1 $f20, 0x20($sp) -/* 0F0894 802CBEE4 24020002 */ addiu $v0, $zero, 2 -/* 0F0898 802CBEE8 03E00008 */ jr $ra -/* 0F089C 802CBEEC 27BD0030 */ addiu $sp, $sp, 0x30 - diff --git a/include/common_structs.h b/include/common_structs.h index a166db9a8d..12258170b1 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -480,7 +480,7 @@ typedef struct Camera { /* 0x4FC */ f32 controllerViewPitch; /* 0x500 */ s32 unk_500; /* 0x504 */ s16 boolTargetPlayer; - /* 0x506 */ char unk_506[2]; + /* 0x506 */ u16 unk_506; /* 0x508 */ s32 panPhase; /* 0x50C */ f32 leadAmount; /* 0x510 */ char unk_510[36]; diff --git a/src/code_ef070_len_3400.c b/src/code_ef070_len_3400.c index 83c36aba4a..b4ad50688b 100644 --- a/src/code_ef070_len_3400.c +++ b/src/code_ef070_len_3400.c @@ -123,39 +123,192 @@ ApiStatus SetCamType(ScriptInstance* script, s32 isInitialCall) { Camera* camera = &cameras[id]; s32 controllerType = get_variable(script, *args++); s32 enabled = get_variable(script, *args++); - + camera->unk_500 = enabled; camera->controllerType = controllerType; return ApiStatus_DONE2; } -INCLUDE_API_ASM("code_ef070_len_3400", SetCamPitch); +ApiStatus SetCamPitch(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + f32 boomPitch = get_float_variable(script, *args++); + f32 viewPitch = get_float_variable(script, *args++); -INCLUDE_API_ASM("code_ef070_len_3400", SetCamDistance); + camera->controllerBoomPitch = boomPitch; + camera->controllerViewPitch = viewPitch; + return ApiStatus_DONE2; +} -INCLUDE_API_ASM("code_ef070_len_3400", SetCamPosA); +ApiStatus SetCamDistance(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + f32 boomLength = get_float_variable(script, *args++); -INCLUDE_API_ASM("code_ef070_len_3400", SetCamPosB); + camera->controllerBoomLen = boomLength; + return ApiStatus_DONE2; +} -INCLUDE_API_ASM("code_ef070_len_3400", SetCamPosC); +ApiStatus SetCamPosA(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + f32 x = get_float_variable(script, *args++); + f32 z = get_float_variable(script, *args++); -INCLUDE_API_ASM("code_ef070_len_3400", SetPanTarget); + camera->posA.x = x; + camera->posA.z = z; + return ApiStatus_DONE2; +} -INCLUDE_API_ASM("code_ef070_len_3400", SetCamSpeed); +ApiStatus SetCamPosB(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + f32 x = get_float_variable(script, *args++); + f32 z = get_float_variable(script, *args++); -INCLUDE_API_ASM("code_ef070_len_3400", GetCamType); + camera->posB.x = x; + camera->posB.z = z; + return ApiStatus_DONE2; +} -INCLUDE_API_ASM("code_ef070_len_3400", GetCamPitch); +ApiStatus SetCamPosC(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + f32 y1 = get_float_variable(script, *args++); + f32 y2 = get_float_variable(script, *args++); -INCLUDE_API_ASM("code_ef070_len_3400", GetCamDistance); + camera->posA.y = y1; + camera->posB.y = y2; + return ApiStatus_DONE2; +} -INCLUDE_API_ASM("code_ef070_len_3400", GetCamPosA); +ApiStatus SetPanTarget(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + f32 x = get_float_variable(script, *args++); + f32 y = get_float_variable(script, *args++); + f32 z = get_float_variable(script, *args++); -INCLUDE_API_ASM("code_ef070_len_3400", GetCamPosB); + camera->movePos.x = x; + camera->movePos.y = y; + camera->movePos.z = z; + camera->unk_506 = 1; + return ApiStatus_DONE2; +} -INCLUDE_API_ASM("code_ef070_len_3400", GetCamPosC); +ApiStatus SetCamSpeed(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + f32 speed = get_float_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; -INCLUDE_API_ASM("code_ef070_len_3400", GetCamPosition); + camera->moveSpeed = speed; + return ApiStatus_DONE2; +} + +ApiStatus GetCamType(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Bytecode outVar1 = *args++; + Bytecode outVar2 = *args++; + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + set_variable(script, outVar1, camera->controllerType); + set_variable(script, outVar2, camera->unk_500); + return ApiStatus_DONE2; +} + +ApiStatus GetCamPitch(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Bytecode outVar1 = *args++; + Bytecode outVar2 = *args++; + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + set_float_variable(script, outVar1, camera->controllerBoomPitch); + set_float_variable(script, outVar2, camera->controllerViewPitch); + return ApiStatus_DONE2; +} + +ApiStatus GetCamDistance(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Bytecode outVar1 = *args++; + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + set_float_variable(script, outVar1, camera->controllerBoomLen); + return ApiStatus_DONE2; +} + +ApiStatus GetCamPosA(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Bytecode outVar1 = *args++; + Bytecode outVar2 = *args++; + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + set_float_variable(script, outVar1, camera->posA.x); + set_float_variable(script, outVar2, camera->posA.z); + return ApiStatus_DONE2; +} + +ApiStatus GetCamPosB(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Bytecode outVar1 = *args++; + Bytecode outVar2 = *args++; + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + set_float_variable(script, outVar1, camera->posB.x); + set_float_variable(script, outVar2, camera->posB.z); + return ApiStatus_DONE2; +} + +ApiStatus GetCamPosC(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Bytecode outVar1 = *args++; + Bytecode outVar2 = *args++; + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + set_float_variable(script, outVar1, camera->posA.y); + set_float_variable(script, outVar2, camera->posB.y); + return ApiStatus_DONE2; +} + +ApiStatus GetCamPosition(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + Bytecode outVar1 = *args++; + Bytecode outVar2 = *args++; + Bytecode outVar3 = *args++; + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + set_float_variable(script, outVar1, camera->movePos.x); + set_float_variable(script, outVar2, camera->movePos.y); + set_float_variable(script, outVar3, camera->movePos.z); + return ApiStatus_DONE2; +} INCLUDE_API_ASM("code_ef070_len_3400", WaitForCam); From 540b74c71b173c7b304a7192fb2f5bc079ac27c2 Mon Sep 17 00:00:00 2001 From: Jdog Date: Thu, 20 Aug 2020 16:41:10 -0700 Subject: [PATCH 6/8] Remove n64splitter --- tools/n64splitter | 1 - 1 file changed, 1 deletion(-) delete mode 160000 tools/n64splitter diff --git a/tools/n64splitter b/tools/n64splitter deleted file mode 160000 index 678acb2ea0..0000000000 --- a/tools/n64splitter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 678acb2ea026162039be6700486499db526dfba6 From 177a9f0fe6c29455a879c22485494ccf0854040f Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 21 Aug 2020 08:04:57 -0700 Subject: [PATCH 7/8] Several more Camera functions & struct changes --- .../code_ef070_len_3400/PanToTarget.s | 58 ------ .../code_ef070_len_3400/SetCamBGColor.s | 108 ----------- .../code_ef070_len_3400/SetCamLeadPlayer.s | 81 --------- .../code_ef070_len_3400/SetCamViewport.s | 168 ------------------ .../{SetCamTarget.s => func_802CB008.s} | 59 +----- include/common_structs.h | 10 +- include/functions.h | 2 + src/code_8230_len_1ae0.c | 2 +- src/code_ef070_len_3400.c | 139 ++++++++++++++- 9 files changed, 145 insertions(+), 482 deletions(-) delete mode 100644 asm/nonmatchings/code_ef070_len_3400/PanToTarget.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamBGColor.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamLeadPlayer.s delete mode 100644 asm/nonmatchings/code_ef070_len_3400/SetCamViewport.s rename asm/nonmatchings/code_ef070_len_3400/{SetCamTarget.s => func_802CB008.s} (75%) diff --git a/asm/nonmatchings/code_ef070_len_3400/PanToTarget.s b/asm/nonmatchings/code_ef070_len_3400/PanToTarget.s deleted file mode 100644 index 864ee143a1..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/PanToTarget.s +++ /dev/null @@ -1,58 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel PanToTarget -/* 0F014C 802CB79C 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0F0150 802CB7A0 AFB20018 */ sw $s2, 0x18($sp) -/* 0F0154 802CB7A4 0080902D */ daddu $s2, $a0, $zero -/* 0F0158 802CB7A8 AFBF001C */ sw $ra, 0x1c($sp) -/* 0F015C 802CB7AC AFB10014 */ sw $s1, 0x14($sp) -/* 0F0160 802CB7B0 AFB00010 */ sw $s0, 0x10($sp) -/* 0F0164 802CB7B4 F7B40020 */ sdc1 $f20, 0x20($sp) -/* 0F0168 802CB7B8 8E50000C */ lw $s0, 0xc($s2) -/* 0F016C 802CB7BC 8E050000 */ lw $a1, ($s0) -/* 0F0170 802CB7C0 0C0B1EAF */ jal get_variable -/* 0F0174 802CB7C4 26100004 */ addiu $s0, $s0, 4 -/* 0F0178 802CB7C8 8E050000 */ lw $a1, ($s0) -/* 0F017C 802CB7CC 26100004 */ addiu $s0, $s0, 4 -/* 0F0180 802CB7D0 0240202D */ daddu $a0, $s2, $zero -/* 0F0184 802CB7D4 0C0B210B */ jal get_float_variable -/* 0F0188 802CB7D8 0040882D */ daddu $s1, $v0, $zero -/* 0F018C 802CB7DC 0240202D */ daddu $a0, $s2, $zero -/* 0F0190 802CB7E0 8E050000 */ lw $a1, ($s0) -/* 0F0194 802CB7E4 0C0B1EAF */ jal get_variable -/* 0F0198 802CB7E8 46000506 */ mov.s $f20, $f0 -/* 0F019C 802CB7EC 3C05800B */ lui $a1, 0x800b -/* 0F01A0 802CB7F0 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0F01A4 802CB7F4 00111880 */ sll $v1, $s1, 2 -/* 0F01A8 802CB7F8 00711821 */ addu $v1, $v1, $s1 -/* 0F01AC 802CB7FC 00031880 */ sll $v1, $v1, 2 -/* 0F01B0 802CB800 00711823 */ subu $v1, $v1, $s1 -/* 0F01B4 802CB804 000320C0 */ sll $a0, $v1, 3 -/* 0F01B8 802CB808 00641821 */ addu $v1, $v1, $a0 -/* 0F01BC 802CB80C 000318C0 */ sll $v1, $v1, 3 -/* 0F01C0 802CB810 00651821 */ addu $v1, $v1, $a1 -/* 0F01C4 802CB814 24040001 */ addiu $a0, $zero, 1 -/* 0F01C8 802CB818 10400004 */ beqz $v0, .L802CB82C -/* 0F01CC 802CB81C A4640506 */ sh $a0, 0x506($v1) -/* 0F01D0 802CB820 A4640504 */ sh $a0, 0x504($v1) -/* 0F01D4 802CB824 080B2E10 */ j .L802CB840 -/* 0F01D8 802CB828 E4740508 */ swc1 $f20, 0x508($v1) - -.L802CB82C: -/* 0F01DC 802CB82C 3C013F80 */ lui $at, 0x3f80 -/* 0F01E0 802CB830 44810000 */ mtc1 $at, $f0 -/* 0F01E4 802CB834 A4600504 */ sh $zero, 0x504($v1) -/* 0F01E8 802CB838 AC600508 */ sw $zero, 0x508($v1) -/* 0F01EC 802CB83C E4600490 */ swc1 $f0, 0x490($v1) -.L802CB840: -/* 0F01F0 802CB840 8FBF001C */ lw $ra, 0x1c($sp) -/* 0F01F4 802CB844 8FB20018 */ lw $s2, 0x18($sp) -/* 0F01F8 802CB848 8FB10014 */ lw $s1, 0x14($sp) -/* 0F01FC 802CB84C 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0200 802CB850 D7B40020 */ ldc1 $f20, 0x20($sp) -/* 0F0204 802CB854 24020002 */ addiu $v0, $zero, 2 -/* 0F0208 802CB858 03E00008 */ jr $ra -/* 0F020C 802CB85C 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamBGColor.s b/asm/nonmatchings/code_ef070_len_3400/SetCamBGColor.s deleted file mode 100644 index 27a2e3b3ab..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamBGColor.s +++ /dev/null @@ -1,108 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamBGColor -/* 0EF748 802CAD98 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0EF74C 802CAD9C AFB10014 */ sw $s1, 0x14($sp) -/* 0EF750 802CADA0 0080882D */ daddu $s1, $a0, $zero -/* 0EF754 802CADA4 AFBF0020 */ sw $ra, 0x20($sp) -/* 0EF758 802CADA8 AFB3001C */ sw $s3, 0x1c($sp) -/* 0EF75C 802CADAC AFB20018 */ sw $s2, 0x18($sp) -/* 0EF760 802CADB0 AFB00010 */ sw $s0, 0x10($sp) -/* 0EF764 802CADB4 8E30000C */ lw $s0, 0xc($s1) -/* 0EF768 802CADB8 8E050000 */ lw $a1, ($s0) -/* 0EF76C 802CADBC 0C0B1EAF */ jal get_variable -/* 0EF770 802CADC0 26100004 */ addiu $s0, $s0, 4 -/* 0EF774 802CADC4 8E050000 */ lw $a1, ($s0) -/* 0EF778 802CADC8 26100004 */ addiu $s0, $s0, 4 -/* 0EF77C 802CADCC 0220202D */ daddu $a0, $s1, $zero -/* 0EF780 802CADD0 0C0B1EAF */ jal get_variable -/* 0EF784 802CADD4 0040902D */ daddu $s2, $v0, $zero -/* 0EF788 802CADD8 8E050000 */ lw $a1, ($s0) -/* 0EF78C 802CADDC 26100004 */ addiu $s0, $s0, 4 -/* 0EF790 802CADE0 0220202D */ daddu $a0, $s1, $zero -/* 0EF794 802CADE4 0C0B1EAF */ jal get_variable -/* 0EF798 802CADE8 0040982D */ daddu $s3, $v0, $zero -/* 0EF79C 802CADEC 0220202D */ daddu $a0, $s1, $zero -/* 0EF7A0 802CADF0 8E050000 */ lw $a1, ($s0) -/* 0EF7A4 802CADF4 0C0B1EAF */ jal get_variable -/* 0EF7A8 802CADF8 0040802D */ daddu $s0, $v0, $zero -/* 0EF7AC 802CADFC 3C05800B */ lui $a1, 0x800b -/* 0EF7B0 802CAE00 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0EF7B4 802CAE04 00121880 */ sll $v1, $s2, 2 -/* 0EF7B8 802CAE08 00721821 */ addu $v1, $v1, $s2 -/* 0EF7BC 802CAE0C 00031880 */ sll $v1, $v1, 2 -/* 0EF7C0 802CAE10 00721823 */ subu $v1, $v1, $s2 -/* 0EF7C4 802CAE14 000320C0 */ sll $a0, $v1, 3 -/* 0EF7C8 802CAE18 00641821 */ addu $v1, $v1, $a0 -/* 0EF7CC 802CAE1C 000318C0 */ sll $v1, $v1, 3 -/* 0EF7D0 802CAE20 00651821 */ addu $v1, $v1, $a1 -/* 0EF7D4 802CAE24 A4620030 */ sh $v0, 0x30($v1) -/* 0EF7D8 802CAE28 A473002C */ sh $s3, 0x2c($v1) -/* 0EF7DC 802CAE2C A470002E */ sh $s0, 0x2e($v1) -/* 0EF7E0 802CAE30 8FBF0020 */ lw $ra, 0x20($sp) -/* 0EF7E4 802CAE34 8FB3001C */ lw $s3, 0x1c($sp) -/* 0EF7E8 802CAE38 8FB20018 */ lw $s2, 0x18($sp) -/* 0EF7EC 802CAE3C 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF7F0 802CAE40 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF7F4 802CAE44 24020002 */ addiu $v0, $zero, 2 -/* 0EF7F8 802CAE48 03E00008 */ jr $ra -/* 0EF7FC 802CAE4C 27BD0028 */ addiu $sp, $sp, 0x28 - -/* 0EF800 802CAE50 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0EF804 802CAE54 AFB10014 */ sw $s1, 0x14($sp) -/* 0EF808 802CAE58 0080882D */ daddu $s1, $a0, $zero -/* 0EF80C 802CAE5C AFBF0020 */ sw $ra, 0x20($sp) -/* 0EF810 802CAE60 AFB3001C */ sw $s3, 0x1c($sp) -/* 0EF814 802CAE64 AFB20018 */ sw $s2, 0x18($sp) -/* 0EF818 802CAE68 AFB00010 */ sw $s0, 0x10($sp) -/* 0EF81C 802CAE6C 8E30000C */ lw $s0, 0xc($s1) -/* 0EF820 802CAE70 8E050000 */ lw $a1, ($s0) -/* 0EF824 802CAE74 0C0B1EAF */ jal get_variable -/* 0EF828 802CAE78 26100004 */ addiu $s0, $s0, 4 -/* 0EF82C 802CAE7C 8E050000 */ lw $a1, ($s0) -/* 0EF830 802CAE80 26100004 */ addiu $s0, $s0, 4 -/* 0EF834 802CAE84 0220202D */ daddu $a0, $s1, $zero -/* 0EF838 802CAE88 0C0B1EAF */ jal get_variable -/* 0EF83C 802CAE8C 0040902D */ daddu $s2, $v0, $zero -/* 0EF840 802CAE90 8E050000 */ lw $a1, ($s0) -/* 0EF844 802CAE94 26100004 */ addiu $s0, $s0, 4 -/* 0EF848 802CAE98 0220202D */ daddu $a0, $s1, $zero -/* 0EF84C 802CAE9C 0C0B1EAF */ jal get_variable -/* 0EF850 802CAEA0 0040982D */ daddu $s3, $v0, $zero -/* 0EF854 802CAEA4 0220202D */ daddu $a0, $s1, $zero -/* 0EF858 802CAEA8 8E050000 */ lw $a1, ($s0) -/* 0EF85C 802CAEAC 0C0B1EAF */ jal get_variable -/* 0EF860 802CAEB0 0040802D */ daddu $s0, $v0, $zero -/* 0EF864 802CAEB4 44821000 */ mtc1 $v0, $f2 -/* 0EF868 802CAEB8 00000000 */ nop -/* 0EF86C 802CAEBC 468010A0 */ cvt.s.w $f2, $f2 -/* 0EF870 802CAEC0 24020002 */ addiu $v0, $zero, 2 -/* 0EF874 802CAEC4 3C05800B */ lui $a1, 0x800b -/* 0EF878 802CAEC8 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0EF87C 802CAECC 00521804 */ sllv $v1, $s2, $v0 -/* 0EF880 802CAED0 00721821 */ addu $v1, $v1, $s2 -/* 0EF884 802CAED4 00431804 */ sllv $v1, $v1, $v0 -/* 0EF888 802CAED8 00721823 */ subu $v1, $v1, $s2 -/* 0EF88C 802CAEDC 000320C0 */ sll $a0, $v1, 3 -/* 0EF890 802CAEE0 00641821 */ addu $v1, $v1, $a0 -/* 0EF894 802CAEE4 000318C0 */ sll $v1, $v1, 3 -/* 0EF898 802CAEE8 00651821 */ addu $v1, $v1, $a1 -/* 0EF89C 802CAEEC 44930000 */ mtc1 $s3, $f0 -/* 0EF8A0 802CAEF0 00000000 */ nop -/* 0EF8A4 802CAEF4 46800020 */ cvt.s.w $f0, $f0 -/* 0EF8A8 802CAEF8 E4600054 */ swc1 $f0, 0x54($v1) -/* 0EF8AC 802CAEFC 44900000 */ mtc1 $s0, $f0 -/* 0EF8B0 802CAF00 00000000 */ nop -/* 0EF8B4 802CAF04 46800020 */ cvt.s.w $f0, $f0 -/* 0EF8B8 802CAF08 E4600058 */ swc1 $f0, 0x58($v1) -/* 0EF8BC 802CAF0C E462005C */ swc1 $f2, 0x5c($v1) -/* 0EF8C0 802CAF10 8FBF0020 */ lw $ra, 0x20($sp) -/* 0EF8C4 802CAF14 8FB3001C */ lw $s3, 0x1c($sp) -/* 0EF8C8 802CAF18 8FB20018 */ lw $s2, 0x18($sp) -/* 0EF8CC 802CAF1C 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF8D0 802CAF20 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF8D4 802CAF24 03E00008 */ jr $ra -/* 0EF8D8 802CAF28 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamLeadPlayer.s b/asm/nonmatchings/code_ef070_len_3400/SetCamLeadPlayer.s deleted file mode 100644 index c1ec961634..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamLeadPlayer.s +++ /dev/null @@ -1,81 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamLeadPlayer -/* 0F0030 802CB680 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F0034 802CB684 AFB10014 */ sw $s1, 0x14($sp) -/* 0F0038 802CB688 0080882D */ daddu $s1, $a0, $zero -/* 0F003C 802CB68C AFBF0018 */ sw $ra, 0x18($sp) -/* 0F0040 802CB690 AFB00010 */ sw $s0, 0x10($sp) -/* 0F0044 802CB694 8E30000C */ lw $s0, 0xc($s1) -/* 0F0048 802CB698 8E050000 */ lw $a1, ($s0) -/* 0F004C 802CB69C 0C0B1EAF */ jal get_variable -/* 0F0050 802CB6A0 26100004 */ addiu $s0, $s0, 4 -/* 0F0054 802CB6A4 0220202D */ daddu $a0, $s1, $zero -/* 0F0058 802CB6A8 8E050000 */ lw $a1, ($s0) -/* 0F005C 802CB6AC 0C0B1EAF */ jal get_variable -/* 0F0060 802CB6B0 0040802D */ daddu $s0, $v0, $zero -/* 0F0064 802CB6B4 3C05800B */ lui $a1, 0x800b -/* 0F0068 802CB6B8 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0F006C 802CB6BC 00101880 */ sll $v1, $s0, 2 -/* 0F0070 802CB6C0 00701821 */ addu $v1, $v1, $s0 -/* 0F0074 802CB6C4 00031880 */ sll $v1, $v1, 2 -/* 0F0078 802CB6C8 00701823 */ subu $v1, $v1, $s0 -/* 0F007C 802CB6CC 000320C0 */ sll $a0, $v1, 3 -/* 0F0080 802CB6D0 00641821 */ addu $v1, $v1, $a0 -/* 0F0084 802CB6D4 000318C0 */ sll $v1, $v1, 3 -/* 0F0088 802CB6D8 10400004 */ beqz $v0, .L802CB6EC -/* 0F008C 802CB6DC 00651821 */ addu $v1, $v1, $a1 -/* 0F0090 802CB6E0 94620000 */ lhu $v0, ($v1) -/* 0F0094 802CB6E4 080B2DBD */ j .L802CB6F4 -/* 0F0098 802CB6E8 34420004 */ ori $v0, $v0, 4 - -.L802CB6EC: -/* 0F009C 802CB6EC 94620000 */ lhu $v0, ($v1) -/* 0F00A0 802CB6F0 3042FFFB */ andi $v0, $v0, 0xfffb -.L802CB6F4: -/* 0F00A4 802CB6F4 A4620000 */ sh $v0, ($v1) -/* 0F00A8 802CB6F8 8FBF0018 */ lw $ra, 0x18($sp) -/* 0F00AC 802CB6FC 8FB10014 */ lw $s1, 0x14($sp) -/* 0F00B0 802CB700 8FB00010 */ lw $s0, 0x10($sp) -/* 0F00B4 802CB704 24020002 */ addiu $v0, $zero, 2 -/* 0F00B8 802CB708 03E00008 */ jr $ra -/* 0F00BC 802CB70C 27BD0020 */ addiu $sp, $sp, 0x20 - -/* 0F00C0 802CB710 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F00C4 802CB714 AFB10014 */ sw $s1, 0x14($sp) -/* 0F00C8 802CB718 0080882D */ daddu $s1, $a0, $zero -/* 0F00CC 802CB71C AFBF0018 */ sw $ra, 0x18($sp) -/* 0F00D0 802CB720 AFB00010 */ sw $s0, 0x10($sp) -/* 0F00D4 802CB724 8E30000C */ lw $s0, 0xc($s1) -/* 0F00D8 802CB728 8E050000 */ lw $a1, ($s0) -/* 0F00DC 802CB72C 0C0B1EAF */ jal get_variable -/* 0F00E0 802CB730 26100004 */ addiu $s0, $s0, 4 -/* 0F00E4 802CB734 0220202D */ daddu $a0, $s1, $zero -/* 0F00E8 802CB738 8E050000 */ lw $a1, ($s0) -/* 0F00EC 802CB73C 0C0B1EAF */ jal get_variable -/* 0F00F0 802CB740 0040802D */ daddu $s0, $v0, $zero -/* 0F00F4 802CB744 44821000 */ mtc1 $v0, $f2 -/* 0F00F8 802CB748 00000000 */ nop -/* 0F00FC 802CB74C 468010A0 */ cvt.s.w $f2, $f2 -/* 0F0100 802CB750 24020002 */ addiu $v0, $zero, 2 -/* 0F0104 802CB754 00501804 */ sllv $v1, $s0, $v0 -/* 0F0108 802CB758 00701821 */ addu $v1, $v1, $s0 -/* 0F010C 802CB75C 00431804 */ sllv $v1, $v1, $v0 -/* 0F0110 802CB760 00701823 */ subu $v1, $v1, $s0 -/* 0F0114 802CB764 000320C0 */ sll $a0, $v1, 3 -/* 0F0118 802CB768 00641821 */ addu $v1, $v1, $a0 -/* 0F011C 802CB76C 3C0142C8 */ lui $at, 0x42c8 -/* 0F0120 802CB770 44810000 */ mtc1 $at, $f0 -/* 0F0124 802CB774 000318C0 */ sll $v1, $v1, 3 -/* 0F0128 802CB778 46001083 */ div.s $f2, $f2, $f0 -/* 0F012C 802CB77C 3C01800B */ lui $at, 0x800b -/* 0F0130 802CB780 00230821 */ addu $at, $at, $v1 -/* 0F0134 802CB784 E42222A0 */ swc1 $f2, 0x22a0($at) -/* 0F0138 802CB788 8FBF0018 */ lw $ra, 0x18($sp) -/* 0F013C 802CB78C 8FB10014 */ lw $s1, 0x14($sp) -/* 0F0140 802CB790 8FB00010 */ lw $s0, 0x10($sp) -/* 0F0144 802CB794 03E00008 */ jr $ra -/* 0F0148 802CB798 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamViewport.s b/asm/nonmatchings/code_ef070_len_3400/SetCamViewport.s deleted file mode 100644 index 070fff8387..0000000000 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamViewport.s +++ /dev/null @@ -1,168 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetCamViewport -/* 0EF4C8 802CAB18 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 0EF4CC 802CAB1C AFB1001C */ sw $s1, 0x1c($sp) -/* 0EF4D0 802CAB20 0080882D */ daddu $s1, $a0, $zero -/* 0EF4D4 802CAB24 AFBF002C */ sw $ra, 0x2c($sp) -/* 0EF4D8 802CAB28 AFB40028 */ sw $s4, 0x28($sp) -/* 0EF4DC 802CAB2C AFB30024 */ sw $s3, 0x24($sp) -/* 0EF4E0 802CAB30 AFB20020 */ sw $s2, 0x20($sp) -/* 0EF4E4 802CAB34 AFB00018 */ sw $s0, 0x18($sp) -/* 0EF4E8 802CAB38 8E30000C */ lw $s0, 0xc($s1) -/* 0EF4EC 802CAB3C 8E050000 */ lw $a1, ($s0) -/* 0EF4F0 802CAB40 0C0B1EAF */ jal get_variable -/* 0EF4F4 802CAB44 26100004 */ addiu $s0, $s0, 4 -/* 0EF4F8 802CAB48 8E050000 */ lw $a1, ($s0) -/* 0EF4FC 802CAB4C 26100004 */ addiu $s0, $s0, 4 -/* 0EF500 802CAB50 0220202D */ daddu $a0, $s1, $zero -/* 0EF504 802CAB54 0C0B1EAF */ jal get_variable -/* 0EF508 802CAB58 0040A02D */ daddu $s4, $v0, $zero -/* 0EF50C 802CAB5C 8E050000 */ lw $a1, ($s0) -/* 0EF510 802CAB60 26100004 */ addiu $s0, $s0, 4 -/* 0EF514 802CAB64 0220202D */ daddu $a0, $s1, $zero -/* 0EF518 802CAB68 0C0B1EAF */ jal get_variable -/* 0EF51C 802CAB6C 0040902D */ daddu $s2, $v0, $zero -/* 0EF520 802CAB70 8E050000 */ lw $a1, ($s0) -/* 0EF524 802CAB74 26100004 */ addiu $s0, $s0, 4 -/* 0EF528 802CAB78 0220202D */ daddu $a0, $s1, $zero -/* 0EF52C 802CAB7C 0C0B1EAF */ jal get_variable -/* 0EF530 802CAB80 0040982D */ daddu $s3, $v0, $zero -/* 0EF534 802CAB84 0220202D */ daddu $a0, $s1, $zero -/* 0EF538 802CAB88 8E050000 */ lw $a1, ($s0) -/* 0EF53C 802CAB8C 0C0B1EAF */ jal get_variable -/* 0EF540 802CAB90 0040802D */ daddu $s0, $v0, $zero -/* 0EF544 802CAB94 0014A400 */ sll $s4, $s4, 0x10 -/* 0EF548 802CAB98 00142403 */ sra $a0, $s4, 0x10 -/* 0EF54C 802CAB9C 00129400 */ sll $s2, $s2, 0x10 -/* 0EF550 802CABA0 00122C03 */ sra $a1, $s2, 0x10 -/* 0EF554 802CABA4 00021400 */ sll $v0, $v0, 0x10 -/* 0EF558 802CABA8 00021403 */ sra $v0, $v0, 0x10 -/* 0EF55C 802CABAC 00139C00 */ sll $s3, $s3, 0x10 -/* 0EF560 802CABB0 00108400 */ sll $s0, $s0, 0x10 -/* 0EF564 802CABB4 00133403 */ sra $a2, $s3, 0x10 -/* 0EF568 802CABB8 00103C03 */ sra $a3, $s0, 0x10 -/* 0EF56C 802CABBC 0C00B8C5 */ jal set_cam_viewport -/* 0EF570 802CABC0 AFA20010 */ sw $v0, 0x10($sp) -/* 0EF574 802CABC4 8FBF002C */ lw $ra, 0x2c($sp) -/* 0EF578 802CABC8 8FB40028 */ lw $s4, 0x28($sp) -/* 0EF57C 802CABCC 8FB30024 */ lw $s3, 0x24($sp) -/* 0EF580 802CABD0 8FB20020 */ lw $s2, 0x20($sp) -/* 0EF584 802CABD4 8FB1001C */ lw $s1, 0x1c($sp) -/* 0EF588 802CABD8 8FB00018 */ lw $s0, 0x18($sp) -/* 0EF58C 802CABDC 24020002 */ addiu $v0, $zero, 2 -/* 0EF590 802CABE0 03E00008 */ jr $ra -/* 0EF594 802CABE4 27BD0030 */ addiu $sp, $sp, 0x30 - -/* 0EF598 802CABE8 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0EF59C 802CABEC AFB10014 */ sw $s1, 0x14($sp) -/* 0EF5A0 802CABF0 0080882D */ daddu $s1, $a0, $zero -/* 0EF5A4 802CABF4 AFBF0024 */ sw $ra, 0x24($sp) -/* 0EF5A8 802CABF8 AFB40020 */ sw $s4, 0x20($sp) -/* 0EF5AC 802CABFC AFB3001C */ sw $s3, 0x1c($sp) -/* 0EF5B0 802CAC00 AFB20018 */ sw $s2, 0x18($sp) -/* 0EF5B4 802CAC04 AFB00010 */ sw $s0, 0x10($sp) -/* 0EF5B8 802CAC08 8E30000C */ lw $s0, 0xc($s1) -/* 0EF5BC 802CAC0C 8E050000 */ lw $a1, ($s0) -/* 0EF5C0 802CAC10 0C0B1EAF */ jal get_variable -/* 0EF5C4 802CAC14 26100004 */ addiu $s0, $s0, 4 -/* 0EF5C8 802CAC18 8E050000 */ lw $a1, ($s0) -/* 0EF5CC 802CAC1C 26100004 */ addiu $s0, $s0, 4 -/* 0EF5D0 802CAC20 0220202D */ daddu $a0, $s1, $zero -/* 0EF5D4 802CAC24 0C0B1EAF */ jal get_variable -/* 0EF5D8 802CAC28 0040902D */ daddu $s2, $v0, $zero -/* 0EF5DC 802CAC2C 8E050000 */ lw $a1, ($s0) -/* 0EF5E0 802CAC30 26100004 */ addiu $s0, $s0, 4 -/* 0EF5E4 802CAC34 0220202D */ daddu $a0, $s1, $zero -/* 0EF5E8 802CAC38 0C0B1EAF */ jal get_variable -/* 0EF5EC 802CAC3C 0040A02D */ daddu $s4, $v0, $zero -/* 0EF5F0 802CAC40 8E050000 */ lw $a1, ($s0) -/* 0EF5F4 802CAC44 26100004 */ addiu $s0, $s0, 4 -/* 0EF5F8 802CAC48 0220202D */ daddu $a0, $s1, $zero -/* 0EF5FC 802CAC4C 0C0B1EAF */ jal get_variable -/* 0EF600 802CAC50 0040982D */ daddu $s3, $v0, $zero -/* 0EF604 802CAC54 0220202D */ daddu $a0, $s1, $zero -/* 0EF608 802CAC58 8E050000 */ lw $a1, ($s0) -/* 0EF60C 802CAC5C 0C0B1EAF */ jal get_variable -/* 0EF610 802CAC60 0040802D */ daddu $s0, $v0, $zero -/* 0EF614 802CAC64 3C05800B */ lui $a1, 0x800b -/* 0EF618 802CAC68 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0EF61C 802CAC6C 00121880 */ sll $v1, $s2, 2 -/* 0EF620 802CAC70 00721821 */ addu $v1, $v1, $s2 -/* 0EF624 802CAC74 00031880 */ sll $v1, $v1, 2 -/* 0EF628 802CAC78 00721823 */ subu $v1, $v1, $s2 -/* 0EF62C 802CAC7C 000320C0 */ sll $a0, $v1, 3 -/* 0EF630 802CAC80 00641821 */ addu $v1, $v1, $a0 -/* 0EF634 802CAC84 000318C0 */ sll $v1, $v1, 3 -/* 0EF638 802CAC88 00651821 */ addu $v1, $v1, $a1 -/* 0EF63C 802CAC8C A4620022 */ sh $v0, 0x22($v1) -/* 0EF640 802CAC90 A474001C */ sh $s4, 0x1c($v1) -/* 0EF644 802CAC94 A473001E */ sh $s3, 0x1e($v1) -/* 0EF648 802CAC98 A4700020 */ sh $s0, 0x20($v1) -/* 0EF64C 802CAC9C 8FBF0024 */ lw $ra, 0x24($sp) -/* 0EF650 802CACA0 8FB40020 */ lw $s4, 0x20($sp) -/* 0EF654 802CACA4 8FB3001C */ lw $s3, 0x1c($sp) -/* 0EF658 802CACA8 8FB20018 */ lw $s2, 0x18($sp) -/* 0EF65C 802CACAC 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF660 802CACB0 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF664 802CACB4 24020002 */ addiu $v0, $zero, 2 -/* 0EF668 802CACB8 03E00008 */ jr $ra -/* 0EF66C 802CACBC 27BD0028 */ addiu $sp, $sp, 0x28 - -/* 0EF670 802CACC0 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0EF674 802CACC4 AFB10014 */ sw $s1, 0x14($sp) -/* 0EF678 802CACC8 0080882D */ daddu $s1, $a0, $zero -/* 0EF67C 802CACCC AFBF0024 */ sw $ra, 0x24($sp) -/* 0EF680 802CACD0 AFB40020 */ sw $s4, 0x20($sp) -/* 0EF684 802CACD4 AFB3001C */ sw $s3, 0x1c($sp) -/* 0EF688 802CACD8 AFB20018 */ sw $s2, 0x18($sp) -/* 0EF68C 802CACDC AFB00010 */ sw $s0, 0x10($sp) -/* 0EF690 802CACE0 8E30000C */ lw $s0, 0xc($s1) -/* 0EF694 802CACE4 8E050000 */ lw $a1, ($s0) -/* 0EF698 802CACE8 0C0B1EAF */ jal get_variable -/* 0EF69C 802CACEC 26100004 */ addiu $s0, $s0, 4 -/* 0EF6A0 802CACF0 8E050000 */ lw $a1, ($s0) -/* 0EF6A4 802CACF4 26100004 */ addiu $s0, $s0, 4 -/* 0EF6A8 802CACF8 0220202D */ daddu $a0, $s1, $zero -/* 0EF6AC 802CACFC 0C0B1EAF */ jal get_variable -/* 0EF6B0 802CAD00 0040902D */ daddu $s2, $v0, $zero -/* 0EF6B4 802CAD04 8E050000 */ lw $a1, ($s0) -/* 0EF6B8 802CAD08 26100004 */ addiu $s0, $s0, 4 -/* 0EF6BC 802CAD0C 0220202D */ daddu $a0, $s1, $zero -/* 0EF6C0 802CAD10 0C0B1EAF */ jal get_variable -/* 0EF6C4 802CAD14 0040A02D */ daddu $s4, $v0, $zero -/* 0EF6C8 802CAD18 8E050000 */ lw $a1, ($s0) -/* 0EF6CC 802CAD1C 26100004 */ addiu $s0, $s0, 4 -/* 0EF6D0 802CAD20 0220202D */ daddu $a0, $s1, $zero -/* 0EF6D4 802CAD24 0C0B1EAF */ jal get_variable -/* 0EF6D8 802CAD28 0040982D */ daddu $s3, $v0, $zero -/* 0EF6DC 802CAD2C 0220202D */ daddu $a0, $s1, $zero -/* 0EF6E0 802CAD30 8E050000 */ lw $a1, ($s0) -/* 0EF6E4 802CAD34 0C0B1EAF */ jal get_variable -/* 0EF6E8 802CAD38 0040802D */ daddu $s0, $v0, $zero -/* 0EF6EC 802CAD3C 3C05800B */ lui $a1, 0x800b -/* 0EF6F0 802CAD40 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0EF6F4 802CAD44 00121880 */ sll $v1, $s2, 2 -/* 0EF6F8 802CAD48 00721821 */ addu $v1, $v1, $s2 -/* 0EF6FC 802CAD4C 00031880 */ sll $v1, $v1, 2 -/* 0EF700 802CAD50 00721823 */ subu $v1, $v1, $s2 -/* 0EF704 802CAD54 000320C0 */ sll $a0, $v1, 3 -/* 0EF708 802CAD58 00641821 */ addu $v1, $v1, $a0 -/* 0EF70C 802CAD5C 000318C0 */ sll $v1, $v1, 3 -/* 0EF710 802CAD60 00651821 */ addu $v1, $v1, $a1 -/* 0EF714 802CAD64 A462002A */ sh $v0, 0x2a($v1) -/* 0EF718 802CAD68 A4740024 */ sh $s4, 0x24($v1) -/* 0EF71C 802CAD6C A4730026 */ sh $s3, 0x26($v1) -/* 0EF720 802CAD70 A4700028 */ sh $s0, 0x28($v1) -/* 0EF724 802CAD74 8FBF0024 */ lw $ra, 0x24($sp) -/* 0EF728 802CAD78 8FB40020 */ lw $s4, 0x20($sp) -/* 0EF72C 802CAD7C 8FB3001C */ lw $s3, 0x1c($sp) -/* 0EF730 802CAD80 8FB20018 */ lw $s2, 0x18($sp) -/* 0EF734 802CAD84 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF738 802CAD88 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF73C 802CAD8C 24020002 */ addiu $v0, $zero, 2 -/* 0EF740 802CAD90 03E00008 */ jr $ra -/* 0EF744 802CAD94 27BD0028 */ addiu $sp, $sp, 0x28 - diff --git a/asm/nonmatchings/code_ef070_len_3400/SetCamTarget.s b/asm/nonmatchings/code_ef070_len_3400/func_802CB008.s similarity index 75% rename from asm/nonmatchings/code_ef070_len_3400/SetCamTarget.s rename to asm/nonmatchings/code_ef070_len_3400/func_802CB008.s index 88e8d142ce..4264123b05 100644 --- a/asm/nonmatchings/code_ef070_len_3400/SetCamTarget.s +++ b/asm/nonmatchings/code_ef070_len_3400/func_802CB008.s @@ -2,63 +2,7 @@ .set noreorder # don't insert nops after branches -glabel SetCamTarget -/* 0EF8DC 802CAF2C 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0EF8E0 802CAF30 AFB10014 */ sw $s1, 0x14($sp) -/* 0EF8E4 802CAF34 0080882D */ daddu $s1, $a0, $zero -/* 0EF8E8 802CAF38 AFBF0020 */ sw $ra, 0x20($sp) -/* 0EF8EC 802CAF3C AFB3001C */ sw $s3, 0x1c($sp) -/* 0EF8F0 802CAF40 AFB20018 */ sw $s2, 0x18($sp) -/* 0EF8F4 802CAF44 AFB00010 */ sw $s0, 0x10($sp) -/* 0EF8F8 802CAF48 8E30000C */ lw $s0, 0xc($s1) -/* 0EF8FC 802CAF4C 8E050000 */ lw $a1, ($s0) -/* 0EF900 802CAF50 0C0B1EAF */ jal get_variable -/* 0EF904 802CAF54 26100004 */ addiu $s0, $s0, 4 -/* 0EF908 802CAF58 8E050000 */ lw $a1, ($s0) -/* 0EF90C 802CAF5C 26100004 */ addiu $s0, $s0, 4 -/* 0EF910 802CAF60 0220202D */ daddu $a0, $s1, $zero -/* 0EF914 802CAF64 0C0B1EAF */ jal get_variable -/* 0EF918 802CAF68 0040902D */ daddu $s2, $v0, $zero -/* 0EF91C 802CAF6C 8E050000 */ lw $a1, ($s0) -/* 0EF920 802CAF70 26100004 */ addiu $s0, $s0, 4 -/* 0EF924 802CAF74 0220202D */ daddu $a0, $s1, $zero -/* 0EF928 802CAF78 0C0B1EAF */ jal get_variable -/* 0EF92C 802CAF7C 0040982D */ daddu $s3, $v0, $zero -/* 0EF930 802CAF80 0220202D */ daddu $a0, $s1, $zero -/* 0EF934 802CAF84 8E050000 */ lw $a1, ($s0) -/* 0EF938 802CAF88 0C0B1EAF */ jal get_variable -/* 0EF93C 802CAF8C 0040802D */ daddu $s0, $v0, $zero -/* 0EF940 802CAF90 44821000 */ mtc1 $v0, $f2 -/* 0EF944 802CAF94 00000000 */ nop -/* 0EF948 802CAF98 468010A0 */ cvt.s.w $f2, $f2 -/* 0EF94C 802CAF9C 24020002 */ addiu $v0, $zero, 2 -/* 0EF950 802CAFA0 3C05800B */ lui $a1, 0x800b -/* 0EF954 802CAFA4 24A51D80 */ addiu $a1, $a1, 0x1d80 -/* 0EF958 802CAFA8 00521804 */ sllv $v1, $s2, $v0 -/* 0EF95C 802CAFAC 00721821 */ addu $v1, $v1, $s2 -/* 0EF960 802CAFB0 00431804 */ sllv $v1, $v1, $v0 -/* 0EF964 802CAFB4 00721823 */ subu $v1, $v1, $s2 -/* 0EF968 802CAFB8 000320C0 */ sll $a0, $v1, 3 -/* 0EF96C 802CAFBC 00641821 */ addu $v1, $v1, $a0 -/* 0EF970 802CAFC0 000318C0 */ sll $v1, $v1, 3 -/* 0EF974 802CAFC4 00651821 */ addu $v1, $v1, $a1 -/* 0EF978 802CAFC8 44930000 */ mtc1 $s3, $f0 -/* 0EF97C 802CAFCC 00000000 */ nop -/* 0EF980 802CAFD0 46800020 */ cvt.s.w $f0, $f0 -/* 0EF984 802CAFD4 E4600060 */ swc1 $f0, 0x60($v1) -/* 0EF988 802CAFD8 44900000 */ mtc1 $s0, $f0 -/* 0EF98C 802CAFDC 00000000 */ nop -/* 0EF990 802CAFE0 46800020 */ cvt.s.w $f0, $f0 -/* 0EF994 802CAFE4 E4600064 */ swc1 $f0, 0x64($v1) -/* 0EF998 802CAFE8 E4620068 */ swc1 $f2, 0x68($v1) -/* 0EF99C 802CAFEC 8FBF0020 */ lw $ra, 0x20($sp) -/* 0EF9A0 802CAFF0 8FB3001C */ lw $s3, 0x1c($sp) -/* 0EF9A4 802CAFF4 8FB20018 */ lw $s2, 0x18($sp) -/* 0EF9A8 802CAFF8 8FB10014 */ lw $s1, 0x14($sp) -/* 0EF9AC 802CAFFC 8FB00010 */ lw $s0, 0x10($sp) -/* 0EF9B0 802CB000 03E00008 */ jr $ra -/* 0EF9B4 802CB004 27BD0028 */ addiu $sp, $sp, 0x28 - +glabel func_802CB008 /* 0EF9B8 802CB008 27BDFFD0 */ addiu $sp, $sp, -0x30 /* 0EF9BC 802CB00C AFB3001C */ sw $s3, 0x1c($sp) /* 0EF9C0 802CB010 0080982D */ daddu $s3, $a0, $zero @@ -241,4 +185,3 @@ glabel SetCamTarget /* 0EFC4C 802CB29C 8FB00010 */ lw $s0, 0x10($sp) /* 0EFC50 802CB2A0 03E00008 */ jr $ra /* 0EFC54 802CB2A4 27BD0030 */ addiu $sp, $sp, 0x30 - diff --git a/include/common_structs.h b/include/common_structs.h index 12258170b1..7cb7b99837 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -432,7 +432,9 @@ typedef struct Camera { /* 0x01E */ s16 unk_1E; /* 0x020 */ s16 unk_20; /* 0x022 */ s16 unk_22; - /* 0x024 */ char unk_24[6]; + /* 0x024 */ s16 unk_24; + /* 0x026 */ s16 unk_26; + /* 0x028 */ s16 unk_28; /* 0x02A */ s16 zoomPercent; /* 0x02C */ s16 backgroundColor[3]; /* 0x032 */ s16 targetScreenCoords[3]; @@ -481,9 +483,11 @@ typedef struct Camera { /* 0x500 */ s32 unk_500; /* 0x504 */ s16 boolTargetPlayer; /* 0x506 */ u16 unk_506; - /* 0x508 */ s32 panPhase; + /* 0x508 */ f32 panPhase; /* 0x50C */ f32 leadAmount; - /* 0x510 */ char unk_510[36]; + /* 0x510 */ char unk_510[16]; + /* 0x520 */ f32 unk_520; + /* 0x524 */ char unk_524[16]; /* 0x534 */ struct ColliderBoundingBox* aabbForZoneBelow; /* 0x538 */ char unk_538[32]; } Camera; // size = 0x558 diff --git a/include/functions.h b/include/functions.h index 69350a9b51..9f0b5809b1 100644 --- a/include/functions.h +++ b/include/functions.h @@ -32,6 +32,8 @@ void sort_items(void); s32 is_ability_active(s32 arg0); f32 update_lerp(Easing easing, f32 start, f32 end, s32 elapsed, s32 duration); +void set_cam_viewport(s16 id, s16 x, s16 y, s16 width, s16 height); + Npc* get_npc_safe(NpcId npcId); Npc* get_npc_unsafe(NpcId npcId); Npc* resolve_npc(ScriptInstance* script, NpcId npcIdOrPtr); diff --git a/src/code_8230_len_1ae0.c b/src/code_8230_len_1ae0.c index 0302de68b9..2dd7d3ef03 100644 --- a/src/code_8230_len_1ae0.c +++ b/src/code_8230_len_1ae0.c @@ -22,7 +22,7 @@ INCLUDE_ASM("code_8230_len_1ae0", create_cameras_b); INCLUDE_ASM("code_8230_len_1ae0", initialize_next_camera); -INCLUDE_ASM("code_8230_len_1ae0", set_cam_viewport); +void INCLUDE_ASM("code_8230_len_1ae0", set_cam_viewport, s16 id, s16 x, s16 y, s16 width, s16 height); INCLUDE_ASM("code_8230_len_1ae0", get_cam_viewport); diff --git a/src/code_ef070_len_3400.c b/src/code_ef070_len_3400.c index b4ad50688b..bd8424d1f0 100644 --- a/src/code_ef070_len_3400.c +++ b/src/code_ef070_len_3400.c @@ -96,11 +96,98 @@ ApiStatus func_802CA988(ScriptInstance* script, s32 isInitialCall) { } */ -INCLUDE_API_ASM("code_ef070_len_3400", SetCamViewport); +ApiStatus SetCamViewport(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s32 x = get_variable(script, *args++); + s32 y = get_variable(script, *args++); + s16 width = get_variable(script, *args++); + s16 height = get_variable(script, *args++); -INCLUDE_API_ASM("code_ef070_len_3400", SetCamBGColor); + set_cam_viewport(id, x, y, width, height); + return ApiStatus_DONE2; +} -INCLUDE_API_ASM("code_ef070_len_3400", SetCamTarget); +ApiStatus func_802CABE8(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s16 value1 = get_variable(script, *args++); + s32 value2 = get_variable(script, *args++); + s32 value3 = get_variable(script, *args++); + s16 value4 = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + camera->unk_22 = value4; + camera->unk_1C = value1; + camera->unk_1E = value2; + camera->unk_20 = value3; + return ApiStatus_DONE2; +} + +ApiStatus func_802CACC0(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s16 value1 = get_variable(script, *args++); + s32 value2 = get_variable(script, *args++); + s32 value3 = get_variable(script, *args++); + s16 zoomPercent = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + camera->zoomPercent = zoomPercent; + camera->unk_24 = value1; + camera->unk_26 = value2; + camera->unk_28 = value3; + return ApiStatus_DONE2; +} + +ApiStatus SetCamBGColor(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s16 r = get_variable(script, *args++); + s16 g = get_variable(script, *args++); + s16 b = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + camera->backgroundColor[0] = r; + camera->backgroundColor[1] = g; + camera->backgroundColor[2] = b; + return ApiStatus_DONE2; +} + +ApiStatus func_802CAE50(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s32 value1 = get_variable(script, *args++); + s32 value2 = get_variable(script, *args++); + s32 value3 = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + camera->unk_54 = value1; + camera->unk_58 = value2; + camera->unk_5C = value3; + return ApiStatus_DONE2; +} + +ApiStatus SetCamTarget(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s32 x = get_variable(script, *args++); + s32 y = get_variable(script, *args++); + s32 z = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + camera->targetPos.x = x; + camera->targetPos.y = y; + camera->targetPos.z = z; + return ApiStatus_DONE2; +} + +INCLUDE_API_ASM("code_ef070_len_3400", func_802CB008); INCLUDE_API_ASM("code_ef070_len_3400", ShakeCam); @@ -108,9 +195,51 @@ INCLUDE_ASM("code_ef070_len_3400", exec_ShakeCam1); INCLUDE_ASM("code_ef070_len_3400", exec_ShakeCamX); -INCLUDE_API_ASM("code_ef070_len_3400", SetCamLeadPlayer); +ApiStatus SetCamLeadPlayer(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + s32 enabled = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; -INCLUDE_API_ASM("code_ef070_len_3400", PanToTarget); + if (enabled) { + camera->flags |= 0x4; + } else { + camera->flags &= ~0x4; + } + return ApiStatus_DONE2; +} + +ApiStatus func_802CB710(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + f32 value = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + camera->unk_520 = (value / 100.0f); + return ApiStatus_DONE2; +} + +ApiStatus PanToTarget(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + s32 id = get_variable(script, *args++); + f32 panPhase = get_float_variable(script, *args++); + s32 targetType = get_variable(script, *args++); + Camera* cameras = &gCameras; + Camera* camera = &cameras[id]; + + camera->unk_506 = 1; + if (targetType != 0) { + camera->boolTargetPlayer = 1; + camera->panPhase = panPhase; + } else { + camera->boolTargetPlayer = 0; + camera->panPhase = 0.0f; + camera->moveSpeed = 1.0f; + } + return ApiStatus_DONE2; +} INCLUDE_API_ASM("code_ef070_len_3400", UseSettingsFrom); From 002b75f4616f0383441ed4c636571530835755cb Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Fri, 21 Aug 2020 23:32:59 -0400 Subject: [PATCH 8/8] Data support --- include/variables.h | 2 -- papermario.ld | 2 ++ src/code_dc470_len_14c0.c | 4 ++++ tools/n64splat | 2 +- tools/splat.yaml | 2 ++ undefined_syms.txt | 3 --- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/variables.h b/include/variables.h index 2c39320eb9..e6268a34c3 100644 --- a/include/variables.h +++ b/include/variables.h @@ -49,8 +49,6 @@ extern s16* D_80151328; extern s16 D_8010CD10; extern s16 D_8010CD12; extern s32 D_801595A0; -extern char gCloudyFlowerFieldsBg[]; // "fla_bg" -extern char gSunnyFlowerFieldsBg[]; // "flb_bg" extern BackgroundHeader gBackgroundImage; extern s8 D_8014F12F; diff --git a/papermario.ld b/papermario.ld index 5c6a12d2ef..f0219f9fb1 100644 --- a/papermario.ld +++ b/papermario.ld @@ -210,6 +210,8 @@ SECTIONS build/src/code_de740_len_23f0.o(.text); build/src/code_e0b30_len_b80.o(.text); build/bin/code_E16B0.o(.data); + build/src/code_dc470_len_14c0.o(.data); + build/bin/code_E5830.o(.data); } /* 0x802C3000 E79B0-FEE30 (len 17480) */ diff --git a/src/code_dc470_len_14c0.c b/src/code_dc470_len_14c0.c index fd520fcead..06fd1ada3c 100644 --- a/src/code_dc470_len_14c0.c +++ b/src/code_dc470_len_14c0.c @@ -1,5 +1,9 @@ #include "common.h" +char gCloudyFlowerFieldsBg[] = "fla_bg"; +char gSunnyFlowerFieldsBg[] = "flb_bg"; +s8 D_8014F12F = 0; + void load_map_bg(char* optAssetName) { UNK_PTR compressedData; u32 assetSize; diff --git a/tools/n64splat b/tools/n64splat index 976e90983e..1a525eafd7 160000 --- a/tools/n64splat +++ b/tools/n64splat @@ -1 +1 @@ -Subproject commit 976e90983e073b575a85294afcab39494012221c +Subproject commit 1a525eafd798840e3b1d8bb7d543aa26d3014a3d diff --git a/tools/splat.yaml b/tools/splat.yaml index a5884cb519..958b6a4476 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -219,6 +219,8 @@ segments: - [0xde740, "c", "code_de740_len_23f0"] - [0xe0b30, "c", "code_e0b30_len_b80"] - [0xe16b0, "bin"] + - [0xE5820, ".data", "code_dc470_len_14c0"] + - [0xE5830, "bin"] - name: code type: code start: 0xE79B0 diff --git a/undefined_syms.txt b/undefined_syms.txt index 0d342669f7..b0030357e7 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -60,9 +60,6 @@ D_00316D90 = 0x00316D90; D_00316F30 = 0x00316F30; D_8010D000 = 0x8010D000; -gCloudyFlowerFieldsBg = 0x8014F120; -gSunnyFlowerFieldsBg = 0x8014F128; -D_8014F12F = 0x8014F12F; D_8014F140 = 0x8014F140; D_80151308 = 0x80151308; D_80151328 = 0x80151328;