diff --git a/asm/nonmatchings/code_197F40/set_part_absolute_position.s b/asm/nonmatchings/code_197F40/set_part_absolute_position.s deleted file mode 100644 index 6b2bf81b69..0000000000 --- a/asm/nonmatchings/code_197F40/set_part_absolute_position.s +++ /dev/null @@ -1,52 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel set_part_absolute_position -/* 198550 80269C70 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 198554 80269C74 F7B40020 */ sdc1 $f20, 0x20($sp) -/* 198558 80269C78 4486A000 */ mtc1 $a2, $f20 -/* 19855C 80269C7C F7B60028 */ sdc1 $f22, 0x28($sp) -/* 198560 80269C80 4487B000 */ mtc1 $a3, $f22 -/* 198564 80269C84 AFB00010 */ sw $s0, 0x10($sp) -/* 198568 80269C88 0080802D */ daddu $s0, $a0, $zero -/* 19856C 80269C8C AFB10014 */ sw $s1, 0x14($sp) -/* 198570 80269C90 F7B80030 */ sdc1 $f24, 0x30($sp) -/* 198574 80269C94 C7B80048 */ lwc1 $f24, 0x48($sp) -/* 198578 80269C98 AFBF0018 */ sw $ra, 0x18($sp) -/* 19857C 80269C9C 0C09A75B */ jal get_actor -/* 198580 80269CA0 00A0882D */ daddu $s1, $a1, $zero -/* 198584 80269CA4 0040202D */ daddu $a0, $v0, $zero -/* 198588 80269CA8 32100700 */ andi $s0, $s0, 0x700 -/* 19858C 80269CAC 24020100 */ addiu $v0, $zero, 0x100 -/* 198590 80269CB0 1202000E */ beq $s0, $v0, .L80269CEC -/* 198594 80269CB4 2A020101 */ slti $v0, $s0, 0x101 -/* 198598 80269CB8 50400005 */ beql $v0, $zero, .L80269CD0 -/* 19859C 80269CBC 24020200 */ addiu $v0, $zero, 0x200 -/* 1985A0 80269CC0 52000007 */ beql $s0, $zero, .L80269CE0 -/* 1985A4 80269CC4 E4940144 */ swc1 $f20, 0x144($a0) -/* 1985A8 80269CC8 0809A740 */ j .L80269D00 -/* 1985AC 80269CCC 00000000 */ nop -.L80269CD0: -/* 1985B0 80269CD0 12020006 */ beq $s0, $v0, .L80269CEC -/* 1985B4 80269CD4 00000000 */ nop -/* 1985B8 80269CD8 0809A740 */ j .L80269D00 -/* 1985BC 80269CDC 00000000 */ nop -.L80269CE0: -/* 1985C0 80269CE0 E4960148 */ swc1 $f22, 0x148($a0) -/* 1985C4 80269CE4 0809A740 */ j .L80269D00 -/* 1985C8 80269CE8 E498014C */ swc1 $f24, 0x14c($a0) -.L80269CEC: -/* 1985CC 80269CEC 0C099117 */ jal get_actor_part -/* 1985D0 80269CF0 0220282D */ daddu $a1, $s1, $zero -/* 1985D4 80269CF4 E454002C */ swc1 $f20, 0x2c($v0) -/* 1985D8 80269CF8 E4560030 */ swc1 $f22, 0x30($v0) -/* 1985DC 80269CFC E4580034 */ swc1 $f24, 0x34($v0) -.L80269D00: -/* 1985E0 80269D00 8FBF0018 */ lw $ra, 0x18($sp) -/* 1985E4 80269D04 8FB10014 */ lw $s1, 0x14($sp) -/* 1985E8 80269D08 8FB00010 */ lw $s0, 0x10($sp) -/* 1985EC 80269D0C D7B80030 */ ldc1 $f24, 0x30($sp) -/* 1985F0 80269D10 D7B60028 */ ldc1 $f22, 0x28($sp) -/* 1985F4 80269D14 D7B40020 */ ldc1 $f20, 0x20($sp) -/* 1985F8 80269D18 03E00008 */ jr $ra -/* 1985FC 80269D1C 27BD0038 */ addiu $sp, $sp, 0x38 diff --git a/asm/nonmatchings/code_e0b30_len_b80/func_8014ADA4.s b/asm/nonmatchings/code_e0b30_len_b80/func_8014ADA4.s deleted file mode 100644 index 3b03167cb0..0000000000 --- a/asm/nonmatchings/code_e0b30_len_b80/func_8014ADA4.s +++ /dev/null @@ -1,26 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8014ADA4 -/* E14A4 8014ADA4 3C028007 */ lui $v0, %hi(gGameStatusPtr) -/* E14A8 8014ADA8 8C42419C */ lw $v0, %lo(gGameStatusPtr)($v0) -/* E14AC 8014ADAC 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* E14B0 8014ADB0 AFBF0018 */ sw $ra, 0x18($sp) -/* E14B4 8014ADB4 80420071 */ lb $v0, 0x71($v0) -/* E14B8 8014ADB8 3C068016 */ lui $a2, %hi(gMusicPlayers) -/* E14BC 8014ADBC 24C69AF0 */ addiu $a2, $a2, %lo(gMusicPlayers) -/* E14C0 8014ADC0 1440000A */ bnez $v0, .L8014ADEC -/* E14C4 8014ADC4 24030008 */ addiu $v1, $zero, 8 -/* E14C8 8014ADC8 94C20000 */ lhu $v0, ($a2) -/* E14CC 8014ADCC 0000202D */ daddu $a0, $zero, $zero -/* E14D0 8014ADD0 AFA30010 */ sw $v1, 0x10($sp) -/* E14D4 8014ADD4 8CC50024 */ lw $a1, 0x24($a2) -/* E14D8 8014ADD8 00431025 */ or $v0, $v0, $v1 -/* E14DC 8014ADDC A4C20000 */ sh $v0, ($a2) -/* E14E0 8014ADE0 8CC60028 */ lw $a2, 0x28($a2) -/* E14E4 8014ADE4 0C0529F8 */ jal _set_music_track -/* E14E8 8014ADE8 0080382D */ daddu $a3, $a0, $zero -.L8014ADEC: -/* E14EC 8014ADEC 8FBF0018 */ lw $ra, 0x18($sp) -/* E14F0 8014ADF0 03E00008 */ jr $ra -/* E14F4 8014ADF4 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/code_e0b30_len_b80/func_8014ADF8.s b/asm/nonmatchings/code_e0b30_len_b80/func_8014ADF8.s deleted file mode 100644 index 80ead6d3be..0000000000 --- a/asm/nonmatchings/code_e0b30_len_b80/func_8014ADF8.s +++ /dev/null @@ -1,34 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8014ADF8 -/* E14F8 8014ADF8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* E14FC 8014ADFC 0080402D */ daddu $t0, $a0, $zero -/* E1500 8014AE00 3C028007 */ lui $v0, %hi(gGameStatusPtr) -/* E1504 8014AE04 8C42419C */ lw $v0, %lo(gGameStatusPtr)($v0) -/* E1508 8014AE08 AFBF0018 */ sw $ra, 0x18($sp) -/* E150C 8014AE0C 80420071 */ lb $v0, 0x71($v0) -/* E1510 8014AE10 3C078016 */ lui $a3, %hi(gMusicPlayers) -/* E1514 8014AE14 24E79AF0 */ addiu $a3, $a3, %lo(gMusicPlayers) -/* E1518 8014AE18 14400011 */ bnez $v0, .L8014AE60 -/* E151C 8014AE1C 00A0482D */ daddu $t1, $a1, $zero -/* E1520 8014AE20 8CE40010 */ lw $a0, 0x10($a3) -/* E1524 8014AE24 8CE50014 */ lw $a1, 0x14($a3) -/* E1528 8014AE28 8CE60018 */ lw $a2, 0x18($a3) -/* E152C 8014AE2C 94E30000 */ lhu $v1, ($a3) -/* E1530 8014AE30 24020008 */ addiu $v0, $zero, 8 -/* E1534 8014AE34 AFA20010 */ sw $v0, 0x10($sp) -/* E1538 8014AE38 34630004 */ ori $v1, $v1, 4 -/* E153C 8014AE3C ACE40024 */ sw $a0, 0x24($a3) -/* E1540 8014AE40 0000202D */ daddu $a0, $zero, $zero -/* E1544 8014AE44 ACE50028 */ sw $a1, 0x28($a3) -/* E1548 8014AE48 0100282D */ daddu $a1, $t0, $zero -/* E154C 8014AE4C ACE6002C */ sw $a2, 0x2c($a3) -/* E1550 8014AE50 0120302D */ daddu $a2, $t1, $zero -/* E1554 8014AE54 A4E30000 */ sh $v1, ($a3) -/* E1558 8014AE58 0C052A46 */ jal set_music_track -/* E155C 8014AE5C 240701F4 */ addiu $a3, $zero, 0x1f4 -.L8014AE60: -/* E1560 8014AE60 8FBF0018 */ lw $ra, 0x18($sp) -/* E1564 8014AE64 03E00008 */ jr $ra -/* E1568 8014AE68 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/code_e0b30_len_b80/func_8014AE6C.s b/asm/nonmatchings/code_e0b30_len_b80/func_8014AE6C.s deleted file mode 100644 index d0cb92e4bb..0000000000 --- a/asm/nonmatchings/code_e0b30_len_b80/func_8014AE6C.s +++ /dev/null @@ -1,41 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8014AE6C -/* E156C 8014AE6C 3C028007 */ lui $v0, %hi(gGameStatusPtr) -/* E1570 8014AE70 8C42419C */ lw $v0, %lo(gGameStatusPtr)($v0) -/* E1574 8014AE74 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* E1578 8014AE78 AFBF0018 */ sw $ra, 0x18($sp) -/* E157C 8014AE7C 80420071 */ lb $v0, 0x71($v0) -/* E1580 8014AE80 3C068016 */ lui $a2, %hi(gMusicPlayers) -/* E1584 8014AE84 24C69AF0 */ addiu $a2, $a2, %lo(gMusicPlayers) -/* E1588 8014AE88 14400018 */ bnez $v0, .L8014AEEC -/* E158C 8014AE8C 3C020002 */ lui $v0, 2 -/* E1590 8014AE90 3C04800A */ lui $a0, %hi(D_8009A650) -/* E1594 8014AE94 2484A650 */ addiu $a0, $a0, %lo(D_8009A650) -/* E1598 8014AE98 8C830000 */ lw $v1, ($a0) -/* E159C 8014AE9C 00621024 */ and $v0, $v1, $v0 -/* E15A0 8014AEA0 10400005 */ beqz $v0, .L8014AEB8 -/* E15A4 8014AEA4 3C02FFFD */ lui $v0, 0xfffd -/* E15A8 8014AEA8 3442FFFF */ ori $v0, $v0, 0xffff -/* E15AC 8014AEAC 00621024 */ and $v0, $v1, $v0 -/* E15B0 8014AEB0 08052BBB */ j .L8014AEEC -/* E15B4 8014AEB4 AC820000 */ sw $v0, ($a0) -.L8014AEB8: -/* E15B8 8014AEB8 0000202D */ daddu $a0, $zero, $zero -/* E15BC 8014AEBC 8CC50024 */ lw $a1, 0x24($a2) -/* E15C0 8014AEC0 94C20000 */ lhu $v0, ($a2) -/* E15C4 8014AEC4 24030008 */ addiu $v1, $zero, 8 -/* E15C8 8014AEC8 AFA30010 */ sw $v1, 0x10($sp) -/* E15CC 8014AECC 00431025 */ or $v0, $v0, $v1 -/* E15D0 8014AED0 A4C20000 */ sh $v0, ($a2) -/* E15D4 8014AED4 8CC60028 */ lw $a2, 0x28($a2) -/* E15D8 8014AED8 0C0529F8 */ jal _set_music_track -/* E15DC 8014AEDC 0080382D */ daddu $a3, $a0, $zero -/* E15E0 8014AEE0 0000202D */ daddu $a0, $zero, $zero -/* E15E4 8014AEE4 0C015564 */ jal func_80055590 -/* E15E8 8014AEE8 240500FA */ addiu $a1, $zero, 0xfa -.L8014AEEC: -/* E15EC 8014AEEC 8FBF0018 */ lw $ra, 0x18($sp) -/* E15F0 8014AEF0 03E00008 */ jr $ra -/* E15F4 8014AEF4 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/code_e0b30_len_b80/func_8014AEF8.s b/asm/nonmatchings/code_e0b30_len_b80/func_8014AEF8.s deleted file mode 100644 index 066759add0..0000000000 --- a/asm/nonmatchings/code_e0b30_len_b80/func_8014AEF8.s +++ /dev/null @@ -1,42 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8014AEF8 -/* E15F8 8014AEF8 3C028007 */ lui $v0, %hi(gGameStatusPtr) -/* E15FC 8014AEFC 8C42419C */ lw $v0, %lo(gGameStatusPtr)($v0) -/* E1600 8014AF00 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* E1604 8014AF04 AFBF001C */ sw $ra, 0x1c($sp) -/* E1608 8014AF08 AFB00018 */ sw $s0, 0x18($sp) -/* E160C 8014AF0C 80420071 */ lb $v0, 0x71($v0) -/* E1610 8014AF10 3C108016 */ lui $s0, %hi(gMusicPlayers) -/* E1614 8014AF14 26109AF0 */ addiu $s0, $s0, %lo(gMusicPlayers) -/* E1618 8014AF18 14400018 */ bnez $v0, .L8014AF7C -/* E161C 8014AF1C 3C030002 */ lui $v1, 2 -/* E1620 8014AF20 3C02800A */ lui $v0, %hi(D_8009A650) -/* E1624 8014AF24 8C42A650 */ lw $v0, %lo(D_8009A650)($v0) -/* E1628 8014AF28 00431024 */ and $v0, $v0, $v1 -/* E162C 8014AF2C 14400013 */ bnez $v0, .L8014AF7C -/* E1630 8014AF30 0000202D */ daddu $a0, $zero, $zero -/* E1634 8014AF34 0C01554F */ jal func_8005553C -/* E1638 8014AF38 240500FA */ addiu $a1, $zero, 0xfa -/* E163C 8014AF3C 0000202D */ daddu $a0, $zero, $zero -/* E1640 8014AF40 8E05001C */ lw $a1, 0x1c($s0) -/* E1644 8014AF44 8E060010 */ lw $a2, 0x10($s0) -/* E1648 8014AF48 8E070014 */ lw $a3, 0x14($s0) -/* E164C 8014AF4C 8E080018 */ lw $t0, 0x18($s0) -/* E1650 8014AF50 96030000 */ lhu $v1, ($s0) -/* E1654 8014AF54 24020008 */ addiu $v0, $zero, 8 -/* E1658 8014AF58 AFA20010 */ sw $v0, 0x10($sp) -/* E165C 8014AF5C AE060024 */ sw $a2, 0x24($s0) -/* E1660 8014AF60 8E060020 */ lw $a2, 0x20($s0) -/* E1664 8014AF64 34630004 */ ori $v1, $v1, 4 -/* E1668 8014AF68 AE070028 */ sw $a3, 0x28($s0) -/* E166C 8014AF6C 240701F4 */ addiu $a3, $zero, 0x1f4 -/* E1670 8014AF70 AE08002C */ sw $t0, 0x2c($s0) -/* E1674 8014AF74 0C052A46 */ jal set_music_track -/* E1678 8014AF78 A6030000 */ sh $v1, ($s0) -.L8014AF7C: -/* E167C 8014AF7C 8FBF001C */ lw $ra, 0x1c($sp) -/* E1680 8014AF80 8FB00018 */ lw $s0, 0x18($sp) -/* E1684 8014AF84 03E00008 */ jr $ra -/* E1688 8014AF88 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/include/common_structs.h b/include/common_structs.h index de7ca66817..0b94f6d4e7 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -322,7 +322,9 @@ typedef struct MusicPlayer { /* 0x18 */ s32 unk_18; /* 0x1C */ s32 unk_1C; /* 0x20 */ s32 unk_20; - /* 0x24 */ char unk_24[12]; + /* 0x24 */ s32 unk_24; + /* 0x28 */ s32 unk_28; + /* 0x2C */ s32 unk_2C; } MusicPlayer; // size = 0x30 typedef struct MenuIcon { diff --git a/include/functions.h b/include/functions.h index 9ba981802d..14ceba06a3 100644 --- a/include/functions.h +++ b/include/functions.h @@ -71,6 +71,7 @@ s32 func_80055464(s32, s32); s32 func_800554A4(s32, s32); s32 func_800554E8(s32, s32); s32 func_800555E4(s32); +void func_800561A4(s16); s32 osGetId(); void set_curtain_scale_goal(f32 scale); diff --git a/include/map.h b/include/map.h index b91d409e0f..3c1708e0ad 100644 --- a/include/map.h +++ b/include/map.h @@ -257,5 +257,6 @@ Area gAreas[29]; /// Lists the songs that are forced to use the variation determined by `map.songVariation & 1`. /// @see get_song_variation_override_for_cur_map extern SongID gSongsUsingVariationFlag[6]; +extern s16 D_8014F738; #endif diff --git a/src/code_197F40.c b/src/code_197F40.c index 49b3d3bd83..4dcfe1d713 100644 --- a/src/code_197F40.c +++ b/src/code_197F40.c @@ -48,7 +48,25 @@ void set_actor_current_position(ActorID actorID, f32 x, f32 y, f32 z) { actor->currentPos.z = z; } -INCLUDE_ASM(s32, "code_197F40", set_part_absolute_position); +void set_part_absolute_position(s32 actorID, s32 partIndex, f32 x, f32 y, f32 z) { + Actor* actor = get_actor(actorID); + ActorPart* actorPart; + + switch (actorID & 0x700) { + case 0: + actor->currentPos.x = x; + actor->currentPos.y = y; + actor->currentPos.z = z; + break; + case 0x100: + case 0x200: + actorPart = get_actor_part(actor, partIndex); + actorPart->absolutePosition.x = x; + actorPart->absolutePosition.y = y; + actorPart->absolutePosition.z = z; + break; + } +} void set_actor_home_position(ActorID actorID, f32 x, f32 y, f32 z) { Actor* actor = get_actor(actorID); diff --git a/src/code_303c0_len_3e10.c b/src/code_303c0_len_3e10.c index 0fb5eb1c82..76cbc9c2a1 100644 --- a/src/code_303c0_len_3e10.c +++ b/src/code_303c0_len_3e10.c @@ -142,7 +142,7 @@ INCLUDE_ASM(s32, "code_303c0_len_3e10", func_8005615C); INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80056180); -INCLUDE_ASM(s32, "code_303c0_len_3e10", func_800561A4); +INCLUDE_ASM(void, "code_303c0_len_3e10", func_800561A4, s16 arg0); INCLUDE_ASM(s32, "code_303c0_len_3e10", func_800561C4); diff --git a/src/code_e0b30_len_b80.c b/src/code_e0b30_len_b80.c index e82a8caaa3..e881e95c0d 100644 --- a/src/code_e0b30_len_b80.c +++ b/src/code_e0b30_len_b80.c @@ -213,18 +213,61 @@ void transition_music_volume_to(s16 volume) { INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014AC94); +s32 func_800559FC(s32); + INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014AD40); -INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014ADA4); +void func_8014ADA4(void) { + MusicPlayer* musicPlayer = &gMusicPlayers[0]; -INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014ADF8); + if (GAME_STATUS->demoState == 0) { + musicPlayer->flags |= 8; + _set_music_track(0, musicPlayer->unk_24, musicPlayer->unk_28, 0, 8); + } +} -INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014AE6C); +void func_8014ADF8(SongID songID, s32 variation) { + MusicPlayer* musicPlayer = &gMusicPlayers[0]; -INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014AEF8); + if (GAME_STATUS->demoState == 0) { + musicPlayer->unk_24 = musicPlayer->songID; + musicPlayer->unk_28 = musicPlayer->variation; + musicPlayer->unk_2C = musicPlayer->unk_18; + musicPlayer->flags |= 4; + set_music_track(0, songID, variation, 500, 8); + } +} + +void func_8014AE6C(void) { + MusicPlayer* musicPlayer = &gMusicPlayers[0]; + + if (GAME_STATUS->demoState == 0) { + if (D_8009A650[0] & 0x20000) { + D_8009A650[0] &= ~0x20000; + } else { + musicPlayer->flags |= 8; + _set_music_track(0, musicPlayer->unk_24, musicPlayer->unk_28, 0, 8); + func_80055590(0, 250); + } + } +} + +void func_8014AEF8(void) { + MusicPlayer* musicPlayer = &gMusicPlayers[0]; + + if (GAME_STATUS->demoState == 0 && !(D_8009A650[0] & 0x20000)) { + func_8005553C(0, 250); + musicPlayer->unk_24 = musicPlayer->songID; + musicPlayer->unk_28 = musicPlayer->variation; + musicPlayer->unk_2C = musicPlayer->unk_18; + musicPlayer->flags |= 4; + set_music_track(0, musicPlayer->unk_1C, musicPlayer->unk_20, 500, 8); + } +} void func_8014AF8C(s32 arg0, s32 arg1) { MusicPlayer* musicPlayer = &gMusicPlayers[0]; + musicPlayer->unk_1C = arg0; musicPlayer->unk_20 = arg1; } diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt index 93a0c4fec6..773afa2152 100644 --- a/tools/symbol_addrs.txt +++ b/tools/symbol_addrs.txt @@ -891,7 +891,8 @@ get_default_variation_for_song = 0x8014A430; _set_music_track = 0x8014A7E0; set_music_track = 0x8014A918; transition_music_volume_to = 0x8014AC84; -gSongArray = 0x8014F720; +gSongsUsingVariationFlag = 0x8014F720; +D_8014F738 = 0x8014F738; gCurrentAnimMeshListPtr = 0x80153A40; D_80156954 = 0x80156954; gMusicUnkVolume = 0x80159AE0; diff --git a/undefined_syms.txt b/undefined_syms.txt index 313f9950d8..5f64481f84 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -331,3 +331,4 @@ D_80078DB0 = 0x80078DB0; D_80078DB4 = 0x80078DB4; gSongsUsingVariationFlag = 0x8014F720; +D_8014F738 = 0x8014F738;