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 printselectionstring STRINGID_STUFFCHEEKSCANTSELECT
endselectionscript endselectionscript
BattleScript_SelectingNotAllowedStuffCheeksInPalace::
printstring STRINGID_STUFFCHEEKSCANTSELECT
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_SelectingNotAllowedBelch:: BattleScript_SelectingNotAllowedBelch::
printselectionstring STRINGID_BELCHCANTSELECT printselectionstring STRINGID_BELCHCANTSELECT
endselectionscript endselectionscript
@ -9197,14 +9201,34 @@ BattleScript_SelectingNotAllowedMoveChoiceItem::
printselectionstring STRINGID_ITEMALLOWSONLYYMOVE printselectionstring STRINGID_ITEMALLOWSONLYYMOVE
endselectionscript endselectionscript
BattleScript_SelectingNotAllowedMoveChoiceItemInPalace::
printstring STRINGID_ITEMALLOWSONLYYMOVE
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_SelectingNotAllowedMoveGorillaTactics:: BattleScript_SelectingNotAllowedMoveGorillaTactics::
printselectionstring STRINGID_ABILITYALLOWSONLYMOVE printselectionstring STRINGID_ABILITYALLOWSONLYMOVE
endselectionscript endselectionscript
BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace::
printstring STRINGID_ABILITYALLOWSONLYMOVE
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_SelectingNotAllowedMoveAssaultVest:: BattleScript_SelectingNotAllowedMoveAssaultVest::
printselectionstring STRINGID_ASSAULTVESTDOESNTALLOW printselectionstring STRINGID_ASSAULTVESTDOESNTALLOW
endselectionscript 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:: BattleScript_HangedOnMsg::
playanimation BS_TARGET, B_ANIM_HANGED_ON playanimation BS_TARGET, B_ANIM_HANGED_ON
printstring STRINGID_PKMNHUNGONWITHX printstring STRINGID_PKMNHUNGONWITHX

View File

@ -73,6 +73,7 @@ enum
HEALTHBOX_SAFARI_BALLS_TEXT HEALTHBOX_SAFARI_BALLS_TEXT
}; };
u32 WhichBattleCoords(u32 battlerId);
u8 GetMegaIndicatorSpriteId(u32 healthboxSpriteId); u8 GetMegaIndicatorSpriteId(u32 healthboxSpriteId);
u8 CreateBattlerHealthboxSprites(u8 battler); u8 CreateBattlerHealthboxSprites(u8 battler);
u8 CreateSafariPlayerHealthboxSprites(void); 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_End2[];
extern const u8 BattleScript_ItemHealHP_Ret[]; extern const u8 BattleScript_ItemHealHP_Ret[];
extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItem[]; extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItem[];
extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItemInPalace[];
extern const u8 BattleScript_HangedOnMsg[]; extern const u8 BattleScript_HangedOnMsg[];
extern const u8 BattleScript_BerryConfuseHealEnd2[]; extern const u8 BattleScript_BerryConfuseHealEnd2[];
extern const u8 BattleScript_BerryConfuseHealRet[]; extern const u8 BattleScript_BerryConfuseHealRet[];
@ -275,6 +276,9 @@ extern const u8 BattleScript_SnowWarningActivates[];
extern const u8 BattleScript_HarvestActivates[]; extern const u8 BattleScript_HarvestActivates[];
extern const u8 BattleScript_ImposterActivates[]; extern const u8 BattleScript_ImposterActivates[];
extern const u8 BattleScript_SelectingNotAllowedMoveAssaultVest[]; 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_SelectingNotAllowedMoveGravity[];
extern const u8 BattleScript_MoveUsedGravityPrevents[]; extern const u8 BattleScript_MoveUsedGravityPrevents[];
extern const u8 BattleScript_SelectingNotAllowedMoveGravityInPalace[]; extern const u8 BattleScript_SelectingNotAllowedMoveGravityInPalace[];
@ -301,6 +305,7 @@ extern const u8 BattleScript_DazzlingProtected[];
extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[]; extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[];
extern const u8 BattleScript_MoveUsedPowder[]; extern const u8 BattleScript_MoveUsedPowder[];
extern const u8 BattleScript_SelectingNotAllowedStuffCheeks[]; extern const u8 BattleScript_SelectingNotAllowedStuffCheeks[];
extern const u8 BattleScript_SelectingNotAllowedStuffCheeksInPalace[];
extern const u8 BattleScript_SelectingNotAllowedBelch[]; extern const u8 BattleScript_SelectingNotAllowedBelch[];
extern const u8 BattleScript_SelectingNotAllowedBelchInPalace[]; extern const u8 BattleScript_SelectingNotAllowedBelchInPalace[];
extern const u8 BattleScript_PsychicSurgeActivates[]; extern const u8 BattleScript_PsychicSurgeActivates[];
@ -405,6 +410,7 @@ extern const u8 BattleScript_BlockedByPrimalWeatherRet[];
extern const u8 BattleScript_PrimalReversion[]; extern const u8 BattleScript_PrimalReversion[];
extern const u8 BattleScript_HyperspaceFuryRemoveProtect[]; extern const u8 BattleScript_HyperspaceFuryRemoveProtect[];
extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[]; extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[];
extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace[];
extern const u8 BattleScript_WanderingSpiritActivates[]; extern const u8 BattleScript_WanderingSpiritActivates[];
extern const u8 BattleScript_MirrorArmorReflect[]; extern const u8 BattleScript_MirrorArmorReflect[];
extern const u8 BattleScript_GooeyActivates[]; extern const u8 BattleScript_GooeyActivates[];

