A handful of script functions. Commented out ones that aren't fully matching yet

This commit is contained in:
Jdog 2020-08-11 14:38:21 -07:00
parent 7463fce021
commit 447e6261e1
14 changed files with 179 additions and 119 deletions

View File

@ -1,11 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.include "include/macro.inc"
glabel func_80035DF0
/* 0111F0 80035DF0 3C01800A */ lui $at, 0x800a
/* 0111F4 80035DF4 A4240942 */ sh $a0, 0x942($at)
/* 0111F8 80035DF8 03E00008 */ jr $ra
/* 0111FC 80035DFC 00000000 */ nop

View File

@ -1,21 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.include "include/macro.inc"
glabel func_800360FC
/* 0114FC 800360FC 3C028007 */ lui $v0, 0x8007
/* 011500 80036100 8C42419C */ lw $v0, 0x419c($v0)
/* 011504 80036104 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 011508 80036108 AFBF0010 */ sw $ra, 0x10($sp)
/* 01150C 8003610C 804300AC */ lb $v1, 0xac($v0)
/* 011510 80036110 24020002 */ addiu $v0, $zero, 2
/* 011514 80036114 14620003 */ bne $v1, $v0, .L80036124
/* 011518 80036118 00000000 */ nop
/* 01151C 8003611C 0C03A5CF */ jal func_800E973C
/* 011520 80036120 00000000 */ nop
.L80036124:
/* 011524 80036124 8FBF0010 */ lw $ra, 0x10($sp)
/* 011528 80036128 03E00008 */ jr $ra
/* 01152C 8003612C 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,28 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.include "include/macro.inc"
glabel func_80036130
/* 011530 80036130 3C058007 */ lui $a1, 0x8007
/* 011534 80036134 8CA5419C */ lw $a1, 0x419c($a1)
/* 011538 80036138 84A40088 */ lh $a0, 0x88($a1)
/* 01153C 8003613C 84A30086 */ lh $v1, 0x86($a1)
/* 011540 80036140 24020014 */ addiu $v0, $zero, 0x14
/* 011544 80036144 3C01800A */ lui $at, 0x800a
/* 011548 80036148 A4200940 */ sh $zero, 0x940($at)
/* 01154C 8003614C 3C01800A */ lui $at, 0x800a
/* 011550 80036150 A4220942 */ sh $v0, 0x942($at)
/* 011554 80036154 3C01800A */ lui $at, 0x800a
/* 011558 80036158 A4200944 */ sh $zero, 0x944($at)
/* 01155C 8003615C 10830005 */ beq $a0, $v1, .L80036174
/* 011560 80036160 24020001 */ addiu $v0, $zero, 1
/* 011564 80036164 94A30086 */ lhu $v1, 0x86($a1)
/* 011568 80036168 A4A2008A */ sh $v0, 0x8a($a1)
/* 01156C 8003616C 03E00008 */ jr $ra
/* 011570 80036170 A4A30088 */ sh $v1, 0x88($a1)
.L80036174:
/* 011574 80036174 03E00008 */ jr $ra
/* 011578 80036178 A4A0008A */ sh $zero, 0x8a($a1)

View File

@ -1,22 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.include "include/macro.inc"
glabel func_800363FC
/* 0117FC 800363FC 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 011800 80036400 3C03800A */ lui $v1, 0x800a
/* 011804 80036404 84630944 */ lh $v1, 0x944($v1)
/* 011808 80036408 24020004 */ addiu $v0, $zero, 4
/* 01180C 8003640C 10620003 */ beq $v1, $v0, .L8003641C
/* 011810 80036410 AFBF0010 */ sw $ra, 0x10($sp)
/* 011814 80036414 14600003 */ bnez $v1, .L80036424
/* 011818 80036418 00000000 */ nop
.L8003641C:
/* 01181C 8003641C 0C03A5CF */ jal func_800E973C
/* 011820 80036420 00000000 */ nop
.L80036424:
/* 011824 80036424 8FBF0010 */ lw $ra, 0x10($sp)
/* 011828 80036428 03E00008 */ jr $ra
/* 01182C 8003642C 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
.include "include/macro.inc"
glabel func_80036430
/* 011830 80036430 240200FF */ addiu $v0, $zero, 0xff
/* 011834 80036434 3C01800A */ lui $at, 0x800a
/* 011838 80036438 A4220940 */ sh $v0, 0x940($at)
/* 01183C 8003643C 24020014 */ addiu $v0, $zero, 0x14
/* 011840 80036440 3C048011 */ lui $a0, 0x8011
/* 011844 80036444 2484EFC8 */ addiu $a0, $a0, -0x1038
/* 011848 80036448 3C01800A */ lui $at, 0x800a
/* 01184C 8003644C A4220942 */ sh $v0, 0x942($at)
/* 011850 80036450 8C820000 */ lw $v0, ($a0)
/* 011854 80036454 24030001 */ addiu $v1, $zero, 1
/* 011858 80036458 3C01800A */ lui $at, 0x800a
/* 01185C 8003645C A4230944 */ sh $v1, 0x944($at)
/* 011860 80036460 34421000 */ ori $v0, $v0, 0x1000
/* 011864 80036464 03E00008 */ jr $ra
/* 011868 80036468 AC820000 */ sw $v0, ($a0)

