[WIP] Decompile fledd_softboiled.h

This commit is contained in:
KDSKardabox 2018-02-15 15:29:26 +05:30
parent fcf3f97da9
commit 64683e1473
6 changed files with 377 additions and 163 deletions

View File

@ -5,169 +5,169 @@
.text .text
thumb_func_start hm_prepare_dive_probably // thumb_func_start hm_prepare_dive_probably
hm_prepare_dive_probably: @ 8161508 //hm_prepare_dive_probably: @ 8161508
push {r4-r6,lr} // push {r4-r6,lr}
bl GetCursorSelectionMonId // bl GetCursorSelectionMonId
lsls r0, 24 // lsls r0, 24
lsrs r0, 24 // lsrs r0, 24
movs r6, 0x64 // movs r6, 0x64
muls r0, r6 // muls r0, r6
ldr r4, =gPlayerParty // ldr r4, =gPlayerParty
adds r0, r4 // adds r0, r4
movs r1, 0x3A // movs r1, 0x3A
bl GetMonData // bl GetMonData
adds r5, r0, 0 // adds r5, r0, 0
lsls r5, 16 // lsls r5, 16
lsrs r5, 16 // lsrs r5, 16
bl GetCursorSelectionMonId // bl GetCursorSelectionMonId
lsls r0, 24 // lsls r0, 24
lsrs r0, 24 // lsrs r0, 24
muls r0, r6 // muls r0, r6
adds r0, r4 // adds r0, r4
movs r1, 0x39 // movs r1, 0x39
bl GetMonData // bl GetMonData
adds r4, r0, 0 // adds r4, r0, 0
lsls r4, 16 // lsls r4, 16
lsrs r4, 16 // lsrs r4, 16
adds r0, r5, 0 // adds r0, r5, 0
movs r1, 0x5 // movs r1, 0x5
bl __udivsi3 // bl __udivsi3
lsls r0, 16 // lsls r0, 16
lsrs r0, 16 // lsrs r0, 16
cmp r4, r0 // cmp r4, r0
bhi _08161558 // bhi _08161558
movs r0, 0 // movs r0, 0
b _0816155A // b _0816155A
.pool // .pool
_08161558: //_08161558:
movs r0, 0x1 // movs r0, 0x1
_0816155A: //_0816155A:
pop {r4-r6} // pop {r4-r6}
pop {r1} // pop {r1}
bx r1 // bx r1
thumb_func_end hm_prepare_dive_probably // thumb_func_end hm_prepare_dive_probably
thumb_func_start sub_8161560 // thumb_func_start sub_8161560
sub_8161560: @ 8161560 //sub_8161560: @ 8161560
push {r4,lr} // push {r4,lr}
adds r4, r0, 0 // adds r4, r0, 0
lsls r4, 24 // lsls r4, 24
lsrs r4, 24 // lsrs r4, 24
ldr r0, =gUnknown_0203CEC8 // ldr r0, =gUnknown_0203CEC8
movs r1, 0xA // movs r1, 0xA
strb r1, [r0, 0xB] // strb r1, [r0, 0xB]
ldrb r1, [r0, 0x9] // ldrb r1, [r0, 0x9]
strb r1, [r0, 0xA] // strb r1, [r0, 0xA]
bl GetCursorSelectionMonId // bl GetCursorSelectionMonId
lsls r0, 24 // lsls r0, 24
lsrs r0, 24 // lsrs r0, 24
movs r1, 0x1 // movs r1, 0x1
bl sub_81B0FCC // bl sub_81B0FCC
movs r0, 0x5 // movs r0, 0x5
bl display_pokemon_menu_message // bl display_pokemon_menu_message
ldr r1, =gTasks // ldr r1, =gTasks
lsls r0, r4, 2 // lsls r0, r4, 2
adds r0, r4 // adds r0, r4
lsls r0, 3 // lsls r0, 3
adds r0, r1 // adds r0, r1
ldr r1, =sub_81B1370 // ldr r1, =sub_81B1370
str r1, [r0] // str r1, [r0]
pop {r4} // pop {r4}
pop {r0} // pop {r0}
bx r0 // bx r0
.pool // .pool
thumb_func_end sub_8161560 // thumb_func_end sub_8161560
thumb_func_start sub_81615A8 // thumb_func_start sub_81615A8
sub_81615A8: @ 81615A8 //sub_81615A8: @ 81615A8
push {r4-r7,lr} // push {r4-r7,lr}
mov r7, r10 // mov r7, r10
mov r6, r9 // mov r6, r9
mov r5, r8 // mov r5, r8
push {r5-r7} // push {r5-r7}
sub sp, 0x8 // sub sp, 0x8
lsls r0, 24 // lsls r0, 24
lsrs r4, r0, 24 // lsrs r4, r0, 24
str r4, [sp, 0x4] // str r4, [sp, 0x4]
ldr r1, =gUnknown_0203CEC8 // ldr r1, =gUnknown_0203CEC8
ldrb r7, [r1, 0x9] // ldrb r7, [r1, 0x9]
mov r8, r7 // mov r8, r7
ldrb r0, [r1, 0xA] // ldrb r0, [r1, 0xA]
adds r5, r0, 0 // adds r5, r0, 0
cmp r5, 0x6 // cmp r5, 0x6
bls _081615EC // bls _081615EC
movs r0, 0 // movs r0, 0
strb r0, [r1, 0xB] // strb r0, [r1, 0xB]
bl display_pokemon_menu_message // bl display_pokemon_menu_message
ldr r1, =gTasks // ldr r1, =gTasks
lsls r0, r4, 2 // lsls r0, r4, 2
adds r0, r4 // adds r0, r4
lsls r0, 3 // lsls r0, 3
adds r0, r1 // adds r0, r1
ldr r1, =sub_81B1370 // ldr r1, =sub_81B1370
str r1, [r0] // str r1, [r0]
b _08161658 // b _08161658
.pool // .pool
_081615EC: //_081615EC:
movs r0, 0x64 // movs r0, 0x64
mov r10, r0 // mov r10, r0
mov r0, r10 // mov r0, r10
muls r0, r5 // muls r0, r5
ldr r1, =gPlayerParty // ldr r1, =gPlayerParty
mov r9, r1 // mov r9, r1
adds r6, r0, r1 // adds r6, r0, r1
adds r0, r6, 0 // adds r0, r6, 0
movs r1, 0x39 // movs r1, 0x39
bl GetMonData // bl GetMonData
lsls r0, 16 // lsls r0, 16
lsrs r4, r0, 16 // lsrs r4, r0, 16
cmp r4, 0 // cmp r4, 0
beq _0816161A // beq _0816161A
cmp r7, r5 // cmp r7, r5
beq _0816161A // beq _0816161A
adds r0, r6, 0 // adds r0, r6, 0
movs r1, 0x3A // movs r1, 0x3A
bl GetMonData // bl GetMonData
cmp r0, r4 // cmp r0, r4
bne _08161628 // bne _08161628
_0816161A: //_0816161A:
ldr r0, [sp, 0x4] // ldr r0, [sp, 0x4]
bl sub_81617B8 // bl sub_81617B8
b _08161658 // b _08161658
.pool // .pool
_08161628: //_08161628:
movs r0, 0x1 // movs r0, 0x1
bl PlaySE // bl PlaySE
mov r1, r10 // mov r1, r10
mov r0, r8 // mov r0, r8
muls r0, r1 // muls r0, r1
add r0, r9 // add r0, r9
movs r1, 0x3A // movs r1, 0x3A
bl GetMonData // bl GetMonData
movs r1, 0x5 // movs r1, 0x5
bl __udivsi3 // bl __udivsi3
adds r3, r0, 0 // adds r3, r0, 0
lsls r3, 16 // lsls r3, 16
asrs r3, 16 // asrs r3, 16
movs r2, 0x1 // movs r2, 0x1
negs r2, r2 // negs r2, r2
ldr r0, =sub_816166C // ldr r0, =sub_816166C
str r0, [sp] // str r0, [sp]
ldr r0, [sp, 0x4] // ldr r0, [sp, 0x4]
mov r1, r8 // mov r1, r8
bl sub_81B1F18 // bl sub_81B1F18
_08161658: //_08161658:
add sp, 0x8 // add sp, 0x8
pop {r3-r5} // pop {r3-r5}
mov r8, r3 // mov r8, r3
mov r9, r4 // mov r9, r4
mov r10, r5 // mov r10, r5
pop {r4-r7} // pop {r4-r7}
pop {r0} // pop {r0}
bx r0 // bx r0
.pool // .pool
thumb_func_end sub_81615A8 // thumb_func_end sub_81615A8
thumb_func_start sub_816166C thumb_func_start sub_816166C
sub_816166C: @ 816166C sub_816166C: @ 816166C