View File

@ -7,7 +7,17 @@
#define MOVE_LIMITATION_TORMENTED (1 << 3) #define MOVE_LIMITATION_TORMENTED (1 << 3)
#define MOVE_LIMITATION_TAUNT (1 << 4) #define MOVE_LIMITATION_TAUNT (1 << 4)
#define MOVE_LIMITATION_IMPRISON (1 << 5) #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_ON_SWITCHIN 0
#define ABILITYEFFECT_ENDTURN 1 #define ABILITYEFFECT_ENDTURN 1
@ -89,7 +99,7 @@ void BattleScriptPush(const u8 *bsPtr);
void BattleScriptPushCursor(void); void BattleScriptPushCursor(void);
void BattleScriptPop(void); void BattleScriptPop(void);
u8 TrySetCantSelectMoveBattleScript(void); u8 TrySetCantSelectMoveBattleScript(void);
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check); u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check);
bool8 AreAllMovesUnusable(void); bool8 AreAllMovesUnusable(void);
u8 GetImprisonedMovesCount(u8 battlerId, u16 move); u8 GetImprisonedMovesCount(u8 battlerId, u16 move);
u8 DoFieldEndTurnEffects(void); u8 DoFieldEndTurnEffects(void);

View File

@ -36,4 +36,12 @@
#endif #endif
#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 #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 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_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 // Battle Outcome defines

View File

@ -1,8 +1,6 @@
#ifndef GUARD_CONSTANTS_BATTLE_CONFIG_H #ifndef GUARD_CONSTANTS_BATTLE_CONFIG_H
#define GUARD_CONSTANTS_BATTLE_CONFIG_H #define GUARD_CONSTANTS_BATTLE_CONFIG_H
#include "constants/expansion_branches.h"
#ifndef GEN_3 #ifndef GEN_3
#define GEN_3 0 #define GEN_3 0
#define GEN_4 1 #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 #ifndef GUARD_CONSTANTS_ITEM_CONFIG_H
#define GUARD_CONSTANTS_ITEM_CONFIG_H #define GUARD_CONSTANTS_ITEM_CONFIG_H
#include "constants/expansion_branches.h"
#ifndef GEN_3 #ifndef GEN_3
#define GEN_3 0 #define GEN_3 0
#define GEN_4 1 #define GEN_4 1

View File

@ -1,8 +1,6 @@
#ifndef GUARD_CONSTANTS_POKEMON_CONFIG_H #ifndef GUARD_CONSTANTS_POKEMON_CONFIG_H
#define GUARD_CONSTANTS_POKEMON_CONFIG_H #define GUARD_CONSTANTS_POKEMON_CONFIG_H
#include "constants/expansion_branches.h"
#ifndef GEN_3 #ifndef GEN_3
#define GEN_3 0 #define GEN_3 0
#define GEN_4 1 #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_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_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_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_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. #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 DecompressPicFromTable(const struct CompressedSpriteSheet *src, void *buffer, s32 species);
void DecompressPicFromTableGender(void* buffer, s32 species, u32 personality); void DecompressPicFromTableGender(void* buffer, s32 species, u32 personality);
void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality); void HandleLoadSpecialPokePic(bool32 isFrontPic, void *dest, s32 species, u32 personality);
void HandleLoadSpecialPokePicCustom(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFemale);
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); u32 GetDecompressedDataSize(const u32 *ptr);

View File

@ -15,7 +15,6 @@
#include "constants/pokemon.h" #include "constants/pokemon.h"
#include "constants/easy_chat.h" #include "constants/easy_chat.h"
#include "constants/trainer_hill.h" #include "constants/trainer_hill.h"
#include "constants/expansion_branches.h"
// Prevent cross-jump optimization. // Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm(""); #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 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg);
u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg); u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg);
u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove); u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove);
bool32 ShouldShowFemaleDifferences(u16 species, u32 personality);
#endif // GUARD_POKEMON_H #endif // GUARD_POKEMON_H

View File

@ -21,7 +21,6 @@ u8 CreateMonIconNoPersonality(u16 species, void (*callback)(struct Sprite *), s1
void FreeMonIconPalette(u16 species); void FreeMonIconPalette(u16 species);
void FreeAndDestroyMonIconSprite(struct Sprite *sprite); void FreeAndDestroyMonIconSprite(struct Sprite *sprite);
u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality); 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); u8 UpdateMonIconFrame(struct Sprite *sprite);
void LoadMonIconPalette(u16 species); void LoadMonIconPalette(u16 species);
void SpriteCB_MonIcon(struct Sprite *sprite); void SpriteCB_MonIcon(struct Sprite *sprite);

View File

@ -6,6 +6,7 @@
extern u8 gLastViewedMonIndex; extern u8 gLastViewedMonIndex;
extern const u8 *const gMoveDescriptionPointers[]; extern const u8 *const gMoveDescriptionPointers[];
extern const u8 gNotDoneYetDescription[];
extern const u8 *const gNatureNamePointers[]; extern const u8 *const gNatureNamePointers[];
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); 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->holdEffectParams[battlerId] = GetBattlerHoldEffectParam(battlerId);
AI_DATA->predictedMoves[battlerId] = gLastMoves[battlerId]; AI_DATA->predictedMoves[battlerId] = gLastMoves[battlerId];
AI_DATA->hpPercents[battlerId] = GetHealthPercentage(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) 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) if (gBattleMons[battlerAtk].hp <= gBattleMons[battlerAtk].maxHP / 3)
score -= 10; score -= 10;
break;*/ break;*/
case EFFECT_PLACEHOLDER:
return 0; // cannot even select
} // move effect checks } // move effect checks
if (score < 0) if (score < 0)

View File

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

View File

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

View File

@ -2747,7 +2747,7 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode)
int i = 0; int i = 0;
int typePower = TYPE_x1; 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; return 0;
defType1 = gBaseStats[targetSpecies].type1; defType1 = gBaseStats[targetSpecies].type1;

View File

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

View File