View File

@ -27,6 +27,7 @@ glabel AddItem
/* 0FB498 802D6AE8 03E00008 */ jr $ra
/* 0FB49C 802D6AEC 27BD0020 */ addiu $sp, $sp, 0x20
glabel func_802D6AF0
/* 0FB4A0 802D6AF0 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0FB4A4 802D6AF4 AFBF0010 */ sw $ra, 0x10($sp)
/* 0FB4A8 802D6AF8 8C82000C */ lw $v0, 0xc($a0)

View File

@ -16,6 +16,7 @@ glabel PlaySound
/* 0FAB24 802D6174 03E00008 */ jr $ra
/* 0FAB28 802D6178 27BD0018 */ addiu $sp, $sp, 0x18
glabel func_802D617C
/* 0FAB2C 802D617C 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0FAB30 802D6180 AFB10014 */ sw $s1, 0x14($sp)
/* 0FAB34 802D6184 0080882D */ daddu $s1, $a0, $zero

View File

@ -16,6 +16,7 @@ glabel RemoveEffect
/* 0FC4B8 802D7B08 03E00008 */ jr $ra
/* 0FC4BC 802D7B0C 27BD0018 */ addiu $sp, $sp, 0x18
glabel func_802D7B10
/* 0FC4C0 802D7B10 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0FC4C4 802D7B14 AFBF0010 */ sw $ra, 0x10($sp)
/* 0FC4C8 802D7B18 8C82000C */ lw $v0, 0xc($a0)
@ -30,6 +31,7 @@ glabel RemoveEffect
/* 0FC4EC 802D7B3C 03E00008 */ jr $ra
/* 0FC4F0 802D7B40 27BD0018 */ addiu $sp, $sp, 0x18
glabel func_802D7B44
/* 0FC4F4 802D7B44 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0FC4F8 802D7B48 AFBF0010 */ sw $ra, 0x10($sp)
/* 0FC4FC 802D7B4C 8C82000C */ lw $v0, 0xc($a0)
@ -43,6 +45,7 @@ glabel RemoveEffect
/* 0FC51C 802D7B6C 03E00008 */ jr $ra
/* 0FC520 802D7B70 27BD0018 */ addiu $sp, $sp, 0x18
glabel func_802D7B74
/* 0FC524 802D7B74 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0FC528 802D7B78 AFBF0010 */ sw $ra, 0x10($sp)
/* 0FC52C 802D7B7C 8C82000C */ lw $v0, 0xc($a0)
@ -56,6 +59,7 @@ glabel RemoveEffect
/* 0FC54C 802D7B9C 03E00008 */ jr $ra
/* 0FC550 802D7BA0 27BD0018 */ addiu $sp, $sp, 0x18
glabel func_802D7BA4
/* 0FC554 802D7BA4 27BDFFC8 */ addiu $sp, $sp, -0x38
/* 0FC558 802D7BA8 AFB00018 */ sw $s0, 0x18($sp)
/* 0FC55C 802D7BAC 0080802D */ daddu $s0, $a0, $zero
@ -148,6 +152,7 @@ glabel RemoveEffect
/* 0FC6A0 802D7CF0 03E00008 */ jr $ra
/* 0FC6A4 802D7CF4 27BD0038 */ addiu $sp, $sp, 0x38
glabel func_802D7CF8
/* 0FC6A8 802D7CF8 27BDFFD0 */ addiu $sp, $sp, -0x30
/* 0FC6AC 802D7CFC AFB10014 */ sw $s1, 0x14($sp)
/* 0FC6B0 802D7D00 0080882D */ daddu $s1, $a0, $zero
@ -217,6 +222,7 @@ glabel RemoveEffect
/* 0FC7B0 802D7E00 03E00008 */ jr $ra
/* 0FC7B4 802D7E04 27BD0030 */ addiu $sp, $sp, 0x30
glabel func_802D7E08
/* 0FC7B8 802D7E08 27BDFFA0 */ addiu $sp, $sp, -0x60
/* 0FC7BC 802D7E0C AFB10024 */ sw $s1, 0x24($sp)
/* 0FC7C0 802D7E10 0080882D */ daddu $s1, $a0, $zero

View File

