Merge pull request #2023 from TheXaman/pokemon_expansion_debug_fixes

fixes for pokemon_debug.c of values not beeing applied/reset
This commit is contained in:
Eduardo Quezada D'Ottone 2022-01-05 09:35:00 -03:00 committed by GitHub
commit d4f03c65e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -782,6 +782,13 @@ static void SetConstSpriteValues(struct PokemonDebugMenu *data)
data->constSpriteValues.backPicCoords = gMonBackPicCoords[species].y_offset; data->constSpriteValues.backPicCoords = gMonBackPicCoords[species].y_offset;
} }
static void ResetOffsetSpriteValues(struct PokemonDebugMenu *data)
{
data->offsetsSpriteValues.offset_back_picCoords = 0;
data->offsetsSpriteValues.offset_front_picCoords = 0;
data->offsetsSpriteValues.offset_front_elevation = 0;
}
static u8 GetBattlerSpriteFinal_YCustom(u16 species, s8 offset_picCoords, s8 offset_elevation) static u8 GetBattlerSpriteFinal_YCustom(u16 species, s8 offset_picCoords, s8 offset_elevation)
{ {
u16 offset; u16 offset;
@ -1281,6 +1288,17 @@ static void ResetBGs_Debug_Menu(u16 a)
} }
} }
static void ApplyOffsetSpriteValues(struct PokemonDebugMenu *data)
{
u16 species = data->currentmonId;
//Back
gSprites[data->backspriteId].y = DEBUG_MON_BACK_Y + gMonBackPicCoords[species].y_offset + data->offsetsSpriteValues.offset_back_picCoords;
//Front
gSprites[data->frontspriteId].y = GetBattlerSpriteFinal_YCustom(species, data->offsetsSpriteValues.offset_front_picCoords, data->offsetsSpriteValues.offset_front_elevation);
//Shadow if one was added
UpdateShadowSpriteInvisible(data);
}
static void UpdateSubmenuOneOptionValue(u8 taskId, bool8 increment) static void UpdateSubmenuOneOptionValue(u8 taskId, bool8 increment)
{ {
struct PokemonDebugMenu *data = GetStructPtr(taskId); struct PokemonDebugMenu *data = GetStructPtr(taskId);
@ -1355,6 +1373,7 @@ static void UpdateSubmenuOneOptionValue(u8 taskId, bool8 increment)
data->animIdBack = GetSpeciesBackAnimSet(modArrows->currValue) + 1; data->animIdBack = GetSpeciesBackAnimSet(modArrows->currValue) + 1;
data->animIdFront = sMonFrontAnimIdsTable[modArrows->currValue - 1]; data->animIdFront = sMonFrontAnimIdsTable[modArrows->currValue - 1];
UpdateMonAnimNames(taskId); UpdateMonAnimNames(taskId);
ResetOffsetSpriteValues(data);
UpdateBattlerValue(data); UpdateBattlerValue(data);
ReloadPokemonSprites(data); ReloadPokemonSprites(data);
@ -1442,7 +1461,6 @@ static void UpdateSubmenuTwoOptionValue(u8 taskId, bool8 increment)
UpdateYPosOffsetText(data); UpdateYPosOffsetText(data);
} }
static void Handle_Input_Debug_Pokemon(u8 taskId) static void Handle_Input_Debug_Pokemon(u8 taskId)
{ {
struct PokemonDebugMenu *data = GetStructPtr(taskId); struct PokemonDebugMenu *data = GetStructPtr(taskId);
@ -1454,7 +1472,6 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
PlayCryInternal(data->currentmonId, 0, 120, 10, 0); PlayCryInternal(data->currentmonId, 0, 120, 10, 0);
LaunchAnimationTaskForBackSprite(Backsprite, data->animIdBack-1); LaunchAnimationTaskForBackSprite(Backsprite, data->animIdBack-1);
} }
if (JOY_NEW(R_BUTTON) && (Frontsprite->callback == SpriteCallbackDummy)) if (JOY_NEW(R_BUTTON) && (Frontsprite->callback == SpriteCallbackDummy))
{ {
PlayCryInternal(data->currentmonId, 0, 120, 10, 0); PlayCryInternal(data->currentmonId, 0, 120, 10, 0);
@ -1462,6 +1479,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
StartSpriteAnim(Frontsprite, 1); StartSpriteAnim(Frontsprite, 1);
LaunchAnimationTaskForFrontSprite(Frontsprite, data->animIdFront); LaunchAnimationTaskForFrontSprite(Frontsprite, data->animIdFront);
} }
if (JOY_NEW(START_BUTTON)) if (JOY_NEW(START_BUTTON))
{ {
data->isShiny = !data->isShiny; data->isShiny = !data->isShiny;
@ -1470,7 +1488,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
PlaySE(SE_SHINY); PlaySE(SE_SHINY);
ReloadPokemonSprites(data); ReloadPokemonSprites(data);
ApplyOffsetSpriteValues(data);
} }
if (JOY_NEW(SELECT_BUTTON) && SpeciesHasGenderDifference[data->currentmonId]) if (JOY_NEW(SELECT_BUTTON) && SpeciesHasGenderDifference[data->currentmonId])
{ {
@ -1488,7 +1506,6 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
{ {
data->currentSubmenu = 1; data->currentSubmenu = 1;
SetArrowInvisibility(data); SetArrowInvisibility(data);
SetConstSpriteValues(data);
PrintInstructionsOnWindow(data); PrintInstructionsOnWindow(data);
} }
else if (JOY_NEW(B_BUTTON)) else if (JOY_NEW(B_BUTTON))
@ -1508,9 +1525,7 @@ 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; ResetOffsetSpriteValues(data);
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));
@ -1526,9 +1541,7 @@ 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; ResetOffsetSpriteValues(data);
data->offsetsSpriteValues.offset_front_picCoords = 0;
data->offsetsSpriteValues.offset_front_elevation = 0;
} }
PlaySE(SE_DEX_SCROLL); PlaySE(SE_DEX_SCROLL);
@ -1560,6 +1573,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
data->currentSubmenu = 2; data->currentSubmenu = 2;
PrintInstructionsOnWindow(data); PrintInstructionsOnWindow(data);
SetArrowInvisibility(data); SetArrowInvisibility(data);
SetConstSpriteValues(data);
UpdateYPosOffsetText(data); UpdateYPosOffsetText(data);
} }
else if (JOY_NEW(B_BUTTON)) else if (JOY_NEW(B_BUTTON))