View File

@ -442,8 +442,8 @@ gUnknown_08615D9C:: @ 8615D9C
.4byte SetUpFieldMove_Teleport, 0x0000000d .4byte SetUpFieldMove_Teleport, 0x0000000d
.4byte sub_813572C, 0x0000000d .4byte sub_813572C, 0x0000000d
.4byte sub_80FA004, 0x0000000d .4byte sub_80FA004, 0x0000000d
.4byte hm_prepare_dive_probably, 0x00000010 .4byte SetUpFieldMove_SoftBoiled, 0x00000010
.4byte hm_prepare_dive_probably, 0x00000010 .4byte SetUpFieldMove_SoftBoiled, 0x00000010
.4byte SetUpFieldMove_SweetScent, 0x0000000d .4byte SetUpFieldMove_SweetScent, 0x0000000d
.align 2 .align 2

View File

@ -0,0 +1,7 @@
#ifndef GUARD_FLDEFF_SOFTBOILED_H
#define GUARD_FLDEFF_SOFTBOILED_H
bool8 SetUpFieldMove_SoftBoiled(void);
void sub_8161560(u8 taskid);
#endif // GUARD_FLDEFF_SOFTBOILED_H

View File

@ -11,6 +11,17 @@ enum
AILMENT_BRN AILMENT_BRN
}; };
struct Struct203CEC8
{
u8 filler[0x9];
u8 unk9;
u8 unkA;
u8 unkB;
u8 filler2[0x2];
};
extern struct Struct203CEC8 gUnknown_0203CEC8;
bool8 pokemon_has_move(struct Pokemon *, u16); bool8 pokemon_has_move(struct Pokemon *, u16);
void sub_81B58A8(void); void sub_81B58A8(void);
void DoWallyTutorialBagMenu(void); void DoWallyTutorialBagMenu(void);
@ -20,4 +31,8 @@ u8 GetCursorSelectionMonId(void);
bool8 FieldCallback_Teleport(void); bool8 FieldCallback_Teleport(void);
void sub_81B7F60(void); void sub_81B7F60(void);
void sub_81B0FCC(u8 partyMonId, u8 a);
void sub_81B1370(u8 taskId);
void display_pokemon_menu_message(u8 windowBorderId);
#endif // GUARD_PARTY_MENU_H #endif // GUARD_PARTY_MENU_H