@ -16,6 +16,7 @@ glabel StopSound
/* 0FAC8C 802D62DC 03E00008 */ jr $ra
/* 0FAC90 802D62E0 27BD0018 */ addiu $sp, $sp, 0x18
glabel func_802D62E4
/* 0FAC94 802D62E4 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0FAC98 802D62E8 AFBF0010 */ sw $ra, 0x10($sp)
/* 0FAC9C 802D62EC 8C82000C */ lw $v0, 0xc($a0)

View File

@ -16,6 +16,7 @@ glabel UseDoorSounds
/* 0FACE8 802D6338 03E00008 */ jr $ra
/* 0FACEC 802D633C 27BD0018 */ addiu $sp, $sp, 0x18
glabel func_802D6340
/* 0FACF0 802D6340 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0FACF4 802D6344 AFBF0010 */ sw $ra, 0x10($sp)
/* 0FACF8 802D6348 8C82000C */ lw $v0, 0xc($a0)

View File

@ -13,10 +13,14 @@ extern s16* D_80151328;
extern s16 D_8010CD10;
extern s16 D_8010CD12;
extern u16 D_800A0940;
extern u16 mapTransitionAlpha;
extern u16 D_800A0942;
extern s16 D_800A0944;
extern s16 D_80151308;
extern s16 gCurrentDoorSoundsSet;
#endif

View File

