pokeemerald/src/fldeff_softboiled.c

110 lines
2.8 KiB
C
Raw Normal View History

2018-02-15 10:59:26 +01:00
#include "global.h"
#include "menu.h"
#include "party_menu.h"
#include "pokemon.h"
#include "sound.h"
#include "sprite.h"
#include "string_util.h"
2018-02-15 10:59:26 +01:00
#include "strings.h"
#include "task.h"
2018-11-14 01:01:50 +01:00
#include "constants/songs.h"
2018-02-15 10:59:26 +01:00
2018-02-27 06:03:23 +01:00
static void sub_816166C(u8 taskId);
static void sub_81616C0(u8 taskId);
static void sub_8161724(u8 taskId);
static void sub_81617B8(u8 taskId);
2018-02-15 10:59:26 +01:00
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;
2019-05-13 00:41:25 +02:00
gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.slotId;
2018-02-15 10:59:26 +01:00
sub_81B0FCC(GetCursorSelectionMonId(), 0x1);
display_pokemon_menu_message(0x5);
gTasks[taskId].func = sub_81B1370;
}
void sub_81615A8(u8 taskId)
{
u16 hp;
2019-05-13 00:41:25 +02:00
u8 slotId = gUnknown_0203CEC8.slotId;
2018-02-15 10:59:26 +01:00
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);
2019-05-13 00:41:25 +02:00
if(hp == 0 || slotId == pokemonIndex || GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_MAX_HP) == hp)
2018-02-15 10:59:26 +01:00
{
sub_81617B8(taskId);
return;
}
PlaySE(SE_KAIFUKU);
2019-05-13 00:41:25 +02:00
sub_81B1F18(taskId, slotId, -1, GetMonData(&gPlayerParty[slotId], MON_DATA_MAX_HP)/5, sub_816166C);
2018-02-15 10:59:26 +01:00
}
2018-02-27 06:03:23 +01:00
static void sub_816166C(u8 taskId)
2018-02-15 11:35:27 +01:00
{
2018-02-15 10:59:26 +01:00
PlaySE(SE_KAIFUKU);
2019-05-13 00:41:25 +02:00
sub_81B1F18(taskId, gUnknown_0203CEC8.unkA, 1, GetMonData(&gPlayerParty[gUnknown_0203CEC8.slotId], MON_DATA_MAX_HP)/5, sub_81616C0);
2018-02-15 10:59:26 +01:00
}
2018-02-27 06:03:23 +01:00
static void sub_81616C0(u8 taskId)
{
GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
sub_81B1B5C(gStringVar4, 0);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_8161724;
2018-02-15 10:59:26 +01:00
}
2018-02-27 06:03:23 +01:00
static void sub_8161724(u8 taskId)
2018-02-15 18:02:28 +01:00
{
if(sub_81B1BD4() == 1)
return;
gUnknown_0203CEC8.unkB = 0x0;
2019-05-13 00:41:25 +02:00
sub_81B0FCC(gUnknown_0203CEC8.slotId, 0);
gUnknown_0203CEC8.slotId = gUnknown_0203CEC8.unkA;
2018-02-15 18:02:28 +01:00
sub_81B0FCC(gUnknown_0203CEC8.unkA, 1);
ClearStdWindowAndFrameToTransparent(0x6, FALSE);
2018-02-15 18:02:28 +01:00
ClearWindowTilemap(0x6);
display_pokemon_menu_message(0);
gTasks[taskId].func = sub_81B1370;
}
2018-02-27 06:03:23 +01:00
static void sub_8161784(u8 taskId)
2018-02-15 18:02:28 +01:00
{
if(sub_81B1BD4() == 1)
return;
display_pokemon_menu_message(0x5);
gTasks[taskId].func = sub_81B1370;
}
2018-02-27 06:03:23 +01:00
static void sub_81617B8(u8 taskId)
2018-02-15 18:02:28 +01:00
{
PlaySE(SE_SELECT);
2018-10-21 02:25:28 +02:00
sub_81B1B5C(gText_CantBeUsedOnPkmn, 0);
2018-02-15 18:02:28 +01:00
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_8161784;
}