@ -764,6 +764,15 @@ static void InitLastUsedBallAssets(void)
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES; 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) u8 CreateBattlerHealthboxSprites(u8 battlerId)
{ {
s16 data6 = 0; s16 data6 = 0;
@ -771,7 +780,7 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId)
u8 healthbarSpriteId, megaIndicatorSpriteId; u8 healthbarSpriteId, megaIndicatorSpriteId;
struct Sprite *healthBarSpritePtr; struct Sprite *healthBarSpritePtr;
if (!IsDoubleBattle()) if (WhichBattleCoords(battlerId) == 0) // Singles
{ {
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
{ {
@ -1035,7 +1044,7 @@ void GetBattlerHealthboxCoords(u8 battler, s16 *x, s16 *y)
{ {
*x = 0, *y = 0; *x = 0, *y = 0;
if (!IsDoubleBattle()) if (!WhichBattleCoords(battler))
{ {
if (GetBattlerSide(battler) != B_SIDE_PLAYER) if (GetBattlerSide(battler) != B_SIDE_PLAYER)
*x = 44, *y = 30; *x = 44, *y = 30;
@ -1102,7 +1111,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl)
if (GetBattlerSide(battler) == B_SIDE_PLAYER) if (GetBattlerSide(battler) == B_SIDE_PLAYER)
{ {
objVram = (void *)(OBJ_VRAM0); objVram = (void *)(OBJ_VRAM0);
if (!IsDoubleBattle()) if (!WhichBattleCoords(battler))
objVram += spriteTileNum + 0x820; objVram += spriteTileNum + 0x820;
else else
objVram += spriteTileNum + 0x420; 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) 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); UpdateHpTextInHealthboxInDoubles(healthboxSpriteId, maxOrCurrent, currHp, maxHp);
} }
else // Single Battle 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); PrintHpOnHealthbox(healthboxSpriteId, currHp, maxHp, 2, 0xB00, 0x3A0);
} }
@ -1334,7 +1344,7 @@ void SwapHpBarsWithHpText(void)
{ {
if (gSprites[gHealthboxSpriteIds[i]].callback == SpriteCallbackDummy if (gSprites[gHealthboxSpriteIds[i]].callback == SpriteCallbackDummy
&& GetBattlerSide(i) != B_SIDE_OPPONENT && 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 currHp = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_HP);
s32 maxHp = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_MAX_HP); s32 maxHp = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_MAX_HP);
@ -1344,7 +1354,7 @@ void SwapHpBarsWithHpText(void)
noBars = gBattleSpritesDataPtr->battlerData[i].hpNumbersNoBars; noBars = gBattleSpritesDataPtr->battlerData[i].hpNumbersNoBars;
if (GetBattlerSide(i) == B_SIDE_PLAYER) if (GetBattlerSide(i) == B_SIDE_PLAYER)
{ {
if (!IsDoubleBattle()) if (!WhichBattleCoords(i))
continue; continue;
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
continue; continue;
@ -1638,7 +1648,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
{ {
isOpponent = TRUE; isOpponent = TRUE;
if (!skipPlayer || !IsDoubleBattle()) if (!skipPlayer || !WhichBattleCoords(battlerId))
bar_X = 104, bar_Y = 40; bar_X = 104, bar_Y = 40;
else else
bar_X = 104, bar_Y = 16; 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); TextIntoHealthboxObject((void *)(OBJ_VRAM0 + 0x40 + spriteTileNum), windowTileData, 6);
ptr = (void *)(OBJ_VRAM0); ptr = (void *)(OBJ_VRAM0);
if (!IsDoubleBattle()) if (!WhichBattleCoords(gSprites[healthboxSpriteId].data[6]))
ptr += spriteTileNum + 0x800; ptr += spriteTileNum + 0x800;
else else
ptr += spriteTileNum + 0x400; ptr += spriteTileNum + 0x400;
@ -2175,7 +2185,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
{ {
status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS); status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_STATUS);
if (!IsDoubleBattle()) if (!WhichBattleCoords(battlerId))
tileNumAdder = 0x1A; tileNumAdder = 0x1A;
else else
tileNumAdder = 0x12; tileNumAdder = 0x12;
@ -2231,7 +2241,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2); FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2);
CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void *)(OBJ_PLTT + pltAdder * 2), 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); 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) if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)
{ {
@ -2339,7 +2349,7 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
{ {
u8 isDoubles = IsDoubleBattle(); u8 isDoubles = WhichBattleCoords(battlerId);
if (elementId == HEALTHBOX_LEVEL || elementId == HEALTHBOX_ALL) if (elementId == HEALTHBOX_LEVEL || elementId == HEALTHBOX_ALL)
UpdateLvlInHealthbox(healthboxSpriteId, GetMonData(mon, MON_DATA_LEVEL)); 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 #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; u32 windowId, i;
u8 *windowTileData; u8 *windowTileData;
@ -2901,6 +2911,15 @@ static void PrintOnAbilityPopUp(const u8 *str, u8 *spriteTileData1, u8 *spriteTi
} }
text1[i] = EOS; 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); windowTileData = AddTextPrinterAndCreateWindowOnAbilityPopUp(text1, x1, y, color1, color2, color3, &windowId);
TextIntoAbilityPopUp(spriteTileData1, windowTileData, 8, (y == 0)); TextIntoAbilityPopUp(spriteTileData1, windowTileData, 8, (y == 0));
RemoveWindow(windowId); RemoveWindow(windowId);
@ -2929,7 +2948,8 @@ static void ClearAbilityName(u8 spriteId1, u8 spriteId2)
(void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32) + 256, (void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32) + 256,
6, 1, 6, 1,
4, 4,
7, 9, 1); 7, 9, 1,
FALSE);
} }
static void PrintBattlerOnAbilityPopUp(u8 battlerId, u8 spriteId1, u8 spriteId2) 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), (void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32),
7, 0, 7, 0,
0, 0,
2, 7, 1); 2, 7, 1,
FALSE);
} }
static void PrintAbilityOnAbilityPopUp(u32 ability, u8 spriteId1, u8 spriteId2) 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], PrintOnAbilityPopUp(gAbilityNames[ability],
(void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32) + 256, (void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32) + 256,
(void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32) + 256, (void*)(OBJ_VRAM0) + (gSprites[spriteId2].oam.tileNum * 32) + 256,
6, 1, 6, 0,
4, 4,
7, 9, 1); 7, 9, 1,
TRUE);
} }
#define PIXEL_COORDS_TO_OFFSET(x, y)( \ #define PIXEL_COORDS_TO_OFFSET(x, y)( \

