Merge pull request #67 from ethteck/in-progress

Assorted goodies
This commit is contained in:
Ethan Roseman 2020-10-14 16:15:04 -04:00 committed by GitHub
commit ceec9c2a2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 141 additions and 2625 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ ctx.c
expected/
# Build artifacts
*.ld
*.z64
*.bin
bin/

View File

@ -59,7 +59,7 @@ default: all
LD_SCRIPT = $(TARGET).ld
all: $(BUILD_DIR) $(TARGET).z64 verify
all: $(TARGET).ld $(BUILD_DIR) $(TARGET).z64 verify
clean:
rm -rf $(BUILD_DIR) $(TARGET).z64
@ -70,6 +70,9 @@ submodules:
split:
rm -rf $(DATA_DIRS) && ./tools/n64splat/split.py baserom.z64 tools/splat.yaml . --modes ld bin
$(TARGET).ld: tools/splat.yaml
./tools/n64splat/split.py baserom.z64 tools/splat.yaml . --modes ld
setup: clean submodules split
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true
@ -100,4 +103,4 @@ $(TARGET).z64: $(BUILD_DIR)/$(TARGET).bin
verify: $(TARGET).z64
sha1sum -c checksum.sha1
.PHONY: all clean default diff test
.PHONY: all clean default

View File

@ -1,25 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel get_defeated
/* 1A1F0 8003EDF0 0080302D */ daddu $a2, $a0, $zero
/* 1A1F4 8003EDF4 04A10002 */ bgez $a1, .L8003EE00
/* 1A1F8 8003EDF8 00A0182D */ daddu $v1, $a1, $zero
/* 1A1FC 8003EDFC 24A3001F */ addiu $v1, $a1, 0x1f
.L8003EE00:
/* 1A200 8003EE00 00031943 */ sra $v1, $v1, 5
/* 1A204 8003EE04 00032140 */ sll $a0, $v1, 5
/* 1A208 8003EE08 00A42023 */ subu $a0, $a1, $a0
/* 1A20C 8003EE0C 00031880 */ sll $v1, $v1, 2
/* 1A210 8003EE10 00061040 */ sll $v0, $a2, 1
/* 1A214 8003EE14 00461021 */ addu $v0, $v0, $a2
/* 1A218 8003EE18 00021100 */ sll $v0, $v0, 4
/* 1A21C 8003EE1C 00621821 */ addu $v1, $v1, $v0
/* 1A220 8003EE20 3C02800B */ lui $v0, %hi(gCurrentEncounter)
/* 1A224 8003EE24 24420F10 */ addiu $v0, $v0, %lo(gCurrentEncounter)
/* 1A228 8003EE28 00621821 */ addu $v1, $v1, $v0
/* 1A22C 8003EE2C 24020001 */ addiu $v0, $zero, 1
/* 1A230 8003EE30 8C6300B0 */ lw $v1, 0xb0($v1)
/* 1A234 8003EE34 00821004 */ sllv $v0, $v0, $a0
/* 1A238 8003EE38 03E00008 */ jr $ra
/* 1A23C 8003EE3C 00621024 */ and $v0, $v1, $v0

View File

@ -1,27 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel set_defeated
/* 1A240 8003EE40 0080182D */ daddu $v1, $a0, $zero
/* 1A244 8003EE44 00A0102D */ daddu $v0, $a1, $zero
/* 1A248 8003EE48 04410002 */ bgez $v0, .L8003EE54
/* 1A24C 8003EE4C 0040202D */ daddu $a0, $v0, $zero
/* 1A250 8003EE50 2444001F */ addiu $a0, $v0, 0x1f
.L8003EE54:
/* 1A254 8003EE54 00042143 */ sra $a0, $a0, 5
/* 1A258 8003EE58 00042940 */ sll $a1, $a0, 5
/* 1A25C 8003EE5C 00452823 */ subu $a1, $v0, $a1
/* 1A260 8003EE60 00042080 */ sll $a0, $a0, 2
/* 1A264 8003EE64 00031040 */ sll $v0, $v1, 1
/* 1A268 8003EE68 00431021 */ addu $v0, $v0, $v1
/* 1A26C 8003EE6C 00021100 */ sll $v0, $v0, 4
/* 1A270 8003EE70 00822021 */ addu $a0, $a0, $v0
/* 1A274 8003EE74 3C02800B */ lui $v0, %hi(gCurrentEncounter)
/* 1A278 8003EE78 24420F10 */ addiu $v0, $v0, %lo(gCurrentEncounter)
/* 1A27C 8003EE7C 00822021 */ addu $a0, $a0, $v0
/* 1A280 8003EE80 24030001 */ addiu $v1, $zero, 1
/* 1A284 8003EE84 8C8200B0 */ lw $v0, 0xb0($a0)
/* 1A288 8003EE88 00A31804 */ sllv $v1, $v1, $a1
/* 1A28C 8003EE8C 00431025 */ or $v0, $v0, $v1
/* 1A290 8003EE90 03E00008 */ jr $ra
/* 1A294 8003EE94 AC8200B0 */ sw $v0, 0xb0($a0)

