Added form switching + Button icons

This commit is contained in:
Eduardo Quezada D'Ottone 2021-12-03 19:32:31 -03:00
parent 42ed047bc0
commit 96b8d21b7a
3 changed files with 41 additions and 11 deletions

View File

@ -8,6 +8,7 @@
#include "constants/map_groups.h"
#define GET_BASE_SPECIES_ID(speciesId) (GetFormSpeciesId(speciesId, 0))
#define FORM_SPECIES_END (0xffff)
struct PokemonSubstruct0
{
@ -279,6 +280,7 @@ extern const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2];
extern const u16 gLinkPlayerFacilityClasses[];
extern const struct SpriteTemplate gBattlerSpriteTemplates[];
extern const s8 gNatureStatTable[][5];
extern const u16 *const gFormSpeciesIdTables[NUM_SPECIES];
void ZeroBoxMonData(struct BoxPokemon *boxMon);
void ZeroMonData(struct Pokemon *mon);

View File

@ -1,5 +1,3 @@
#define FORM_SPECIES_END (0xffff)
static const u16 sVenusaurFormSpeciesIdTable[] = {
SPECIES_VENUSAUR,
SPECIES_VENUSAUR_MEGA,

View File

@ -1,4 +1,4 @@
//Credits: Gamer2020, AsparagusEduardo, TheXaman
//Credits: Gamer2020, AsparagusEduardo, TheXaman, ShinyDragonHunter
#include "global.h"
#include "battle.h"
#include "battle_anim.h"
@ -18,6 +18,7 @@
#include "menu.h"
#include "overworld.h"
#include "palette.h"
#include "pokemon.h"
#include "pokemon_animation.h"
#include "pokemon_debug.h"
#include "pokemon_icon.h"
@ -154,16 +155,28 @@ static void PadString(const u8 *src, u8 *dst)
static void PrintInstructionsOnWindow(u8 windowId, struct PokemonDebugMenu *data)
{
u8 text[] = _("A - Shiny START - Cry\nL - Back R - Front$");
u8 textGender[] = _("A - Shiny START - Cry\nL - Back R - Front SEL - Gender$");
u8 text[] = _("{A_BUTTON} Shiny\n{L_BUTTON} Back {R_BUTTON} Front$");
u8 textGender[] = _("{A_BUTTON} Shiny\n{L_BUTTON} Back {R_BUTTON} Front {SELECT_BUTTON} Gender$");
u8 textForms[] = _("{A_BUTTON} Shiny {START_BUTTON} Forms\n{L_BUTTON} Back {R_BUTTON} Front$");
u8 textGenderForms[] = _("{A_BUTTON} Shiny {START_BUTTON} Forms\n{L_BUTTON} Back {R_BUTTON} Front {SELECT_BUTTON} Gender$");
u16 species = data->modifyArrows.currValue;
FillWindowPixelBuffer(windowId, 0x11);
if (SpeciesHasGenderDifference[species])
AddTextPrinterParameterized(windowId, 1, textGender, 0, 0, 0, NULL);
{
if (gFormSpeciesIdTables[data->currentmonId] != NULL)
AddTextPrinterParameterized(windowId, 1, textGenderForms, 0, 0, 0, NULL);
else
AddTextPrinterParameterized(windowId, 1, textGender, 0, 0, 0, NULL);
}
else
AddTextPrinterParameterized(windowId, 1, text, 0, 0, 0, NULL);
{
if (gFormSpeciesIdTables[data->currentmonId] != NULL)
AddTextPrinterParameterized(windowId, 1, textForms, 0, 0, 0, NULL);
else
AddTextPrinterParameterized(windowId, 1, text, 0, 0, 0, NULL);
}
CopyWindowToVram(windowId, 3);
}
@ -416,7 +429,7 @@ void CB2_Debug_Pokemon(void)
data = AllocZeroed(sizeof(struct PokemonDebugMenu));
SetStructPtr(taskId, data);
data->currentmonId = 1;
data->currentmonId = SPECIES_BULBASAUR;
species = data->currentmonId;
data->InstructionsWindowId = AddWindow(&sDebugPokemonInstructionsTemplate);
@ -527,10 +540,12 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
if (JOY_NEW(L_BUTTON))
{
PlayCryInternal(data->currentmonId, 0, 120, 10, 0);
LaunchAnimationTaskForBackSprite(Backsprite, GetSpeciesBackAnimSet(data->currentmonId));
}
else if (JOY_NEW(R_BUTTON))
{
PlayCryInternal(data->currentmonId, 0, 120, 10, 0);
if (HasTwoFramesAnimation(data->currentmonId))
StartSpriteAnim(Frontsprite, 1);
BattleAnimateFrontSprite(Frontsprite, data->currentmonId, TRUE, 1);
@ -547,13 +562,27 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
}
else if (JOY_NEW(B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].func = Exit_Debug_Pokemon;
PlaySE(SE_PC_OFF);
}
else if (JOY_NEW(START_BUTTON))
{
PlayCryInternal(data->currentmonId, 0, 120, 10, 0);
if (gFormSpeciesIdTables[data->currentmonId] != NULL)
{
struct PokemonDebugModifyArrows *modArrows = &data->modifyArrows;
u8 formId = GetFormIdFromFormSpeciesId(data->currentmonId);
if (gFormSpeciesIdTables[data->currentmonId][formId + 1] != FORM_SPECIES_END)
modArrows->currValue = GetFormSpeciesId(data->currentmonId, formId + 1);
else
modArrows->currValue = gFormSpeciesIdTables[data->currentmonId][0];
PrintDigitChars(data);
UpdateBattlerValue(data);
ReloadPokemonSprites(data);
while (!(gMain.intrCheck & INTR_FLAG_VBLANK));
PlaySE(SE_DEX_SCROLL);
}
}
else if (JOY_NEW(SELECT_BUTTON) && SpeciesHasGenderDifference[data->currentmonId])
{
@ -562,6 +591,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
UpdateBattlerValue(data);
ReloadPokemonSprites(data);
while (!(gMain.intrCheck & INTR_FLAG_VBLANK));
PlaySE(SE_DEX_SCROLL);
}
else if (JOY_NEW(DPAD_DOWN)) // || gMain.heldKeys & DPAD_DOWN)
{
@ -673,7 +703,7 @@ static void Exit_Debug_Pokemon(u8 taskId)
Free(data);
FreeMonSpritesGfx();
DestroyTask(taskId);
SetMainCallback2(CB2_ReturnToField);
SetMainCallback2(CB2_ReturnToFieldWithOpenMenu);
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
}
}