View File

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

View File

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

View File

@ -1435,7 +1435,7 @@ static void TrySetBattleSeminarShow(void)
return; return;
else if (gBattleTypeFlags & (BATTLE_TYPE_PALACE | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)) else if (gBattleTypeFlags & (BATTLE_TYPE_PALACE | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID))
return; return;
else if (gBattleMoves[gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]]].power == 0) else if (IS_MOVE_STATUS(gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]]))
return; return;
i = 0; i = 0;
@ -1496,7 +1496,7 @@ static void TrySetBattleSeminarShow(void)
static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride) static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride)
{ {
if (gBattleMoves[moveId].power == 0) if (IS_MOVE_STATUS(moveId))
{ {
*dmg = 0; *dmg = 0;
return FALSE; 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; gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
@ -1859,7 +1859,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gCurrentMove = move; gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace; gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedStuffCheeksInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
} }
else else
@ -1876,6 +1876,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gLastUsedItem = gBattleMons[gActiveBattler].item; gLastUsedItem = gBattleMons[gActiveBattler].item;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveChoiceItemInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
} }
else else
@ -1884,12 +1885,13 @@ u8 TrySetCantSelectMoveBattleScript(void)
limitations++; 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; gCurrentMove = move;
gLastUsedItem = gBattleMons[gActiveBattler].item; gLastUsedItem = gBattleMons[gActiveBattler].item;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveAssaultVestInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
} }
else else
@ -1905,6 +1907,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gLastUsedItem = gBattleMons[gActiveBattler].item; gLastUsedItem = gBattleMons[gActiveBattler].item;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE; gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
} }
else 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; return limitations;
} }
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check) u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u16 check)
{ {
u8 holdEffect = GetBattlerHoldEffect(battlerId, TRUE); u8 holdEffect = GetBattlerHoldEffect(battlerId, TRUE);
u16 *choicedMove = &gBattleStruct->choicedMove[battlerId]; 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++) for (i = 0; i < MAX_MON_MOVES; i++)
{ {
// No move // 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]; unusableMoves |= gBitTable[i];
// No PP // 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]; unusableMoves |= gBitTable[i];
// Disable // 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]; unusableMoves |= gBitTable[i];
// Torment // 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]; unusableMoves |= gBitTable[i];
// Taunt // 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]; unusableMoves |= gBitTable[i];
// Imprison // 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]; unusableMoves |= gBitTable[i];
// Encore // 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]; unusableMoves |= gBitTable[i];
// Choice Items // 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]; unusableMoves |= gBitTable[i];
// Assault Vest // 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]; unusableMoves |= gBitTable[i];
// Gravity // Gravity
else if (IsGravityPreventingMove(gBattleMons[battlerId].moves[i])) else if (check & MOVE_LIMITATION_GRAVITY && IsGravityPreventingMove(gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i]; unusableMoves |= gBitTable[i];
// Heal Block // 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]; unusableMoves |= gBitTable[i];
// Belch // Belch
else if (IsBelchPreventingMove(battlerId, gBattleMons[battlerId].moves[i])) else if (check & MOVE_LIMITATION_BELCH && IsBelchPreventingMove(battlerId, gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i]; unusableMoves |= gBitTable[i];
// Throat Chop // 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]; unusableMoves |= gBitTable[i];
// Stuff Cheeks // 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]; unusableMoves |= gBitTable[i];
// Gorilla Tactics // 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]; unusableMoves |= gBitTable[i];
} }
return unusableMoves; return unusableMoves;
@ -2341,6 +2361,7 @@ u8 DoFieldEndTurnEffects(void)
if (effect == 0) if (effect == 0)
{ {
gBattleStruct->turnCountersTracker++; gBattleStruct->turnCountersTracker++;
gBattleStruct->turnSideTracker = 0;
} }
break; break;
case ENDTURN_RAIN: case ENDTURN_RAIN:
@ -3545,7 +3566,7 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleStruct->atkCancellerTracker++; gBattleStruct->atkCancellerTracker++;
break; break;
case CANCELLER_TAUNTED: // taunt case CANCELLER_TAUNTED: // taunt
if (gDisableStructs[gBattlerAttacker].tauntTimer && gBattleMoves[gCurrentMove].power == 0) if (gDisableStructs[gBattlerAttacker].tauntTimer && IS_MOVE_STATUS(gCurrentMove))
{ {
gProtectStructs[gBattlerAttacker].usedTauntedMove = TRUE; gProtectStructs[gBattlerAttacker].usedTauntedMove = TRUE;
CancelMultiTurnMoves(gBattlerAttacker); CancelMultiTurnMoves(gBattlerAttacker);
@ -8476,15 +8497,15 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, holdEffectModifier); MulModifier(&modifier, holdEffectModifier);
break; break;
case HOLD_EFFECT_LUSTROUS_ORB: 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); MulModifier(&modifier, holdEffectModifier);
break; break;
case HOLD_EFFECT_ADAMANT_ORB: 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); MulModifier(&modifier, holdEffectModifier);
break; break;
case HOLD_EFFECT_GRISEOUS_ORB: 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); MulModifier(&modifier, holdEffectModifier);
break; break;
case HOLD_EFFECT_SOUL_DEW: case HOLD_EFFECT_SOUL_DEW:

View File

@ -3121,7 +3121,7 @@ static u8 CreateContestantSprite(u16 species, u32 otId, u32 personality, u32 ind
u8 spriteId; u8 spriteId;
species = SanitizeSpecies(species); 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); LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20);
SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_PLAYER_LEFT); SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_PLAYER_LEFT);

