Changed EVO_OVERWORLD_STEPS to use an EWRAM variable (#5047)
* Changed EVO_OVERWORLD_STEPS to use an EWRAM variable * Fixed PC swapping not resetting the follower steps
This commit is contained in:
parent
e82e3b4198
commit
1e8773356c
9 changed files with 52 additions and 26 deletions
|
@ -439,4 +439,14 @@ Debug_EventScript_InflictStatus1_Text_Freeze:
|
||||||
Debug_EventScript_InflictStatus1_Text_Frostbite:
|
Debug_EventScript_InflictStatus1_Text_Frostbite:
|
||||||
.string "Frostbite$"
|
.string "Frostbite$"
|
||||||
|
|
||||||
|
Debug_EventScript_EWRAMCounters::
|
||||||
|
callnative CheckEWRAMCounters
|
||||||
|
msgbox Debug_EventScript_EWRAMCounters_Text, MSGBOX_DEFAULT
|
||||||
|
release
|
||||||
|
end
|
||||||
|
|
||||||
|
Debug_EventScript_EWRAMCounters_Text::
|
||||||
|
.string "Follower Steps: {STR_VAR_1}.\n"
|
||||||
|
.string "Fishing Chain: {STR_VAR_2}.$"
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
|
@ -297,7 +297,7 @@
|
||||||
#define EVO_RECOIL_DAMAGE_FEMALE 49 // Pokémon levels up after having suffered specified amount of non-fainting recoil damage as a female
|
#define EVO_RECOIL_DAMAGE_FEMALE 49 // Pokémon levels up after having suffered specified amount of non-fainting recoil damage as a female
|
||||||
#define EVO_ITEM_COUNT_999 50 // Pokémon levels up after trainer has collected 999 of a specific item
|
#define EVO_ITEM_COUNT_999 50 // Pokémon levels up after trainer has collected 999 of a specific item
|
||||||
#define EVO_DEFEAT_WITH_ITEM 51 // Pokémon levels up after having defeat 3 Pokémon of the same species holding the specified item
|
#define EVO_DEFEAT_WITH_ITEM 51 // Pokémon levels up after having defeat 3 Pokémon of the same species holding the specified item
|
||||||
#define EVO_OVERWORLD_STEPS 52 // Pokémon levels up after having taken a specific amount of steps in the overworld
|
#define EVO_OVERWORLD_STEPS 52 // Pokémon levels up after having taken a specific amount of steps in the overworld (or as the party lead if OW_FOLLOWERS_ENABLED is FALSE) without switching
|
||||||
|
|
||||||
// Evolution 'modes,' for GetEvolutionTargetSpecies
|
// Evolution 'modes,' for GetEvolutionTargetSpecies
|
||||||
#define EVO_MODE_NORMAL 0
|
#define EVO_MODE_NORMAL 0
|
||||||
|
|
|
@ -684,6 +684,7 @@ extern struct Pokemon gPlayerParty[PARTY_SIZE];
|
||||||
extern u8 gEnemyPartyCount;
|
extern u8 gEnemyPartyCount;
|
||||||
extern struct Pokemon gEnemyParty[PARTY_SIZE];
|
extern struct Pokemon gEnemyParty[PARTY_SIZE];
|
||||||
extern struct SpriteTemplate gMultiuseSpriteTemplate;
|
extern struct SpriteTemplate gMultiuseSpriteTemplate;
|
||||||
|
extern u16 gFollowerSteps;
|
||||||
|
|
||||||
extern const struct MoveInfo gMovesInfo[];
|
extern const struct MoveInfo gMovesInfo[];
|
||||||
extern const u8 gFacilityClassToPicIndex[];
|
extern const u8 gFacilityClassToPicIndex[];
|
||||||
|
|
17
src/debug.c
17
src/debug.c
|
@ -99,6 +99,7 @@ enum UtilDebugMenu
|
||||||
DEBUG_UTIL_MENU_ITEM_CHEAT,
|
DEBUG_UTIL_MENU_ITEM_CHEAT,
|
||||||
DEBUG_UTIL_MENU_ITEM_EXPANSION_VER,
|
DEBUG_UTIL_MENU_ITEM_EXPANSION_VER,
|
||||||
DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS,
|
DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS,
|
||||||
|
DEBUG_UTIL_MENU_ITEM_EWRAM_COUNTERS,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GivePCBagDebugMenu
|
enum GivePCBagDebugMenu
|
||||||
|
@ -374,6 +375,7 @@ static void DebugAction_Util_Player_Id(u8 taskId);
|
||||||
static void DebugAction_Util_CheatStart(u8 taskId);
|
static void DebugAction_Util_CheatStart(u8 taskId);
|
||||||
static void DebugAction_Util_ExpansionVersion(u8 taskId);
|
static void DebugAction_Util_ExpansionVersion(u8 taskId);
|
||||||
static void DebugAction_Util_BerryFunctions(u8 taskId);
|
static void DebugAction_Util_BerryFunctions(u8 taskId);
|
||||||
|
static void DebugAction_Util_CheckEWRAMCounters(u8 taskId);
|
||||||
|
|
||||||
static void DebugAction_OpenPCBagFillMenu(u8 taskId);
|
static void DebugAction_OpenPCBagFillMenu(u8 taskId);
|
||||||
static void DebugAction_PCBag_Fill_PCBoxes_Fast(u8 taskId);
|
static void DebugAction_PCBag_Fill_PCBoxes_Fast(u8 taskId);
|
||||||
|
@ -476,6 +478,7 @@ extern const u8 Debug_CheckSaveBlock[];
|
||||||
extern const u8 Debug_CheckROMSpace[];
|
extern const u8 Debug_CheckROMSpace[];
|
||||||
extern const u8 Debug_BoxFilledMessage[];
|
extern const u8 Debug_BoxFilledMessage[];
|
||||||
extern const u8 Debug_ShowExpansionVersion[];
|
extern const u8 Debug_ShowExpansionVersion[];
|
||||||
|
extern const u8 Debug_EventScript_EWRAMCounters[];
|
||||||
|
|
||||||
extern const u8 Debug_BerryPestsDisabled[];
|
extern const u8 Debug_BerryPestsDisabled[];
|
||||||
extern const u8 Debug_BerryWeedsDisabled[];
|
extern const u8 Debug_BerryWeedsDisabled[];
|
||||||
|
@ -532,6 +535,7 @@ static const u8 sDebugText_Util_Player_Id[] = _("New Trainer ID")
|
||||||
static const u8 sDebugText_Util_CheatStart[] = _("Cheat start");
|
static const u8 sDebugText_Util_CheatStart[] = _("Cheat start");
|
||||||
static const u8 sDebugText_Util_ExpansionVersion[] = _("Expansion Version");
|
static const u8 sDebugText_Util_ExpansionVersion[] = _("Expansion Version");
|
||||||
static const u8 sDebugText_Util_BerryFunctions[] = _("Berry Functions…{CLEAR_TO 110}{RIGHT_ARROW}");
|
static const u8 sDebugText_Util_BerryFunctions[] = _("Berry Functions…{CLEAR_TO 110}{RIGHT_ARROW}");
|
||||||
|
static const u8 sDebugText_Util_EWRAMCounters[] = _("EWRAM Counters…{CLEAR_TO 110}{RIGHT_ARROW}");
|
||||||
// PC/Bag Menu
|
// PC/Bag Menu
|
||||||
static const u8 sDebugText_PCBag_Fill[] = _("Fill…{CLEAR_TO 110}{RIGHT_ARROW}");
|
static const u8 sDebugText_PCBag_Fill[] = _("Fill…{CLEAR_TO 110}{RIGHT_ARROW}");
|
||||||
static const u8 sDebugText_PCBag_Fill_Pc_Fast[] = _("Fill PC Boxes Fast");
|
static const u8 sDebugText_PCBag_Fill_Pc_Fast[] = _("Fill PC Boxes Fast");
|
||||||
|
@ -720,6 +724,7 @@ static const struct ListMenuItem sDebugMenu_Items_Utilities[] =
|
||||||
[DEBUG_UTIL_MENU_ITEM_CHEAT] = {sDebugText_Util_CheatStart, DEBUG_UTIL_MENU_ITEM_CHEAT},
|
[DEBUG_UTIL_MENU_ITEM_CHEAT] = {sDebugText_Util_CheatStart, DEBUG_UTIL_MENU_ITEM_CHEAT},
|
||||||
[DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = {sDebugText_Util_ExpansionVersion, DEBUG_UTIL_MENU_ITEM_EXPANSION_VER},
|
[DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = {sDebugText_Util_ExpansionVersion, DEBUG_UTIL_MENU_ITEM_EXPANSION_VER},
|
||||||
[DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS] = {sDebugText_Util_BerryFunctions, DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS},
|
[DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS] = {sDebugText_Util_BerryFunctions, DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS},
|
||||||
|
[DEBUG_UTIL_MENU_ITEM_EWRAM_COUNTERS] = {sDebugText_Util_EWRAMCounters, DEBUG_UTIL_MENU_ITEM_EWRAM_COUNTERS},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ListMenuItem sDebugMenu_Items_PCBag[] =
|
static const struct ListMenuItem sDebugMenu_Items_PCBag[] =
|
||||||
|
@ -889,6 +894,7 @@ static void (*const sDebugMenu_Actions_Utilities[])(u8) =
|
||||||
[DEBUG_UTIL_MENU_ITEM_CHEAT] = DebugAction_Util_CheatStart,
|
[DEBUG_UTIL_MENU_ITEM_CHEAT] = DebugAction_Util_CheatStart,
|
||||||
[DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = DebugAction_Util_ExpansionVersion,
|
[DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = DebugAction_Util_ExpansionVersion,
|
||||||
[DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS] = DebugAction_Util_BerryFunctions,
|
[DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS] = DebugAction_Util_BerryFunctions,
|
||||||
|
[DEBUG_UTIL_MENU_ITEM_EWRAM_COUNTERS] = DebugAction_Util_CheckEWRAMCounters,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void (*const sDebugMenu_Actions_PCBag[])(u8) =
|
static void (*const sDebugMenu_Actions_PCBag[])(u8) =
|
||||||
|
@ -5113,4 +5119,15 @@ static void DebugAction_Party_ClearParty(u8 taskId)
|
||||||
Debug_DestroyMenu_Full(taskId);
|
Debug_DestroyMenu_Full(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckEWRAMCounters(struct ScriptContext *ctx)
|
||||||
|
{
|
||||||
|
ConvertIntToDecimalStringN(gStringVar1, gFollowerSteps, STR_CONV_MODE_LEFT_ALIGN, 5);
|
||||||
|
ConvertIntToDecimalStringN(gStringVar2, gChainFishingDexNavStreak, STR_CONV_MODE_LEFT_ALIGN, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DebugAction_Util_CheckEWRAMCounters(u8 taskId)
|
||||||
|
{
|
||||||
|
Debug_DestroyMenu_Full_Script(taskId, Debug_EventScript_EWRAMCounters);
|
||||||
|
}
|
||||||
|
|
||||||
#endif //DEBUG_OVERWORLD_MENU == TRUE
|
#endif //DEBUG_OVERWORLD_MENU == TRUE
|
||||||
|
|
|
@ -69,7 +69,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *, u16);
|
||||||
static bool8 TryStartMiscWalkingScripts(u16);
|
static bool8 TryStartMiscWalkingScripts(u16);
|
||||||
static bool8 TryStartStepCountScript(u16);
|
static bool8 TryStartStepCountScript(u16);
|
||||||
static void UpdateFriendshipStepCounter(void);
|
static void UpdateFriendshipStepCounter(void);
|
||||||
static void UpdateLetsGoEvolutionTracker(void);
|
static void UpdateFollowerStepCounter(void);
|
||||||
#if OW_POISON_DAMAGE < GEN_5
|
#if OW_POISON_DAMAGE < GEN_5
|
||||||
static bool8 UpdatePoisonStepCounter(void);
|
static bool8 UpdatePoisonStepCounter(void);
|
||||||
#endif // OW_POISON_DAMAGE
|
#endif // OW_POISON_DAMAGE
|
||||||
|
@ -566,7 +566,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
|
||||||
IncrementRematchStepCounter();
|
IncrementRematchStepCounter();
|
||||||
UpdateFriendshipStepCounter();
|
UpdateFriendshipStepCounter();
|
||||||
UpdateFarawayIslandStepCounter();
|
UpdateFarawayIslandStepCounter();
|
||||||
UpdateLetsGoEvolutionTracker();
|
UpdateFollowerStepCounter();
|
||||||
|
|
||||||
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior))
|
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior))
|
||||||
{
|
{
|
||||||
|
@ -660,26 +660,10 @@ static void UpdateFriendshipStepCounter(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateLetsGoEvolutionTracker(void)
|
static void UpdateFollowerStepCounter(void)
|
||||||
{
|
{
|
||||||
u32 i;
|
if (gPlayerPartyCount > 0 && gFollowerSteps < (u16)-1)
|
||||||
u16 count;
|
gFollowerSteps++;
|
||||||
struct Pokemon *followingMon = GetFirstLiveMon();
|
|
||||||
const struct Evolution *evolutions = GetSpeciesEvolutions(GetMonData(followingMon, MON_DATA_SPECIES));
|
|
||||||
|
|
||||||
if (evolutions == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; evolutions[i].method != EVOLUTIONS_END; i++)
|
|
||||||
{
|
|
||||||
if (evolutions[i].method != EVO_OVERWORLD_STEPS || SanitizeSpeciesId(evolutions[i].targetSpecies) == SPECIES_NONE)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// We only have 10 bits to use
|
|
||||||
count = min(1023, GetMonData(followingMon, MON_DATA_EVOLUTION_TRACKER) + 1);
|
|
||||||
SetMonData(followingMon, MON_DATA_EVOLUTION_TRACKER, &count);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearPoisonStepCounter(void)
|
void ClearPoisonStepCounter(void)
|
||||||
|
|
|
@ -2987,6 +2987,9 @@ static void CB2_ReturnToPartyMenuFromSummaryScreen(void)
|
||||||
|
|
||||||
static void CursorCb_Switch(u8 taskId)
|
static void CursorCb_Switch(u8 taskId)
|
||||||
{
|
{
|
||||||
|
// Reset follower steps when the party leader is changed
|
||||||
|
if (gPartyMenu.slotId == 0 || gPartyMenu.slotId2 == 0)
|
||||||
|
gFollowerSteps = 0;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gPartyMenu.action = PARTY_ACTION_SWITCH;
|
gPartyMenu.action = PARTY_ACTION_SWITCH;
|
||||||
PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[1]);
|
PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[1]);
|
||||||
|
|
|
@ -85,6 +85,7 @@ EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
|
||||||
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
|
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
|
||||||
EWRAM_DATA static struct MonSpritesGfxManager *sMonSpritesGfxManagers[MON_SPR_GFX_MANAGERS_COUNT] = {NULL};
|
EWRAM_DATA static struct MonSpritesGfxManager *sMonSpritesGfxManagers[MON_SPR_GFX_MANAGERS_COUNT] = {NULL};
|
||||||
EWRAM_DATA static u8 sTriedEvolving = 0;
|
EWRAM_DATA static u8 sTriedEvolving = 0;
|
||||||
|
EWRAM_DATA u16 gFollowerSteps = 0;
|
||||||
|
|
||||||
#include "data/moves_info.h"
|
#include "data/moves_info.h"
|
||||||
#include "data/abilities.h"
|
#include "data/abilities.h"
|
||||||
|
@ -4708,7 +4709,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s
|
||||||
targetSpecies = evolutions[i].targetSpecies;
|
targetSpecies = evolutions[i].targetSpecies;
|
||||||
break;
|
break;
|
||||||
case EVO_OVERWORLD_STEPS:
|
case EVO_OVERWORLD_STEPS:
|
||||||
if (evolutionTracker >= evolutions[i].param)
|
if (mon == GetFirstLiveMon() && gFollowerSteps >= evolutions[i].param)
|
||||||
targetSpecies = evolutions[i].targetSpecies;
|
targetSpecies = evolutions[i].targetSpecies;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "dma3.h"
|
#include "dma3.h"
|
||||||
#include "dynamic_placeholder_text_util.h"
|
#include "dynamic_placeholder_text_util.h"
|
||||||
#include "event_data.h"
|
#include "event_data.h"
|
||||||
|
#include "event_object_movement.h"
|
||||||
#include "field_screen_effect.h"
|
#include "field_screen_effect.h"
|
||||||
#include "field_weather.h"
|
#include "field_weather.h"
|
||||||
#include "fldeff_misc.h"
|
#include "fldeff_misc.h"
|
||||||
|
@ -6412,9 +6413,15 @@ static void RefreshDisplayMon(void)
|
||||||
static void SetMovingMonData(u8 boxId, u8 position)
|
static void SetMovingMonData(u8 boxId, u8 position)
|
||||||
{
|
{
|
||||||
if (boxId == TOTAL_BOXES_COUNT)
|
if (boxId == TOTAL_BOXES_COUNT)
|
||||||
|
{
|
||||||
sStorage->movingMon = gPlayerParty[sCursorPosition];
|
sStorage->movingMon = gPlayerParty[sCursorPosition];
|
||||||
|
if (&gPlayerParty[sCursorPosition] == GetFirstLiveMon())
|
||||||
|
gFollowerSteps = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
BoxMonAtToMon(boxId, position, &sStorage->movingMon);
|
BoxMonAtToMon(boxId, position, &sStorage->movingMon);
|
||||||
|
}
|
||||||
|
|
||||||
PurgeMonOrBoxMon(boxId, position);
|
PurgeMonOrBoxMon(boxId, position);
|
||||||
sMovingMonOrigBoxId = boxId;
|
sMovingMonOrigBoxId = boxId;
|
||||||
|
@ -6427,10 +6434,16 @@ static void SetPlacedMonData(u8 boxId, u8 position)
|
||||||
HealPokemon(&sStorage->movingMon);
|
HealPokemon(&sStorage->movingMon);
|
||||||
|
|
||||||
if (boxId == TOTAL_BOXES_COUNT)
|
if (boxId == TOTAL_BOXES_COUNT)
|
||||||
|
{
|
||||||
gPlayerParty[position] = sStorage->movingMon;
|
gPlayerParty[position] = sStorage->movingMon;
|
||||||
|
if (&gPlayerParty[position] == GetFirstLiveMon())
|
||||||
|
gFollowerSteps = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetBoxMonAt(boxId, position, &sStorage->movingMon.box);
|
SetBoxMonAt(boxId, position, &sStorage->movingMon.box);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void PurgeMonOrBoxMon(u8 boxId, u8 position)
|
static void PurgeMonOrBoxMon(u8 boxId, u8 position)
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,9 +119,6 @@ TEST("No species has two evolutions that use the evolution tracker")
|
||||||
#ifdef EVO_DEFEAT_WITH_ITEM
|
#ifdef EVO_DEFEAT_WITH_ITEM
|
||||||
|| evolutions[i].method == EVO_DEFEAT_WITH_ITEM
|
|| evolutions[i].method == EVO_DEFEAT_WITH_ITEM
|
||||||
#endif //EVO_DEFEAT_WITH_ITEM
|
#endif //EVO_DEFEAT_WITH_ITEM
|
||||||
#ifdef EVO_OVERWORLD_STEPS
|
|
||||||
|| evolutions[i].method == EVO_OVERWORLD_STEPS
|
|
||||||
#endif //EVO_OVERWORLD_STEPS
|
|
||||||
)
|
)
|
||||||
evolutionTrackerEvolutions++;
|
evolutionTrackerEvolutions++;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue