merge with master

This commit is contained in:
DizzyEggg 2022-08-25 22:10:59 +02:00
commit 622a7f8141
44 changed files with 430 additions and 425 deletions

View File

@ -7257,6 +7257,10 @@ BattleScript_SelectingNotAllowedStuffCheeks::
printselectionstring STRINGID_STUFFCHEEKSCANTSELECT
endselectionscript
BattleScript_SelectingNotAllowedStuffCheeksInPalace::
printstring STRINGID_STUFFCHEEKSCANTSELECT
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_SelectingNotAllowedBelch::
printselectionstring STRINGID_BELCHCANTSELECT
endselectionscript
@ -9197,14 +9201,34 @@ BattleScript_SelectingNotAllowedMoveChoiceItem::
printselectionstring STRINGID_ITEMALLOWSONLYYMOVE
endselectionscript
BattleScript_SelectingNotAllowedMoveChoiceItemInPalace::
printstring STRINGID_ITEMALLOWSONLYYMOVE
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_SelectingNotAllowedMoveGorillaTactics::
printselectionstring STRINGID_ABILITYALLOWSONLYMOVE
endselectionscript
BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace::
printstring STRINGID_ABILITYALLOWSONLYMOVE
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_SelectingNotAllowedMoveAssaultVest::
printselectionstring STRINGID_ASSAULTVESTDOESNTALLOW
endselectionscript
BattleScript_SelectingNotAllowedMoveAssaultVestInPalace::
printstring STRINGID_ASSAULTVESTDOESNTALLOW
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_SelectingNotAllowedPlaceholder::
printselectionstring STRINGID_NOTDONEYET
endselectionscript
BattleScript_SelectingNotAllowedPlaceholderInPalace::
printstring STRINGID_NOTDONEYET
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_HangedOnMsg::
playanimation BS_TARGET, B_ANIM_HANGED_ON
printstring STRINGID_PKMNHUNGONWITHX

View File

@ -73,6 +73,7 @@ enum
HEALTHBOX_SAFARI_BALLS_TEXT
};
u32 WhichBattleCoords(u32 battlerId);
u8 GetMegaIndicatorSpriteId(u32 healthboxSpriteId);
u8 CreateBattlerHealthboxSprites(u8 battler);
u8 CreateSafariPlayerHealthboxSprites(void);

View File

@ -210,6 +210,7 @@ extern const u8 BattleScript_BerryPPHealEnd2[];
extern const u8 BattleScript_ItemHealHP_End2[];
extern const u8 BattleScript_ItemHealHP_Ret[];
extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItem[];
extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItemInPalace[];
extern const u8 BattleScript_HangedOnMsg[];
extern const u8 BattleScript_BerryConfuseHealEnd2[];
extern const u8 BattleScript_BerryConfuseHealRet[];
@ -275,6 +276,9 @@ extern const u8 BattleScript_SnowWarningActivates[];
extern const u8 BattleScript_HarvestActivates[];
extern const u8 BattleScript_ImposterActivates[];
extern const u8 BattleScript_SelectingNotAllowedMoveAssaultVest[];
extern const u8 BattleScript_SelectingNotAllowedMoveAssaultVestInPalace[];
extern const u8 BattleScript_SelectingNotAllowedPlaceholder[];
extern const u8 BattleScript_SelectingNotAllowedPlaceholderInPalace[];
extern const u8 BattleScript_SelectingNotAllowedMoveGravity[];
extern const u8 BattleScript_MoveUsedGravityPrevents[];
extern const u8 BattleScript_SelectingNotAllowedMoveGravityInPalace[];
@ -301,6 +305,7 @@ extern const u8 BattleScript_DazzlingProtected[];
extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[];
extern const u8 BattleScript_MoveUsedPowder[];
extern const u8 BattleScript_SelectingNotAllowedStuffCheeks[];
extern const u8 BattleScript_SelectingNotAllowedStuffCheeksInPalace[];
extern const u8 BattleScript_SelectingNotAllowedBelch[];
extern const u8 BattleScript_SelectingNotAllowedBelchInPalace[];
extern const u8 BattleScript_PsychicSurgeActivates[];
@ -405,6 +410,7 @@ extern const u8 BattleScript_BlockedByPrimalWeatherRet[];
extern const u8 BattleScript_PrimalReversion[];
extern const u8 BattleScript_HyperspaceFuryRemoveProtect[];
extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[];
extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace[];
extern const u8 BattleScript_WanderingSpiritActivates[];
extern const u8 BattleScript_MirrorArmorReflect[];
extern const u8 BattleScript_GooeyActivates[];

View File

@ -7,7 +7,17 @@
#define MOVE_LIMITATION_TORMENTED (1 << 3)
#define MOVE_LIMITATION_TAUNT (1 << 4)
#define MOVE_LIMITATION_IMPRISON (1 << 5)
#define MOVE_LIMITATIONS_ALL 0xFF
#define MOVE_LIMITATION_ENCORE (1 << 6)
#define MOVE_LIMITATION_CHOICE_ITEM (1 << 7)
#define MOVE_LIMITATION_ASSAULT_VEST (1 << 8)
#define MOVE_LIMITATION_GRAVITY (1 << 9)
#define MOVE_LIMITATION_HEAL_BLOCK (1 << 10)
#define MOVE_LIMITATION_BELCH (1 << 11)
#define MOVE_LIMITATION_THROAT_CHOP (1 << 12)
#define MOVE_LIMITATION_STUFF_CHEEKS (1 << 13)
#define MOVE_LIMITATION_PLACEHOLDER (1 << 15)
#define MOVE_LIMITATIONS_ALL 0xFFFF
#define ABILITYEFFECT_ON_SWITCHIN 0
#define ABILITYEFFECT_ENDTURN 1
@ -89,7 +99,7 @@ void BattleScriptPush(const u8 *bsPtr);
void BattleScriptPushCursor(void);
void BattleScriptPop(void);
u8 TrySetCantSelectMoveBattleScript(void);
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check);
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check);
bool8 AreAllMovesUnusable(void);
u8 GetImprisonedMovesCount(u8 battlerId, u16 move);
u8 DoFieldEndTurnEffects(void);

View File

@ -36,4 +36,12 @@
#endif
#endif
// Compatibility definition for other projects to detect pokeemerald-expansion
#define RHH_EXPANSION
// Legacy branch-based defines included for backwards compatibility
#define BATTLE_ENGINE
#define POKEMON_EXPANSION
#define ITEM_EXPANSION
#endif // GUARD_CONFIG_H

View File

@ -81,7 +81,7 @@
#define WILD_DOUBLE_BATTLE ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER))))
#define BATTLE_TWO_VS_ONE_OPPONENT ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gTrainerBattleOpponent_B == 0xFFFF))
#define BATTLE_TYPE_HAS_AI (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI | BATTLE_TYPE_ROAMER)
#define BATTLE_TYPE_HAS_AI (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI | BATTLE_TYPE_ROAMER | BATTLE_TYPE_INGAME_PARTNER)
// Battle Outcome defines

View File

@ -1,8 +1,6 @@
#ifndef GUARD_CONSTANTS_BATTLE_CONFIG_H
#define GUARD_CONSTANTS_BATTLE_CONFIG_H
#include "constants/expansion_branches.h"
#ifndef GEN_3
#define GEN_3 0
#define GEN_4 1

View File