View File

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

View File

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

View File

@ -2978,8 +2978,9 @@ static const u8 sEerieSpellDescription[] = _(
"Attacks with psychic power.\n" "Attacks with psychic power.\n"
"Foe's last move has 3 PP cut."); "Foe's last move has 3 PP cut.");
static const u8 sNotDoneYetDescription[] = _( const u8 gNotDoneYetDescription[] = _(
"Not done yet."); "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. // 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] = 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) 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); DecompressPicFromTable(&gMonFrontPicTableFemale[species], buffer, species);
else else
DecompressPicFromTable(&gMonFrontPicTable[species], buffer, species); 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; LoadSpecialPokePic(dest, species, personality, isFrontPic);
if (src == &gMonFrontPicTable[species])
isFrontPic = TRUE; // frontPic
else
isFrontPic = FALSE; // backPic
LoadSpecialPokePic(src, 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) if (species == SPECIES_UNOWN)
{ {
@ -100,8 +93,13 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32
LZ77UnCompWram(gMonFrontPicTable[id].data, dest); LZ77UnCompWram(gMonFrontPicTable[id].data, dest);
} }
else if (species > NUM_SPECIES) // is species unknown? draw the ? icon else if (species > NUM_SPECIES) // is species unknown? draw the ? icon
{
if (isFrontPic)
LZ77UnCompWram(gMonFrontPicTable[0].data, dest); 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) if (isFrontPic)
LZ77UnCompWram(gMonFrontPicTableFemale[species].data, dest); LZ77UnCompWram(gMonFrontPicTableFemale[species].data, dest);
@ -109,49 +107,15 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32
LZ77UnCompWram(gMonBackPicTableFemale[species].data, dest); LZ77UnCompWram(gMonBackPicTableFemale[species].data, dest);
} }
else 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) if (isFrontPic)
LZ77UnCompWram(gMonFrontPicTableFemale[species].data, dest); LZ77UnCompWram(gMonFrontPicTable[species].data, dest);
else else
LZ77UnCompWram(gMonBackPicTableFemale[species].data, dest); LZ77UnCompWram(gMonBackPicTable[species].data, dest);
} }
else
LZ77UnCompWram(src->data, dest);
DrawSpindaSpots(species, personality, dest, isFrontPic); 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) 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); u16 species = GetMonData(mon, MON_DATA_SPECIES);
u32 pid = GetMonData(mon, MON_DATA_PERSONALITY); u32 pid = GetMonData(mon, MON_DATA_PERSONALITY);
HandleLoadSpecialPokePic(&gMonFrontPicTable[species], HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[(useAlt * 2) + B_POSITION_OPPONENT_LEFT], gMonSpritesGfxPtr->sprites.ptr[(useAlt * 2) + B_POSITION_OPPONENT_LEFT],
species, pid); species, pid);
LoadCompressedSpritePalette(GetMonSpritePalStruct(mon)); 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 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_Crusher_Gfx[] = INCBIN_U32("graphics/berry_crush/crusher.4bpp.lz");
const u32 gBerryCrush_TextWindows_Tilemap[] = INCBIN_U32("graphics/berry_crush/text_windows.bin.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 "trig.h"
#include "window.h" #include "window.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/battle_move_effects.h"
#include "gba/io_reg.h" #include "gba/io_reg.h"
extern const struct CompressedSpriteSheet gMonFrontPicTable[]; 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); AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x29, TEXT_SKIP_DRAW, NULL);
if (move->effect != EFFECT_PLACEHOLDER)
str = gMoveDescriptionPointers[chosenMove - 1]; str = gMoveDescriptionPointers[chosenMove - 1];
else
str = gNotDoneYetDescription;
AddTextPrinterParameterized(0, FONT_NARROW, str, 0, 0x41, 0, NULL); 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 trainerId = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
u32 personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, 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); LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst);
} }
} }