View File

@ -210,6 +210,7 @@ SECTIONS {
src/fldeff_sweetscent.o(.text); src/fldeff_sweetscent.o(.text);
asm/battle_anim_815A0D4.o(.text); asm/battle_anim_815A0D4.o(.text);
asm/learn_move.o(.text); asm/learn_move.o(.text);
src/fldeff_softboiled.o(.text);
asm/fldeff_softboiled.o(.text); asm/fldeff_softboiled.o(.text);
src/decoration_inventory.o(.text); src/decoration_inventory.o(.text);
src/roamer.o(.text); src/roamer.o(.text);

191
src/fldeff_softboiled.c Normal file
View File

@ -0,0 +1,191 @@
#include "global.h"
#include "fldeff_softboiled.h"
#include "menu.h"
#include "party_menu.h"
#include "pokemon.h"
//#include "pokemon_menu.h"
#include "constants/songs.h"
#include "sound.h"
#include "sprite.h"
#include "strings.h"
#include "task.h"
//#include "ewram.h"
/*
struct Struct2001000 {
u8 unk0;
u8 unk1;
u8 unk2;
u8 filler3[9];
void *unkC;
};
struct Struct201C000 {
struct Pokemon *unk0;
u8 filler4[1];
u8 unk5;
u16 unk6;
u8 filler8[4];
s32 unkC;
void* unk10;
u8 filler14[26];
s16 unk2E;
};
#if ENGLISH
#define WINDOW_LEFT 3
#define WINDOW_RIGHT 26
#elif GERMAN
#define WINDOW_LEFT 0
#define WINDOW_RIGHT 29
#endif
*/
/*
// extern
extern u8 gUnknown_0202E8F6;
extern u8 gLastFieldPokeMenuOpened;
extern u8 gUnknown_0202E8F4;
// Static
static void sub_8133D50(u8 taskId);
static void sub_8133E74(u8 taskId);
static void sub_8133EB8(u8 taskId);
static void sub_8133EF8(void);
*/
void sub_816166C(u8 taskId);
void sub_81617B8(u8 taskId);
void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func);
bool8 SetUpFieldMove_SoftBoiled(void)
{
u16 maxHp;
u16 hp;
u16 minHp;
maxHp = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_MAX_HP);
hp = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_HP);
minHp = (maxHp / 5);
if (hp > minHp)
{
return TRUE;
}
return FALSE;
}
void sub_8161560(u8 taskId)
{
gUnknown_0203CEC8.unkB = 0xA;
gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.unk9;
sub_81B0FCC(GetCursorSelectionMonId(), 0x1);
display_pokemon_menu_message(0x5);
gTasks[taskId].func = sub_81B1370;
}
void sub_81615A8(u8 taskId)
{
u16 hp;
u8 unk9 = gUnknown_0203CEC8.unk9;
u8 pokemonIndex = gUnknown_0203CEC8.unkA;
if(pokemonIndex > 6)
{
gUnknown_0203CEC8.unkB = 0;
display_pokemon_menu_message(0x0);
gTasks[taskId].func = sub_81B1370;
return;
}
hp = GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_HP);
if(hp == 0 || unk9 == pokemonIndex || GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_MAX_HP) == hp)
{
sub_81617B8(taskId);
return;
}
PlaySE(SE_KAIFUKU);
sub_81B1F18(taskId, unk9, -1, GetMonData(&gPlayerParty[unk9], MON_DATA_MAX_HP)/5, sub_816166C);
}
/*
void sub_8133D28(u8 taskid) {
EWRAM_1000.unkC = sub_8133D50;
EWRAM_1B000_2.unk272 = 3;
DoPokemonMenu_Switch(taskid);
}
static void sub_8133D50(u8 taskId) {
u8 unk1, unk2;
u16 hp;
struct Pokemon *pokemon;
//struct Task *task;
struct Sprite *sprites = gSprites;
unk1 = sprites[EWRAM_1000.unk1].data[0];
unk2 = sprites[EWRAM_1000.unk2].data[0];
if (unk1 > 5 || unk2 > 5)
{
sub_806CD44(taskId);
return;
}
EWRAM_1C000.unk0 = &gPlayerParty[sprites[EWRAM_1000.unk2].data[0]];
hp = GetMonData(EWRAM_1C000.unk0, MON_DATA_HP);
if (hp == 0 || unk1 == unk2 || GetMonData(EWRAM_1C000.unk0, MON_DATA_MAX_HP) == hp)
{
sub_8133EB8(taskId);
return;
}
PlaySE(SE_KAIFUKU);
EWRAM_1C000.unk5 = gSprites[EWRAM_1000.unk1].data[0];
pokemon = &gPlayerParty[EWRAM_1C000.unk5];
EWRAM_1C000.unk0 = pokemon;
EWRAM_1C000.unk6 = 0;
EWRAM_1C000.unkC = -0x8000;
EWRAM_1C000.unk10 = sub_8133EF8;
gTasks[taskId].data[10] = GetMonData(EWRAM_1C000.unk0, MON_DATA_MAX_HP);
gTasks[taskId].data[11] = GetMonData(EWRAM_1C000.unk0, MON_DATA_HP);
gTasks[taskId].data[12] = gTasks[taskId].data[10] / 5;
sub_806D5A4();
gTasks[taskId].func = sub_806FA18;
EWRAM_1B000_2.unk282 = gTasks[taskId].data[11];
}
static void sub_8133E74(u8 taskId) {
if (gUnknown_0202E8F6)
{
return;
}
MenuZeroFillWindowRect(WINDOW_LEFT, 14, WINDOW_RIGHT, 19);
PrintPartyMenuPromptText(3, 0);
gTasks[taskId].func = HandlePartyMenuSwitchPokemonInput;
}
static void sub_8133EB8(u8 taskId) {
gUnknown_0202E8F4 = 0;
sub_806D5A4();
sub_806E834(gOtherText_CantUseOnPoke, 1);
gTasks[taskId].func = sub_8133E74;
}
static void sub_8133EF8(void) {
sub_806CCE4();
EWRAM_1B000_2.unk261 = 2;
DestroySprite(&gSprites[EWRAM_1000.unk1]);
MenuZeroFillWindowRect(WINDOW_LEFT, 14, WINDOW_RIGHT, 19);
PrintPartyMenuPromptText(0, 0);
SwitchTaskToFollowupFunc(EWRAM_1000.unk0);
}
*/