toggleable manual ability popup destruction

This commit is contained in:
Evan 2020-11-19 15:16:27 -07:00
parent fdfe330330
commit ef43596a79
6 changed files with 24 additions and 1 deletions

View File

@ -1755,6 +1755,10 @@
various \battler, VARIOUS_JUMP_IF_ABSENT
.4byte \ptr
.endm
.macro destroyabilitypopup
various BS_ABILITY_BATTLER, VARIOUS_DESTROY_ABILITY_POPUP
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req

View File

@ -520,6 +520,7 @@ struct BattleStruct
u8 savedBattlerTarget;
bool8 ateBoost[MAX_BATTLERS_COUNT];
u8 activeAbilityPopUps; // as bits for each battler
u8 abilityPopUpSpriteIds[MAX_BATTLERS_COUNT][2]; //two per battler
bool8 throwingPokeBall;
struct MegaEvolutionData mega;
const u8 *trainerSlideMsg;
@ -611,6 +612,7 @@ struct BattleScripting
u16 moveEffect;
u16 multihitMoveEffect;
u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN.
bool8 fixedPopup; // force ability popup to stick until manually called back
};
// rom_80A5C6C

View File

@ -92,5 +92,6 @@ s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 arg3);
u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale);
u8 GetHPBarLevel(s16 hp, s16 maxhp);
void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle);
void DestroyAbilityPopUp(u8 battlerId);
#endif // GUARD_BATTLE_INTERFACE_H

View File

@ -35,6 +35,7 @@
#define sMOVE_EFFECT gBattleScripting + 0x2E
#define sMULTIHIT_EFFECT gBattleScripting + 0x30
#define sILLUSION_NICK_HACK gBattleScripting + 0x32
#define sFIXED_ABILITY_POPUP gBattleScripting + 0x33
#define cMULTISTRING_CHOOSER gBattleCommunication + 5
@ -165,6 +166,7 @@
#define VARIOUS_SET_LAST_USED_ITEM 99
#define VARIOUS_PARALYZE_TYPE_IMMUNITY 100
#define VARIOUS_JUMP_IF_ABSENT 101
#define VARIOUS_DESTROY_ABILITY_POPUP 102
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -3062,6 +3062,9 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
gSprites[spriteId1].tRightToLeft = FALSE;
gSprites[spriteId2].tRightToLeft = FALSE;
}
gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][0] = spriteId1;
gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][1] = spriteId2;
taskId = CreateTask(Task_FreeAbilityPopUpGfx, 5);
gTasks[taskId].tSpriteId1 = spriteId1;
@ -3110,11 +3113,19 @@ static void SpriteCb_AbilityPopUp(struct Sprite *sprite)
}
else
{
sprite->tFrames--;
if (!gBattleScripting.fixedPopup)
sprite->tFrames--;
}
}
}
void DestroyAbilityPopUp(u8 battlerId)
{
gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][0]].tFrames = 0;
gSprites[gBattleStruct->abilityPopUpSpriteIds[battlerId][1]].tFrames = 0;
gBattleScripting.fixedPopup = FALSE;
}
static void Task_FreeAbilityPopUpGfx(u8 taskId)
{
if (!gSprites[gTasks[taskId].tSpriteId1].inUse

View File

@ -8300,6 +8300,9 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 7;
}
return;
case VARIOUS_DESTROY_ABILITY_POPUP:
DestroyAbilityPopUp(gActiveBattler);
break;
}
gBattlescriptCurrInstr += 3;