View File

@ -6134,7 +6134,7 @@ void ChooseMonForWirelessMinigame(void)
static u8 GetPartyLayoutFromBattleType(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; return PARTY_LAYOUT_SINGLE;
if (IsMultiBattle() == TRUE) if (IsMultiBattle() == TRUE)
return PARTY_LAYOUT_MULTI; return PARTY_LAYOUT_MULTI;

View File

@ -727,7 +727,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
// Load mon gfx // Load mon gfx
species = GetMonData(mon, MON_DATA_SPECIES2); species = GetMonData(mon, MON_DATA_SPECIES2);
personality = GetMonData(mon, MON_DATA_PERSONALITY); 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++; sPokeblockFeed->loadGfxState++;
break; break;
case 1: case 1:

View File

@ -7520,14 +7520,14 @@ const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 p
shinyValue = GET_SHINY_VALUE(otId, personality); shinyValue = GET_SHINY_VALUE(otId, personality);
if (shinyValue < SHINY_ODDS) if (shinyValue < SHINY_ODDS)
{ {
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) if (ShouldShowFemaleDifferences(species, personality))
return gMonShinyPaletteTableFemale[species].data; return gMonShinyPaletteTableFemale[species].data;
else else
return gMonShinyPaletteTable[species].data; return gMonShinyPaletteTable[species].data;
} }
else else
{ {
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) if (ShouldShowFemaleDifferences(species, personality))
return gMonPaletteTableFemale[species].data; return gMonPaletteTableFemale[species].data;
else else
return gMonPaletteTable[species].data; return gMonPaletteTable[species].data;
@ -7549,14 +7549,14 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u
shinyValue = GET_SHINY_VALUE(otId, personality); shinyValue = GET_SHINY_VALUE(otId, personality);
if (shinyValue < SHINY_ODDS) if (shinyValue < SHINY_ODDS)
{ {
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) if (ShouldShowFemaleDifferences(species, personality))
return &gMonShinyPaletteTableFemale[species]; return &gMonShinyPaletteTableFemale[species];
else else
return &gMonShinyPaletteTable[species]; return &gMonShinyPaletteTable[species];
} }
else else
{ {
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE) if (ShouldShowFemaleDifferences(species, personality))
return &gMonPaletteTableFemale[species]; return &gMonPaletteTableFemale[species];
else else
return &gMonPaletteTable[species]; return &gMonPaletteTable[species];
@ -8359,3 +8359,8 @@ void TrySpecialOverworldEvo(void)
sTriedEvolving = 0; sTriedEvolving = 0;
SetMainCallback2(CB2_ReturnToField); 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) void CB2_Debug_Pokemon(void)
{ {
u8 taskId; u8 taskId;
@ -1180,7 +1183,7 @@ void CB2_Debug_Pokemon(void)
palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny); palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny);
LoadCompressedSpritePalette(palette); LoadCompressedSpritePalette(palette);
//Front //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->isShiny = FALSE;
data->isFemale = FALSE; data->isFemale = FALSE;
BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1);
@ -1195,7 +1198,7 @@ void CB2_Debug_Pokemon(void)
LoadAndCreateEnemyShadowSpriteCustom(data, species); LoadAndCreateEnemyShadowSpriteCustom(data, species);
//Back //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); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 4);
SetMultiuseSpriteTemplateToPokemon(species, 2); SetMultiuseSpriteTemplateToPokemon(species, 2);
offset_y = gMonBackPicCoords[species].y_offset; offset_y = gMonBackPicCoords[species].y_offset;
@ -1205,7 +1208,7 @@ void CB2_Debug_Pokemon(void)
gSprites[data->backspriteId].oam.priority = 0; gSprites[data->backspriteId].oam.priority = 0;
//Icon Sprite //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; gSprites[data->iconspriteId].oam.priority = 0;
//Modify Arrows //Modify Arrows
@ -1692,7 +1695,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny); palette = GetMonSpritePalStructCustom(species, data->isFemale, data->isShiny);
LoadCompressedSpritePalette(palette); LoadCompressedSpritePalette(palette);
//Front //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); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 1);
SetMultiuseSpriteTemplateToPokemon(species, 1); SetMultiuseSpriteTemplateToPokemon(species, 1);
gMultiuseSpriteTemplate.paletteTag = palette->tag; gMultiuseSpriteTemplate.paletteTag = palette->tag;
@ -1705,7 +1708,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
LoadAndCreateEnemyShadowSpriteCustom(data, species); LoadAndCreateEnemyShadowSpriteCustom(data, species);
//Back //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); BattleLoadOpponentMonSpriteGfxCustom(species, data->isFemale, data->isShiny, 5);
SetMultiuseSpriteTemplateToPokemon(species, 2); SetMultiuseSpriteTemplateToPokemon(species, 2);
offset_y = gMonBackPicCoords[species].y_offset; offset_y = gMonBackPicCoords[species].y_offset;
@ -1715,7 +1718,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data)
gSprites[data->backspriteId].oam.priority = 0; gSprites[data->backspriteId].oam.priority = 0;
//Icon Sprite //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; gSprites[data->iconspriteId].oam.priority = 0;
//Modify Arrows //Modify Arrows