@ -1,12 +0,0 @@
#ifndef GUARD_CONSTANTS_EXPANSION_BRANCHES_H
#define GUARD_CONSTANTS_EXPANSION_BRANCHES_H
// Branch defines: Used by other branches to detect each other.
// Each define must be here for each of RHH's branch you have pulled.
// e.g. If you have both the battle_engine and pokemon_expansion branch,
// then both BATTLE_ENGINE and POKEMON_EXPANSION must be defined here.
#define BATTLE_ENGINE
#define POKEMON_EXPANSION
#define ITEM_EXPANSION
#endif

View File

@ -1,8 +1,6 @@
#ifndef GUARD_CONSTANTS_ITEM_CONFIG_H
#define GUARD_CONSTANTS_ITEM_CONFIG_H
#include "constants/expansion_branches.h"
#ifndef GEN_3
#define GEN_3 0
#define GEN_4 1

View File

@ -1,8 +1,6 @@
#ifndef GUARD_CONSTANTS_POKEMON_CONFIG_H
#define GUARD_CONSTANTS_POKEMON_CONFIG_H
#include "constants/expansion_branches.h"
#ifndef GEN_3
#define GEN_3 0
#define GEN_4 1
@ -14,7 +12,7 @@
#define P_UPDATED_TYPES GEN_8 // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type.
#define P_UPDATED_STATS GEN_8 // Since Gen 6, Pokémon stats are updated with each passing generation.
#define P_UPDATED_ABILITIES GEN_8 // Since Gen 6, certain Pokémon have their abilities changed. Requires BATTLE_ENGINE for Gen4+ abilities.
#define P_UPDATED_ABILITIES GEN_8 // Since Gen 6, certain Pokémon have their abilities changed.
#define P_UPDATED_EGG_GROUPS GEN_8 // Since Gen 8, certain Pokémon have gained new egg groups.
#define P_SHEDINJA_BALL GEN_8 // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball.
#define P_LEGENDARY_PERFECT_IVS GEN_8 // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs.

View File

@ -19,10 +19,9 @@ bool8 LoadCompressedSpritePaletteUsingHeap(const struct CompressedSpritePalette
void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void *buffer, s32 species);
void DecompressPicFromTableGender(void* buffer, s32 species, u32 personality);
void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality);
void HandleLoadSpecialPokePicCustom(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFemale);
void HandleLoadSpecialPokePic(bool32 isFrontPic, void *dest, s32 species, u32 personality);
void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic);
void LoadSpecialPokePic(void *dest, s32 species, u32 personality, bool8 isFrontPic);
u32 GetDecompressedDataSize(const u32 *ptr);

View File

@ -15,7 +15,6 @@
#include "constants/pokemon.h"
#include "constants/easy_chat.h"
#include "constants/trainer_hill.h"
#include "constants/expansion_branches.h"
// Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm("");

View File

@ -558,5 +558,6 @@ u8 GetFormIdFromFormSpeciesId(u16 formSpeciesId);
u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg);
u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg);
u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove);
bool32 ShouldShowFemaleDifferences(u16 species, u32 personality);
#endif // GUARD_POKEMON_H

View File

@ -21,7 +21,6 @@ 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 SpriteCB_MonIcon(struct Sprite *sprite);

View File

@ -6,6 +6,7 @@
extern u8 gLastViewedMonIndex;
extern const u8 *const gMoveDescriptionPointers[];
extern const u8 gNotDoneYetDescription[];
extern const u8 *const gNatureNamePointers[];
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void));

View File

@ -245,7 +245,7 @@ static void SetBattlerAiData(u8 battlerId)
AI_DATA->holdEffectParams[battlerId] = GetBattlerHoldEffectParam(battlerId);
AI_DATA->predictedMoves[battlerId] = gLastMoves[battlerId];
AI_DATA->hpPercents[battlerId] = GetHealthPercentage(battlerId);
AI_DATA->moveLimitations[battlerId] = CheckMoveLimitations(battlerId, 0, 0xFF);
AI_DATA->moveLimitations[battlerId] = CheckMoveLimitations(battlerId, 0, MOVE_LIMITATIONS_ALL);
}
void GetAiLogicData(void)
@ -2512,6 +2512,8 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
if (gBattleMons[battlerAtk].hp <= gBattleMons[battlerAtk].maxHP / 3)
score -= 10;
break;*/
case EFFECT_PLACEHOLDER:
return 0; // cannot even select
} // move effect checks
if (score < 0)

View File

@ -154,7 +154,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
return FALSE;
if (gLastLandedMoves[gActiveBattler] == MOVE_UNAVAILABLE)
return FALSE;
if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0)
if (IS_MOVE_STATUS(gLastLandedMoves[gActiveBattler]))
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
@ -245,8 +245,7 @@ static bool8 ShouldSwitchIfNaturalCure(void)
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
return TRUE;
}
else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0
&& Random() & 1)
else if (IS_MOVE_STATUS(gLastLandedMoves[gActiveBattler]) && Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
@ -350,7 +349,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent)
return FALSE;
if (gLastHitBy[gActiveBattler] == 0xFF)
return FALSE;
if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0)
if (IS_MOVE_STATUS(gLastLandedMoves[gActiveBattler]))
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "battle.h"
#include "battle_anim.h"
#include "battle_interface.h"
#include "bg.h"
#include "contest.h"
#include "data.h"
@ -134,10 +135,10 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType)
{
case BATTLER_COORD_X:
case BATTLER_COORD_X_2:
retVal = sBattlerCoords[IS_DOUBLE_BATTLE()][GetBattlerPosition(battlerId)].x;
retVal = sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].x;
break;
case BATTLER_COORD_Y:
retVal = sBattlerCoords[IS_DOUBLE_BATTLE()][GetBattlerPosition(battlerId)].y;
retVal = sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].y;
break;
case BATTLER_COORD_Y_PIC_OFFSET:
case BATTLER_COORD_Y_PIC_OFFSET_DEFAULT:
@ -278,7 +279,7 @@ u8 GetBattlerSpriteFinal_Y(u8 battlerId, u16 species, bool8 a3)
offset = GetBattlerYDelta(battlerId, species);
offset -= GetBattlerElevation(battlerId, species);
}
y = offset + sBattlerCoords[IS_DOUBLE_BATTLE()][GetBattlerPosition(battlerId)].y;
y = offset + sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].y;
if (a3)
{
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
@ -2149,8 +2150,7 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16
if (!isBackpic)
{
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20);
LoadSpecialPokePic(&gMonFrontPicTable[species],
gMonSpritesGfxPtr->buffer,
LoadSpecialPokePic(gMonSpritesGfxPtr->buffer,
species,
personality,
TRUE);
@ -2158,8 +2158,7 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16
else
{
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20);
LoadSpecialPokePic(&gMonBackPicTable[species],
gMonSpritesGfxPtr->buffer,
LoadSpecialPokePic(gMonSpritesGfxPtr->buffer,
species,
personality,
FALSE);

View File

@ -2747,7 +2747,7 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode)
int i = 0;
int typePower = TYPE_x1;
if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || gBattleMoves[move].power == 0)
if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || IS_MOVE_STATUS(move))
return 0;
defType1 = gBaseStats[targetSpecies].type1;

View File

