mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +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
|
// sweet scent
|
||||||
bool8 SetUpFieldMove_SweetScent(void);
|
bool8 SetUpFieldMove_SweetScent(void);
|
||||||
bool8 FldEff_SweetScent(void);
|
bool8 FldEff_SweetScent(void);
|
||||||
|
void StartSweetScentFieldEffect(void);
|
||||||
|
|
||||||
// teleport
|
// teleport
|
||||||
bool8 SetUpFieldMove_Teleport(void);
|
bool8 SetUpFieldMove_Teleport(void);
|
||||||
|
@ -27,6 +27,7 @@ void ItemUseOutOfBattle_Berry(u8);
|
|||||||
void ItemUseOutOfBattle_EnigmaBerry(u8);
|
void ItemUseOutOfBattle_EnigmaBerry(u8);
|
||||||
void ItemUseOutOfBattle_FormChange(u8);
|
void ItemUseOutOfBattle_FormChange(u8);
|
||||||
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8);
|
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8);
|
||||||
|
void ItemUseOutOfBattle_Honey(u8);
|
||||||
void ItemUseOutOfBattle_CannotUse(u8);
|
void ItemUseOutOfBattle_CannotUse(u8);
|
||||||
void ItemUseInBattle_PokeBall(u8);
|
void ItemUseInBattle_PokeBall(u8);
|
||||||
void ItemUseInBattle_StatIncrease(u8);
|
void ItemUseInBattle_StatIncrease(u8);
|
||||||
|
@ -2035,8 +2035,8 @@ const struct Item gItems[] =
|
|||||||
.price = 300,
|
.price = 300,
|
||||||
.description = sHoneyDesc,
|
.description = sHoneyDesc,
|
||||||
.pocket = POCKET_ITEMS,
|
.pocket = POCKET_ITEMS,
|
||||||
.type = ITEM_USE_BAG_MENU,
|
.type = ITEM_USE_FIELD,
|
||||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
.fieldUseFunc = ItemUseOutOfBattle_Honey,
|
||||||
.flingPower = 30,
|
.flingPower = 30,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
|
||||||
static void FieldCallback_SweetScent(void);
|
static void FieldCallback_SweetScent(void);
|
||||||
static void StartSweetScentFieldEffect(void);
|
|
||||||
static void TrySweetScentEncounter(u8 taskId);
|
static void TrySweetScentEncounter(u8 taskId);
|
||||||
static void FailSweetScentEncounter(u8 taskId);
|
static void FailSweetScentEncounter(u8 taskId);
|
||||||
|
|
||||||
@ -47,14 +46,15 @@ bool8 FldEff_SweetScent(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StartSweetScentFieldEffect(void)
|
void StartSweetScentFieldEffect(void)
|
||||||
{
|
{
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
u32 palettes = ~(1 << (gSprites[GetPlayerAvatarSpriteId()].oam.paletteNum + 16) | (1 << 13) | (1 << 14) | (1 << 15));
|
||||||
|
|
||||||
PlaySE(SE_M_SWEET_SCENT);
|
PlaySE(SE_M_SWEET_SCENT);
|
||||||
CpuFastSet(gPlttBufferUnfaded, gPaletteDecompressionBuffer, 0x100);
|
CpuFastSet(gPlttBufferUnfaded, gPaletteDecompressionBuffer, 0x100);
|
||||||
CpuFastSet(gPlttBufferFaded, gPlttBufferUnfaded, 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);
|
taskId = CreateTask(TrySweetScentEncounter, 0);
|
||||||
gTasks[taskId].data[0] = 0;
|
gTasks[taskId].data[0] = 0;
|
||||||
FieldEffectActiveListRemove(FLDEFF_SWEET_SCENT);
|
FieldEffectActiveListRemove(FLDEFF_SWEET_SCENT);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "field_player_avatar.h"
|
#include "field_player_avatar.h"
|
||||||
#include "field_screen_effect.h"
|
#include "field_screen_effect.h"
|
||||||
#include "field_weather.h"
|
#include "field_weather.h"
|
||||||
|
#include "fldeff.h"
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "item_menu.h"
|
#include "item_menu.h"
|
||||||
#include "item_use.h"
|
#include "item_use.h"
|
||||||
@ -71,6 +72,7 @@ static void Task_UseRepel(u8);
|
|||||||
static void Task_CloseCantUseKeyItemMessage(u8);
|
static void Task_CloseCantUseKeyItemMessage(u8);
|
||||||
static void SetDistanceOfClosestHiddenItem(u8, s16, s16);
|
static void SetDistanceOfClosestHiddenItem(u8, s16, s16);
|
||||||
static void CB2_OpenPokeblockFromBag(void);
|
static void CB2_OpenPokeblockFromBag(void);
|
||||||
|
static void ItemUseOnFieldCB_Honey(u8 taskId);
|
||||||
|
|
||||||
// EWRAM variables
|
// EWRAM variables
|
||||||
EWRAM_DATA static void(*sItemUseOnFieldCB)(u8 taskId) = NULL;
|
EWRAM_DATA static void(*sItemUseOnFieldCB)(u8 taskId) = NULL;
|
||||||
@ -1202,6 +1204,29 @@ void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8 taskId)
|
|||||||
SetUpItemUseCallback(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)
|
void ItemUseOutOfBattle_CannotUse(u8 taskId)
|
||||||
{
|
{
|
||||||
DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
|
DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
|
||||||
|
Loading…
Reference in New Issue
Block a user