View File

@ -1,17 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel load_map_script_lib
/* 35AC0 8005A6C0 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 35AC4 8005A6C4 3C04007E */ lui $a0, 0x7e
/* 35AC8 8005A6C8 24840E80 */ addiu $a0, $a0, 0xe80
/* 35ACC 8005A6CC 3C05007E */ lui $a1, 0x7e
/* 35AD0 8005A6D0 24A573A0 */ addiu $a1, $a1, 0x73a0
/* 35AD4 8005A6D4 3C068028 */ lui $a2, 0x8028
/* 35AD8 8005A6D8 24C60000 */ addiu $a2, $a2, 0
/* 35ADC 8005A6DC AFBF0010 */ sw $ra, 0x10($sp)
/* 35AE0 8005A6E0 0C00A5CF */ jal dma_copy
/* 35AE4 8005A6E4 00000000 */ nop
/* 35AE8 8005A6E8 8FBF0010 */ lw $ra, 0x10($sp)
/* 35AEC 8005A6EC 03E00008 */ jr $ra
/* 35AF0 8005A6F0 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,15 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetCurrentPartnerID
/* F4624 802CFC74 27BDFFE8 */ addiu $sp, $sp, -0x18
/* F4628 802CFC78 AFBF0010 */ sw $ra, 0x10($sp)
/* F462C 802CFC7C 8C82000C */ lw $v0, 0xc($a0)
/* F4630 802CFC80 3C068011 */ lui $a2, 0x8011
/* F4634 802CFC84 80C6F2A2 */ lb $a2, -0xd5e($a2)
/* F4638 802CFC88 0C0B2026 */ jal set_variable
/* F463C 802CFC8C 8C450000 */ lw $a1, ($v0)
/* F4640 802CFC90 8FBF0010 */ lw $ra, 0x10($sp)
/* F4644 802CFC94 24020002 */ addiu $v0, $zero, 2
/* F4648 802CFC98 03E00008 */ jr $ra
/* F464C 802CFC9C 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,22 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel PartnerCanUseAbility
/* F4650 802CFCA0 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F4654 802CFCA4 AFB00010 */ sw $s0, 0x10($sp)
/* F4658 802CFCA8 0080802D */ daddu $s0, $a0, $zero
/* F465C 802CFCAC AFBF0018 */ sw $ra, 0x18($sp)
/* F4660 802CFCB0 AFB10014 */ sw $s1, 0x14($sp)
/* F4664 802CFCB4 8E02000C */ lw $v0, 0xc($s0)
/* F4668 802CFCB8 0C03AD0B */ jal partner_can_use_ability
/* F466C 802CFCBC 8C510000 */ lw $s1, ($v0)
/* F4670 802CFCC0 0200202D */ daddu $a0, $s0, $zero
/* F4674 802CFCC4 0040302D */ daddu $a2, $v0, $zero
/* F4678 802CFCC8 0C0B2026 */ jal set_variable
/* F467C 802CFCCC 0220282D */ daddu $a1, $s1, $zero
/* F4680 802CFCD0 8FBF0018 */ lw $ra, 0x18($sp)
/* F4684 802CFCD4 8FB10014 */ lw $s1, 0x14($sp)
/* F4688 802CFCD8 8FB00010 */ lw $s0, 0x10($sp)
/* F468C 802CFCDC 24020002 */ addiu $v0, $zero, 2
/* F4690 802CFCE0 03E00008 */ jr $ra
/* F4694 802CFCE4 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,22 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel PartnerIsFlying
/* F4698 802CFCE8 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F469C 802CFCEC AFB00010 */ sw $s0, 0x10($sp)
/* F46A0 802CFCF0 0080802D */ daddu $s0, $a0, $zero
/* F46A4 802CFCF4 AFBF0018 */ sw $ra, 0x18($sp)
/* F46A8 802CFCF8 AFB10014 */ sw $s1, 0x14($sp)
/* F46AC 802CFCFC 8E02000C */ lw $v0, 0xc($s0)
/* F46B0 802CFD00 0C03A969 */ jal is_current_partner_flying
/* F46B4 802CFD04 8C510000 */ lw $s1, ($v0)
/* F46B8 802CFD08 0200202D */ daddu $a0, $s0, $zero
/* F46BC 802CFD0C 0040302D */ daddu $a2, $v0, $zero
/* F46C0 802CFD10 0C0B2026 */ jal set_variable
/* F46C4 802CFD14 0220282D */ daddu $a1, $s1, $zero
/* F46C8 802CFD18 8FBF0018 */ lw $ra, 0x18($sp)
/* F46CC 802CFD1C 8FB10014 */ lw $s1, 0x14($sp)
/* F46D0 802CFD20 8FB00010 */ lw $s0, 0x10($sp)
/* F46D4 802CFD24 24020002 */ addiu $v0, $zero, 2
/* F46D8 802CFD28 03E00008 */ jr $ra
/* F46DC 802CFD2C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,32 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802CDE68
/* F2818 802CDE68 27BDFFD8 */ addiu $sp, $sp, -0x28
/* F281C 802CDE6C AFB10014 */ sw $s1, 0x14($sp)
/* F2820 802CDE70 0080882D */ daddu $s1, $a0, $zero
/* F2824 802CDE74 AFBF0018 */ sw $ra, 0x18($sp)
/* F2828 802CDE78 AFB00010 */ sw $s0, 0x10($sp)
/* F282C 802CDE7C F7B40020 */ sdc1 $f20, 0x20($sp)
/* F2830 802CDE80 8E30000C */ lw $s0, 0xc($s1)
/* F2834 802CDE84 8E050000 */ lw $a1, ($s0)
/* F2838 802CDE88 0C0B1EAF */ jal get_variable
/* F283C 802CDE8C 26100004 */ addiu $s0, $s0, 4
/* F2840 802CDE90 0220202D */ daddu $a0, $s1, $zero
/* F2844 802CDE94 8E050000 */ lw $a1, ($s0)
/* F2848 802CDE98 0C0B210B */ jal get_float_variable
/* F284C 802CDE9C 0040802D */ daddu $s0, $v0, $zero
/* F2850 802CDEA0 0220202D */ daddu $a0, $s1, $zero
/* F2854 802CDEA4 0200282D */ daddu $a1, $s0, $zero
/* F2858 802CDEA8 0C0B36B0 */ jal resolve_npc
/* F285C 802CDEAC 46000506 */ mov.s $f20, $f0
/* F2860 802CDEB0 54400001 */ bnel $v0, $zero, .L802CDEB8
/* F2864 802CDEB4 E4540050 */ swc1 $f20, 0x50($v0)
.L802CDEB8:
/* F2868 802CDEB8 24020002 */ addiu $v0, $zero, 2
/* F286C 802CDEBC 8FBF0018 */ lw $ra, 0x18($sp)
/* F2870 802CDEC0 8FB10014 */ lw $s1, 0x14($sp)
/* F2874 802CDEC4 8FB00010 */ lw $s0, 0x10($sp)
/* F2878 802CDEC8 D7B40020 */ ldc1 $f20, 0x20($sp)
/* F287C 802CDECC 03E00008 */ jr $ra
/* F2880 802CDED0 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802CF1B4
/* F3B64 802CF1B4 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F3B68 802CF1B8 AFB00010 */ sw $s0, 0x10($sp)
/* F3B6C 802CF1BC 0080802D */ daddu $s0, $a0, $zero
/* F3B70 802CF1C0 AFBF0018 */ sw $ra, 0x18($sp)
/* F3B74 802CF1C4 AFB10014 */ sw $s1, 0x14($sp)
/* F3B78 802CF1C8 8E11000C */ lw $s1, 0xc($s0)
/* F3B7C 802CF1CC 8E250000 */ lw $a1, ($s1)
/* F3B80 802CF1D0 0C0B1EAF */ jal get_variable
/* F3B84 802CF1D4 26310004 */ addiu $s1, $s1, 4
/* F3B88 802CF1D8 0200202D */ daddu $a0, $s0, $zero
/* F3B8C 802CF1DC 8E310000 */ lw $s1, ($s1)
/* F3B90 802CF1E0 0C0B36B0 */ jal resolve_npc
/* F3B94 802CF1E4 0040282D */ daddu $a1, $v0, $zero
/* F3B98 802CF1E8 54400001 */ bnel $v0, $zero, .L802CF1F0
/* F3B9C 802CF1EC AC510080 */ sw $s1, 0x80($v0)
.L802CF1F0:
/* F3BA0 802CF1F0 24020002 */ addiu $v0, $zero, 2
/* F3BA4 802CF1F4 8FBF0018 */ lw $ra, 0x18($sp)
/* F3BA8 802CF1F8 8FB10014 */ lw $s1, 0x14($sp)
/* F3BAC 802CF1FC 8FB00010 */ lw $s0, 0x10($sp)
/* F3BB0 802CF200 03E00008 */ jr $ra
/* F3BB4 802CF204 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,29 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802CF208
/* F3BB8 802CF208 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F3BBC 802CF20C AFB00010 */ sw $s0, 0x10($sp)
/* F3BC0 802CF210 0080802D */ daddu $s0, $a0, $zero
/* F3BC4 802CF214 AFBF0018 */ sw $ra, 0x18($sp)
/* F3BC8 802CF218 AFB10014 */ sw $s1, 0x14($sp)
/* F3BCC 802CF21C 8E11000C */ lw $s1, 0xc($s0)
/* F3BD0 802CF220 8E250000 */ lw $a1, ($s1)
/* F3BD4 802CF224 0C0B1EAF */ jal get_variable
/* F3BD8 802CF228 26310004 */ addiu $s1, $s1, 4
/* F3BDC 802CF22C 0200202D */ daddu $a0, $s0, $zero
/* F3BE0 802CF230 8E310000 */ lw $s1, ($s1)
/* F3BE4 802CF234 0C0B36B0 */ jal resolve_npc
/* F3BE8 802CF238 0040282D */ daddu $a1, $v0, $zero
/* F3BEC 802CF23C 10400004 */ beqz $v0, .L802CF250
/* F3BF0 802CF240 0040202D */ daddu $a0, $v0, $zero
/* F3BF4 802CF244 0220282D */ daddu $a1, $s1, $zero
/* F3BF8 802CF248 0C00EB17 */ jal func_8003AC5C
/* F3BFC 802CF24C 0000302D */ daddu $a2, $zero, $zero
.L802CF250:
/* F3C00 802CF250 24020002 */ addiu $v0, $zero, 2
/* F3C04 802CF254 8FBF0018 */ lw $ra, 0x18($sp)
/* F3C08 802CF258 8FB10014 */ lw $s1, 0x14($sp)
/* F3C0C 802CF25C 8FB00010 */ lw $s0, 0x10($sp)
/* F3C10 802CF260 03E00008 */ jr $ra
/* F3C14 802CF264 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802CFE2C
/* F47DC 802CFE2C 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F47E0 802CFE30 AFB00010 */ sw $s0, 0x10($sp)
/* F47E4 802CFE34 0080802D */ daddu $s0, $a0, $zero
/* F47E8 802CFE38 AFBF0018 */ sw $ra, 0x18($sp)
/* F47EC 802CFE3C AFB10014 */ sw $s1, 0x14($sp)
/* F47F0 802CFE40 8E11000C */ lw $s1, 0xc($s0)
/* F47F4 802CFE44 8E250000 */ lw $a1, ($s1)
/* F47F8 802CFE48 0C0B1EAF */ jal get_variable
/* F47FC 802CFE4C 26310004 */ addiu $s1, $s1, 4
/* F4800 802CFE50 0200202D */ daddu $a0, $s0, $zero
/* F4804 802CFE54 8E310000 */ lw $s1, ($s1)
/* F4808 802CFE58 0C0B36B0 */ jal resolve_npc
/* F480C 802CFE5C 0040282D */ daddu $a1, $v0, $zero
/* F4810 802CFE60 54400001 */ bnel $v0, $zero, .L802CFE68
/* F4814 802CFE64 A45100A2 */ sh $s1, 0xa2($v0)
.L802CFE68:
/* F4818 802CFE68 24020002 */ addiu $v0, $zero, 2
/* F481C 802CFE6C 8FBF0018 */ lw $ra, 0x18($sp)
/* F4820 802CFE70 8FB10014 */ lw $s1, 0x14($sp)
/* F4824 802CFE74 8FB00010 */ lw $s0, 0x10($sp)
/* F4828 802CFE78 03E00008 */ jr $ra
/* F482C 802CFE7C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,32 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802CFE80
/* F4830 802CFE80 27BDFFE0 */ addiu $sp, $sp, -0x20
/* F4834 802CFE84 AFB10014 */ sw $s1, 0x14($sp)
/* F4838 802CFE88 0080882D */ daddu $s1, $a0, $zero
/* F483C 802CFE8C AFBF0018 */ sw $ra, 0x18($sp)
/* F4840 802CFE90 AFB00010 */ sw $s0, 0x10($sp)
/* F4844 802CFE94 8E30000C */ lw $s0, 0xc($s1)
/* F4848 802CFE98 8E050000 */ lw $a1, ($s0)
/* F484C 802CFE9C 0C0B1EAF */ jal get_variable
/* F4850 802CFEA0 26100004 */ addiu $s0, $s0, 4
/* F4854 802CFEA4 0220202D */ daddu $a0, $s1, $zero
/* F4858 802CFEA8 8E050000 */ lw $a1, ($s0)
/* F485C 802CFEAC 0C0B1EAF */ jal get_variable
/* F4860 802CFEB0 0040802D */ daddu $s0, $v0, $zero
/* F4864 802CFEB4 0220202D */ daddu $a0, $s1, $zero
/* F4868 802CFEB8 0200282D */ daddu $a1, $s0, $zero
/* F486C 802CFEBC 0C0B36B0 */ jal resolve_npc
/* F4870 802CFEC0 0040802D */ daddu $s0, $v0, $zero
/* F4874 802CFEC4 10400003 */ beqz $v0, .L802CFED4
/* F4878 802CFEC8 0040202D */ daddu $a0, $v0, $zero
/* F487C 802CFECC 0C00ECF4 */ jal func_8003B3D0
/* F4880 802CFED0 0200282D */ daddu $a1, $s0, $zero
.L802CFED4:
/* F4884 802CFED4 24020002 */ addiu $v0, $zero, 2
/* F4888 802CFED8 8FBF0018 */ lw $ra, 0x18($sp)
/* F488C 802CFEDC 8FB10014 */ lw $s1, 0x14($sp)
/* F4890 802CFEE0 8FB00010 */ lw $s0, 0x10($sp)
/* F4894 802CFEE4 03E00008 */ jr $ra
/* F4898 802CFEE8 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -79,19 +79,21 @@ typedef struct Npc {
/* 0x034 */ char unk_34[4];
/* 0x038 */ struct Vec3f pos;
/* 0x044 */ struct Vec3f rotation;
/* 0x050 */ char unk_50[4];
/* 0x050 */ f32 unk_50;
/* 0x054 */ struct Vec3f scale;
/* 0x060 */ struct Vec3f moveToPos;
/* 0x06C */ struct Vec3f colliderPos; /* used during collision with player */
/* 0x078 */ s32 shadowIndex;
/* 0x07C */ f32 shadowScale;
/* 0x080 */ char unk_80[8];
/* 0x080 */ s32 unk_80;
/* 0x084 */ char unk_84[4];
/* 0x088 */ s16 isFacingAway;
/* 0x08A */ s16 yawCamOffset;
/* 0x08C */ char unk_8C[2];
/* 0x08E */ s16 duration; /* formerly interp_counter */
/* 0x090 */ s16 homePos[3];
/* 0x096 */ char unk_96[14];
/* 0x096 */ char unk_96[12];
/* 0x0A2 */ s16 unk_A2;
/* 0x0A4 */ u8 npcID;
/* 0x0A5 */ char unk_A5;
/* 0x0A6 */ s16 collisionRadius;

