This commit is contained in:
Ethan Roseman 2020-09-07 17:12:31 -04:00
parent 290a7426a5
commit ab244966a8
11 changed files with 62 additions and 96 deletions

View File

@ -1,22 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetBattleMusic
/* 01FE38 80044A38 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 01FE3C 80044A3C AFBF0010 */ sw $ra, 0x10($sp)
/* 01FE40 80044A40 8C82000C */ lw $v0, 0xc($a0)
/* 01FE44 80044A44 0C0B1EAF */ jal get_variable
/* 01FE48 80044A48 8C450000 */ lw $a1, ($v0)
/* 01FE4C 80044A4C 3C04800B */ lui $a0, 0x800b
/* 01FE50 80044A50 24840F10 */ addiu $a0, $a0, 0xf10
/* 01FE54 80044A54 24030001 */ addiu $v1, $zero, 1
/* 01FE58 80044A58 A0830011 */ sb $v1, 0x11($a0)
/* 01FE5C 80044A5C 2403FFFF */ addiu $v1, $zero, -1
/* 01FE60 80044A60 AC820014 */ sw $v0, 0x14($a0)
/* 01FE64 80044A64 AC830018 */ sw $v1, 0x18($a0)
/* 01FE68 80044A68 8FBF0010 */ lw $ra, 0x10($sp)
/* 01FE6C 80044A6C 24020002 */ addiu $v0, $zero, 2
/* 01FE70 80044A70 03E00008 */ jr $ra
/* 01FE74 80044A74 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,24 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_800287F0
/* 003BF0 800287F0 3C038007 */ lui $v1, 0x8007
/* 003BF4 800287F4 2463419C */ addiu $v1, $v1, 0x419c
/* 003BF8 800287F8 8C620000 */ lw $v0, ($v1)
/* 003BFC 800287FC A0400040 */ sb $zero, 0x40($v0)
/* 003C00 80028800 8C640000 */ lw $a0, ($v1)
/* 003C04 80028804 AC400000 */ sw $zero, ($v0)
/* 003C08 80028808 AC400010 */ sw $zero, 0x10($v0)
/* 003C0C 8002880C AC400020 */ sw $zero, 0x20($v0)
/* 003C10 80028810 A0800044 */ sb $zero, 0x44($a0)
/* 003C14 80028814 8C630000 */ lw $v1, ($v1)
/* 003C18 80028818 24020004 */ addiu $v0, $zero, 4
/* 003C1C 8002881C A4620050 */ sh $v0, 0x50($v1)
/* 003C20 80028820 2402000F */ addiu $v0, $zero, 0xf
/* 003C24 80028824 AC600030 */ sw $zero, 0x30($v1)
/* 003C28 80028828 A4620048 */ sh $v0, 0x48($v1)
/* 003C2C 8002882C A4600060 */ sh $zero, 0x60($v1)
/* 003C30 80028830 03E00008 */ jr $ra
/* 003C34 80028834 A4600058 */ sh $zero, 0x58($v1)

View File

@ -1,8 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8002BA78
/* 006E78 8002BA78 03E00008 */ jr $ra
/* 006E7C 8002BA7C 00000000 */ nop

View File

@ -1,16 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel _spr_sign_extend_12bit
/* 1001CC 802DD0DC 30840FFF */ andi $a0, $a0, 0xfff
/* 1001D0 802DD0E0 30820800 */ andi $v0, $a0, 0x800
/* 1001D4 802DD0E4 14400003 */ bnez $v0, .L802DD0F4
/* 1001D8 802DD0E8 2402F000 */ addiu $v0, $zero, -0x1000
/* 1001DC 802DD0EC 03E00008 */ jr $ra
/* 1001E0 802DD0F0 0080102D */ daddu $v0, $a0, $zero
.L802DD0F4:
/* 1001E4 802DD0F4 03E00008 */ jr $ra
/* 1001E8 802DD0F8 00821025 */ or $v0, $a0, $v0

View File

@ -1,16 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel _spr_sign_extend_16bit
/* 1001EC 802DD0FC 3084FFFF */ andi $a0, $a0, 0xffff
/* 1001F0 802DD100 30828000 */ andi $v0, $a0, 0x8000
/* 1001F4 802DD104 14400003 */ bnez $v0, .L802DD114
/* 1001F8 802DD108 3C02FFFF */ lui $v0, 0xffff
/* 1001FC 802DD10C 03E00008 */ jr $ra
/* 100200 802DD110 0080102D */ daddu $v0, $a0, $zero
.L802DD114:
/* 100204 802DD114 03E00008 */ jr $ra
/* 100208 802DD118 00821025 */ or $v0, $a0, $v0

View File