@ -282,7 +282,7 @@ static u8 GetBattlePalaceMoveGroup(u8 battlerId, u16 move)
case MOVE_TARGET_RANDOM:
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
if (gBattleMoves[move].power == 0)
if (IS_MOVE_STATUS(move))
return PALACE_MOVE_GROUP_SUPPORT;
else
return PALACE_MOVE_GROUP_ATTACK;
@ -578,13 +578,13 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
position = GetBattlerPosition(battlerId);
if (opponent)
{
HandleLoadSpecialPokePic(&gMonFrontPicTable[species],
HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[position],
species, currentPersonality);
}
else
{
HandleLoadSpecialPokePic(&gMonBackPicTable[species],
HandleLoadSpecialPokePic(FALSE,
gMonSpritesGfxPtr->sprites.ptr[position],
species, currentPersonality);
}
@ -715,7 +715,12 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
else
{
if (state == 2)
{
if (WhichBattleCoords(0))
LoadCompressedSpriteSheet(&sSpriteSheets_DoublesPlayerHealthbox[0]);
else
LoadCompressedSpriteSheet(&sSpriteSheet_SinglesPlayerHealthbox);
}
else if (state == 3)
LoadCompressedSpriteSheet(&sSpriteSheets_DoublesPlayerHealthbox[1]);
else if (state == 4)
@ -860,7 +865,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform, bo
personalityValue = gContestResources->moveAnim->personality;
otId = gContestResources->moveAnim->otId;
HandleLoadSpecialPokePic(&gMonBackPicTable[targetSpecies],
HandleLoadSpecialPokePic(FALSE,
gMonSpritesGfxPtr->sprites.ptr[position],
targetSpecies,
gContestResources->moveAnim->targetPersonality);
@ -879,7 +884,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform, bo
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
HandleLoadSpecialPokePic(&gMonBackPicTable[targetSpecies],
HandleLoadSpecialPokePic(FALSE,
gMonSpritesGfxPtr->sprites.ptr[position],
targetSpecies,
gTransformedPersonalities[battlerAtk]);
@ -889,7 +894,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform, bo
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
HandleLoadSpecialPokePic(&gMonFrontPicTable[targetSpecies],
HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[position],
targetSpecies,
gTransformedPersonalities[battlerAtk]);

View File

@ -764,6 +764,15 @@ static void InitLastUsedBallAssets(void)
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
}
// This function is here to cover a specific case - one player's mon in a 2 vs 1 double battle. In this scenario - display singles layout.
u32 WhichBattleCoords(u32 battlerId) // 0 - singles, 1 - doubles
{
if (GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT && gPlayerPartyCount == 1)
return 0;
else
return IsDoubleBattle();
}
u8 CreateBattlerHealthboxSprites(u8 battlerId)
{
s16 data6 = 0;
@ -771,7 +780,7 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId)
u8 healthbarSpriteId, megaIndicatorSpriteId;
struct Sprite *healthBarSpritePtr;
if (!IsDoubleBattle())
if (WhichBattleCoords(battlerId) == 0) // Singles
{
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
{
@ -1035,7 +1044,7 @@ void GetBattlerHealthboxCoords(u8 battler, s16 *x, s16 *y)
{
*x = 0, *y = 0;
if (!IsDoubleBattle())
if (!WhichBattleCoords(battler))
{
if (GetBattlerSide(battler) != B_SIDE_PLAYER)
*x = 44, *y = 30;
@ -1102,7 +1111,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl)
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
{
objVram = (void *)(OBJ_VRAM0);
if (!IsDoubleBattle())
if (!WhichBattleCoords(battler))
objVram += spriteTileNum + 0x820;
else
objVram += spriteTileNum + 0x420;
@ -1219,13 +1228,14 @@ static void UpdateOpponentHpTextSingles(u32 healthboxSpriteId, s16 value, u32 ma
void UpdateHpTextInHealthbox(u32 healthboxSpriteId, u32 maxOrCurrent, s16 currHp, s16 maxHp)
{
if (IsDoubleBattle())
u32 battlerId = gSprites[healthboxSpriteId].hMain_Battler;
if (WhichBattleCoords(battlerId))
{
UpdateHpTextInHealthboxInDoubles(healthboxSpriteId, maxOrCurrent, currHp, maxHp);
}
else // Single Battle
{
if (GetBattlerSide(gSprites[healthboxSpriteId].hMain_Battler) == B_SIDE_PLAYER) // Player
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) // Player
{
PrintHpOnHealthbox(healthboxSpriteId, currHp, maxHp, 2, 0xB00, 0x3A0);
}
@ -1334,7 +1344,7 @@ void SwapHpBarsWithHpText(void)
{
if (gSprites[gHealthboxSpriteIds[i]].callback == SpriteCallbackDummy
&& GetBattlerSide(i) != B_SIDE_OPPONENT
&& (IsDoubleBattle() || GetBattlerSide(i) != B_SIDE_PLAYER))
&& (WhichBattleCoords(i) || GetBattlerSide(i) != B_SIDE_PLAYER))
{
s32 currHp = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_HP);
s32 maxHp = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_MAX_HP);
@ -1344,7 +1354,7 @@ void SwapHpBarsWithHpText(void)
noBars = gBattleSpritesDataPtr->battlerData[i].hpNumbersNoBars;
if (GetBattlerSide(i) == B_SIDE_PLAYER)
{
if (!IsDoubleBattle())
if (!WhichBattleCoords(i))
continue;
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
continue;
@ -1638,7 +1648,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
{
isOpponent = TRUE;
if (!skipPlayer || !IsDoubleBattle())
if (!skipPlayer || !WhichBattleCoords(battlerId))
bar_X = 104, bar_Y = 40;
else
bar_X = 104, bar_Y = 16;
@ -2124,7 +2134,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon)
{
TextIntoHealthboxObject((void *)(OBJ_VRAM0 + 0x40 + spriteTileNum), windowTileData, 6);
ptr = (void *)(OBJ_VRAM0);
if (!IsDoubleBattle())
if (!WhichBattleCoords(gSprites[healthboxSpriteId].data[6]))
ptr += spriteTileNum + 0x800;
else
ptr += spriteTileNum + 0x400;
@ -2175,7 +2185,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
{
status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS);
if (!IsDoubleBattle())
if (!WhichBattleCoords(battlerId))
tileNumAdder = 0x1A;
else
tileNumAdder = 0x12;
@ -2231,7 +2241,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2);
CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void *)(OBJ_PLTT + pltAdder * 2), 2);
CpuCopy32(statusGfxPtr, (void *)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * TILE_SIZE_4BPP), 96);
if (IsDoubleBattle() == TRUE || GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
if (WhichBattleCoords(battlerId) == 1 || GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
{
if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)
{
@ -2339,7 +2349,7 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
{
u8 isDoubles = IsDoubleBattle();
u8 isDoubles = WhichBattleCoords(battlerId);
if (elementId == HEALTHBOX_LEVEL || elementId == HEALTHBOX_ALL)
UpdateLvlInHealthbox(healthboxSpriteId, GetMonData(mon, MON_DATA_LEVEL));
@ -2886,7 +2896,7 @@ static void TextIntoAbilityPopUp(void *dest, u8 *windowTileData, s32 arg2, bool3
#define MAX_CHARS_PRINTED 12
static void PrintOnAbilityPopUp(const u8 *str, u8 *spriteTileData1, u8 *spriteTileData2, u32 x1, u32 x2, u32 y, u32 color1, u32 color2, u32 color3)
static void PrintOnAbilityPopUp(const u8 *str, u8 *spriteTileData1, u8 *spriteTileData2, u32 x1, u32 x2, u32 y, u32 color1, u32 color2, u32 color3, bool32 alignAbilityChars)
{
u32 windowId, i;
u8 *windowTileData;
@ -2901,6 +2911,15 @@ static void PrintOnAbilityPopUp(const u8 *str, u8 *spriteTileData1, u8 *spriteTi
}
text1[i] = EOS;
// Because there are two Windows, we need to align the strings, so that the first char in the second window starts right after the last char in the first window.
// Windows are 64 pixels in width.
if (alignAbilityChars && i == MAX_CHARS_PRINTED)
{
u32 width = GetStringWidth(FONT_SMALL, text1, 0);
if (x1 + width < 64)
x1 += 64 - (x1 + width);
}
windowTileData = AddTextPrinterAndCreateWindowOnAbilityPopUp(text1, x1, y, color1, color2, color3, &windowId);
TextIntoAbilityPopUp(spriteTileData1, windowTileData, 8, (y == 0));
RemoveWindow(windowId);
@ -2929,7 +2948,8 @@ static void ClearAbilityName(u8 spriteId1, u8 spriteId2)
(void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32) + 256,
6, 1,
4,
7, 9, 1);
7, 9, 1,
FALSE);
}
static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2)
@ -2966,7 +2986,8 @@ static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2)
(void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32),
7, 0,
0,
2, 7, 1);
2, 7, 1,
FALSE);
}
static void PrintAbilityOnAbilityPopUp(u32 ability, u8 spriteId1, u8 spriteId2)
@ -2974,9 +2995,10 @@ static void PrintAbilityOnAbilityPopUp(u32 ability, u8 spriteId1, u8 spriteId2)
PrintOnAbilityPopUp(gAbilityNames[ability],
(void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32) + 256,
(void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32) + 256,
6, 1,
6, 0,
4,
7, 9, 1);
7, 9, 1,
TRUE);
}
#define PIXEL_COORDS_TO_OFFSET(x, y)( \

View File

@ -3342,7 +3342,7 @@ static void DoBattleIntro(void)
MarkBattlerForControllerExec(gActiveBattler);
}
}
else // wild mon 2
else if (IsBattlerAlive(gActiveBattler)) // wild mon 2 if alive
{
BtlController_EmitLoadMonSprite(BUFFER_A);
MarkBattlerForControllerExec(gActiveBattler);

View File

@ -1345,7 +1345,7 @@ static bool32 TryAegiFormChange(void)
default:
return FALSE;
case SPECIES_AEGISLASH: // Shield -> Blade
if (gBattleMoves[gCurrentMove].power == 0)
if (IS_MOVE_STATUS(gCurrentMove))
return FALSE;
gBattleMons[gBattlerAttacker].species = SPECIES_AEGISLASH_BLADE;
break;
@ -1687,7 +1687,7 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u
&& (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))
moveAcc = 50;
// Check Wonder Skin.
if (defAbility == ABILITY_WONDER_SKIN && gBattleMoves[move].power == 0)
if (defAbility == ABILITY_WONDER_SKIN && IS_MOVE_STATUS(move) && moveAcc > 50)
moveAcc = 50;
calc = gAccuracyStageRatios[buff].dividend * moveAcc;
@ -8395,7 +8395,7 @@ static void Cmd_various(void)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else if (gBattleMoves[gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]].power == 0)
else if (IS_MOVE_STATUS(gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
gBattlescriptCurrInstr += 7;
@ -8493,7 +8493,7 @@ static void Cmd_various(void)
case VARIOUS_TRY_ME_FIRST:
if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else if (gBattleMoves[gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]].power == 0)
else if (IS_MOVE_STATUS(gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
{
@ -10571,19 +10571,20 @@ static void Cmd_setmultihitcounter(void)
}
else if (B_MULTI_HIT_CHANCE >= GEN_5)
{
// 2 and 3 hits: 33.3%
// 4 and 5 hits: 16.7%
gMultiHitCounter = Random() % 4;
if (gMultiHitCounter > 2)
{
gMultiHitCounter = (Random() % 3);
if (gMultiHitCounter < 2)
// Based on Gen 5's odds
// 35% for 2 hits
// 35% for 3 hits
// 15% for 4 hits
// 15% for 5 hits
gMultiHitCounter = Random() % 100;
if (gMultiHitCounter < 35)
gMultiHitCounter = 2;
else
else if (gMultiHitCounter < 35 + 35)
gMultiHitCounter = 3;
}
else if (gMultiHitCounter < 35 + 35 + 15)
gMultiHitCounter = 4;
else
gMultiHitCounter += 3;
gMultiHitCounter = 5;
}
else
{
@ -13451,11 +13452,11 @@ bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move)
bool32 DoesDisguiseBlockMove(u8 battlerAtk, u8 battlerDef, u32 move)
{
if (GetBattlerAbility(battlerDef) != ABILITY_DISGUISE
|| gBattleMons[battlerDef].species != SPECIES_MIMIKYU
if (gBattleMons[battlerDef].species != SPECIES_MIMIKYU
|| gBattleMons[battlerDef].status2 & STATUS2_TRANSFORMED
|| gBattleMoves[move].power == 0
|| gHitMarker & HITMARKER_IGNORE_DISGUISE)
|| IS_MOVE_STATUS(move)
|| gHitMarker & HITMARKER_IGNORE_DISGUISE
|| GetBattlerAbility(battlerDef) != ABILITY_DISGUISE)
return FALSE;
else
return TRUE;
@ -13870,13 +13871,13 @@ static void Cmd_handleballthrow(void)
u8 shakes;
u8 maxShakes;
gBattleSpritesDataPtr->animationData->isCriticalCapture = 0;
gBattleSpritesDataPtr->animationData->criticalCaptureSuccess = 0;
gBattleSpritesDataPtr->animationData->isCriticalCapture = FALSE;
gBattleSpritesDataPtr->animationData->criticalCaptureSuccess = FALSE;
if (CriticalCapture(odds))
{
maxShakes = BALL_1_SHAKE; // critical capture doesn't guarantee capture
gBattleSpritesDataPtr->animationData->isCriticalCapture = 1;
gBattleSpritesDataPtr->animationData->isCriticalCapture = TRUE;
}
else
{
@ -13900,7 +13901,7 @@ static void Cmd_handleballthrow(void)
if (shakes == maxShakes) // mon caught, copy of the code above
{
if (IsCriticalCapture())
gBattleSpritesDataPtr->animationData->criticalCaptureSuccess = 1;
gBattleSpritesDataPtr->animationData->criticalCaptureSuccess = TRUE;
UndoFormChange(gBattlerPartyIndexes[gBattlerTarget], GET_BATTLER_SIDE(gBattlerTarget), FALSE);
gBattlescriptCurrInstr = BattleScript_SuccessBallThrow;

View File

@ -1435,7 +1435,7 @@ static void TrySetBattleSeminarShow(void)
return;
else if (gBattleTypeFlags & (BATTLE_TYPE_PALACE | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID))
return;
else if (gBattleMoves[gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]]].power == 0)
else if (IS_MOVE_STATUS(gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]]))
return;
i = 0;
@ -1496,7 +1496,7 @@ static void TrySetBattleSeminarShow(void)
static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride)
{
if (gBattleMoves[moveId].power == 0)
if (IS_MOVE_STATUS(moveId))
{
*dmg = 0;
return FALSE;

View File

@ -1764,7 +1764,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
}
}
if (!gBattleStruct->zmove.active && gDisableStructs[gActiveBattler].tauntTimer != 0 && gBattleMoves[move].power == 0)
if (!gBattleStruct->zmove.active && gDisableStructs[gActiveBattler].tauntTimer != 0 && IS_MOVE_STATUS(move))
{
gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
@ -1859,7 +1859,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace;
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedStuffCheeksInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
}
else
@ -1876,6 +1876,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gLastUsedItem = gBattleMons[gActiveBattler].item;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveChoiceItemInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
}
else
@ -1884,12 +1885,13 @@ u8 TrySetCantSelectMoveBattleScript(void)
limitations++;
}
}
else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && gBattleMoves[move].power == 0 && move != MOVE_ME_FIRST)
else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && IS_MOVE_STATUS(move) && move != MOVE_ME_FIRST)
{
gCurrentMove = move;
gLastUsedItem = gBattleMons[gActiveBattler].item;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveAssaultVestInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
}
else
@ -1905,6 +1907,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gLastUsedItem = gBattleMons[gActiveBattler].item;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
}
else
@ -1927,10 +1930,24 @@ u8 TrySetCantSelectMoveBattleScript(void)
}
}
if (gBattleMoves[move].effect == EFFECT_PLACEHOLDER)
{
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedPlaceholderInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
}
else
{
gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedPlaceholder;
limitations++;
}
}
return limitations;
}
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check)
{
u8 holdEffect = GetBattlerHoldEffect(battlerId, TRUE);
u16 *choicedMove = &gBattleStruct->choicedMove[battlerId];
@ -1941,49 +1958,52 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
for (i = 0; i < MAX_MON_MOVES; i++)
{
// No move
if (gBattleMons[battlerId].moves[i] == MOVE_NONE && check & MOVE_LIMITATION_ZEROMOVE)
if (check & MOVE_LIMITATION_ZEROMOVE && gBattleMons[battlerId].moves[i] == MOVE_NONE)
unusableMoves |= gBitTable[i];
// No PP
else if (gBattleMons[battlerId].pp[i] == 0 && check & MOVE_LIMITATION_PP)
else if (check & MOVE_LIMITATION_PP && gBattleMons[battlerId].pp[i] == 0)
unusableMoves |= gBitTable[i];
// Placeholder
else if (check & MOVE_LIMITATION_PLACEHOLDER && gBattleMoves[gBattleMons[battlerId].moves[i]].effect == EFFECT_PLACEHOLDER)
unusableMoves |= gBitTable[i];
// Disable
else if (gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove && check & MOVE_LIMITATION_DISABLED)
else if (check & MOVE_LIMITATION_DISABLED && gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove)
unusableMoves |= gBitTable[i];
// Torment
else if (gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].status2 & STATUS2_TORMENT)
else if (check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && gBattleMons[battlerId].status2 & STATUS2_TORMENT)
unusableMoves |= gBitTable[i];
// Taunt
else if (gDisableStructs[battlerId].tauntTimer && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0)
else if (check & MOVE_LIMITATION_TAUNT && gDisableStructs[battlerId].tauntTimer && IS_MOVE_STATUS(gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i];
// Imprison
else if (GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]) && check & MOVE_LIMITATION_IMPRISON)
else if (check & MOVE_LIMITATION_IMPRISON && GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i];
// Encore
else if (gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i])
else if (check & MOVE_LIMITATION_ENCORE && gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i])
unusableMoves |= gBitTable[i];
// Choice Items
else if (HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i])
else if (check & MOVE_LIMITATION_CHOICE_ITEM && HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i])
unusableMoves |= gBitTable[i];
// Assault Vest
else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0 && gBattleMons[battlerId].moves[i] != MOVE_ME_FIRST)
else if (check & MOVE_LIMITATION_ASSAULT_VEST && holdEffect == HOLD_EFFECT_ASSAULT_VEST && IS_MOVE_STATUS(gBattleMons[battlerId].moves[i]) && gBattleMons[battlerId].moves[i] != MOVE_ME_FIRST)
unusableMoves |= gBitTable[i];
// Gravity
else if (IsGravityPreventingMove(gBattleMons[battlerId].moves[i]))
else if (check & MOVE_LIMITATION_GRAVITY && IsGravityPreventingMove(gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i];
// Heal Block
else if (IsHealBlockPreventingMove(battlerId, gBattleMons[battlerId].moves[i]))
else if (check & MOVE_LIMITATION_HEAL_BLOCK && IsHealBlockPreventingMove(battlerId, gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i];
// Belch
else if (IsBelchPreventingMove(battlerId, gBattleMons[battlerId].moves[i]))
else if (check & MOVE_LIMITATION_BELCH && IsBelchPreventingMove(battlerId, gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i];
// Throat Chop
else if (gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].flags & FLAG_SOUND)
else if (check & MOVE_LIMITATION_THROAT_CHOP && gDisableStructs[battlerId].throatChopTimer && gBattleMoves[gBattleMons[battlerId].moves[i]].flags & FLAG_SOUND)
unusableMoves |= gBitTable[i];
// Stuff Cheeks
else if (gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES)
else if (check & MOVE_LIMITATION_STUFF_CHEEKS && gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES)
unusableMoves |= gBitTable[i];
// Gorilla Tactics
else if (GetBattlerAbility(battlerId) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i])
else if (check & MOVE_LIMITATION_CHOICE_ITEM && GetBattlerAbility(battlerId) == ABILITY_GORILLA_TACTICS && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i])
unusableMoves |= gBitTable[i];
}
return unusableMoves;
@ -2341,6 +2361,7 @@ u8 DoFieldEndTurnEffects(void)
if (effect == 0)
{
gBattleStruct->turnCountersTracker++;
gBattleStruct->turnSideTracker = 0;
}
break;
case ENDTURN_RAIN:
@ -3545,7 +3566,7 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_TAUNTED: // taunt
if (gDisableStructs[gBattlerAttacker].tauntTimer && gBattleMoves[gCurrentMove].power == 0)
if (gDisableStructs[gBattlerAttacker].tauntTimer && IS_MOVE_STATUS(gCurrentMove))
{
gProtectStructs[gBattlerAttacker].usedTauntedMove = TRUE;
CancelMultiTurnMoves(gBattlerAttacker);
@ -8476,15 +8497,15 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, holdEffectModifier);
break;
case HOLD_EFFECT_LUSTROUS_ORB:
if (gBattleMons[battlerAtk].species == SPECIES_PALKIA && (moveType == TYPE_WATER || moveType == TYPE_DRAGON))
if (GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species) == SPECIES_PALKIA && (moveType == TYPE_WATER || moveType == TYPE_DRAGON))
MulModifier(&modifier, holdEffectModifier);
break;
case HOLD_EFFECT_ADAMANT_ORB:
if (gBattleMons[battlerAtk].species == SPECIES_DIALGA && (moveType == TYPE_STEEL || moveType == TYPE_DRAGON))
if (GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species) == SPECIES_DIALGA && (moveType == TYPE_STEEL || moveType == TYPE_DRAGON))
MulModifier(&modifier, holdEffectModifier);
break;
case HOLD_EFFECT_GRISEOUS_ORB:
if (gBattleMons[battlerAtk].species == SPECIES_GIRATINA && (moveType == TYPE_GHOST || moveType == TYPE_DRAGON))
if (GET_BASE_SPECIES_ID(gBattleMons[battlerAtk].species) == SPECIES_GIRATINA && (moveType == TYPE_GHOST || moveType == TYPE_DRAGON))
MulModifier(&modifier, holdEffectModifier);
break;
case HOLD_EFFECT_SOUL_DEW:

