This commit is contained in:
resetes12
2024-03-09 16:48:09 +01:00
11 changed files with 2384 additions and 39 deletions

View File

@@ -332,6 +332,66 @@ u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8
return dest;
}
u8 *ConvertUIntToHexStringN(u8 *dest, u32 value, enum StringConvertMode mode, u8 n)
{
enum { WAITING_FOR_NONZERO_DIGIT, WRITING_DIGITS, WRITING_SPACES } state;
u8 i;
s32 powerOfSixteen;
s32 largestPowerOfSixteen = 1;
for (i = 1; i < n; i++)
largestPowerOfSixteen *= 16;
state = WAITING_FOR_NONZERO_DIGIT;
if (mode == STR_CONV_MODE_RIGHT_ALIGN)
state = WRITING_SPACES;
if (mode == STR_CONV_MODE_LEADING_ZEROS)
state = WRITING_DIGITS;
for (powerOfSixteen = largestPowerOfSixteen; powerOfSixteen > 0; powerOfSixteen /= 16)
{
u8 c;
u32 digit = value / powerOfSixteen;
u32 temp = value % powerOfSixteen;
if (state == WRITING_DIGITS)
{
char *out = dest++;
if (digit <= 0xF)
c = sDigits[digit];
else
c = CHAR_QUESTION_MARK;
*out = c;
}
else if (digit != 0 || powerOfSixteen == 1)
{
char *out;
state = WRITING_DIGITS;
out = dest++;
if (digit <= 0xF)
c = sDigits[digit];
else
c = CHAR_QUESTION_MARK;
*out = c;
}
else if (state == WRITING_SPACES)
{
*dest++ = 0x77;
}
value = temp;
}
*dest = EOS;
return dest;
}
u8 *StringExpandPlaceholders(u8 *dest, const u8 *src)
{
for (;;)

View File

@@ -27,6 +27,7 @@ bool8 IsStringLengthAtLeast(const u8 *str, s32 n);
u8 *ConvertIntToDecimalStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8 n);
u8 *ConvertUIntToDecimalStringN(u8 *dest, u32 value, enum StringConvertMode mode, u8 n);
u8 *ConvertIntToHexStringN(u8 *dest, s32 value, enum StringConvertMode mode, u8 n);
u8 *ConvertUIntToHexStringN(u8 *dest, u32 value, enum StringConvertMode mode, u8 n);
u8 *StringExpandPlaceholders(u8 *dest, const u8 *src);
u8 *StringBraille(u8 *dest, const u8 *src);
const u8 *GetExpandedPlaceholder(u32 id);

View File

@@ -6,7 +6,7 @@
// still has them in the ROM. This is because the developers forgot
// to define NDEBUG before release, however this has been changed as
// Ruby's actual debug build does not use the AGBPrint features.
#define NDEBUG
//#define NDEBUG
// To enable printf debugging, comment out "#define NDEBUG". This allows
// the various AGBPrint functions to be used. (See include/gba/isagbprint.h).

View File

@@ -9,6 +9,7 @@
void Debug_ShowMainMenu(void);
void Debug_ReShowBattleDebugMenu(void);
extern EWRAM_DATA bool8 gIsDebugBattle;
extern EWRAM_DATA u32 gDebugAIFlags;

10
include/debug_pokemon_creator.h Executable file
View File

@@ -0,0 +1,10 @@
#ifndef GUARD_DEBUG_POKEMON_CREATOR_H
#define GUARD_DEBUG_POKEMON_CREATOR_H
#define MODIFY_DIGITS_MAX 4
void CB2_Debug_Pokemon(void);
void DebugPkmCreator_Init(u8 mode, u8 index);
#endif // GUARD_DEBUG_POKEMON_CREATOR_H

View File

@@ -113,6 +113,7 @@ bool8 IsRegionMapZoomed(void);
void TrySetPlayerIconBlink(void);
void BlendRegionMap(u16 color, u32 coeff);
void SetRegionMapDataForZoom(void);
u8* GetMapName_HandleVersion(u8*, u16, u8);
extern const struct RegionMapLocation gRegionMapEntries[];