@ -836,7 +836,15 @@ typedef struct GameStatus {
/* 0x042 */ char unk_42[2];
/* 0x044 */ u8 stickY; /* with deadzone */
/* 0x045 */ u8 altStickY; /* input used for batte when flag 80000 set */
/* 0x046 */ char unk_46[34];
/* 0x046 */ char unk_46[2];
/* 0x048 */ s16 unk_48;
/* 0x04A */ char unk_4A[6];
/* 0x050 */ s16 unk_50;
/* 0x052 */ char unk_52[6];
/* 0x058 */ s16 unk_58;
/* 0x05A */ char unk_5A[6];
/* 0x060 */ s16 unk_60;
/* 0x062 */ char unk_62[6];
/* 0x068 */ s16 demoButtonInput;
/* 0x06A */ s8 demoStickX;
/* 0x06B */ s8 demoStickY;
@ -1406,7 +1414,7 @@ typedef struct EncounterStatus {
/* 0x12 */ char unk_12;
/* 0x13 */ u8 dropWhackaBump;
/* 0x14 */ s32 songID;
/* 0x18 */ char unk_18[4];
/* 0x18 */ s32 unk_18;
/* 0x1C */ u8 numEncounters; /* number of encounters for current map (in list) */
/* 0x1D */ char unk_1D[3];
/* 0x20 */ u8 mapID;

View File

@ -48,15 +48,15 @@ s32 func_800363FC(void) {
}
s32 func_80036430(void) {
PlayerStatus* pPlayerStatus = &gPlayerStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
gMapTransitionAlpha = 0xFF;
D_800A0942 = 0x14;
D_800A0944 = 0x01;
pPlayerStatus->flags |= 0x1000;
playerStatus->flags |= 0x1000;
return pPlayerStatus->flags;
return playerStatus->flags;
}
INCLUDE_ASM("code_111f0_len_860", func_8003646C);

View File

@ -41,7 +41,15 @@ ApiStatus StartBattleWith(ScriptInstance* script, s32 isInitialCall) {
INCLUDE_API_ASM("code_1f580_len_1940", StartBossBattle);
INCLUDE_API_ASM("code_1f580_len_1940", SetBattleMusic);
ApiStatus SetBattleMusic(ScriptInstance* script, s32 isInitialCall) {
Bytecode songID = get_variable(script, *script->ptrReadPos);
EncounterStatus* currentEncounter = &gCurrentEncounter;
currentEncounter->allowFleeing = 1;
currentEncounter->songID = songID;
currentEncounter->unk_18 = -1;
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_1f580_len_1940", BindNpcAI);

View File

@ -1,6 +1,24 @@
#include "common.h"
INCLUDE_ASM("code_3bf0_len_6f0", func_800287F0);
void func_800287F0(void) {
GameStatus* gameStatus = *gGameStatusPtr;
GameStatus* gameStatus2;
GameStatus* gameStatus3;
gameStatus->stickX = 0;
gameStatus2 = *gGameStatusPtr;
gameStatus->currentButtons = 0;
gameStatus->pressedButtons = 0;
gameStatus->heldButtons = 0;
gameStatus2->stickY = 0;
gameStatus3 = *gGameStatusPtr;
gameStatus3->unk_50 = 4;
gameStatus3->prevButtons = 0;
gameStatus3->unk_48 = 15;
gameStatus3->unk_60 = 0;
gameStatus3->unk_58 = 0;
}
INCLUDE_ASM("code_3bf0_len_6f0", func_80028838);

View File

@ -2,7 +2,8 @@
INCLUDE_ASM("code_6e40_len_500", func_8002BA40);
INCLUDE_ASM("code_6e40_len_500", func_8002BA78);
void func_8002BA78(void) {
}
INCLUDE_ASM("code_6e40_len_500", func_8002BA80);

View File

@ -18,9 +18,26 @@ INCLUDE_ASM("code_fee30_len_2d60", spr_transform_point);
INCLUDE_ASM("code_fee30_len_2d60", spr_draw_component);
INCLUDE_ASM("code_fee30_len_2d60", _spr_sign_extend_12bit);
s32 _spr_sign_extend_12bit(u16 val) {
s32 temp = val & 0xFFF;
INCLUDE_ASM("code_fee30_len_2d60", _spr_sign_extend_16bit);
if ((temp & 0x800)) {
return temp | -0x1000;
} else {
return temp;
}
}
//INCLUDE_ASM("code_fee30_len_2d60", _spr_sign_extend_16bit);
s32 _spr_sign_extend_16bit(u16 val) {
s32 temp = val & 0xFFFF;
if (temp & 0x8000) {
return temp | 0xFFFF0000;
} else {
return temp;
}
}
INCLUDE_ASM("code_fee30_len_2d60", update_component);