View File

@ -3121,7 +3121,7 @@ static u8 CreateContestantSprite(u16 species, u32 otId, u32 personality, u32 ind
u8 spriteId;
species = SanitizeSpecies(species);
HandleLoadSpecialPokePic(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT], species, personality);
HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT], species, personality);
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20);
SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_PLAYER_LEFT);

View File

@ -367,8 +367,7 @@ static void InitContestMonPixels(u16 species, bool8 backPic)
LZDecompressVram(pal, gContestPaintingMonPalette);
if (!backPic)
{
HandleLoadSpecialPokePic(
&gMonFrontPicTable[species],
HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT],
species,
gContestPaintingWinner->personality);
@ -376,8 +375,7 @@ static void InitContestMonPixels(u16 species, bool8 backPic)
}
else
{
HandleLoadSpecialPokePic(
&gMonBackPicTable[species],
HandleLoadSpecialPokePic(FALSE,
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT],
species,
gContestPaintingWinner->personality);

View File

@ -892,8 +892,7 @@ static void Task_ShowWinnerMonBanner(u8 taskId)
species = gContestMons[i].species;
personality = gContestMons[i].personality;
otId = gContestMons[i].otId;
HandleLoadSpecialPokePic(
&gMonFrontPicTable[species],
HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT],
species,
personality);
@ -2572,7 +2571,7 @@ void ShowContestEntryMonPic(void)
taskId = CreateTask(Task_ShowContestEntryMonPic, 0x50);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = species;
HandleLoadSpecialPokePic(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], species, personality);
HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], species, personality);
palette = GetMonSpritePalStructFromOtIdPersonality(species, otId, personality);
LoadCompressedSpritePalette(palette);