View File

@ -127,7 +127,6 @@ extern SaveData gCurrentSaveFile;
extern s32 D_802D9CA4;
extern u32* gMapFlags;
extern u32* gMapVars;
extern s32 gNumScripts;
extern f32 D_80286540;
@ -139,6 +138,10 @@ extern u32 gBattleMapFlags[MAX_MAPFLAGS];
extern s32 D_8009A5D8;
extern s32 mapScriptLibStart;
extern s32 mapScriptLibEnd;
extern s32 mapScriptLibVram;
// Scripts
extern Bytecode* SCRIPT_NpcDefeat;

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,31 @@
#include "common.h"
INCLUDE_ASM(s32, "code_1a1f0_len_5390", get_defeated);
s32 get_defeated(s32 mapID, s32 encounterID) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
s32 encounterIdx = encounterID / 32;
s32 encounterShift = encounterID % 32;
INCLUDE_ASM(s32, "code_1a1f0_len_5390", set_defeated);
return currentEncounter->defeatFlags[mapID][encounterIdx] & (1 << encounterShift);
}
void set_defeated(s32 mapID, s32 encounterID) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
s32 encounterIdx = encounterID / 32;
s32 encounterShift;
s32 flag;
flag = encounterID % 32;
encounterShift = flag;
flag = currentEncounter->defeatFlags[mapID][encounterIdx];
currentEncounter->defeatFlags[mapID][encounterIdx] = flag | (1 << encounterShift);
// TODO: The below should work but has regalloc issues:
/*EncounterStatus *currentEncounter = &gCurrentEncounter;
s32 encounterIdx = encounterID / 32;
s32 encounterShift = encounterID % 32;
currentEncounter->defeatFlags[mapID][encounterIdx] |= (1 << encounterShift);*/
}
INCLUDE_ASM(s32, "code_1a1f0_len_5390", func_8003EE98);