@ -25,7 +25,7 @@ void func_800360FC(void) {
void func_80036130(void) {
game_status* gameStatus = *gGameStatusPtr;
D_800A0940 = 0x00;
mapTransitionAlpha = 0x00;
D_800A0942 = 0x14;
D_800A0944 = 0x00;
@ -52,7 +52,7 @@ s32 func_800363FC(void) {
s32 func_80036430(void) {
player_status* pPlayerStatus = &gPlayerStatus;
D_800A0940 = 0xFF;
mapTransitionAlpha = 0xFF;
D_800A0942 = 0x14;
D_800A0944 = 0x01;

View File

@ -2,21 +2,92 @@
INCLUDE_ASM(code_fa4c0_len_3bf0, func_802D5B10);
INCLUDE_ASM(code_fa4c0_len_3bf0, FadeOutMusic);
s32 FadeOutMusic(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32* ptrNextPos = ptrReadPos++;
INCLUDE_ASM(code_fa4c0_len_3bf0, SetMusicTrack);
return (set_music_track(itemID, -1, 0, get_variable(script, *ptrNextPos++), 8) != 0) * 2;
}
s32 SetMusicTrack(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 musicPlayer = get_variable(script, *ptrReadPos++);
s32 songID = get_variable(script, *ptrReadPos++);
s32 variation = get_variable(script, *ptrReadPos++);
s32 volume = get_variable(script, *ptrReadPos++);
return (set_music_track(musicPlayer, songID, variation, 0x1F4, (volume << 0x10) >> 0x10) != 0) * 2;
}
INCLUDE_ASM(code_fa4c0_len_3bf0, FadeInMusic);
INCLUDE_ASM(code_fa4c0_len_3bf0, PlayAmbientSounds);
s32 PlayAmbientSounds(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 soundID = get_variable(script, *ptrReadPos++);
INCLUDE_ASM(code_fa4c0_len_3bf0, PlaySound);
return (play_ambient_sounds(soundID, 0xFA) != 0) * 2;
}
s32 PlaySound(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 soundID = get_variable(script, *ptrReadPos++);
play_sound(soundID);
return 2;
}
s32 func_802D617C(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 soundID = get_variable(script, *ptrReadPos++);
s32 value2 = get_variable(script, *ptrReadPos++);
_play_sound(soundID, value2 & 0xFF, 0, 0);
return 2;
}
INCLUDE_ASM(code_fa4c0_len_3bf0, PlaySoundAt);
/*
s32 PlaySoundAt(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 soundID = get_variable(script, *ptrReadPos++);
s32 value2 = get_variable(script, *ptrReadPos++);
s32 x = get_variable(script, *ptrReadPos++);
s32 y = get_variable(script, *ptrReadPos++);
s32 z = get_variable(script, *ptrReadPos++);
INCLUDE_ASM(code_fa4c0_len_3bf0, StopSound);
play_sound_at_position(soundID, value2, x, y, z);
return 2;
}
*/
INCLUDE_ASM(code_fa4c0_len_3bf0, UseDoorSounds);
s32 StopSound(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
stop_sound(get_variable(script, *ptrReadPos++));
return 2;
}
s32 func_802D62E4(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
func_80149A6C(get_variable(script, *ptrReadPos++), 1);
return 2;
}
s32 UseDoorSounds(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
gCurrentDoorSoundsSet = get_variable(script, *ptrReadPos++);
return 2;
}
s32 func_802D6340(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
D_80151308 = get_variable(script, *ptrReadPos++);
return 2;
}
INCLUDE_ASM(code_fa4c0_len_3bf0, PlaySoundAtF);
@ -30,7 +101,19 @@ INCLUDE_ASM(code_fa4c0_len_3bf0, HasKeyItem);
INCLUDE_ASM(code_fa4c0_len_3bf0, FindKeyItem);
INCLUDE_ASM(code_fa4c0_len_3bf0, AddItem);
s32 AddItem(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32* ptrNextPos = *ptrReadPos++;
set_variable(script, ptrNextPos, add_item(itemID));
return 2;
}
s32 func_802D6AF0(script_context* script, s32 initialCall) {
set_variable(script, *script->ptrReadPos, 0);
return 2;
}
INCLUDE_ASM(code_fa4c0_len_3bf0, FindItem);
@ -48,19 +131,53 @@ INCLUDE_ASM(code_fa4c0_len_3bf0, DropItemEntityB);
INCLUDE_ASM(code_fa4c0_len_3bf0, RemoveItemEntity);
INCLUDE_ASM(code_fa4c0_len_3bf0, AddBadge);
s32 AddBadge(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemID = get_variable(script, *ptrReadPos++);
s32* ptrNextPos = *ptrReadPos++;
set_variable(script, ptrNextPos, add_badge(itemID));
return 2;
}
INCLUDE_ASM(code_fa4c0_len_3bf0, RemoveBadge);
INCLUDE_ASM(code_fa4c0_len_3bf0, SetItemPos);
/*
s32 SetItemPos(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 itemEntityIndex, value2, value3, value4;
s32* ptrItemEntity;
itemEntityIndex = get_variable(script, *ptrReadPos++);
value2 = get_variable(script, *ptrReadPos++);
value3 = get_variable(script, *ptrReadPos++);
value4 = get_variable(script, *ptrReadPos++);
ptrItemEntity = get_item_entity(itemEntityIndex);
*(ptrItemEntity + 0x08) = (f64) value2;
*(ptrItemEntity + 0x0C) = (f64) value3;
*(ptrItemEntity + 0x10) = (f64) value4;
return 2;
}
*/
INCLUDE_ASM(code_fa4c0_len_3bf0, SetItemFlags);
INCLUDE_ASM(code_fa4c0_len_3bf0, AddCoin);
s32 AddCoin(script_context* script, s32 initialCall) {
script->varTable[0] = add_coins(get_variable(script, *script->ptrReadPos));
return 2;
}
INCLUDE_ASM(code_fa4c0_len_3bf0, AddStarPoints);
s32 AddStarPoints(script_context* script, s32 initialCall) {
script->varTable[0] = add_star_points(get_variable(script, *script->ptrReadPos));
return 2;
}
INCLUDE_ASM(code_fa4c0_len_3bf0, AddStarPieces);
s32 AddStarPieces(script_context* script, s32 initialCall) {
script->varTable[0] = add_star_pieces(get_variable(script, *script->ptrReadPos));
return 2;
}
INCLUDE_ASM(code_fa4c0_len_3bf0, GetItemPower);
@ -73,6 +190,35 @@ INCLUDE_ASM(code_fa4c0_len_3bf0, func_802D74C0);
INCLUDE_ASM(code_fa4c0_len_3bf0, ShowEmote);
INCLUDE_ASM(code_fa4c0_len_3bf0, RemoveEffect);
/*
s32 RemoveEffect(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
remove_effect(get_variable(script, *ptrReadPos++));
return 2;
}
s32 func_802D7B10(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 ptrValue = get_variable(script, *ptrReadPos++);
*ptrValue = (*ptrValue | 0x10);
return 2;
}
s32 func_802D7B44(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 ptrValue = get_variable(script, *ptrReadPos++);
*((ptrValue + 0xC) + 0x14) = 10;
return 2;
}
s32 func_802D7B74(script_context* script, s32 initialCall) {
s32* ptrReadPos = script->ptrReadPos;
s32 ptrValue = get_variable(script, *ptrReadPos++);
*((ptrValue + 0xC) + 0x30) = 5;
return 2;
}
*/
INCLUDE_ASM(code_fa4c0_len_3bf0, ShowSleepBubble);

View File

@ -4,7 +4,7 @@ gPlayerData = 0x8010F290;
gPlayerStatus = 0x8010EFC8;
gItemTable = 0x800878E0;
D_800A0940 = 0x800A0940;
mapTransitionAlpha = 0x800A0940;
D_800A0942 = 0x800A0942;
D_800A0944 = 0x800A0944;
@ -46,7 +46,11 @@ D_00316F30 = 0x00316F30;
D_8010D000 = 0x8010D000;
D_8014F140 = 0x8014F140;
D_80151308 = 0x80151308;
D_80151328 = 0x80151328;
gCurrentDoorSoundsSet = 0x80151340;
D_8015C7C0 = 0x8015C7C0;
func_802A91F8 = 0x802A91F8;