View File

@ -2978,8 +2978,9 @@ static const u8 sEerieSpellDescription[] = _(
"Attacks with psychic power.\n"
"Foe's last move has 3 PP cut.");
static const u8 sNotDoneYetDescription[] = _(
"Not done yet.");
const u8 gNotDoneYetDescription[] = _(
"This move can't be used. Its\n"
"effect is in development.");
// MOVE_NONE is ignored in this table. Make sure to always subtract 1 before getting the right pointer.
const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] =

View File

@ -70,25 +70,18 @@ void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void *buffe
void DecompressPicFromTableGender(void* buffer, s32 species, u32 personality)
{
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
if (ShouldShowFemaleDifferences(species, personality))
DecompressPicFromTable(&gMonFrontPicTableFemale[species], buffer, species);
else
DecompressPicFromTable(&gMonFrontPicTable[species], buffer, species);
}
void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality)
void HandleLoadSpecialPokePic(bool32 isFrontPic, void *dest, s32 species, u32 personality)
{
bool8 isFrontPic;
if (src == &gMonFrontPicTable[species])
isFrontPic = TRUE; // frontPic
else
isFrontPic = FALSE; // backPic
LoadSpecialPokePic(src, dest, species, personality, isFrontPic);
LoadSpecialPokePic(dest, species, personality, isFrontPic);
}
void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic)
void LoadSpecialPokePic(void *dest, s32 species, u32 personality, bool8 isFrontPic)
{
if (species == SPECIES_UNOWN)
{
@ -100,8 +93,13 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32
LZ77UnCompWram(gMonFrontPicTable[id].data, dest);
}
else if (species > NUM_SPECIES) // is species unknown? draw the ? icon
{
if (isFrontPic)
LZ77UnCompWram(gMonFrontPicTable[0].data, dest);
else if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
else
LZ77UnCompWram(gMonBackPicTable[0].data, dest);
}
else if (ShouldShowFemaleDifferences(species, personality))
{
if (isFrontPic)
LZ77UnCompWram(gMonFrontPicTableFemale[species].data, dest);
@ -109,49 +107,15 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32
LZ77UnCompWram(gMonBackPicTableFemale[species].data, dest);
}
else
LZ77UnCompWram(src->data, dest);
DrawSpindaSpots(species, personality, dest, isFrontPic);
}
#if P_ENABLE_DEBUG == TRUE
static void LoadSpecialPokePicCustom(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic, bool8 isFemale)
{
if (species == SPECIES_UNOWN)
{
u32 id = GetUnownSpeciesId(personality);
if (!isFrontPic)
LZ77UnCompWram(gMonBackPicTable[id].data, dest);
else
LZ77UnCompWram(gMonFrontPicTable[id].data, dest);
}
else if (species > NUM_SPECIES) // is species unknown? draw the ? icon
LZ77UnCompWram(gMonFrontPicTable[0].data, dest);
else if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale)
{
if (isFrontPic)
LZ77UnCompWram(gMonFrontPicTableFemale[species].data, dest);
LZ77UnCompWram(gMonFrontPicTable[species].data, dest);
else
LZ77UnCompWram(gMonBackPicTableFemale[species].data, dest);
LZ77UnCompWram(gMonBackPicTable[species].data, dest);
}
else
LZ77UnCompWram(src->data, dest);
DrawSpindaSpots(species, personality, dest, isFrontPic);
}
void HandleLoadSpecialPokePicCustom(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFemale)
{
bool8 isFrontPic;
if (src == &gMonFrontPicTable[species])
isFrontPic = TRUE; // frontPic
else
isFrontPic = FALSE; // backPic
LoadSpecialPokePicCustom(src, dest, species, personality, isFrontPic, isFemale);
}
#endif
void Unused_LZDecompressWramIndirect(const void **src, void *dest)
{

View File

@ -444,7 +444,7 @@ static u8 EggHatchCreateMonSprite(u8 useAlt, u8 state, u8 partyId, u16 *speciesL
{
u16 species = GetMonData(mon, MON_DATA_SPECIES);
u32 pid = GetMonData(mon, MON_DATA_PERSONALITY);
HandleLoadSpecialPokePic(&gMonFrontPicTable[species],
HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[(useAlt * 2) + B_POSITION_OPPONENT_LEFT],
species, pid);
LoadCompressedSpritePalette(GetMonSpritePalStruct(mon));

View File

@ -2033,12 +2033,3 @@ const u16 gFrontierPassCancelButtonHighlighted_Tilemap[] = INCBIN_U16("graphics/
const u16 gBerryCrush_Crusher_Pal[] = INCBIN_U16("graphics/berry_crush/crusher.gbapal");
const u32 gBerryCrush_Crusher_Gfx[] = INCBIN_U32("graphics/berry_crush/crusher.4bpp.lz");
const u32 gBerryCrush_TextWindows_Tilemap[] = INCBIN_U32("graphics/berry_crush/text_windows.bin.lz");
// random garbage at the end.
static const u8 sEmpty3[0x54BAC] = {0};
static const u8 sUnused1[] = {0x0D, 0x00, 0x58, 0x02};
static const u8 sEmpty4[0x1145] = {0};
static const u8 sUnused2[] = {0x02};
static const u8 sEmpty5[0x3242] = {0};
static const u8 sUnused3[] = {0x40};
static const u8 sEmpty6[0x13] = {0};

View File

@ -24,6 +24,7 @@
#include "trig.h"
#include "window.h"
#include "constants/songs.h"
#include "constants/battle_move_effects.h"
#include "gba/io_reg.h"
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
@ -807,7 +808,11 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
}
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x29, TEXT_SKIP_DRAW, NULL);
if (move->effect != EFFECT_PLACEHOLDER)
str = gMoveDescriptionPointers[chosenMove - 1];
else
str = gNotDoneYetDescription;
AddTextPrinterParameterized(0, FONT_NARROW, str, 0, 0x41, 0, NULL);
}
@ -1075,7 +1080,7 @@ void GetConditionMenuMonGfx(void *tilesDst, void *palDst, u16 boxId, u16 monId,
u32 trainerId = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
u32 personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL);
LoadSpecialPokePic(&gMonFrontPicTable[species], tilesDst, species, personality, TRUE);
LoadSpecialPokePic(tilesDst, species, personality, TRUE);
LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst);
}
}

