added option to view changes for front/back sprite picCoords and elevation live

This commit is contained in:
TheXaman 2021-12-13 22:31:37 +01:00
parent f1f4082f62
commit fe95e88938
3 changed files with 345 additions and 71 deletions

View File

@ -23,6 +23,9 @@
#define MON_PIC_BACK 0 #define MON_PIC_BACK 0
#define MON_PIC_FRONT 1 #define MON_PIC_FRONT 1
//Sprite offset
#define MAX_Y_OFFSET 20
//Windows //Windows
#define WIN_NAME_NUMBERS 0 #define WIN_NAME_NUMBERS 0
#define WIN_INSTRUCTIONS 1 #define WIN_INSTRUCTIONS 1

View File

@ -19,9 +19,28 @@ struct PokemonDebugModifyArrows
struct PokemonDebugOptionArrows struct PokemonDebugOptionArrows
{ {
u8 arrowSpriteId[2]; u8 arrowSpriteId[1];
u8 currentDigit; u8 currentDigit;
void *modifiedValPtr; };
struct PokemonDebugYPosModifiyArrows
{
u8 arrowSpriteId[1];
u8 currentDigit;
};
struct PokemonSpriteConstValues
{
u8 backPicCoords;
u8 frontPicCoords;
u8 frontElevation;
};
struct PokemonSpriteOffsets
{
s8 offset_back_picCoords;
s8 offset_front_picCoords;
s8 offset_front_elevation;
}; };
struct PokemonDebugMenu struct PokemonDebugMenu
@ -37,12 +56,15 @@ struct PokemonDebugMenu
bool8 isFemale; bool8 isFemale;
struct PokemonDebugModifyArrows modifyArrows; struct PokemonDebugModifyArrows modifyArrows;
struct PokemonDebugOptionArrows optionArrows; struct PokemonDebugOptionArrows optionArrows;
struct PokemonDebugYPosModifiyArrows yPosModifyArrows;
struct PokemonSpriteConstValues constSpriteValues;
struct PokemonSpriteOffsets offsetsSpriteValues;
u8 animIdBack; u8 animIdBack;
u8 animIdFront; u8 animIdFront;
u8 battleBgType; u8 battleBgType;
u8 battleTerrain; u8 battleTerrain;
bool8 inSubmenu; u8 currentSubmenu;
u8 submenuYpos; u8 submenuYpos[3];
}; };
void CB2_Debug_Pokemon(void); void CB2_Debug_Pokemon(void);

View File

