mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Implemented Honey's Sweet Scent functionality
This commit is contained in:
parent
ede6162724
commit
1607291982
@ -35,6 +35,7 @@ bool8 FldEff_UseStrength(void);
|
||||
// sweet scent
|
||||
bool8 SetUpFieldMove_SweetScent(void);
|
||||
bool8 FldEff_SweetScent(void);
|
||||
void StartSweetScentFieldEffect(void);
|
||||
|
||||
// teleport
|
||||
bool8 SetUpFieldMove_Teleport(void);
|
||||
|
@ -27,6 +27,7 @@ void ItemUseOutOfBattle_Berry(u8);
|
||||
void ItemUseOutOfBattle_EnigmaBerry(u8);
|
||||
void ItemUseOutOfBattle_FormChange(u8);
|
||||
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8);
|
||||
void ItemUseOutOfBattle_Honey(u8);
|
||||
void ItemUseOutOfBattle_CannotUse(u8);
|
||||
void ItemUseInBattle_PokeBall(u8);
|
||||
void ItemUseInBattle_StatIncrease(u8);
|
||||
|
@ -2035,8 +2035,8 @@ const struct Item gItems[] =
|
||||
.price = 300,
|
||||
.description = sHoneyDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||
.type = ITEM_USE_FIELD,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_Honey,
|
||||
.flingPower = 30,
|
||||
},
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "constants/songs.h"
|
||||
|
||||
static void FieldCallback_SweetScent(void);
|
||||
static void StartSweetScentFieldEffect(void);
|
||||
static void TrySweetScentEncounter(u8 taskId);
|
||||
static void FailSweetScentEncounter(u8 taskId);
|
||||
|
||||
@ -47,14 +46,15 @@ bool8 FldEff_SweetScent(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void StartSweetScentFieldEffect(void)
|
||||
void StartSweetScentFieldEffect(void)
|
||||
{
|
||||
u8 taskId;
|
||||
u32 palettes = ~(1 << (gSprites[GetPlayerAvatarSpriteId()].oam.paletteNum + 16) | (1 << 13) | (1 << 14) | (1 << 15));
|
||||
|
||||
PlaySE(SE_M_SWEET_SCENT);
|
||||
CpuFastSet(gPlttBufferUnfaded, gPaletteDecompressionBuffer, 0x100);
|
||||
CpuFastSet(gPlttBufferFaded, gPlttBufferUnfaded, 0x100);
|
||||
BeginNormalPaletteFade(~(1 << (gSprites[GetPlayerAvatarSpriteId()].oam.paletteNum + 16)), 4, 0, 8, RGB_RED);
|
||||
BeginNormalPaletteFade(palettes, 4, 0, 8, RGB_RED);
|
||||
taskId = CreateTask(TrySweetScentEncounter, 0);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
FieldEffectActiveListRemove(FLDEFF_SWEET_SCENT);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "field_player_avatar.h"
|
||||
#include "field_screen_effect.h"
|
||||
#include "field_weather.h"
|
||||
#include "fldeff.h"
|
||||
#include "item.h"
|
||||
#include "item_menu.h"
|
||||
#include "item_use.h"
|
||||
@ -71,6 +72,7 @@ static void Task_UseRepel(u8);
|
||||
static void Task_CloseCantUseKeyItemMessage(u8);
|
||||
static void SetDistanceOfClosestHiddenItem(u8, s16, s16);
|
||||
static void CB2_OpenPokeblockFromBag(void);
|
||||
static void ItemUseOnFieldCB_Honey(u8 taskId);
|
||||
|
||||
// EWRAM variables
|
||||
EWRAM_DATA static void(*sItemUseOnFieldCB)(u8 taskId) = NULL;
|
||||
@ -1202,6 +1204,29 @@ void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8 taskId)
|
||||
SetUpItemUseCallback(taskId);
|
||||
}
|
||||
|
||||
void Task_UseHoneyOnField(u8 taskId)
|
||||
{
|
||||
//ResetInitialPlayerAvatarState();
|
||||
StartSweetScentFieldEffect();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
static void ItemUseOnFieldCB_Honey(u8 taskId)
|
||||
{
|
||||
Overworld_ResetStateAfterDigEscRope();
|
||||
RemoveUsedItem();
|
||||
gTasks[taskId].data[0] = 0;
|
||||
DisplayItemMessageOnField(taskId, gStringVar4, Task_UseHoneyOnField);
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_Honey(u8 taskId)
|
||||
{
|
||||
sItemUseOnFieldCB = ItemUseOnFieldCB_Honey;
|
||||
gFieldCallback = FieldCB_UseItemOnField;
|
||||
gBagMenu->newScreenCallback = CB2_ReturnToField;
|
||||
Task_FadeAndCloseBagMenu(taskId);
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_CannotUse(u8 taskId)
|
||||
{
|
||||
DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
|
||||
|
Loading…
Reference in New Issue
Block a user