View File

@ -6134,7 +6134,7 @@ void ChooseMonForWirelessMinigame(void)
static u8 GetPartyLayoutFromBattleType(void)
{
if (IsDoubleBattle() == FALSE)
if (!IsDoubleBattle() || gPlayerPartyCount == 1) // Draw the single layout in a double battle where the player has only one pokemon.
return PARTY_LAYOUT_SINGLE;
if (IsMultiBattle() == TRUE)
return PARTY_LAYOUT_MULTI;

View File

@ -727,7 +727,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
// Load mon gfx
species = GetMonData(mon, MON_DATA_SPECIES2);
personality = GetMonData(mon, MON_DATA_PERSONALITY);
HandleLoadSpecialPokePic(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], species, personality);
HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], species, personality);
sPokeblockFeed->loadGfxState++;
break;
case 1:

View File

@ -7520,14 +7520,14 @@ const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 p
shinyValue = GET_SHINY_VALUE(otId, personality);
if (shinyValue < SHINY_ODDS)
{
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
if (ShouldShowFemaleDifferences(species, personality))
return gMonShinyPaletteTableFemale[species].data;
else
return gMonShinyPaletteTable[species].data;
}
else
{
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
if (ShouldShowFemaleDifferences(species, personality))
return gMonPaletteTableFemale[species].data;
else
return gMonPaletteTable[species].data;
@ -7549,14 +7549,14 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u
shinyValue = GET_SHINY_VALUE(otId, personality);
if (shinyValue < SHINY_ODDS)
{
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
if (ShouldShowFemaleDifferences(species, personality))
return &gMonShinyPaletteTableFemale[species];
else
return &gMonShinyPaletteTable[species];
}
else
{
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
if (ShouldShowFemaleDifferences(species, personality))
return &gMonPaletteTableFemale[species];
else
return &gMonPaletteTable[species];
@ -8359,3 +8359,8 @@ void TrySpecialOverworldEvo(void)
sTriedEvolving = 0;
SetMainCallback2(CB2_ReturnToField);
}
bool32 ShouldShowFemaleDifferences(u16 species, u32 personality)
{
return (gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE;
}

View File

@ -1107,6 +1107,9 @@ static void ResetPokemonDebugWindows(void)
}
}
#define MALE_PERSONALITY 0xFE
#define FEMALE_PERSONALITY 0X0
void CB2_Debug_Pokemon(void)
{
u8 taskId;
@ -1180,7 +1183,7 @@ void CB2_Debug_Pokemon(void)
palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny);
LoadCompressedSpritePalette(palette);
//Front
HandleLoadSpecialPokePicCustom(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[1], species, 0, data->isFemale);
HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[1], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY));
data->isShiny = FALSE;
data->isFemale = FALSE;
BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1);
@ -1195,7 +1198,7 @@ void CB2_Debug_Pokemon(void)
LoadAndCreateEnemyShadowSpriteCustom(data, species);
//Back
HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->isFemale);
HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->sprites.ptr[2], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY));
BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 4);
SetMultiuseSpriteTemplateToPokemon(species, 2);
offset_y = gMonBackPicCoords[species].y_offset;
@ -1205,7 +1208,7 @@ void CB2_Debug_Pokemon(void)
gSprites[data->backspriteId].oam.priority = 0;
//Icon Sprite
data->iconspriteId = CreateMonIconCustom(species, SpriteCB_MonIcon, DEBUG_ICON_X, DEBUG_ICON_Y, 4, data->isShiny, data->isFemale, data->isShiny);
data->iconspriteId = CreateMonIcon(species, SpriteCB_MonIcon, DEBUG_ICON_X, DEBUG_ICON_Y, 4, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY));
gSprites[data->iconspriteId].oam.priority = 0;
//Modify Arrows
@ -1692,7 +1695,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny);
LoadCompressedSpritePalette(palette);
//Front
HandleLoadSpecialPokePicCustom(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[1], species, 0, data->isFemale);
HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[1], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY));
BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1);
SetMultiuseSpriteTemplateToPokemon(species, 1);
gMultiuseSpriteTemplate.paletteTag = palette->tag;
@ -1705,7 +1708,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
LoadAndCreateEnemyShadowSpriteCustom(data, species);
//Back
HandleLoadSpecialPokePicCustom(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[2], species, 0, data->isFemale);
HandleLoadSpecialPokePic(FALSE, gMonSpritesGfxPtr->sprites.ptr[2], species, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY));
BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 5);
SetMultiuseSpriteTemplateToPokemon(species, 2);
offset_y = gMonBackPicCoords[species].y_offset;
@ -1715,7 +1718,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
gSprites[data->backspriteId].oam.priority = 0;
//Icon Sprite
data->iconspriteId = CreateMonIconCustom(species, SpriteCB_MonIcon, DEBUG_ICON_X, DEBUG_ICON_Y, 4, data->isShiny, data->isFemale, data->isShiny);
data->iconspriteId = CreateMonIcon(species, SpriteCB_MonIcon, DEBUG_ICON_X, DEBUG_ICON_Y, 4, (data->isFemale ? FEMALE_PERSONALITY : MALE_PERSONALITY));
gSprites[data->iconspriteId].oam.priority = 0;
//Modify Arrows