View File

@@ -2005,13 +2005,14 @@ static void Cmd_waitanimation(void)
static void Cmd_healthbarupdate(void)
{
#if TX_DEBUG_SYSTEM_ENABLE == TRUE
#if TX_DEBUG_SYSTEM_ENABLE == TRUE
u8 side = GetBattlerSide(gBattlerTarget);
if (FlagGet(FLAG_SYS_NO_BATTLE_DMG) && side == B_SIDE_PLAYER)
{
gMoveResultFlags |= MOVE_RESULT_NO_EFFECT;
}
#endif
#endif
if (gBattleControllerExecFlags)
return;

View File

@@ -14,6 +14,7 @@
#include "data.h"
#include "daycare.h"
#include "debug.h"
#include "debug_pokemon_creator.h"
#include "event_data.h"
#include "event_object_movement.h"
#include "event_scripts.h"
@@ -71,6 +72,7 @@ enum { // Main
DEBUG_MENU_ITEM_FLAGVAR,
DEBUG_MENU_ITEM_BATTLE,
DEBUG_MENU_ITEM_GIVE,
DEBUG_MENU_ITEM_POKEMON_CREATOR,
DEBUG_MENU_ITEM_FILL,
DEBUG_MENU_ITEM_SOUND,
DEBUG_MENU_ITEM_ACCESS_PC,
@@ -173,6 +175,17 @@ enum { // Give
DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS,
DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG,
};
enum {
DEBUG_PKM_CREATOR_MENU_ITEM_PARTY_ADD, // Add to party
DEBUG_PKM_CREATOR_MENU_ITEM_PARTY_EDIT, // Edit party
DEBUG_PKM_CREATOR_MENU_ITEM_PC_EDIT, // Edit PC Box
DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_EDIT, // Edit enemy party (usable as a sandbox)
DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_EDIT_DEBUG, // Edit enemy party for debug battle
DEBUG_PKM_CREATOR_MENU_ITEM_DEBUG_EDIT, // Edit party for debug battle
DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_ADD, // Add to enemy party (Unused)
DEBUG_PKM_CREATOR_MENU_ITEM_TESTING, // Testing mode (Dont alter parties)
DEBUG_PKM_CREATOR_MENU_ITEM_TESTING_COPY, // Testing mode (use first mon as template)
};
enum { // Give Fill
DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST,
DEBUG_FILL_MENU_ITEM_PC_BOXES_SLOW,
@@ -264,8 +277,7 @@ EWRAM_DATA u32 gDebugAIFlags = 0;
// *******************************
// Define functions
static void Debug_ReShowMainMenu(void);
static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate);
static void Debug_ShowMenuDynamic(u8 taskId);
static u8 Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate);
static void Debug_DestroyMenu(u8 taskId);
static void Debug_DestroyMenu_Full(u8 taskId);
static void DebugAction_Cancel(u8 taskId);
@@ -289,6 +301,7 @@ static void DebugAction_OpenScriptsMenu(u8 taskId);
static void DebugAction_OpenFlagsVarsMenu(u8 taskId);
static void DebugAction_OpenBattleMenu(u8 taskId);
static void DebugAction_OpenGiveMenu(u8 taskId);
static void DebugAction_OpenPokemonCreator(u8 taskId);
static void DebugAction_OpenFillMenu(u8 taskId);
static void DebugAction_OpenSoundMenu(u8 taskId);
static void DebugAction_AccessPC(u8 taskId);
@@ -298,6 +311,7 @@ static void DebugTask_HandleMenuInput_Scripts(u8 taskId);
static void DebugTask_HandleMenuInput_FlagsVars(u8 taskId);
static void DebugTask_HandleMenuInput_Battle(u8 taskId);
static void DebugTask_HandleMenuInput_Give(u8 taskId);
static void DebugTask_HandleMenuInput_PkmCreator(u8 taskId);
static void DebugTask_HandleMenuInput_Fill(u8 taskId);
static void DebugTask_HandleMenuInput_Sound(u8 taskId);
@@ -361,6 +375,16 @@ static void DebugAction_Give_MaxCoins(u8 taskId);
static void DebugAction_Give_MaxBattlePoints(u8 taskId);
static void DebugAction_Give_DayCareEgg(u8 taskId);
static void DebugAction_PkmCreator_Party_Add(u8 taskid);
static void DebugAction_PkmCreator_Party_Edit(u8 taskid);
static void DebugAction_PkmCreator_PC_Edit(u8 taskid);
static void DebugAction_PkmCreator_Enemy_Party_Edit(u8 taskId);
static void DebugAction_PkmCreator_Enemy_Party_Edit_Debug(u8 taskId);
static void DebugAction_PkmCreator_Debug_Edit(u8 taskid);
static void DebugAction_PkmCreator_Enemy_Party_Add(u8 taskid);
static void DebugAction_PkmCreator_Testing(u8 taskid);
static void DebugAction_PkmCreator_Testing_Copy(u8 taskid);
static void DebugAction_Fill_PCBoxes_Fast(u8 taskId);
static void DebugAction_Fill_PCBoxes_Slow(u8 taskId);
static void DebugAction_Fill_PCItemStorage(u8 taskId);
@@ -414,8 +438,9 @@ static const u8 sDebugText_Continue[] = _("Continue…{CLEAR_TO 110}{RIGHT_
static const u8 sDebugText_Utilities[] = _("Utilities…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_Scripts[] = _("Scripts…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_FlagsVars[] = _("Flags & Vars…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_Battle[] = _("Battle Test{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_Battle[] = _("Battle Test{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_Give[] = _("Give X…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_PkmCreator[] = _("Pokémon Creator…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_Fill[] = _("Fill PC/Pockets…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_Sound[] = _("Sound…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_AccessPC[] = _("Access PC…{CLEAR_TO 110}{RIGHT_ARROW}");
@@ -544,6 +569,16 @@ static const u8 sDebugText_Give_MaxMoney[] = _("Max Money");
static const u8 sDebugText_Give_MaxCoins[] = _("Max Coins");
static const u8 sDebugText_Give_BattlePoints[] = _("Max Battle Points");
static const u8 sDebugText_Give_DaycareEgg[] = _("Daycare Egg");
// Pokemon Creator
static const u8 sDebugText_PkmCreator_Party_Add[] = _("Party add");
static const u8 sDebugText_PkmCreator_Party_Edit[] = _("Party edit");
static const u8 sDebugText_PkmCreator_PC_Edit[] = _("PC edit");
static const u8 sDebugText_PkmCreator_Enemy_Party_Edit[] = _("Enemy edit");
static const u8 sDebugText_PkmCreator_Enemy_Party_Edit_Debug[] = _("Enemy edit debug");
static const u8 sDebugText_PkmCreator_Debug_Edit[] = _("Debug edit");
static const u8 sDebugText_PkmCreator_Enemy_Party_Add[] = _("Enemy add");
static const u8 sDebugText_PkmCreator_Testing[] = _("Testing");
static const u8 sDebugText_PkmCreator_Testing_Copy[] = _("Testing (copy 1st mon)");
// Fill Menu
static const u8 sDebugText_Fill_Pc_Fast[] = _("Fill PCBoxes Fast");
static const u8 sDebugText_Fill_Pc_Slow[] = _("Fill PCBoxes Slow (LAG!)");
@@ -596,15 +631,16 @@ static const s32 sPowersOfTen[] =
// List Menu Items
static const struct ListMenuItem sDebugMenu_Items_Main[] =
{
[DEBUG_MENU_ITEM_UTILITIES] = {sDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES},
[DEBUG_MENU_ITEM_SCRIPTS] = {sDebugText_Scripts, DEBUG_MENU_ITEM_SCRIPTS},
[DEBUG_MENU_ITEM_FLAGVAR] = {sDebugText_FlagsVars, DEBUG_MENU_ITEM_FLAGVAR},
[DEBUG_MENU_ITEM_BATTLE] = {sDebugText_Battle, DEBUG_MENU_ITEM_BATTLE},
[DEBUG_MENU_ITEM_GIVE] = {sDebugText_Give, DEBUG_MENU_ITEM_GIVE},
[DEBUG_MENU_ITEM_FILL] = {sDebugText_Fill, DEBUG_MENU_ITEM_FILL},
[DEBUG_MENU_ITEM_SOUND] = {sDebugText_Sound, DEBUG_MENU_ITEM_SOUND},
[DEBUG_MENU_ITEM_ACCESS_PC] = {sDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC},
[DEBUG_MENU_ITEM_CANCEL] = {sDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL}
[DEBUG_MENU_ITEM_UTILITIES] = {sDebugText_Utilities, DEBUG_MENU_ITEM_UTILITIES},
[DEBUG_MENU_ITEM_SCRIPTS] = {sDebugText_Scripts, DEBUG_MENU_ITEM_SCRIPTS},
[DEBUG_MENU_ITEM_FLAGVAR] = {sDebugText_FlagsVars, DEBUG_MENU_ITEM_FLAGVAR},
[DEBUG_MENU_ITEM_BATTLE] = {sDebugText_Battle, DEBUG_MENU_ITEM_BATTLE},
[DEBUG_MENU_ITEM_GIVE] = {sDebugText_Give, DEBUG_MENU_ITEM_GIVE},
[DEBUG_MENU_ITEM_POKEMON_CREATOR] = {sDebugText_PkmCreator, DEBUG_MENU_ITEM_POKEMON_CREATOR},
[DEBUG_MENU_ITEM_FILL] = {sDebugText_Fill, DEBUG_MENU_ITEM_FILL},
[DEBUG_MENU_ITEM_SOUND] = {sDebugText_Sound, DEBUG_MENU_ITEM_SOUND},
[DEBUG_MENU_ITEM_ACCESS_PC] = {sDebugText_AccessPC, DEBUG_MENU_ITEM_ACCESS_PC},
[DEBUG_MENU_ITEM_CANCEL] = {sDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL}
};
static const struct ListMenuItem sDebugMenu_Items_Utilities[] =
{
@@ -710,6 +746,18 @@ static const struct ListMenuItem sDebugMenu_Items_Give[] =
[DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS] = {sDebugText_Give_BattlePoints, DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS},
[DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = {sDebugText_Give_DaycareEgg, DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG},
};
static const struct ListMenuItem sDebugMenu_Items_PkmCreator[] =
{
[DEBUG_PKM_CREATOR_MENU_ITEM_PARTY_ADD] = {sDebugText_PkmCreator_Party_Add, DEBUG_PKM_CREATOR_MENU_ITEM_PARTY_ADD},
[DEBUG_PKM_CREATOR_MENU_ITEM_PARTY_EDIT] = {sDebugText_PkmCreator_Party_Edit, DEBUG_PKM_CREATOR_MENU_ITEM_PARTY_EDIT},
[DEBUG_PKM_CREATOR_MENU_ITEM_PC_EDIT] = {sDebugText_PkmCreator_PC_Edit, DEBUG_PKM_CREATOR_MENU_ITEM_PC_EDIT},
[DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_EDIT] = {sDebugText_PkmCreator_Enemy_Party_Edit, DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_EDIT},
[DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_EDIT_DEBUG] = {sDebugText_PkmCreator_Enemy_Party_Edit_Debug, DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_EDIT_DEBUG},
[DEBUG_PKM_CREATOR_MENU_ITEM_DEBUG_EDIT] = {sDebugText_PkmCreator_Debug_Edit, DEBUG_PKM_CREATOR_MENU_ITEM_DEBUG_EDIT},
[DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_ADD] = {sDebugText_PkmCreator_Enemy_Party_Add, DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_ADD},
[DEBUG_PKM_CREATOR_MENU_ITEM_TESTING] = {sDebugText_PkmCreator_Testing, DEBUG_PKM_CREATOR_MENU_ITEM_TESTING},
[DEBUG_PKM_CREATOR_MENU_ITEM_TESTING_COPY] = {sDebugText_PkmCreator_Testing_Copy, DEBUG_PKM_CREATOR_MENU_ITEM_TESTING_COPY},
};
static const struct ListMenuItem sDebugMenu_Items_Fill[] =
{
[DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST] = {sDebugText_Fill_Pc_Fast, DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST},
@@ -731,15 +779,16 @@ static const struct ListMenuItem sDebugMenu_Items_Sound[] =
// Menu Actions
static void (*const sDebugMenu_Actions_Main[])(u8) =
{
[DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu,
[DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu,
[DEBUG_MENU_ITEM_FLAGVAR] = DebugAction_OpenFlagsVarsMenu,
[DEBUG_MENU_ITEM_BATTLE] = DebugAction_OpenBattleMenu,
[DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu,
[DEBUG_MENU_ITEM_FILL] = DebugAction_OpenFillMenu,
[DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu,
[DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC,
[DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel
[DEBUG_MENU_ITEM_UTILITIES] = DebugAction_OpenUtilitiesMenu,
[DEBUG_MENU_ITEM_SCRIPTS] = DebugAction_OpenScriptsMenu,
[DEBUG_MENU_ITEM_FLAGVAR] = DebugAction_OpenFlagsVarsMenu,
[DEBUG_MENU_ITEM_BATTLE] = DebugAction_OpenBattleMenu,
[DEBUG_MENU_ITEM_GIVE] = DebugAction_OpenGiveMenu,
[DEBUG_MENU_ITEM_POKEMON_CREATOR] = DebugAction_OpenPokemonCreator,
[DEBUG_MENU_ITEM_FILL] = DebugAction_OpenFillMenu,
[DEBUG_MENU_ITEM_SOUND] = DebugAction_OpenSoundMenu,
[DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC,
[DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel
};
static void (*const sDebugMenu_Actions_Utilities[])(u8) =
{
@@ -799,6 +848,18 @@ static void (*const sDebugMenu_Actions_Give[])(u8) =
[DEBUG_GIVE_MENU_ITEM_MAX_BATTLE_POINTS] = DebugAction_Give_MaxBattlePoints,
[DEBUG_GIVE_MENU_ITEM_DAYCARE_EGG] = DebugAction_Give_DayCareEgg,
};
static void (*const sDebugMenu_Actions_PkmCreator[])(u8) =
{
[DEBUG_PKM_CREATOR_MENU_ITEM_PARTY_ADD] = DebugAction_PkmCreator_Party_Add,
[DEBUG_PKM_CREATOR_MENU_ITEM_PARTY_EDIT] = DebugAction_PkmCreator_Party_Edit,
[DEBUG_PKM_CREATOR_MENU_ITEM_PC_EDIT] = DebugAction_PkmCreator_PC_Edit,
[DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_EDIT] = DebugAction_PkmCreator_Enemy_Party_Edit,
[DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_EDIT_DEBUG] = DebugAction_PkmCreator_Enemy_Party_Edit_Debug,
[DEBUG_PKM_CREATOR_MENU_ITEM_DEBUG_EDIT] = DebugAction_PkmCreator_Debug_Edit,
[DEBUG_PKM_CREATOR_MENU_ITEM_ENEMY_PARTY_ADD] = DebugAction_PkmCreator_Enemy_Party_Add,
[DEBUG_PKM_CREATOR_MENU_ITEM_TESTING] = DebugAction_PkmCreator_Testing,
[DEBUG_PKM_CREATOR_MENU_ITEM_TESTING_COPY] = DebugAction_PkmCreator_Testing_Copy,
};
static void (*const sDebugMenu_Actions_Fill[])(u8) =
{
[DEBUG_FILL_MENU_ITEM_PC_BOXES_FAST] = DebugAction_Fill_PCBoxes_Fast,
@@ -921,6 +982,12 @@ static const struct ListMenuTemplate sDebugMenu_ListTemplate_Give =
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.totalItems = ARRAY_COUNT(sDebugMenu_Items_Give),
};
static const struct ListMenuTemplate sDebugMenu_ListTemplate_PkmCreator =
{
.items = sDebugMenu_Items_PkmCreator,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.totalItems = ARRAY_COUNT(sDebugMenu_Items_PkmCreator),
};
static const struct ListMenuTemplate sDebugMenu_ListTemplate_Fill =
{
.items = sDebugMenu_Items_Fill,
@@ -949,7 +1016,7 @@ static void Debug_ReShowMainMenu(void)
{
Debug_ShowMenu(DebugTask_HandleMenuInput_Main, sDebugMenu_ListTemplate_Main);
}
static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate)
static u8 Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate)
{
struct ListMenuTemplate menuTemplate;
u8 windowId;
@@ -987,10 +1054,17 @@ static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMte
gTasks[inputTaskId].data[2] = 0;
Debug_RefreshListMenu(inputTaskId);
//Debug_ShowMenuDynamic(inputTaskId);
// draw everything
CopyWindowToVram(windowId, 3);
// return taskId for use right after
return inputTaskId;
}
void Debug_ReShowBattleDebugMenu(void)
{
u8 taskId = Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, gMultiuseListMenuTemplate);
Debug_RedrawListMenu(taskId);
}
static void Debug_DestroyMenu(u8 taskId)
{
@@ -1409,6 +1483,19 @@ static void DebugTask_HandleMenuInput_Battle(u8 taskId)
case 3: // Enemy pokemon
if (idx == 6)
Debug_InitializeBattle(taskId);
else
{
if (GetMonData(&gEnemyParty[idx], MON_DATA_SANITY_HAS_SPECIES))
{
Debug_DestroyMenu(taskId);
DebugPkmCreator_Init(10, idx);
}
else
{
Debug_DestroyMenu(taskId);
DebugPkmCreator_Init(9, 0xFF);
}
}
break;
}
}
@@ -1441,7 +1528,6 @@ static void DebugTask_HandleMenuInput_Battle(u8 taskId)
}
}
}
static void Debug_InitializeBattle(u8 taskId)
{
u32 i;
@@ -1466,14 +1552,6 @@ static void Debug_InitializeBattle(u8 taskId)
// Set terrain
gBattleTerrain = sDebugBattleData->battleTerrain;
// Populate enemy party
for (i = 0; i < PARTY_SIZE; i++)
{
ZeroMonData(&gEnemyParty[i]);
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES))
gEnemyParty[i] = gPlayerParty[i];
}
// Set AI flags
for (i = 0; i < ARRAY_COUNT(sDebugBattleData->aiFlags); i++)
{
@@ -1506,6 +1584,24 @@ static void DebugTask_HandleMenuInput_Give(u8 taskId)
Debug_ReShowMainMenu();
}
}
static void DebugTask_HandleMenuInput_PkmCreator(u8 taskId)
{
void (*func)(u8);
u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
if ((func = sDebugMenu_Actions_PkmCreator[input]) != NULL)
func(taskId);
}
else if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
Debug_DestroyMenu(taskId);
Debug_ReShowMainMenu();
}
}
static void DebugTask_HandleMenuInput_Fill(u8 taskId)
{
void (*func)(u8);
@@ -1561,19 +1657,26 @@ static void DebugAction_OpenFlagsVarsMenu(u8 taskId)
sDebugMenuListData->listId = 0;
Debug_ShowMenu(DebugTask_HandleMenuInput_FlagsVars, gMultiuseListMenuTemplate);
}
static void DebugAction_OpenBattleMenu(u8 taskId)
{
// Clean enemy party
//u32 i;
//for (i = 0; i < PARTY_SIZE; i++)
// ZeroMonData(&gEnemyParty[i]);
Debug_DestroyMenu(taskId);
sDebugMenuListData->listId = 1;
Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, sDebugMenu_ListTemplate_Battle_0);
}
static void DebugAction_OpenGiveMenu(u8 taskId)
{
Debug_DestroyMenu(taskId);
Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
}
static void DebugAction_OpenPokemonCreator(u8 taskId)
{
Debug_DestroyMenu(taskId);
Debug_ShowMenu(DebugTask_HandleMenuInput_PkmCreator, sDebugMenu_ListTemplate_PkmCreator);
}
static void DebugAction_OpenFillMenu(u8 taskId)
{
Debug_DestroyMenu(taskId);
@@ -2478,7 +2581,6 @@ static void DebugAction_FlagsVars_ToggleFrontierPass(u8 taskId)
PlaySE(SE_PC_LOGIN);
FlagToggle(FLAG_SYS_FRONTIER_PASS);
}
static void DebugAction_FlagsVars_BattleDmgOnOff(u8 taskId)
{
if (FlagGet(FLAG_SYS_NO_BATTLE_DMG))
@@ -2487,7 +2589,6 @@ static void DebugAction_FlagsVars_BattleDmgOnOff(u8 taskId)
PlaySE(SE_PC_LOGIN);
FlagToggle(FLAG_SYS_NO_BATTLE_DMG);
}
static void DebugAction_FlagsVars_CollisionOnOff(u8 taskId)
{
if (FlagGet(FLAG_SYS_NO_COLLISION))
@@ -3531,6 +3632,63 @@ static void DebugAction_Give_DayCareEgg(u8 taskId)
TriggerPendingDaycareEgg();
}
// *******************************
// Actions Pokemon Creator
static void DebugAction_PkmCreator_Party_Add(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(0, 0xFF);
}
static void DebugAction_PkmCreator_Party_Edit(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(1, 0xFF);
}
static void DebugAction_PkmCreator_PC_Edit(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(2, 0xFF);
}
static void DebugAction_PkmCreator_Enemy_Party_Edit(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(3, 0xFF);
}
static void DebugAction_PkmCreator_Enemy_Party_Edit_Debug(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(4, 0xFF);
}
static void DebugAction_PkmCreator_Debug_Edit(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(5, 0xFF);
}
static void DebugAction_PkmCreator_Enemy_Party_Add(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(6, 0xFF);
}
static void DebugAction_PkmCreator_Testing(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(7, 0xFF);
}
static void DebugAction_PkmCreator_Testing_Copy(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);
LockPlayerFieldControls();
DebugPkmCreator_Init(8, 0xFF);
}
// *******************************
// Actions Fill
static void DebugAction_Fill_PCBoxes_Fast(u8 taskId) //Credit: Sierraffinity

2077
src/debug_pokemon_creator.c Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -2018,3 +2018,38 @@ static void CB_ExitFlyMap(void)
break;
}
}
// added 7/23/21, luma~
u8* GetMapName_HandleVersion(u8* dest, u16 mapsec, u8 version) {
switch (version)
{
default:
if ((mapsec & 255) == METLOC_SPECIAL_EGG) {
return StringCopy(dest, gRegionMapEntries[214].name);
}
else if ((mapsec & 255) == METLOC_IN_GAME_TRADE) {
return StringCopy(dest, gRegionMapEntries[215].name);
}
else if ((mapsec & 255) == METLOC_FATEFUL_ENCOUNTER) {
return StringCopy(dest, gRegionMapEntries[216].name);
}
else {
return GetMapNameGeneric(dest, mapsec & 255);
}
// TODO: expand R/S Aqua Hideout placeholder
case 1 ... 6: // R/S/E/FR/LG/WB
if (mapsec == 253) {
return StringCopy(dest, gRegionMapEntries[214].name);
}
else if (mapsec == 254) {
return StringCopy(dest, gRegionMapEntries[215].name);
}
else if (mapsec == 255) {
return StringCopy(dest, gRegionMapEntries[216].name);
}
else if (mapsec < 213) {
return StringCopy(dest, gRegionMapEntries[mapsec].name);
}
// TODO: expand R/S Aqua Hideout placeholder
}
}

View File

@@ -157,3 +157,4 @@
.include "src/battle_controller_player.o"
.include "src/pokedex_plus_hgss.o"
.include "src/sound_check_menu.o"
.include "src/debug_pokemon_creator.o"