mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
added Select button text, added gender based icons, imrpoved code
This commit is contained in:
parent
b0f8408fb6
commit
50e95878e9
@ -19,6 +19,7 @@ u8 CreateMonIconNoPersonality(u16 species, void (*callback)(struct Sprite *), s1
|
||||
void FreeMonIconPalette(u16 species);
|
||||
void FreeAndDestroyMonIconSprite(struct Sprite *sprite);
|
||||
u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality);
|
||||
u8 CreateMonIconCustom(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool8 isFemale, bool8 isShiny);
|
||||
u8 UpdateMonIconFrame(struct Sprite *sprite);
|
||||
void LoadMonIconPalette(u16 species);
|
||||
void sub_80D328C(struct Sprite *sprite);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "data.h"
|
||||
#include "decompress.h"
|
||||
#include "pokemon.h"
|
||||
#include "pokemon_debug.h"
|
||||
#include "text.h"
|
||||
|
||||
EWRAM_DATA ALIGNED(4) u8 gDecompressionBuffer[0x4000] = {0};
|
||||
@ -113,6 +114,7 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32
|
||||
DrawSpindaSpots(species, personality, dest, isFrontPic);
|
||||
}
|
||||
|
||||
#ifdef POKEMON_DEBUG
|
||||
static void LoadSpecialPokePicCustom(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic, bool8 isFemale)
|
||||
{
|
||||
if (species == SPECIES_UNOWN)
|
||||
@ -149,6 +151,7 @@ void HandleLoadSpecialPokePicCustom(const struct CompressedSpriteSheet *src, voi
|
||||
|
||||
LoadSpecialPokePicCustom(src, dest, species, personality, isFrontPic, isFemale);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Unused_LZDecompressWramIndirect(const void **src, void *dest)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define DEBUG_MON_Y 14
|
||||
#define DEBUG_MON_BACK_X 32
|
||||
#define DEBUG_MON_BACK_Y 50
|
||||
#define DEBUG_ICON_X 148
|
||||
#define DEBUG_ICON_X 158
|
||||
#define DEBUG_ICON_Y 90
|
||||
#define DEBUG_MON_SHINY 0
|
||||
#define DEBUG_MON_NORMAL 9
|
||||
@ -78,7 +78,7 @@ struct PokemonDebugMenu
|
||||
u8 backspriteId;
|
||||
u8 iconspriteId;
|
||||
bool8 isShiny;
|
||||
u8 gender;
|
||||
bool8 isFemale;
|
||||
struct PokemonDebugModifyArrows modifyArrows;
|
||||
u8 modifyWindowId;
|
||||
u8 messageBoxWindowId;
|
||||
@ -103,7 +103,7 @@ static const struct WindowTemplate sDebugPokemonInstructionsTemplate =
|
||||
.bg = 0,
|
||||
.tilemapLeft =1,
|
||||
.tilemapTop = 207,
|
||||
.width = 14,
|
||||
.width = 22,
|
||||
.height = 8,
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x300
|
||||
@ -184,12 +184,18 @@ static void PrintOnCurrentMonWindow(u8 windowId, u16 monId)
|
||||
}
|
||||
*/
|
||||
|
||||
static void PrintInstructionsOnWindow(u8 windowId)
|
||||
static void PrintInstructionsOnWindow(u8 windowId, struct PokemonDebugMenu *data)
|
||||
{
|
||||
u8 text[] = _("A - Shiny START - Cry\nL - Back R - Front$");
|
||||
u8 text[] = _("A - Shiny START - Cry\nL - Back R - Front$");
|
||||
u8 textGender[] = _("A - Shiny START - Cry\nL - Back R - Front SEL - Gender$");
|
||||
u16 species = data->modifyArrows.currValue;
|
||||
|
||||
|
||||
FillWindowPixelBuffer(windowId, 0x11);
|
||||
AddTextPrinterParameterized(windowId, 1, text, 0, 0, 0, NULL);
|
||||
if (SpeciesHasGenderDifference[species])
|
||||
AddTextPrinterParameterized(windowId, 1, textGender, 0, 0, 0, NULL);
|
||||
else
|
||||
AddTextPrinterParameterized(windowId, 1, text, 0, 0, 0, NULL);
|
||||
CopyWindowToVram(windowId, 3);
|
||||
}
|
||||
|
||||
@ -217,7 +223,7 @@ static void PrintDigitChars(struct PokemonDebugMenu *data)
|
||||
{
|
||||
s32 i;
|
||||
u16 species = data->modifyArrows.currValue;
|
||||
u8 text[MODIFY_DIGITS_MAX + POKEMON_NAME_LENGTH + 4];
|
||||
u8 text[MODIFY_DIGITS_MAX + POKEMON_NAME_LENGTH + 8];
|
||||
|
||||
for (i = 0; i < data->modifyArrows.maxDigits; i++)
|
||||
text[i] = data->modifyArrows.charDigits[i];
|
||||
@ -227,10 +233,10 @@ static void PrintDigitChars(struct PokemonDebugMenu *data)
|
||||
|
||||
if (SpeciesHasGenderDifference[species])
|
||||
{
|
||||
if (data->gender == GENDER_MALE)
|
||||
text[i++] = CHAR_MALE;
|
||||
else
|
||||
if (data->isFemale)
|
||||
text[i++] = CHAR_FEMALE;
|
||||
else
|
||||
text[i++] = CHAR_MALE;
|
||||
text[i++] = CHAR_HYPHEN;
|
||||
}
|
||||
|
||||
@ -376,18 +382,18 @@ static void UpdateBattlerValue(struct PokemonDebugMenu *data)
|
||||
}
|
||||
|
||||
//Sprite functions
|
||||
static const struct CompressedSpritePalette *GetMonSpritePalStructCustom(u16 species, u8 gender, bool8 isShiny)
|
||||
static const struct CompressedSpritePalette *GetMonSpritePalStructCustom(u16 species, bool8 isFemale, bool8 isShiny)
|
||||
{
|
||||
if (isShiny)
|
||||
{
|
||||
if (SpeciesHasGenderDifference[species] && gender == GENDER_FEMALE)
|
||||
if (SpeciesHasGenderDifference[species] && isFemale)
|
||||
return &gMonShinyPaletteTableFemale[species];
|
||||
else
|
||||
return &gMonShinyPaletteTable[species];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SpeciesHasGenderDifference[species] && gender == GENDER_FEMALE)
|
||||
if (SpeciesHasGenderDifference[species] && isFemale)
|
||||
return &gMonPaletteTableFemale[species];
|
||||
else
|
||||
return &gMonPaletteTable[species];
|
||||
@ -643,12 +649,12 @@ void CB2_Debug_Pokemon(void)
|
||||
|
||||
data->InstructionsWindowId = AddWindow(&sDebugPokemonInstructionsTemplate);
|
||||
PutWindowTilemap(data->InstructionsWindowId);
|
||||
PrintInstructionsOnWindow(data->InstructionsWindowId);
|
||||
PrintInstructionsOnWindow(data->InstructionsWindowId, data);
|
||||
|
||||
HandleLoadSpecialPokePicCustom(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[1], species, 0, data->gender);
|
||||
HandleLoadSpecialPokePicCustom(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[1], species, 0, data->isFemale);
|
||||
data->isShiny = FALSE;
|
||||
data->gender = GENDER_MALE;
|
||||
palette = GetMonSpritePalStructCustom(species, data->gender, data->isShiny);
|
||||
data->isFemale = FALSE;
|
||||
palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny);
|
||||
LoadCompressedSpritePalette(palette);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, 1);
|
||||
gMultiuseSpriteTemplate.paletteTag = palette->tag;
|
||||
@ -656,8 +662,8 @@ void CB2_Debug_Pokemon(void)
|
||||
gSprites[data->frontspriteId].callback = SpriteCallbackDummy;
|
||||
gSprites[data->frontspriteId].oam.priority = 0;
|
||||
|
||||
HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->gender);
|
||||
palette = GetMonSpritePalStructCustom(species, data->gender, data->isShiny);
|
||||
HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->isFemale);
|
||||
palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny);
|
||||
LoadCompressedSpritePalette(palette);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, 2);
|
||||
gMultiuseSpriteTemplate.paletteTag = palette->tag;
|
||||
@ -668,7 +674,7 @@ void CB2_Debug_Pokemon(void)
|
||||
gSprites[data->backspriteId].oam.priority = 0;
|
||||
|
||||
//Icon Sprite
|
||||
data->iconspriteId = CreateMonIcon(species, SpriteCB_MonIcon, DEBUG_ICON_X + 32, DEBUG_ICON_Y + 40, 4, data->isShiny);
|
||||
data->iconspriteId = CreateMonIconCustom(species, SpriteCB_MonIcon, DEBUG_ICON_X + 32, DEBUG_ICON_Y + 40, 4, data->isShiny, data->isFemale, data->isShiny);
|
||||
gSprites[data->iconspriteId].oam.priority = 0;
|
||||
|
||||
//Modify Arrows
|
||||
@ -780,10 +786,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
|
||||
}
|
||||
else if (JOY_NEW(SELECT_BUTTON) && SpeciesHasGenderDifference[data->currentmonId])
|
||||
{
|
||||
if (data->gender == GENDER_MALE)
|
||||
data->gender = GENDER_FEMALE;
|
||||
else
|
||||
data->gender = GENDER_MALE;
|
||||
data->isFemale = !data->isFemale;
|
||||
PrintDigitChars(data);
|
||||
UpdateBattlerValue(data);
|
||||
ReloadPokemonSprites(data);
|
||||
@ -793,7 +796,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
|
||||
{
|
||||
if (TryMoveDigit(&data->modifyArrows, FALSE))
|
||||
{
|
||||
data->gender = GENDER_MALE;
|
||||
data->isFemale = FALSE;
|
||||
PrintDigitChars(data);
|
||||
UpdateBattlerValue(data);
|
||||
ReloadPokemonSprites(data);
|
||||
@ -807,7 +810,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
|
||||
{
|
||||
if (TryMoveDigit(&data->modifyArrows, TRUE))
|
||||
{
|
||||
data->gender = GENDER_MALE;
|
||||
data->isFemale = FALSE;
|
||||
PrintDigitChars(data);
|
||||
UpdateBattlerValue(data);
|
||||
ReloadPokemonSprites(data);
|
||||
@ -859,8 +862,10 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
|
||||
|
||||
LoadMonIconPalettes();
|
||||
|
||||
HandleLoadSpecialPokePicCustom(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[1], species, 0, data->gender);
|
||||
palette = GetMonSpritePalStructCustom(species, data->gender, data->isShiny);
|
||||
PrintInstructionsOnWindow(data->InstructionsWindowId, data);
|
||||
|
||||
HandleLoadSpecialPokePicCustom(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[1], species, 0, data->isFemale);
|
||||
palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny);
|
||||
LoadCompressedSpritePalette(palette);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, 1);
|
||||
gMultiuseSpriteTemplate.paletteTag = palette->tag;
|
||||
@ -868,8 +873,8 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
|
||||
gSprites[data->frontspriteId].callback = SpriteCallbackDummy;
|
||||
gSprites[data->frontspriteId].oam.priority = 0;
|
||||
|
||||
HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->gender);
|
||||
palette = GetMonSpritePalStructCustom(species, data->gender, data->isShiny);
|
||||
HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->isFemale);
|
||||
palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny);
|
||||
LoadCompressedSpritePalette(palette);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, 2);
|
||||
gMultiuseSpriteTemplate.paletteTag = palette->tag;
|
||||
@ -880,7 +885,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
|
||||
gSprites[data->backspriteId].oam.priority = 0;
|
||||
|
||||
//Icon Sprite
|
||||
data->iconspriteId = CreateMonIcon(species, SpriteCB_MonIcon, DEBUG_ICON_X + 32, DEBUG_ICON_Y + 40, 4, data->isShiny);
|
||||
data->iconspriteId = CreateMonIconCustom(species, SpriteCB_MonIcon, DEBUG_ICON_X + 32, DEBUG_ICON_Y + 40, 4, data->isShiny, data->isFemale, data->isShiny);
|
||||
gSprites[data->iconspriteId].oam.priority = 0;
|
||||
|
||||
//Modify Arrows
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "graphics.h"
|
||||
#include "mail.h"
|
||||
#include "palette.h"
|
||||
#include "pokemon_debug.h"
|
||||
#include "pokemon_icon.h"
|
||||
#include "sprite.h"
|
||||
#include "data.h"
|
||||
@ -22,6 +23,10 @@ struct MonIconSpriteTemplate
|
||||
|
||||
// static functions
|
||||
static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8);
|
||||
#ifdef POKEMON_DEBUG
|
||||
static const u8 *GetMonIconPtrCustom(u16 species, u32 personality, bool8 isFemale);
|
||||
static const u8* GetMonIconTilesCustom(u16 species, bool8 isFemale);
|
||||
#endif
|
||||
|
||||
// .rodata
|
||||
|
||||
@ -2575,6 +2580,33 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u
|
||||
return spriteId;
|
||||
}
|
||||
|
||||
#ifdef POKEMON_DEBUG
|
||||
u8 CreateMonIconCustom(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool8 isFemale, bool8 isShiny)
|
||||
{
|
||||
u8 spriteId;
|
||||
struct MonIconSpriteTemplate iconTemplate =
|
||||
{
|
||||
.oam = &sMonIconOamData,
|
||||
.image = GetMonIconPtrCustom(species, personality, isFemale),
|
||||
.anims = sMonIconAnims,
|
||||
.affineAnims = sMonIconAffineAnims,
|
||||
.callback = callback,
|
||||
.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndices[species],
|
||||
};
|
||||
|
||||
if (species > NUM_SPECIES)
|
||||
iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG;
|
||||
else if (SpeciesHasGenderDifference[species] && isFemale)
|
||||
iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndicesFemale[species];
|
||||
|
||||
spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority);
|
||||
|
||||
UpdateMonIconFrame(&gSprites[spriteId]);
|
||||
|
||||
return spriteId;
|
||||
}
|
||||
#endif
|
||||
|
||||
u8 CreateMonIconNoPersonality(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority)
|
||||
{
|
||||
u8 spriteId;
|
||||
@ -2646,6 +2678,13 @@ const u8 *GetMonIconPtr(u16 species, u32 personality)
|
||||
return GetMonIconTiles(GetIconSpecies(species, personality), personality);
|
||||
}
|
||||
|
||||
#ifdef POKEMON_DEBUG
|
||||
static const u8 *GetMonIconPtrCustom(u16 species, u32 personality, bool8 isFemale)
|
||||
{
|
||||
return GetMonIconTilesCustom(GetIconSpecies(species, personality), isFemale);
|
||||
}
|
||||
#endif
|
||||
|
||||
void FreeAndDestroyMonIconSprite(struct Sprite *sprite)
|
||||
{
|
||||
sub_80D328C(sprite);
|
||||
@ -2715,6 +2754,18 @@ const u8* GetMonIconTiles(u16 species, u32 personality)
|
||||
return iconSprite;
|
||||
}
|
||||
|
||||
#ifdef POKEMON_DEBUG
|
||||
static const u8* GetMonIconTilesCustom(u16 species, bool8 isFemale)
|
||||
{
|
||||
const u8* iconSprite = gMonIconTable[species];
|
||||
if (SpeciesHasGenderDifference[species] && isFemale)
|
||||
{
|
||||
iconSprite = gMonIconTableFemale[species];
|
||||
}
|
||||
return iconSprite;
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_80D304C(u16 offset)
|
||||
{
|
||||
s32 i;
|
||||
|
Loading…
Reference in New Issue
Block a user