mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Ported TheXaman's latest changes to the Debug Menu (#2815)
* Added option for generating incrementing pokemon in pc boxes # Conflicts: # src/debug.c * added submenu arrows, increased menu high to full screen # Conflicts: # src/debug.c * combined flags and vars into one submenu # Conflicts: # src/debug.c * added new window to flags/vars showing the current state and added submenu indicator # Conflicts: # src/debug.c * added alligned arrows for debug submenus # Conflicts: # src/debug.c * used {CLEAR_TO X} instead of manual spaces # Conflicts: # src/debug.c * renamed gDebugText to proper sDebugText # Conflicts: # src/debug.c * added Fill submenu, added fill function for PC items and all bag pockets @LOuroboros # Conflicts: # src/debug.c * put cheat start into utility # Conflicts: # src/debug.c * put fill submenu into main menu # Conflicts: # src/debug.c * tiny fix * renaming and reordering # Conflicts: # src/debug.c * Added reset pokedex flags for @AsparagusEduardo * made flag toggle list dynamic # Conflicts: # src/debug.c * initial battle debug menu WIP # Conflicts: # src/debug.c # src/wild_encounter.c * fix visual bug * added battle start # Conflicts: # include/debug.h # src/battle_ai_script_commands.c * Added faster way to add initial movesets to mon * Added waiting music for the slow box filling * Simplified the call to scripts * Simplified debug scripts * Disabled Battle Test for now * Fixed personality on fast PC fill being always 0 * Removed BATTLE_ENGINE instances + added AI_FLAG_COUNT * Added missing return TRUE * Sets nickname * Changed how GetSpeciesName to how it's used upstream --------- Co-authored-by: TheXaman <48356183+TheXaman@users.noreply.github.com>
This commit is contained in:
parent
43ad1a4d3b
commit
6fec0e4dd1
@ -1,14 +1,15 @@
|
|||||||
.if DEBUG_OVERWORLD_MENU == TRUE
|
.if DEBUG_OVERWORLD_MENU == TRUE
|
||||||
|
Debug_MessageEnd:
|
||||||
Debug_ShowFieldMessageStringVar4::
|
|
||||||
special ShowFieldMessageStringVar4
|
|
||||||
waitmessage
|
waitmessage
|
||||||
waitbuttonpress
|
waitbuttonpress
|
||||||
releaseall
|
releaseall
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Debug_ShowFieldMessageStringVar4::
|
||||||
|
special ShowFieldMessageStringVar4
|
||||||
|
goto Debug_MessageEnd
|
||||||
|
|
||||||
Debug_CheatStart::
|
Debug_CheatStart::
|
||||||
lockall
|
|
||||||
setflag FLAG_SYS_POKEMON_GET
|
setflag FLAG_SYS_POKEMON_GET
|
||||||
setflag FLAG_RESCUED_BIRCH
|
setflag FLAG_RESCUED_BIRCH
|
||||||
setflag FLAG_HIDE_ROUTE_101_BIRCH_ZIGZAGOON_BATTLE
|
setflag FLAG_HIDE_ROUTE_101_BIRCH_ZIGZAGOON_BATTLE
|
||||||
@ -44,12 +45,8 @@ Debug_CheatStart::
|
|||||||
end
|
end
|
||||||
|
|
||||||
Debug_FlagsNotSetOverworldConfigMessage::
|
Debug_FlagsNotSetOverworldConfigMessage::
|
||||||
lockall
|
|
||||||
message Debug_FlagsNotSetOverworldConfigMessage_Text
|
message Debug_FlagsNotSetOverworldConfigMessage_Text
|
||||||
waitmessage
|
goto Debug_MessageEnd
|
||||||
waitbuttonpress
|
|
||||||
releaseall
|
|
||||||
end
|
|
||||||
|
|
||||||
Debug_FlagsNotSetOverworldConfigMessage_Text:
|
Debug_FlagsNotSetOverworldConfigMessage_Text:
|
||||||
.string "Feature unavailable!\n"
|
.string "Feature unavailable!\n"
|
||||||
@ -57,18 +54,21 @@ Debug_FlagsNotSetOverworldConfigMessage_Text:
|
|||||||
.string "'include/config/overworld.h'!$"
|
.string "'include/config/overworld.h'!$"
|
||||||
|
|
||||||
Debug_FlagsNotSetBattleConfigMessage::
|
Debug_FlagsNotSetBattleConfigMessage::
|
||||||
lockall
|
|
||||||
message Debug_FlagsNotSetBattleConfigMessage_Text
|
message Debug_FlagsNotSetBattleConfigMessage_Text
|
||||||
waitmessage
|
goto Debug_MessageEnd
|
||||||
waitbuttonpress
|
|
||||||
releaseall
|
|
||||||
end
|
|
||||||
|
|
||||||
Debug_FlagsNotSetBattleConfigMessage_Text:
|
Debug_FlagsNotSetBattleConfigMessage_Text:
|
||||||
.string "Feature unavailable!\n"
|
.string "Feature unavailable!\n"
|
||||||
.string "Please define a usable flag in:\l"
|
.string "Please define a usable flag in:\l"
|
||||||
.string "'include/config/battle.h'!$"
|
.string "'include/config/battle.h'!$"
|
||||||
|
|
||||||
|
Debug_BoxFilledMessage::
|
||||||
|
message Debug_BoxFilledMessage_Text
|
||||||
|
goto Debug_MessageEnd
|
||||||
|
|
||||||
|
Debug_BoxFilledMessage_Text:
|
||||||
|
.string "Storage boxes filled!$"
|
||||||
|
|
||||||
Debug_Script_1::
|
Debug_Script_1::
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,4 +68,7 @@ bool8 IsTrainerReadyForRematch(void);
|
|||||||
void ShouldTryGetTrainerScript(void);
|
void ShouldTryGetTrainerScript(void);
|
||||||
u16 CountBattledRematchTeams(u16 trainerId);
|
u16 CountBattledRematchTeams(u16 trainerId);
|
||||||
|
|
||||||
|
void DoStandardWildBattle_Debug(void);
|
||||||
|
void BattleSetup_StartTrainerBattle_Debug(void);
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_SETUP_H
|
#endif // GUARD_BATTLE_SETUP_H
|
||||||
|
@ -60,6 +60,8 @@
|
|||||||
#define AI_FLAG_ACE_POKEMON (1 << 16) // AI has an Ace Pokemon. The last Pokemon in the party will not be used until it's the last one remaining.
|
#define AI_FLAG_ACE_POKEMON (1 << 16) // AI has an Ace Pokemon. The last Pokemon in the party will not be used until it's the last one remaining.
|
||||||
#define AI_FLAG_OMNISCIENT (1 << 17) // AI has full knowledge of player moves, abilities, hold items
|
#define AI_FLAG_OMNISCIENT (1 << 17) // AI has full knowledge of player moves, abilities, hold items
|
||||||
|
|
||||||
|
#define AI_FLAG_COUNT 18
|
||||||
|
|
||||||
// 'other' ai logic flags
|
// 'other' ai logic flags
|
||||||
#define AI_FLAG_ROAMING (1 << 29)
|
#define AI_FLAG_ROAMING (1 << 29)
|
||||||
#define AI_FLAG_SAFARI (1 << 30)
|
#define AI_FLAG_SAFARI (1 << 30)
|
||||||
|
@ -3,4 +3,7 @@
|
|||||||
|
|
||||||
void Debug_ShowMainMenu(void);
|
void Debug_ShowMainMenu(void);
|
||||||
|
|
||||||
|
extern EWRAM_DATA bool8 gIsDebugBattle;
|
||||||
|
extern EWRAM_DATA u32 gDebugAIFlags;
|
||||||
|
|
||||||
#endif // GUARD_DEBUG_H
|
#endif // GUARD_DEBUG_H
|
||||||
|
@ -485,6 +485,8 @@ void SetMonMoveSlot(struct Pokemon *mon, u16 move, u8 slot);
|
|||||||
void SetBattleMonMoveSlot(struct BattlePokemon *mon, u16 move, u8 slot);
|
void SetBattleMonMoveSlot(struct BattlePokemon *mon, u16 move, u8 slot);
|
||||||
void GiveMonInitialMoveset(struct Pokemon *mon);
|
void GiveMonInitialMoveset(struct Pokemon *mon);
|
||||||
void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon);
|
void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon);
|
||||||
|
void GiveMonInitialMoveset_Fast(struct Pokemon *mon);
|
||||||
|
void GiveBoxMonInitialMoveset_Fast(struct BoxPokemon *boxMon);
|
||||||
u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove);
|
u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove);
|
||||||
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move);
|
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move);
|
||||||
void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
|
void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
|
||||||
|
@ -39,5 +39,6 @@ u16 GetLocalWildMon(bool8 *isWaterMon);
|
|||||||
u16 GetLocalWaterMon(void);
|
u16 GetLocalWaterMon(void);
|
||||||
bool8 UpdateRepelCounter(void);
|
bool8 UpdateRepelCounter(void);
|
||||||
bool8 TryDoDoubleWildBattle(void);
|
bool8 TryDoDoubleWildBattle(void);
|
||||||
|
bool8 StandardWildEncounter_Debug(void);
|
||||||
|
|
||||||
#endif // GUARD_WILD_ENCOUNTER_H
|
#endif // GUARD_WILD_ENCOUNTER_H
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "battle_setup.h"
|
#include "battle_setup.h"
|
||||||
#include "battle_z_move.h"
|
#include "battle_z_move.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
#include "debug.h"
|
||||||
#include "event_data.h"
|
#include "event_data.h"
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "pokemon.h"
|
#include "pokemon.h"
|
||||||
@ -152,6 +153,11 @@ static u32 GetWildAiFlags(void)
|
|||||||
|
|
||||||
void BattleAI_SetupFlags(void)
|
void BattleAI_SetupFlags(void)
|
||||||
{
|
{
|
||||||
|
#if DEBUG_OVERWORLD_MENU == TRUE
|
||||||
|
if (gIsDebugBattle)
|
||||||
|
AI_THINKING_STRUCT->aiFlags = gDebugAIFlags;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||||
AI_THINKING_STRUCT->aiFlags = GetAiScriptsInRecordedBattle();
|
AI_THINKING_STRUCT->aiFlags = GetAiScriptsInRecordedBattle();
|
||||||
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
|
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "berry.h"
|
#include "berry.h"
|
||||||
#include "bg.h"
|
#include "bg.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
#include "debug.h"
|
||||||
#include "decompress.h"
|
#include "decompress.h"
|
||||||
#include "dma3.h"
|
#include "dma3.h"
|
||||||
#include "event_data.h"
|
#include "event_data.h"
|
||||||
@ -565,7 +566,13 @@ static void CB2_InitBattleInternal(void)
|
|||||||
gBattle_BG3_X = 0;
|
gBattle_BG3_X = 0;
|
||||||
gBattle_BG3_Y = 0;
|
gBattle_BG3_Y = 0;
|
||||||
|
|
||||||
|
#if DEBUG_OVERWORLD_MENU == FALSE
|
||||||
|
|
||||||
gBattleTerrain = BattleSetup_GetTerrainId();
|
gBattleTerrain = BattleSetup_GetTerrainId();
|
||||||
|
#else
|
||||||
|
if (!gIsDebugBattle)
|
||||||
|
gBattleTerrain = BattleSetup_GetTerrainId();
|
||||||
|
#endif
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||||
gBattleTerrain = BATTLE_TERRAIN_BUILDING;
|
gBattleTerrain = BATTLE_TERRAIN_BUILDING;
|
||||||
|
|
||||||
@ -588,6 +595,7 @@ static void CB2_InitBattleInternal(void)
|
|||||||
else
|
else
|
||||||
SetMainCallback2(CB2_HandleStartBattle);
|
SetMainCallback2(CB2_HandleStartBattle);
|
||||||
|
|
||||||
|
#if DEBUG_OVERWORLD_MENU == FALSE
|
||||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED)))
|
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED)))
|
||||||
{
|
{
|
||||||
CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A, TRUE);
|
CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A, TRUE);
|
||||||
@ -596,6 +604,18 @@ static void CB2_InitBattleInternal(void)
|
|||||||
SetWildMonHeldItem();
|
SetWildMonHeldItem();
|
||||||
CalculateEnemyPartyCount();
|
CalculateEnemyPartyCount();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (!gIsDebugBattle)
|
||||||
|
{
|
||||||
|
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED)))
|
||||||
|
{
|
||||||
|
CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A, TRUE);
|
||||||
|
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
|
||||||
|
CreateNPCTrainerParty(&gEnemyParty[PARTY_SIZE / 2], gTrainerBattleOpponent_B, FALSE);
|
||||||
|
SetWildMonHeldItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gMain.inBattle = TRUE;
|
gMain.inBattle = TRUE;
|
||||||
gSaveBlock2Ptr->frontier.disableRecordBattle = FALSE;
|
gSaveBlock2Ptr->frontier.disableRecordBattle = FALSE;
|
||||||
|
@ -380,6 +380,41 @@ static void CreateBattleStartTask(u8 transition, u16 song)
|
|||||||
PlayMapChosenOrBattleBGM(song);
|
PlayMapChosenOrBattleBGM(song);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Task_BattleStart_Debug(u8 taskId)
|
||||||
|
{
|
||||||
|
s16 *data = gTasks[taskId].data;
|
||||||
|
|
||||||
|
switch (tState)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if (!FldEffPoison_IsActive()) // is poison not active?
|
||||||
|
{
|
||||||
|
BattleTransition_StartOnField(tTransition);
|
||||||
|
ClearMirageTowerPulseBlendEffect();
|
||||||
|
tState++; // go to case 1.
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (IsBattleTransitionDone() == TRUE)
|
||||||
|
{
|
||||||
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
|
SetMainCallback2(CB2_InitBattle);
|
||||||
|
RestartWildEncounterImmunitySteps();
|
||||||
|
ClearPoisonStepCounter();
|
||||||
|
DestroyTask(taskId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CreateBattleStartTask_Debug(u8 transition, u16 song)
|
||||||
|
{
|
||||||
|
u8 taskId = CreateTask(Task_BattleStart_Debug, 1);
|
||||||
|
|
||||||
|
gTasks[taskId].tTransition = transition;
|
||||||
|
PlayMapChosenOrBattleBGM(song);
|
||||||
|
}
|
||||||
|
|
||||||
#undef tState
|
#undef tState
|
||||||
#undef tTransition
|
#undef tTransition
|
||||||
|
|
||||||
@ -422,6 +457,25 @@ static void DoStandardWildBattle(bool32 isDouble)
|
|||||||
TryUpdateGymLeaderRematchFromWild();
|
TryUpdateGymLeaderRematchFromWild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoStandardWildBattle_Debug(void)
|
||||||
|
{
|
||||||
|
LockPlayerFieldControls();
|
||||||
|
FreezeObjectEvents();
|
||||||
|
StopPlayerAvatar();
|
||||||
|
gMain.savedCallback = CB2_EndWildBattle;
|
||||||
|
gBattleTypeFlags = 0;
|
||||||
|
if (InBattlePyramid())
|
||||||
|
{
|
||||||
|
VarSet(VAR_TEMP_E, 0);
|
||||||
|
gBattleTypeFlags |= BATTLE_TYPE_PYRAMID;
|
||||||
|
}
|
||||||
|
CreateBattleStartTask_Debug(GetWildBattleTransition(), 0);
|
||||||
|
//IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
|
||||||
|
//IncrementGameStat(GAME_STAT_WILD_BATTLES);
|
||||||
|
//IncrementDailyWildBattles();
|
||||||
|
//TryUpdateGymLeaderRematchFromWild();
|
||||||
|
}
|
||||||
|
|
||||||
void BattleSetup_StartRoamerBattle(void)
|
void BattleSetup_StartRoamerBattle(void)
|
||||||
{
|
{
|
||||||
LockPlayerFieldControls();
|
LockPlayerFieldControls();
|
||||||
@ -1349,6 +1403,19 @@ void BattleSetup_StartTrainerBattle(void)
|
|||||||
ScriptContext_Stop();
|
ScriptContext_Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BattleSetup_StartTrainerBattle_Debug(void)
|
||||||
|
{
|
||||||
|
sNoOfPossibleTrainerRetScripts = gNoOfApproachingTrainers;
|
||||||
|
gNoOfApproachingTrainers = 0;
|
||||||
|
sShouldCheckTrainerBScript = FALSE;
|
||||||
|
gWhichTrainerToFaceAfterBattle = 0;
|
||||||
|
gMain.savedCallback = CB2_EndTrainerBattle;
|
||||||
|
|
||||||
|
CreateBattleStartTask_Debug(GetWildBattleTransition(), 0);
|
||||||
|
|
||||||
|
ScriptContext_Stop();
|
||||||
|
}
|
||||||
|
|
||||||
static void CB2_EndTrainerBattle(void)
|
static void CB2_EndTrainerBattle(void)
|
||||||
{
|
{
|
||||||
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
|
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
|
||||||
|
1724
src/debug.c
1724
src/debug.c
File diff suppressed because it is too large
Load Diff
@ -4287,6 +4287,40 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GiveMonInitialMoveset_Fast(struct Pokemon *mon)
|
||||||
|
{
|
||||||
|
GiveBoxMonInitialMoveset_Fast(&mon->box);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GiveBoxMonInitialMoveset_Fast(struct BoxPokemon *boxMon) //Credit: AsparagusEduardo
|
||||||
|
{
|
||||||
|
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
|
||||||
|
s32 level = GetLevelFromBoxMonExp(boxMon);
|
||||||
|
s32 i, j;
|
||||||
|
u16 levelMoveCount = 0;
|
||||||
|
u16 moves[MAX_MON_MOVES] = {0};
|
||||||
|
u8 addedMoves = 0;
|
||||||
|
|
||||||
|
for (i = 0; gLevelUpLearnsets[species][i].move != LEVEL_UP_END; i++)
|
||||||
|
levelMoveCount++;
|
||||||
|
|
||||||
|
for (i = levelMoveCount; (i >= 0 && addedMoves < MAX_MON_MOVES); i--)
|
||||||
|
{
|
||||||
|
if (gLevelUpLearnsets[species][i].level > level)
|
||||||
|
continue;
|
||||||
|
if (gLevelUpLearnsets[species][i].level == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (moves[addedMoves] != gLevelUpLearnsets[species][i].move)
|
||||||
|
moves[addedMoves++] = gLevelUpLearnsets[species][i].move;
|
||||||
|
}
|
||||||
|
for (i = MAX_MON_MOVES - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &moves[i]);
|
||||||
|
SetBoxMonData(boxMon, MON_DATA_PP1 + i, &gBattleMoves[moves[i]].pp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
|
u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
|
||||||
{
|
{
|
||||||
u32 retVal = MOVE_NONE;
|
u32 retVal = MOVE_NONE;
|
||||||
|
@ -1113,3 +1113,13 @@ bool8 TryDoDoubleWildBattle(void)
|
|||||||
#endif
|
#endif
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool8 StandardWildEncounter_Debug(void)
|
||||||
|
{
|
||||||
|
u16 headerId = GetCurrentMapWildMonHeaderId();
|
||||||
|
if (TryGenerateWildMon(gWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, 0) != TRUE)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
DoStandardWildBattle_Debug();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user