diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/berry_blender.c | 2 | ||||
-rw-r--r-- | src/lilycove_lady.c | 2 | ||||
-rw-r--r-- | src/pokeblock.c | 200 | ||||
-rw-r--r-- | src/pokeblock_feed.c | 10 | ||||
-rw-r--r-- | src/pokemon_3.c | 12 | ||||
-rw-r--r-- | src/safari_zone.c | 2 |
6 files changed, 212 insertions, 16 deletions
diff --git a/src/berry_blender.c b/src/berry_blender.c index 7c90391fa..aed7814d8 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -132,8 +132,6 @@ extern u8 gInGameOpponentsNo; extern u8 gUnknown_020322D5; extern u8 gResultsWindowId; -extern const u8 * const gPokeblockNames[]; - // graphics extern const u8 gBerryBlenderArrowTiles[]; extern const u8 gBerryBlenderStartTiles[]; diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c index e18733e37..a85cf8945 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -1079,7 +1079,7 @@ void sub_818E914(void) void sub_818E92C(void) { - sub_81357FC(3, c2_exit_to_overworld_2_switch); + OpenPokeblockCase(3, c2_exit_to_overworld_2_switch); } void sub_818E940(void) diff --git a/src/pokeblock.c b/src/pokeblock.c index 023b7c3e7..4c8a9504f 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -1,4 +1,204 @@ #include "global.h" #include "pokeblock.h" +#include "bg.h" +#include "strings.h" +#include "text.h" +#include "menu.h" +#include "task.h" +#include "menu_helpers.h" +#include "pokemon.h" +#include "graphics.h" +enum +{ + PKBL_USE_ON_FIELD, + PKBL_TOSS, + PKBL_CANCEL, + PKBL_USE_IN_BATTLE, + PKBL_USE_ON_FEEDER, + PKBL_GIVE_TO_LADY +}; +// this file's functions +void PokeblockAction_UseOnField(u8 taskId); +void PokeblockAction_Toss(u8 taskId); +void PokeblockAction_Cancel(u8 taskId); +void PokeblockAction_UseInBattle(u8 taskId); +void PokeblockAction_UseOnPokeblockFeeder(u8 taskId); +void PokeblockAction_GiveToContestLady(u8 taskId); +void TossPokeblockChoice_Yes(u8 taskId); +void TossPokeblockChoice_No(u8 taskId); + +// const rom data +const s8 gPokeblockFlavorCompatibilityTable[] = +{ + // Cool, Beauty, Cute, Smart, Tough + 0, 0, 0, 0, 0, // Hardy + 1, 0, 0, 0, -1, // Lonely + 1, 0, -1, 0, 0, // Brave + 1, -1, 0, 0, 0, // Adamant + 1, 0, 0, -1, 0, // Naughty + -1, 0, 0, 0, 1, // Bold + 0, 0, 0, 0, 0, // Docile + 0, 0, -1, 0, 1, // Relaxed + 0, -1, 0, 0, 1, // Impish + 0, 0, 0, -1, 1, // Lax + -1, 0, 1, 0, 0, // Timid + 0, 0, 1, 0, -1, // Hasty + 0, 0, 0, 0, 0, // Serious + 0, -1, 1, 0, 0, // Jolly + 0, 0, 1, -1, 0, // Naive + -1, 1, 0, 0, 0, // Modest + 0, 1, 0, 0, -1, // Mild + 0, 1, -1, 0, 0, // Quiet + 0, 0, 0, 0, 0, // Bashful + 0, 1, 0, -1, 0, // Rash + -1, 0, 0, 1, 0, // Calm + 0, 0, 0, 1, -1, // Gentle + 0, 0, -1, 1, 0, // Sassy + 0, -1, 0, 1, 0, // Careful + 0, 0, 0, 0, 0 // Quirky +}; + +const struct BgTemplate gUnknown_085B2620[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 3, + .mapBaseIndex = 29, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + } +}; + +const u8 *const gPokeblockNames[] = +{ + NULL, + gText_RedPokeblock, + gText_BluePokeblock, + gText_PinkPokeblock, + gText_GreenPokeblock, + gText_YellowPokeblock, + gText_PurplePokeblock, + gText_IndigoPokeblock, + gText_BrownPokeblock, + gText_LiteBluePokeblock, + gText_OlivePokeblock, + gText_GrayPokeblock, + gText_BlackPokeblock, + gText_WhitePokeblock, + gText_GoldPokeblock +}; + +const struct MenuAction sPokeblockMenuActions[] = +{ + {gMenuText_Use, PokeblockAction_UseOnField}, + {gMenuText_Toss, PokeblockAction_Toss}, + {gText_Cancel2, PokeblockAction_Cancel}, + {gMenuText_Use, PokeblockAction_UseInBattle}, + {gMenuText_Use, PokeblockAction_UseOnPokeblockFeeder}, + {gMenuText_Give2, PokeblockAction_GiveToContestLady}, +}; + +const u8 sActionsOnField[] = {PKBL_USE_ON_FIELD, PKBL_TOSS, PKBL_CANCEL}; +const u8 sActionsInBattle[] = {PKBL_USE_IN_BATTLE, PKBL_CANCEL}; +const u8 sActionsOnPokeblockFeeder[] = {PKBL_USE_ON_FEEDER, PKBL_CANCEL}; +const u8 sActionsWhenGivingToLady[] = {PKBL_GIVE_TO_LADY, PKBL_CANCEL}; + +const struct YesNoFuncTable sTossYesNoFuncTable = {TossPokeblockChoice_Yes, TossPokeblockChoice_No}; + +static const u8 sContestStatsMonData[] = {MON_DATA_COOL, MON_DATA_BEAUTY, MON_DATA_CUTE, MON_DATA_SMART, MON_DATA_TOUGH}; + +static const struct OamData sOamData_PokeblockCase = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_PokeblockCase[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_PokeblockCase[] = +{ + sSpriteAnim_PokeblockCase +}; + +static const union AffineAnimCmd gSpriteAffineAnim_85B26C8[] = +{ + AFFINEANIMCMD_FRAME(0, 0, -2, 2), + AFFINEANIMCMD_FRAME(0, 0, 2, 4), + AFFINEANIMCMD_FRAME(0, 0, -2, 4), + AFFINEANIMCMD_FRAME(0, 0, 2, 2), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd *const sSpriteAffineAnimTable_85B26F0[] = +{ + gSpriteAffineAnim_85B26C8 +}; + +const struct CompressedSpriteSheet gPokeblockCase_SpriteSheet = +{ + gMenuPokeblockDevice_Gfx, 0x800, GFX_TAG_POKEBLOCK_CASE +}; + +const struct CompressedSpritePalette gPokeblockCase_SpritePal = +{ + gMenuPokeblockDevice_Pal, GFX_TAG_POKEBLOCK_CASE +}; + +const struct SpriteTemplate sSpriteTemplate_PokeblockCase = +{ + GFX_TAG_POKEBLOCK_CASE, + GFX_TAG_POKEBLOCK_CASE, + &sOamData_PokeblockCase, + sSpriteAnimTable_PokeblockCase, + NULL, + gDummySpriteAffineAnimTable, + SpriteCallbackDummy +}; + +const struct TextColor sTextColorInPokeblockMenu = {0, 2, 3}; + +const struct Pokeblock sFavoritePokeblocksTable[] = +{ + { PBLOCK_CLR_RED, 20, 0, 0, 0, 0, 20}, + { PBLOCK_CLR_BLUE, 0, 20, 0, 0, 0, 20}, + { PBLOCK_CLR_PINK, 0, 0, 20, 0, 0, 20}, + { PBLOCK_CLR_GREEN, 0, 0, 0, 20, 0, 20}, + { PBLOCK_CLR_YELLOW, 0, 0, 0, 0, 20, 20} +}; diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index 58a8667fd..ec5f3074f 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -56,8 +56,6 @@ extern struct SpriteTemplate gUnknown_0202499C; extern const u8 gBattleTerrainPalette_Frontier[]; extern const u8 gBattleTerrainTiles_Building[]; extern const u8 gUnknown_08D9BA44[]; -extern const struct CompressedSpriteSheet gPokeblockCase_SpriteSheet; -extern const struct CompressedSpritePalette gPokeblockCase_SpritePal; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; extern const u16 gUnknown_0860F074[]; @@ -508,13 +506,13 @@ static const union AffineAnimCmd *const sThrownPokeblockAffineAnimTable[] = static const struct CompressedSpriteSheet sPokeblock_SpriteSheet = { - gPokeblock_Gfx, 0x20, TAG_POKEBLOCK_GFX + gPokeblock_Gfx, 0x20, GFX_TAG_POKEBLOCK }; static const struct SpriteTemplate sThrownPokeblockSpriteTemplate = { - .tileTag = TAG_POKEBLOCK_GFX, - .paletteTag = TAG_POKEBLOCK_GFX, + .tileTag = GFX_TAG_POKEBLOCK, + .paletteTag = GFX_TAG_POKEBLOCK, .oam = &sThrownPokeblockOamData, .anims = sThrownPokeblockAnimTable, .images = NULL, @@ -721,7 +719,7 @@ static void SetPokeblockSpritePal(u8 pokeblockCaseId) { u8 colorId = GetPokeblockData(&gSaveBlock1Ptr->pokeblocks[pokeblockCaseId], PBLOCK_COLOR); sPokeblockSpritePal.data = sPokeblocksPals[colorId - 1]; - sPokeblockSpritePal.tag = TAG_POKEBLOCK_GFX; + sPokeblockSpritePal.tag = GFX_TAG_POKEBLOCK; } // defines for task data fields diff --git a/src/pokemon_3.c b/src/pokemon_3.c index b89b00e8e..634923777 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -22,6 +22,7 @@ #include "abilities.h" #include "pokemon_animation.h" #include "pokedex.h" +#include "pokeblock.h" extern struct BattlePokemon gBattleMons[4]; extern struct BattleEnigmaBerry gEnigmaBerries[4]; @@ -59,7 +60,6 @@ extern const u8 gText_PkmnsXPreventsSwitching[]; extern const struct CompressedSpritePalette gMonPaletteTable[]; extern const struct CompressedSpritePalette gMonShinyPaletteTable[]; extern const u16 gHMMoves[]; -extern const s8 gPokeblockFlavorCompatibilityTable[]; extern const u8 gMonAnimationDelayTable[]; extern const u8 gMonFrontAnimIdsTable[]; @@ -1297,21 +1297,21 @@ bool8 IsPokeSpriteNotFlipped(u16 species) return gBaseStats[species].noFlip; } -s8 GetMonFlavorRelation(struct Pokemon *mon, u8 a2) +s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavour) { u8 nature = GetNature(mon); - return gPokeblockFlavorCompatibilityTable[nature * 5 + a2]; + return gPokeblockFlavorCompatibilityTable[nature * 5 + flavour]; } -s8 GetFlavorRelationByPersonality(u32 personality, u8 a2) +s8 GetFlavorRelationByPersonality(u32 personality, u8 flavour) { u8 nature = GetNatureFromPersonality(personality); - return gPokeblockFlavorCompatibilityTable[nature * 5 + a2]; + return gPokeblockFlavorCompatibilityTable[nature * 5 + flavour]; } bool8 IsTradedMon(struct Pokemon *mon) { - u8 otName[8]; + u8 otName[OT_NAME_LENGTH + 1]; u32 otId; GetMonData(mon, MON_DATA_OT_NAME, otName); otId = GetMonData(mon, MON_DATA_OT_ID, 0); diff --git a/src/safari_zone.c b/src/safari_zone.c index d3d40af28..53027b57e 100644 --- a/src/safari_zone.c +++ b/src/safari_zone.c @@ -5,6 +5,7 @@ #include "main.h" #include "battle.h" #include "string_util.h" +#include "pokeblock.h" struct PokeblockFeeder { @@ -24,7 +25,6 @@ extern u8 EventScript_2A4B8A[]; extern u8 EventScript_2A4B6F[]; extern u8 EventScript_2A4B4C[]; extern u8 EventScript_2A4B9B[]; -extern const u8* const gPokeblockNames[]; extern void sub_80EE44C(u8, u8); extern void IncrementGameStat(u8 index); |