From 177a9f0fe6c29455a879c22485494ccf0854040f Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 21 Aug 2020 08:04:57 -0700 Subject: [PATCH] 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);