View File

@ -23,10 +23,6 @@ struct MonIconSpriteTemplate
static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8); static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8);
static void FreeAndDestroyMonIconSprite_(struct Sprite *sprite); 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[] = 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) if (species > NUM_SPECIES)
iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG; 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]; iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndicesFemale[species];
spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority); 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; 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) 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); 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) void FreeAndDestroyMonIconSprite(struct Sprite *sprite)
{ {
FreeAndDestroyMonIconSprite_(sprite); FreeAndDestroyMonIconSprite_(sprite);
@ -2772,24 +2735,15 @@ void SpriteCB_MonIcon(struct Sprite *sprite)
const u8 *GetMonIconTiles(u16 species, u32 personality) const u8 *GetMonIconTiles(u16 species, u32 personality)
{ {
const u8 *iconSprite = gMonIconTable[species]; const u8 *iconSprite;
if ((gBaseStats[species].flags & FLAG_GENDER_DIFFERENCE) && GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE)
{ if (ShouldShowFemaleDifferences(species, personality))
iconSprite = gMonIconTableFemale[species]; iconSprite = gMonIconTableFemale[species];
} else
iconSprite = gMonIconTable[species];
return iconSprite; 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) void TryLoadAllMonIconPalettesAtOffset(u16 offset)
{ {

View File

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

View File

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

View File

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

View File

@ -534,7 +534,7 @@ static void ConditionGraphDrawMonPic(s16 listId, u8 loadId)
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL); species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL);
tid = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL); tid = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, 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]); 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); species = GetMonData(mon, MON_DATA_SPECIES2);
personality = GetMonData(mon, MON_DATA_PERSONALITY); 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)); LoadCompressedSpritePalette(GetMonSpritePalStruct(mon));
sTradeData->monSpecies[whichParty] = species; sTradeData->monSpecies[whichParty] = species;
@ -3727,7 +3727,7 @@ static bool8 AnimateTradeSequenceCable(void)
case TS_STATE_POKEBALL_ARRIVE_WAIT: case TS_STATE_POKEBALL_ARRIVE_WAIT:
if (gSprites[sTradeData->bouncingPokeballSpriteId].callback == SpriteCallbackDummy) 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++; sTradeData->state++;
} }
break; break;
@ -4224,7 +4224,7 @@ static bool8 AnimateTradeSequenceWireless(void)
case TS_STATE_POKEBALL_ARRIVE_WAIT: case TS_STATE_POKEBALL_ARRIVE_WAIT:
if (gSprites[sTradeData->bouncingPokeballSpriteId].callback == SpriteCallbackDummy) if (gSprites[sTradeData->bouncingPokeballSpriteId].callback == SpriteCallbackDummy)
{ {
HandleLoadSpecialPokePic(&gMonFrontPicTable[sTradeData->monSpecies[TRADE_PARTNER]], HandleLoadSpecialPokePic(TRUE,
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT], gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT],
sTradeData->monSpecies[TRADE_PARTNER], sTradeData->monSpecies[TRADE_PARTNER],
sTradeData->monPersonalities[TRADE_PARTNER]); sTradeData->monPersonalities[TRADE_PARTNER]);

View File

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