View File

@ -23,10 +23,6 @@ struct MonIconSpriteTemplate
static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8);
static void FreeAndDestroyMonIconSprite_(struct Sprite *sprite);
#if P_ENABLE_DEBUG == TRUE
static const u8 *GetMonIconPtrCustom(u16 species, u32 personality, bool8 isFemale);
static const u8 *GetMonIconTilesCustom(u16 species, bool8 isFemale);
#endif
const u8 *const gMonIconTable[] =
{
@ -2596,7 +2592,7 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u
if (species > NUM_SPECIES)
iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG;
else if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
else if (ShouldShowFemaleDifferences(species, personality))
iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndicesFemale[species];
spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority);
@ -2606,32 +2602,6 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u
return spriteId;
}
#if P_ENABLE_DEBUG == TRUE
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 ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && 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)
{
@ -2704,13 +2674,6 @@ const u8 *GetMonIconPtr(u16 species, u32 personality)
return GetMonIconTiles(GetIconSpecies(species, personality), personality);
}
#if P_ENABLE_DEBUG == TRUE
static const u8 *GetMonIconPtrCustom(u16 species, u32 personality, bool8 isFemale)
{
return GetMonIconTilesCustom(GetIconSpecies(species, personality), isFemale);
}
#endif
void FreeAndDestroyMonIconSprite(struct Sprite *sprite)
{
FreeAndDestroyMonIconSprite_(sprite);
@ -2772,24 +2735,15 @@ void SpriteCB_MonIcon(struct Sprite *sprite)
const u8 *GetMonIconTiles(u16 species, u32 personality)
{
const u8 *iconSprite = gMonIconTable[species];
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
{
const u8 *iconSprite;
if (ShouldShowFemaleDifferences(species, personality))
iconSprite = gMonIconTableFemale[species];
}
else
iconSprite = gMonIconTable[species];
return iconSprite;
}
#if P_ENABLE_DEBUG == TRUE
static const u8 *GetMonIconTilesCustom(u16 species, bool8 isFemale)
{
const u8 *iconSprite = gMonIconTable[species];
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && isFemale)
{
iconSprite = gMonIconTableFemale[species];
}
return iconSprite;
}
#endif
void TryLoadAllMonIconPalettesAtOffset(u16 offset)
{

View File

@ -2905,8 +2905,7 @@ static void CreateJumpMonSprite(struct PokemonJumpGfx *jumpGfx, struct PokemonJu
if (buffer && unusedBuffer)
{
HandleLoadSpecialPokePic(
&gMonFrontPicTable[monInfo->species],
HandleLoadSpecialPokePic(TRUE,
buffer,
monInfo->species,
monInfo->personality);

View File

@ -3991,7 +3991,7 @@ static void LoadDisplayMonGfx(u16 species, u32 pid)
if (species != SPECIES_NONE)
{
LoadSpecialPokePic(&gMonFrontPicTable[species], sStorage->tileBuffer, species, pid, TRUE);
LoadSpecialPokePic(sStorage->tileBuffer, species, pid, TRUE);
LZ77UnCompWram(sStorage->displayMonPalette, sStorage->displayMonPalBuffer);
CpuCopy32(sStorage->tileBuffer, sStorage->displayMonTilePtr, MON_PIC_SIZE);
LoadPalette(sStorage->displayMonPalBuffer, sStorage->displayMonPalOffset, 0x20);
@ -5109,7 +5109,7 @@ static u16 TryLoadMonIconTiles(u16 species, u32 personality)
u16 i, offset;
// Treat female mons as a seperate species as they may have a different icon than males
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
if (ShouldShowFemaleDifferences(species, personality))
species |= 0x8000; // 1 << 15
// Search icon list for this species
@ -5176,7 +5176,7 @@ static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s
struct SpriteTemplate template = sSpriteTemplate_MonIcon;
species = GetIconSpecies(species, personality);
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
if (ShouldShowFemaleDifferences(species, personality))
{
template.paletteTag = PALTAG_MON_ICON_0 + gMonIconPaletteIndicesFemale[species];
}

View File

@ -41,13 +41,14 @@
#include "text.h"
#include "tv.h"
#include "window.h"
#include "constants/battle_config.h"
#include "constants/battle_move_effects.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
#include "constants/region_map_sections.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/battle_config.h"
enum {
PSS_PAGE_INFO,
@ -3730,15 +3731,21 @@ static void PrintContestMoveDescription(u8 moveSlot)
static void PrintMoveDetails(u16 move)
{
u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, PSS_DATA_WINDOW_MOVE_DESCRIPTION);
u8 moveEffect;
FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
if (move != MOVE_NONE)
{
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES)
{
moveEffect = gBattleMoves[move].effect;
if (B_SHOW_SPLIT_ICON == TRUE)
ShowSplitIcon(GetBattleMoveSplit(move));
PrintMovePowerAndAccuracy(move);
if (moveEffect != EFFECT_PLACEHOLDER)
PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0);
else
PrintTextOnWindow(windowId, gNotDoneYetDescription, 6, 1, 0, 0);
}
else
{
@ -3980,7 +3987,7 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state)
case 0:
if (gMain.inBattle)
{
HandleLoadSpecialPokePic(&gMonFrontPicTable[summary->species2],
HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT],
summary->species2,
summary->pid);
@ -3989,14 +3996,14 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state)
{
if (gMonSpritesGfxPtr != NULL)
{
HandleLoadSpecialPokePic(&gMonFrontPicTable[summary->species2],
HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT],
summary->species2,
summary->pid);
}
else
{
HandleLoadSpecialPokePic(&gMonFrontPicTable[summary->species2],
HandleLoadSpecialPokePic(TRUE,
MonSpritesGfxManager_GetSpritePtr(MON_SPR_GFX_MANAGER_A, B_POSITION_OPPONENT_LEFT),
summary->species2,
summary->pid);

View File

@ -534,7 +534,7 @@ static void ConditionGraphDrawMonPic(s16 listId, u8 loadId)
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL);
tid = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL);
LoadSpecialPokePic(&gMonFrontPicTable[species], menu->monPicGfx[loadId], species, personality, TRUE);
LoadSpecialPokePic(menu->monPicGfx[loadId], species, personality, TRUE);
LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, tid, personality), menu->monPal[loadId]);
}

View File

@ -2734,7 +2734,7 @@ static void LoadTradeMonPic(u8 whichParty, u8 state)
species = GetMonData(mon, MON_DATA_SPECIES2);
personality = GetMonData(mon, MON_DATA_PERSONALITY);
HandleLoadSpecialPokePic(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites.ptr[whichParty * 2 + B_POSITION_OPPONENT_LEFT], species, personality);
HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[whichParty * 2 + B_POSITION_OPPONENT_LEFT], species, personality);
LoadCompressedSpritePalette(GetMonSpritePalStruct(mon));
sTradeData->monSpecies[whichParty] = species;
@ -3727,7 +3727,7 @@ static bool8 AnimateTradeSequenceCable(void)
case TS_STATE_POKEBALL_ARRIVE_WAIT:
if (gSprites[sTradeData->bouncingPokeballSpriteId].callback == SpriteCallbackDummy)
{
HandleLoadSpecialPokePic(&gMonFrontPicTable[sTradeData->monSpecies[TRADE_PARTNER]], gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT], sTradeData->monSpecies[TRADE_PARTNER], sTradeData->monPersonalities[TRADE_PARTNER]);
HandleLoadSpecialPokePic(TRUE, gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT], sTradeData->monSpecies[TRADE_PARTNER], sTradeData->monPersonalities[TRADE_PARTNER]);
sTradeData->state++;
}
break;
@ -4224,7 +4224,7 @@ static bool8 AnimateTradeSequenceWireless(void)
case TS_STATE_POKEBALL_ARRIVE_WAIT:
if (gSprites[sTradeData->bouncingPokeballSpriteId].callback == SpriteCallbackDummy)
{
HandleLoadSpecialPokePic(&gMonFrontPicTable[sTradeData->monSpecies[TRADE_PARTNER]],
HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT],
sTradeData->monSpecies[TRADE_PARTNER],
sTradeData->monPersonalities[TRADE_PARTNER]);

View File

@ -59,11 +59,11 @@ static bool16 DecompressPic(u16 species, u32 personality, bool8 isFrontPic, u8 *
{
if (isFrontPic)
{
LoadSpecialPokePic(&gMonFrontPicTable[species], dest, species, personality, isFrontPic);
LoadSpecialPokePic(dest, species, personality, isFrontPic);
}
else
{
LoadSpecialPokePic(&gMonBackPicTable[species], dest, species, personality, isFrontPic);
LoadSpecialPokePic(dest, species, personality, isFrontPic);
}
}
else