@ -123,19 +123,19 @@ static const struct WindowTemplate sPokemonDebugWindowTemplate[] =
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 14, .tilemapTop = 14,
.width = 5, .width = 6,
.height = 6, .height = 6,
.paletteNum = 0xF, .paletteNum = 0xF,
.baseBlock = 1 + 30 + 60 .baseBlock = 1 + 30 + 60
}, },
[WIN_BOTTOM_RIGHT] = { [WIN_BOTTOM_RIGHT] = {
.bg = 0, .bg = 0,
.tilemapLeft = 6, .tilemapLeft = 7,
.tilemapTop = 14, .tilemapTop = 14,
.width = 25, .width = 24,
.height = 6, .height = 6,
.paletteNum = 0xF, .paletteNum = 0xF,
.baseBlock = 1 + 30 + 60 + 30 .baseBlock = 1 + 30 + 60 + 36
}, },
[WIN_FOOTPRINT] = [WIN_FOOTPRINT] =
{ {
@ -145,7 +145,7 @@ static const struct WindowTemplate sPokemonDebugWindowTemplate[] =
.width = 2, .width = 2,
.height = 2, .height = 2,
.paletteNum = 0xF, .paletteNum = 0xF,
.baseBlock = 1 + 30 + 60 + 30 + 150, .baseBlock = 1 + 30 + 60 + 36 + 144,
}, },
DUMMY_WIN_TEMPLATE, DUMMY_WIN_TEMPLATE,
}; };
@ -397,41 +397,55 @@ static void PrintInstructionsOnWindow(struct PokemonDebugMenu *data)
{ {
u8 fontId = 0; u8 fontId = 0;
u8 x = 2; u8 x = 2;
u8 textInstructions[] = _("{START_BUTTON} Shiny\n{B_BUTTON} Exit {A_BUTTON} Submenu$"); u8 textInstructions[] = _("{START_BUTTON} Shiny\n{B_BUTTON} Exit {A_BUTTON} Submenu 1$");
u8 textInstructionsGender[] = _("{START_BUTTON} Shiny {SELECT_BUTTON} Gender\n{B_BUTTON} Exit {A_BUTTON} Submenu$"); u8 textInstructionsGender[] = _("{START_BUTTON} Shiny {SELECT_BUTTON} Gender\n{B_BUTTON} Exit {A_BUTTON} Submenu 1$");
u8 textInstructionsInSubmenu[] = _("{START_BUTTON} Shiny\n{B_BUTTON} Back$"); u8 textInstructionsSubmenuOne[] = _("{START_BUTTON} Shiny\n{B_BUTTON} Back {A_BUTTON} Submenu 2$");
u8 textInstructionsInSubmenuGender[] = _("{START_BUTTON} Shiny {SELECT_BUTTON} Gender\n{B_BUTTON} Back$"); u8 textInstructionsSubmenuOneGender[] = _("{START_BUTTON} Shiny {SELECT_BUTTON} Gender\n{B_BUTTON} Back {A_BUTTON} Submenu 2$");
u8 textInstructionsSubmenuTwo[] = _("{START_BUTTON} Shiny\n{B_BUTTON} Back$");
u8 textInstructionsSubmenuTwoGender[] = _("{START_BUTTON} Shiny {SELECT_BUTTON} Gender\n{B_BUTTON} Back$");
u8 textBottom[] = _("BACK:\nFRONT:\nBG:$"); u8 textBottom[] = _("BACK:\nFRONT:\nBG:$");
u8 textBottomForms[] = _("BACK:\nFRONT:\nBG:\nFORMS:$"); u8 textBottomForms[] = _("BACK:\nFRONT:\nBG:\nFORMS:$");
u8 textBottomSubmenuTwo[] = _("B coords:\nF coords:\nF elev:");
u16 species = data->modifyArrows.currValue; u16 species = data->modifyArrows.currValue;
//Instruction window //Instruction window
FillWindowPixelBuffer(WIN_INSTRUCTIONS, 0x11); FillWindowPixelBuffer(WIN_INSTRUCTIONS, 0x11);
if (data->inSubmenu) if (data->currentSubmenu == 0)
{
if (SpeciesHasGenderDifference[species])
AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsInSubmenuGender, x, 0, 0, NULL);
else
AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsInSubmenu, x, 0, 0, NULL);
}
else
{ {
if (SpeciesHasGenderDifference[species]) if (SpeciesHasGenderDifference[species])
AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsGender, x, 0, 0, NULL); AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsGender, x, 0, 0, NULL);
else else
AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructions, x, 0, 0, NULL); AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructions, x, 0, 0, NULL);
} }
else if (data->currentSubmenu == 1)
{
if (SpeciesHasGenderDifference[species])
AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuOneGender, x, 0, 0, NULL);
else
AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuOne, x, 0, 0, NULL);
}
else if (data->currentSubmenu == 2)
{
if (SpeciesHasGenderDifference[species])
AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuTwoGender, x, 0, 0, NULL);
else
AddTextPrinterParameterized(WIN_INSTRUCTIONS, fontId, textInstructionsSubmenuTwo, x, 0, 0, NULL);
}
CopyWindowToVram(WIN_INSTRUCTIONS, 3); CopyWindowToVram(WIN_INSTRUCTIONS, 3);
//Bottom left text //Bottom left text
if (gFormSpeciesIdTables[data->currentmonId] != NULL) FillWindowPixelBuffer(WIN_BOTTOM_LEFT, PIXEL_FILL(0));
AddTextPrinterParameterized(WIN_BOTTOM_LEFT, fontId, textBottomForms, 0, 0, 0, NULL); if (data->currentSubmenu != 2)
else
{ {
FillWindowPixelBuffer(WIN_BOTTOM_LEFT, PIXEL_FILL(0)); if (gFormSpeciesIdTables[data->currentmonId] != NULL)
AddTextPrinterParameterized(WIN_BOTTOM_LEFT, fontId, textBottom, 0, 0, 0, NULL); AddTextPrinterParameterized(WIN_BOTTOM_LEFT, fontId, textBottomForms, 0, 0, 0, NULL);
else
AddTextPrinterParameterized(WIN_BOTTOM_LEFT, fontId, textBottom, 0, 0, 0, NULL);
} }
else
AddTextPrinterParameterized(WIN_BOTTOM_LEFT, fontId, textBottomSubmenuTwo, 0, 0, 0, NULL);
} }
static void VBlankCB(void) static void VBlankCB(void)
@ -525,10 +539,28 @@ static void ValueToCharDigits(u8 *charDigits, u32 newValue, u8 maxDigits)
static void SetArrowInvisibility(struct PokemonDebugMenu *data) static void SetArrowInvisibility(struct PokemonDebugMenu *data)
{ {
bool8 invisible = data->inSubmenu; bool8 invisible = data->currentSubmenu;
gSprites[data->modifyArrows.arrowSpriteId[0]].invisible = invisible; switch (data->currentSubmenu)
gSprites[data->modifyArrows.arrowSpriteId[1]].invisible = invisible; {
gSprites[data->optionArrows.arrowSpriteId[0]].invisible = !invisible; case 0:
gSprites[data->modifyArrows.arrowSpriteId[0]].invisible = FALSE;
gSprites[data->modifyArrows.arrowSpriteId[1]].invisible = FALSE;
gSprites[data->optionArrows.arrowSpriteId[0]].invisible = TRUE;
gSprites[data->yPosModifyArrows.arrowSpriteId[0]].invisible = TRUE;
break;
case 1:
gSprites[data->modifyArrows.arrowSpriteId[0]].invisible = TRUE;
gSprites[data->modifyArrows.arrowSpriteId[1]].invisible = TRUE;
gSprites[data->optionArrows.arrowSpriteId[0]].invisible = FALSE;
gSprites[data->yPosModifyArrows.arrowSpriteId[0]].invisible = TRUE;
break;
case 2:
gSprites[data->modifyArrows.arrowSpriteId[0]].invisible = TRUE;
gSprites[data->modifyArrows.arrowSpriteId[1]].invisible = TRUE;
gSprites[data->optionArrows.arrowSpriteId[0]].invisible = TRUE;
gSprites[data->yPosModifyArrows.arrowSpriteId[0]].invisible = FALSE;
break;
}
} }
static void SetUpModifyArrows(struct PokemonDebugMenu *data) static void SetUpModifyArrows(struct PokemonDebugMenu *data)
@ -560,6 +592,17 @@ static void SetUpOptionArrows(struct PokemonDebugMenu *data)
gSprites[data->optionArrows.arrowSpriteId[0]].invisible = TRUE; gSprites[data->optionArrows.arrowSpriteId[0]].invisible = TRUE;
} }
static void SetUpYPosModifyArrows(struct PokemonDebugMenu *data)
{
LoadSpritePalette(&sSpritePalette_Arrow);
data->yPosModifyArrows.arrowSpriteId[0] = CreateSprite(&sSpriteTemplate_Arrow, OPTIONS_ARROW_1_X, OPTIONS_ARROW_Y, 0);
gSprites[data->yPosModifyArrows.arrowSpriteId[0]].animNum = 2;
data->yPosModifyArrows.currentDigit = 0;
gSprites[data->yPosModifyArrows.arrowSpriteId[0]].invisible = TRUE;
}
static bool32 TryMoveDigit(struct PokemonDebugModifyArrows *modArrows, bool32 moveUp) static bool32 TryMoveDigit(struct PokemonDebugModifyArrows *modArrows, bool32 moveUp)
{ {
s32 i; s32 i;
@ -654,7 +697,7 @@ static const struct CompressedSpritePalette *GetMonSpritePalStructCustom(u16 spe
} }
} }
void BattleLoadOpponentMonSpriteGfxCustom(u16 species, bool8 isFemale, bool8 isShiny, u8 battlerId) static void BattleLoadOpponentMonSpriteGfxCustom(u16 species, bool8 isFemale, bool8 isShiny, u8 battlerId)
{ {
u16 paletteOffset; u16 paletteOffset;
const void *lzPaletteData; const void *lzPaletteData;
@ -713,21 +756,39 @@ static u8 GetCastformYCustom(species)
return ret; return ret;
} }
u8 GetBattlerSpriteFinal_YCustom(u16 species) static u8 GetElevationValue(u16 species)
{
u8 val;
if (species == SPECIES_CASTFORM)
val = sCastformElevations[0];
else if (IsCastformForm(species))
val = sCastformElevations[species - SPECIES_CASTFORM_SUNNY + 1];
else
val = gEnemyMonElevation[species];
return val;
}
static void SetConstSpriteValues(struct PokemonDebugMenu *data)
{
u16 species = data->currentmonId;
data->constSpriteValues.frontPicCoords = gMonFrontPicCoords[species].y_offset;
data->constSpriteValues.frontElevation = GetElevationValue(species);
data->constSpriteValues.backPicCoords = gMonBackPicCoords[species].y_offset;
}
static u8 GetBattlerSpriteFinal_YCustom(u16 species, s8 offset_picCoords, s8 offset_elevation)
{ {
u16 offset; u16 offset;
u8 y; u8 y;
offset = gMonFrontPicCoords[species].y_offset; //FrontPicCoords
offset = gMonFrontPicCoords[species].y_offset + offset_picCoords;
if (species == SPECIES_CASTFORM)
offset -= sCastformElevations[0];
else if (IsCastformForm(species))
offset -= sCastformElevations[species - SPECIES_CASTFORM_SUNNY + 1];
else
offset -= gEnemyMonElevation[species];
//Elevation
offset -= GetElevationValue(species) + offset_elevation;
//Main position
y = offset + sBattlerCoords[0][1].y; y = offset + sBattlerCoords[0][1].y;
if (y > DISPLAY_HEIGHT - MON_PIC_HEIGHT + 8) if (y > DISPLAY_HEIGHT - MON_PIC_HEIGHT + 8)
@ -736,7 +797,7 @@ u8 GetBattlerSpriteFinal_YCustom(u16 species)
return y; return y;
} }
void SpriteCB_EnemyShadowCustom(struct Sprite *shadowSprite) static void SpriteCB_EnemyShadowCustom(struct Sprite *shadowSprite)
{ {
bool8 invisible = FALSE; bool8 invisible = FALSE;
u8 frontSpriteId = shadowSprite->data[0]; u8 frontSpriteId = shadowSprite->data[0];
@ -746,12 +807,15 @@ void SpriteCB_EnemyShadowCustom(struct Sprite *shadowSprite)
shadowSprite->x2 = battlerSprite->x2; shadowSprite->x2 = battlerSprite->x2;
shadowSprite->invisible = invisible; shadowSprite->invisible = invisible;
} }
static void LoadAndCreateEnemyShadowSpriteCustom(struct PokemonDebugMenu *data, u8 x, u8 y, u16 species) static void LoadAndCreateEnemyShadowSpriteCustom(struct PokemonDebugMenu *data, u16 species)
{ {
u8 x, y;
if (gEnemyMonElevation[species] == 0 && !IsCastformForm(species)) if (gEnemyMonElevation[species] == 0 && !IsCastformForm(species))
return; return;
LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow); LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]); LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]);
x = sBattlerCoords[0][1].x;
y = sBattlerCoords[0][1].y;
data->frontShadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, x, y + 29, 0xC8); data->frontShadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, x, y + 29, 0xC8);
gSprites[data->frontShadowSpriteId].data[0] = data->frontspriteId; gSprites[data->frontShadowSpriteId].data[0] = data->frontspriteId;
@ -955,6 +1019,57 @@ static void UpdateMonAnimNames(u8 taskId)
PrintBattleBgName(taskId); PrintBattleBgName(taskId);
} }
static void UpdateYPosOffsetText(struct PokemonDebugMenu *data)
{
u8 text[34];
u8 fontId = 0;
u8 textConst[] = _("const val:");
u8 textNew[] = _("new val:");
u8 x_const_val = 50;
u8 x_new_text = 70;
u8 x_new_val = 110;
u8 y = 0;
u8 backPicCoords = data->constSpriteValues.backPicCoords;
u8 frontPicCoords = data->constSpriteValues.frontPicCoords;
u8 frontElevation = data->constSpriteValues.frontElevation;
s8 offset_back_picCoords = data->offsetsSpriteValues.offset_back_picCoords;
s8 offset_front_picCoords = data->offsetsSpriteValues.offset_front_picCoords;
s8 offset_front_elevation = data->offsetsSpriteValues.offset_front_elevation;
u8 newBackPicCoords = backPicCoords + offset_back_picCoords;
u8 newFrontPicCoords = frontPicCoords + offset_front_picCoords;
u8 newFrontElevation = frontElevation + offset_front_elevation;
FillWindowPixelBuffer(WIN_BOTTOM_RIGHT, PIXEL_FILL(0));
//Back
y = 0;
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, textConst, 0, y, 0, NULL);
ConvertIntToDecimalStringN(text, backPicCoords , STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, text, x_const_val, y, 0, NULL);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, textNew, x_new_text, y, 0, NULL);
ConvertIntToDecimalStringN(text, newBackPicCoords , STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, text, x_new_val, y, 0, NULL);
//Front picCoords
y = 12;
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, textConst, 0, y, 0, NULL);
ConvertIntToDecimalStringN(text, frontPicCoords , STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, text, x_const_val, y, 0, NULL);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, textNew, x_new_text, y, 0, NULL);
ConvertIntToDecimalStringN(text, newFrontPicCoords , STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, text, x_new_val, y, 0, NULL);
//Front elevation
y = 24;
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, textConst, 0, y, 0, NULL);
ConvertIntToDecimalStringN(text, frontElevation , STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, text, x_const_val, y, 0, NULL);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, textNew, x_new_text, y, 0, NULL);
ConvertIntToDecimalStringN(text, newFrontElevation , STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized(WIN_BOTTOM_RIGHT, fontId, text, x_new_val, y, 0, NULL);
}
static void ResetPokemonDebugWindows(void) static void ResetPokemonDebugWindows(void)
{ {
u8 i; u8 i;
@ -1049,13 +1164,13 @@ void CB2_Debug_Pokemon(void)
BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1);
SetMultiuseSpriteTemplateToPokemon(species, 1); SetMultiuseSpriteTemplateToPokemon(species, 1);
gMultiuseSpriteTemplate.paletteTag = palette->tag; gMultiuseSpriteTemplate.paletteTag = palette->tag;
front_y = GetBattlerSpriteFinal_YCustom(species); front_y = GetBattlerSpriteFinal_YCustom(species, 0, 0);
data->frontspriteId = CreateSprite(&gMultiuseSpriteTemplate, front_x, front_y, 0); data->frontspriteId = CreateSprite(&gMultiuseSpriteTemplate, front_x, front_y, 0);
gSprites[data->frontspriteId].oam.paletteNum = 1; gSprites[data->frontspriteId].oam.paletteNum = 1;
gSprites[data->frontspriteId].callback = SpriteCallbackDummy; gSprites[data->frontspriteId].callback = SpriteCallbackDummy;
gSprites[data->frontspriteId].oam.priority = 0; gSprites[data->frontspriteId].oam.priority = 0;
//Front Shadow //Front Shadow
LoadAndCreateEnemyShadowSpriteCustom(data, front_x, front_y, species); LoadAndCreateEnemyShadowSpriteCustom(data, species);
//Back //Back
HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->isFemale); HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->isFemale);
@ -1075,9 +1190,12 @@ void CB2_Debug_Pokemon(void)
SetUpModifyArrows(data); SetUpModifyArrows(data);
PrintDigitChars(data); PrintDigitChars(data);
//Option Arrows //Option Arrow
SetUpOptionArrows(data); SetUpOptionArrows(data);
//Modify Y Pos Arrow
SetUpYPosModifyArrows(data);
//Anim names //Anim names
data->animIdBack = GetSpeciesBackAnimSet(species) + 1; data->animIdBack = GetSpeciesBackAnimSet(species) + 1;
data->animIdFront = sMonFrontAnimIdsTable[data->currentmonId - 1]; data->animIdFront = sMonFrontAnimIdsTable[data->currentmonId - 1];
@ -1148,10 +1266,10 @@ static void ResetBGs_Debug_Menu(u16 a)
} }
} }
static void UpdateSubmenuOptionValue(u8 taskId, bool8 increment) static void UpdateSubmenuOneOptionValue(u8 taskId, bool8 increment)
{ {
struct PokemonDebugMenu *data = GetStructPtr(taskId); struct PokemonDebugMenu *data = GetStructPtr(taskId);
u8 option = data->submenuYpos; u8 option = data->submenuYpos[1];
switch (option) switch (option)
{ {
@ -1223,6 +1341,80 @@ static void UpdateSubmenuOptionValue(u8 taskId, bool8 increment)
} }
} }
static void UpdateSubmenuTwoOptionValue(u8 taskId, bool8 increment)
{
struct PokemonDebugMenu *data = GetStructPtr(taskId);
u16 species = data->currentmonId;
u8 option = data->submenuYpos[2];
s8 offset;
u8 y;
switch (option)
{
case 0: //Back picCoords
offset = data->offsetsSpriteValues.offset_back_picCoords;
if (increment)
{
if (offset == MAX_Y_OFFSET)
offset = -data->constSpriteValues.backPicCoords;
else
offset += 1;
}
else
{
if (offset == -data->constSpriteValues.backPicCoords)
offset = MAX_Y_OFFSET;
else
offset -= 1;
}
data->offsetsSpriteValues.offset_back_picCoords = offset;
gSprites[data->backspriteId].y = DEBUG_MON_BACK_Y + gMonBackPicCoords[species].y_offset + offset;
break;
case 1: //Front picCoords
offset = data->offsetsSpriteValues.offset_front_picCoords;
if (increment)
{
if (offset == MAX_Y_OFFSET)
offset = -data->constSpriteValues.frontPicCoords;
else
offset += 1;
}
else
{
if (offset == -data->constSpriteValues.frontPicCoords)
offset = MAX_Y_OFFSET;
else
offset -= 1;
}
data->offsetsSpriteValues.offset_front_picCoords = offset;
y = GetBattlerSpriteFinal_YCustom(species, offset, data->offsetsSpriteValues.offset_front_elevation);
gSprites[data->frontspriteId].y = y;
break;
case 2: //Front elevation
offset = data->offsetsSpriteValues.offset_front_elevation;
if (increment)
{
if (offset == MAX_Y_OFFSET)
offset = -data->constSpriteValues.frontElevation;
else
offset += 1;
}
else
{
if (offset == -data->constSpriteValues.frontElevation)
offset = MAX_Y_OFFSET;
else
offset -= 1;
}
data->offsetsSpriteValues.offset_front_elevation = offset;
y = GetBattlerSpriteFinal_YCustom(species, data->offsetsSpriteValues.offset_front_picCoords, offset);
gSprites[data->frontspriteId].y = y;
break;
}
UpdateYPosOffsetText(data);
}
static void Handle_Input_Debug_Pokemon(u8 taskId) static void Handle_Input_Debug_Pokemon(u8 taskId)
{ {
@ -1263,11 +1455,11 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
PlaySE(SE_DEX_SCROLL); PlaySE(SE_DEX_SCROLL);
} }
if (!data->inSubmenu) if (data->currentSubmenu == 0)
{ {
if (JOY_NEW(A_BUTTON)) if (JOY_NEW(A_BUTTON))
{ {
data->inSubmenu = TRUE; data->currentSubmenu = 1;
SetArrowInvisibility(data); SetArrowInvisibility(data);
PrintInstructionsOnWindow(data); PrintInstructionsOnWindow(data);
} }
@ -1288,6 +1480,9 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
data->animIdBack = GetSpeciesBackAnimSet(data->currentmonId) + 1; data->animIdBack = GetSpeciesBackAnimSet(data->currentmonId) + 1;
data->animIdFront = sMonFrontAnimIdsTable[data->currentmonId - 1]; data->animIdFront = sMonFrontAnimIdsTable[data->currentmonId - 1];
UpdateMonAnimNames(taskId); UpdateMonAnimNames(taskId);
data->offsetsSpriteValues.offset_back_picCoords = 0;
data->offsetsSpriteValues.offset_front_picCoords = 0;
data->offsetsSpriteValues.offset_front_elevation = 0;
} }
PlaySE(SE_DEX_SCROLL); PlaySE(SE_DEX_SCROLL);
while (!(gMain.intrCheck & INTR_FLAG_VBLANK)); while (!(gMain.intrCheck & INTR_FLAG_VBLANK));
@ -1303,6 +1498,9 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
data->animIdBack = GetSpeciesBackAnimSet(data->currentmonId) + 1; data->animIdBack = GetSpeciesBackAnimSet(data->currentmonId) + 1;
data->animIdFront = sMonFrontAnimIdsTable[data->currentmonId - 1]; data->animIdFront = sMonFrontAnimIdsTable[data->currentmonId - 1];
UpdateMonAnimNames(taskId); UpdateMonAnimNames(taskId);
data->offsetsSpriteValues.offset_back_picCoords = 0;
data->offsetsSpriteValues.offset_front_picCoords = 0;
data->offsetsSpriteValues.offset_front_elevation = 0;
} }
PlaySE(SE_DEX_SCROLL); PlaySE(SE_DEX_SCROLL);
@ -1327,15 +1525,23 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
} }
} }
else //Submenu else if (data->currentSubmenu == 1) //Submenu 1
{ {
if (JOY_NEW(B_BUTTON)) if (JOY_NEW(A_BUTTON))
{ {
data->inSubmenu = FALSE; data->currentSubmenu = 2;
if (data->submenuYpos == 3) SetConstSpriteValues(data);
PrintInstructionsOnWindow(data);
SetArrowInvisibility(data);
UpdateYPosOffsetText(data);
}
else if (JOY_NEW(B_BUTTON))
{
data->currentSubmenu = 0;
if (data->submenuYpos[1] == 3)
{ {
data->submenuYpos = 2; data->submenuYpos[1] = 2;
data->optionArrows.currentDigit = data->submenuYpos; data->optionArrows.currentDigit = data->submenuYpos[1];
gSprites[data->optionArrows.arrowSpriteId[0]].y = OPTIONS_ARROW_Y + data->optionArrows.currentDigit * 12; gSprites[data->optionArrows.arrowSpriteId[0]].y = OPTIONS_ARROW_Y + data->optionArrows.currentDigit * 12;
} }
SetArrowInvisibility(data); SetArrowInvisibility(data);
@ -1343,37 +1549,75 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
} }
else if (JOY_NEW(DPAD_DOWN)) else if (JOY_NEW(DPAD_DOWN))
{ {
data->submenuYpos += 1; data->submenuYpos[1] += 1;
if (data->submenuYpos >= 3) if (data->submenuYpos[1] >= 3)
{ {
if ((gFormSpeciesIdTables[data->currentmonId] == NULL) || (data->submenuYpos >= 4)) if ((gFormSpeciesIdTables[data->currentmonId] == NULL) || (data->submenuYpos[1] >= 4))
data->submenuYpos = 0; data->submenuYpos[1] = 0;
} }
data->optionArrows.currentDigit = data->submenuYpos; data->optionArrows.currentDigit = data->submenuYpos[1];
gSprites[data->optionArrows.arrowSpriteId[0]].y = OPTIONS_ARROW_Y + data->optionArrows.currentDigit * 12; gSprites[data->optionArrows.arrowSpriteId[0]].y = OPTIONS_ARROW_Y + data->optionArrows.currentDigit * 12;
} }
else if (JOY_NEW(DPAD_UP)) else if (JOY_NEW(DPAD_UP))
{ {
if (data->submenuYpos == 0) if (data->submenuYpos[1] == 0)
{ {
if (gFormSpeciesIdTables[data->currentmonId] != NULL) if (gFormSpeciesIdTables[data->currentmonId] != NULL)
data->submenuYpos = 3; data->submenuYpos[1] = 3;
else else
data->submenuYpos = 2; data->submenuYpos[1] = 2;
} }
else else
data->submenuYpos -= 1; data->submenuYpos[1] -= 1;
data->optionArrows.currentDigit = data->submenuYpos; data->optionArrows.currentDigit = data->submenuYpos[1];
gSprites[data->optionArrows.arrowSpriteId[0]].y = OPTIONS_ARROW_Y + data->optionArrows.currentDigit * 12; gSprites[data->optionArrows.arrowSpriteId[0]].y = OPTIONS_ARROW_Y + data->optionArrows.currentDigit * 12;
} }
else if (JOY_NEW(DPAD_LEFT)) else if (JOY_NEW(DPAD_LEFT))
{ {
UpdateSubmenuOptionValue(taskId, FALSE); UpdateSubmenuOneOptionValue(taskId, FALSE);
} }
else if (JOY_NEW(DPAD_RIGHT)) else if (JOY_NEW(DPAD_RIGHT))
{ {
UpdateSubmenuOptionValue(taskId, TRUE); UpdateSubmenuOneOptionValue(taskId, TRUE);
}
}
else if (data->currentSubmenu == 2) //Submenu 2
{
if (JOY_NEW(B_BUTTON))
{
data->currentSubmenu = 1;
SetArrowInvisibility(data);
PrintInstructionsOnWindow(data);
UpdateMonAnimNames(taskId);
}
else if (JOY_NEW(DPAD_DOWN))
{
data->submenuYpos[2] += 1;
if (data->submenuYpos[2] >= 3)
data->submenuYpos[2] = 0;
data->yPosModifyArrows.currentDigit = data->submenuYpos[2];
gSprites[data->yPosModifyArrows.arrowSpriteId[0]].y = OPTIONS_ARROW_Y + data->yPosModifyArrows.currentDigit * 12;
}
else if (JOY_NEW(DPAD_UP))
{
if (data->submenuYpos[2] == 0)
data->submenuYpos[2] = 2;
else
data->submenuYpos[2] -= 1;
data->yPosModifyArrows.currentDigit = data->submenuYpos[2];
gSprites[data->yPosModifyArrows.arrowSpriteId[0]].y = OPTIONS_ARROW_Y + data->yPosModifyArrows.currentDigit * 12;
}
else if (JOY_NEW(DPAD_LEFT))
{
UpdateSubmenuTwoOptionValue(taskId, FALSE);
}
else if (JOY_NEW(DPAD_RIGHT))
{
UpdateSubmenuTwoOptionValue(taskId, TRUE);
} }
} }
} }
@ -1411,13 +1655,13 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1);
SetMultiuseSpriteTemplateToPokemon(species, 1); SetMultiuseSpriteTemplateToPokemon(species, 1);
gMultiuseSpriteTemplate.paletteTag = palette->tag; gMultiuseSpriteTemplate.paletteTag = palette->tag;
front_y = GetBattlerSpriteFinal_YCustom(species); front_y = GetBattlerSpriteFinal_YCustom(species, 0, 0);
data->frontspriteId = CreateSprite(&gMultiuseSpriteTemplate, front_x, front_y, 0); data->frontspriteId = CreateSprite(&gMultiuseSpriteTemplate, front_x, front_y, 0);
gSprites[data->frontspriteId].oam.paletteNum = 1; gSprites[data->frontspriteId].oam.paletteNum = 1;
gSprites[data->frontspriteId].callback = SpriteCallbackDummy; gSprites[data->frontspriteId].callback = SpriteCallbackDummy;
gSprites[data->frontspriteId].oam.priority = 0; gSprites[data->frontspriteId].oam.priority = 0;
//Front Shadow //Front Shadow
LoadAndCreateEnemyShadowSpriteCustom(data, front_x, front_y, species); LoadAndCreateEnemyShadowSpriteCustom(data, species);
//Back //Back
HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->isFemale); HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->isFemale);
@ -1439,11 +1683,16 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
data->modifyArrows.arrowSpriteId[1] = CreateSprite(&sSpriteTemplate_Arrow, MODIFY_DIGITS_ARROW_X + (data->modifyArrows.currentDigit * 6), MODIFY_DIGITS_ARROW2_Y, 0); data->modifyArrows.arrowSpriteId[1] = CreateSprite(&sSpriteTemplate_Arrow, MODIFY_DIGITS_ARROW_X + (data->modifyArrows.currentDigit * 6), MODIFY_DIGITS_ARROW2_Y, 0);
gSprites[data->modifyArrows.arrowSpriteId[1]].animNum = 1; gSprites[data->modifyArrows.arrowSpriteId[1]].animNum = 1;
//Option Arrows //Option Arrow
LoadSpritePalette(&sSpritePalette_Arrow); LoadSpritePalette(&sSpritePalette_Arrow);
data->optionArrows.arrowSpriteId[0] = CreateSprite(&sSpriteTemplate_Arrow, OPTIONS_ARROW_1_X, OPTIONS_ARROW_Y + data->optionArrows.currentDigit * 12, 0); data->optionArrows.arrowSpriteId[0] = CreateSprite(&sSpriteTemplate_Arrow, OPTIONS_ARROW_1_X, OPTIONS_ARROW_Y + data->optionArrows.currentDigit * 12, 0);
gSprites[data->optionArrows.arrowSpriteId[0]].animNum = 2; gSprites[data->optionArrows.arrowSpriteId[0]].animNum = 2;
//Y Pos Modify Arrow
LoadSpritePalette(&sSpritePalette_Arrow);
data->yPosModifyArrows.arrowSpriteId[0] = CreateSprite(&sSpriteTemplate_Arrow, OPTIONS_ARROW_1_X, OPTIONS_ARROW_Y + data->yPosModifyArrows.currentDigit * 12, 0);
gSprites[data->yPosModifyArrows.arrowSpriteId[0]].animNum = 2;
//Arrow invisibility //Arrow invisibility
SetArrowInvisibility(data); SetArrowInvisibility(data);