View File

@ -42,7 +42,9 @@ INCLUDE_ASM(s32, "code_341d0_len_20d0", remove_all_effects);
INCLUDE_ASM(s32, "code_341d0_len_20d0", play_effect);
INCLUDE_ASM(s32, "code_341d0_len_20d0", load_map_script_lib);
void load_map_script_lib(void) {
dma_copy(&mapScriptLibStart, &mapScriptLibEnd, &mapScriptLibVram);
}
INCLUDE_ASM(s32, "code_341d0_len_20d0", load_map_by_IDs);

View File

@ -15,8 +15,8 @@ INCLUDE_ASM(s32, "code_f2470_len_27f0", set_npc_animation);
INCLUDE_ASM(s32, "code_f2470_len_27f0", CreateNpc);
ApiStatus DeleteNpc(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Npc* npc = get_npc_unsafe(get_variable(script, *ptrReadPos++));
Bytecode* args = script->ptrReadPos;
Npc* npc = get_npc_unsafe(get_variable(script, *args++));
if (npc) {
free_npc(npc);
@ -26,9 +26,9 @@ ApiStatus DeleteNpc(ScriptInstance* script, s32 isInitialCall) {
}
ApiStatus GetNpcPointer(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Bytecode varNPC = *ptrReadPos++;
Bytecode* args = script->ptrReadPos;
NpcId npcID = get_variable(script, *args++);
Bytecode varNPC = *args++;
set_variable(script, varNPC, (s32)get_npc_safe(npcID));
return ApiStatus_DONE2;
@ -38,7 +38,20 @@ INCLUDE_ASM(s32, "code_f2470_len_27f0", SetNpcPos, ScriptInstance* script, s32 i
INCLUDE_ASM(s32, "code_f2470_len_27f0", SetNpcRotation, ScriptInstance* script, s32 isInitialCall);
INCLUDE_ASM(s32, "code_f2470_len_27f0", func_802CDE68, ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802CDE68(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
f32 var1 = get_float_variable(script, *args++);
Npc* npc;
npc = resolve_npc(script, npcId);
if (npc != NULL) {
npc->unk_50 = var1;
}
return ApiStatus_DONE2;
do {} while (0); // necessary to match
}
ApiStatus SetNpcScale(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
@ -195,9 +208,35 @@ INCLUDE_ASM(s32, "code_f2470_len_27f0", SetNpcFlagBits, ScriptInstance* script,
INCLUDE_ASM(s32, "code_f2470_len_27f0", GetNpcPos, ScriptInstance* script, s32 isInitialCall);
INCLUDE_ASM(s32, "code_f2470_len_27f0", func_802CF1B4);
ApiStatus func_802CF1B4(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode arg1 = *args;
Npc* npc;
INCLUDE_ASM(s32, "code_f2470_len_27f0", func_802CF208);
npc = resolve_npc(script, npcId);
if (npc != NULL) {
npc->unk_80 = arg1;
}
return ApiStatus_DONE2;
do {} while (0); // necessary to match
}
ApiStatus func_802CF208(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode arg1 = *args;
Npc* npc;
npc = resolve_npc(script, npcId);
if (npc != NULL) {
func_8003AC5C(npc, arg1, 0);
}
return ApiStatus_DONE2;
do {} while (0); // necessary to match
}
ApiStatus EnableNpcShadow(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
@ -298,17 +337,56 @@ INCLUDE_ASM(s32, "code_f2470_len_27f0", BringPartnerOut);
INCLUDE_ASM(s32, "code_f2470_len_27f0", PutPartnerAway);
INCLUDE_ASM(s32, "code_f2470_len_27f0", GetCurrentPartnerID);
ApiStatus GetCurrentPartnerID(ScriptInstance* script, s32 isInitialCall) {
set_variable(script, *script->ptrReadPos, gPlayerData.currentPartner);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_f2470_len_27f0", PartnerCanUseAbility);
ApiStatus PartnerCanUseAbility(ScriptInstance* script, s32 isInitialCall) {
Bytecode arg0 = *script->ptrReadPos;
INCLUDE_ASM(s32, "code_f2470_len_27f0", PartnerIsFlying);
set_variable(script, arg0, partner_can_use_ability());
return ApiStatus_DONE2;
}
ApiStatus PartnerIsFlying(ScriptInstance* script, s32 isInitialCall) {
Bytecode arg0 = *script->ptrReadPos;
set_variable(script, arg0, is_current_partner_flying());
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_f2470_len_27f0", func_802CFD30);
INCLUDE_ASM(s32, "code_f2470_len_27f0", func_802CFE2C);
ApiStatus func_802CFE2C(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode arg1 = *args;
Npc* npc;
INCLUDE_ASM(s32, "code_f2470_len_27f0", func_802CFE80);
npc = resolve_npc(script, npcId);
if (npc != NULL) {
npc->unk_A2 = arg1;
}
return ApiStatus_DONE2;
do {} while (0); // necessary to match
}
ApiStatus func_802CFE80(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
NpcId npcId = get_variable(script, *args++);
Bytecode var1 = get_variable(script, *args++);
Npc* npc;
npc = resolve_npc(script, npcId);
if (npc != NULL) {
func_8003B3D0(npc, var1);
}
return ApiStatus_DONE2;
do {} while (0); // necessary to match
}
INCLUDE_ASM(s32, "code_f2470_len_27f0", func_802CFEEC);

@ -1 +1 @@
Subproject commit d606c8ec15daa3632a2ef7baf10948fe5c88209d
Subproject commit 968477e3cc7b26514196abae0ff0e3f10a45d31e

View File

@ -333,7 +333,8 @@ segments:
- [0x7e0e80, "c", "code_7e0e80"]
- [0x7E2AA0, "c", "code_7E2AA0"]
- [0x7E3700, "c", "code_7E3700"]
- [0x7e4d00, "bin"] # todo split this further
- [0x7e4d00, "bin"]
- [0x7E73A0, "bin"] # todo split this further
- name: code
type: code
start: 0xE20EB0

View File

@ -47,6 +47,10 @@ D_800D9620 = 0x800D9620;
gBattleStatus = 0x800DC070;
mapScriptLibStart = 0x7E0E80;
mapScriptLibEnd = 0x7E73A0;
mapScriptLibVram = 0x80280000;
D_000759B0 = 0x000759B0;
D_000759B0_end = 0x000A5DD0;
D_000A5DD0 = 0x000A5DD0;