mirror of
https://github.com/pret/pokefirered.git
synced 2026-09-30 12:59:43 -05:00
added exp share gen6+ functionality
This commit is contained in:
@@ -142,6 +142,7 @@ ViridianCity_Mart_Items::
|
||||
.2byte ITEM_N_LUNARIZER
|
||||
.2byte ITEM_HONEY
|
||||
.2byte ITEM_POKEMON_BOX_LINK
|
||||
.2byte ITEM_EXP_SHARE
|
||||
.2byte ITEM_NONE
|
||||
release
|
||||
end
|
||||
|
||||
@@ -45,6 +45,7 @@ bool8 VarSet(u16 id, u16 value);
|
||||
u8 VarGetObjectEventGraphicsId(u8 id);
|
||||
u8 *GetFlagPointer(u16 id);
|
||||
u8 FlagSet(u16 id);
|
||||
u8 FlagToggle(u16 id);
|
||||
u8 FlagClear(u16 id);
|
||||
bool8 FlagGet(u16 id);
|
||||
u16 * GetVarPointer(u16 id);
|
||||
|
||||
@@ -11,6 +11,7 @@ void ItemUseOutOfBattle_DynamaxCandy(u8 taskId);
|
||||
void ItemUseOutOfBattle_EscapeRope(u8 taskId);
|
||||
void ItemUseOutOfBattle_EnigmaBerry(u8 taskId);
|
||||
void ItemUseOutOfBattle_EvolutionStone(u8 taskId);
|
||||
void ItemUseOutOfBattle_ExpShare(u8 taskId);
|
||||
void ItemUseOutOfBattle_FameChecker(u8 taskId);
|
||||
void ItemUseOutOfBattle_FormChange(u8 taskId);
|
||||
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8 taskId);
|
||||
|
||||
@@ -1601,4 +1601,8 @@ extern const u8 gText_PkmnTransformed[];
|
||||
extern const u8 gText_WhichAppliance[];
|
||||
extern const u8 gText_NextFusionMon[];
|
||||
|
||||
// Exp. Share
|
||||
extern const u8 gText_ExpShareOn[];
|
||||
extern const u8 gText_ExpShareOff[];
|
||||
|
||||
#endif //GUARD_STRINGS_H
|
||||
|
||||
@@ -7286,7 +7286,7 @@ const struct Item gItemsInfo[] =
|
||||
#endif
|
||||
.pocket = I_EXP_SHARE_ITEM >= GEN_6 ? POCKET_KEY_ITEMS : POCKET_ITEMS,
|
||||
.type = ITEM_TYPE_FIELD,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_ExpShare,
|
||||
.flingPower = 30,
|
||||
},
|
||||
|
||||
|
||||
@@ -302,6 +302,14 @@ bool8 FlagSet(u16 idx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u8 FlagToggle(u16 id)
|
||||
{
|
||||
u8 *ptr = GetFlagAddr(id);
|
||||
if (ptr)
|
||||
*ptr ^= 1 << (id & 7);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 FlagClear(u16 idx)
|
||||
{
|
||||
u8 *ptr = GetFlagAddr(idx);
|
||||
|
||||
@@ -211,6 +211,33 @@ static void CB2_CheckMail(void)
|
||||
ReadMail(&mail, CB2_BagMenuFromStartMenu, FALSE);
|
||||
}
|
||||
|
||||
STATIC_ASSERT(I_EXP_SHARE_ITEM < GEN_6 || I_EXP_SHARE_FLAG > TEMP_FLAGS_END, YouNeedToSetAFlagToUseGen6ExpShare);
|
||||
|
||||
void ItemUseOutOfBattle_ExpShare(u8 taskId)
|
||||
{
|
||||
#if I_EXP_SHARE_ITEM >= GEN_6
|
||||
if (IsGen6ExpShareEnabled())
|
||||
{
|
||||
PlaySE(SE_PC_OFF);
|
||||
if (!gTasks[taskId].data[2]) // to account for pressing select in the overworld
|
||||
DisplayItemMessageOnField(taskId, FONT_NORMAL, gText_ExpShareOff, Task_ItemUse_CloseMessageBoxAndReturnToField);
|
||||
else
|
||||
DisplayItemMessageInBag(taskId, FONT_NORMAL, gText_ExpShareOff, Task_ReturnToBagFromContextMenu);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_EXP_MAX);
|
||||
if (!gTasks[taskId].data[2]) // to account for pressing select in the overworld
|
||||
DisplayItemMessageOnField(taskId, FONT_NORMAL, gText_ExpShareOn, Task_ItemUse_CloseMessageBoxAndReturnToField);
|
||||
else
|
||||
DisplayItemMessageInBag(taskId, FONT_NORMAL, gText_ExpShareOn, Task_ReturnToBagFromContextMenu);
|
||||
}
|
||||
FlagToggle(I_EXP_SHARE_FLAG);
|
||||
#else
|
||||
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_Bike(u8 taskId)
|
||||
{
|
||||
s16 x, y;
|
||||
|
||||
@@ -1373,3 +1373,6 @@ const u8 gText_ChangeAbility[] = _("Change Ability");
|
||||
const u8 gText_PkmnTransformed[] = _("{STR_VAR_1} transformed!{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gText_WhichAppliance[] = _("Order which\nappliance?");
|
||||
const u8 gText_NextFusionMon[] = _("Choose {PKMN} to fuse with.");
|
||||
|
||||
const u8 gText_ExpShareOn[] = _("The Exp. Share has been turned on.{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gText_ExpShareOff[] = _("The Exp. Share has been turned off.{PAUSE_UNTIL_PRESS}");
|
||||
|
||||
Reference in New Issue
Block a user