Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into battle_engine
This commit is contained in:
commit
a93a8b2194
12 changed files with 65 additions and 6 deletions
|
@ -815,6 +815,7 @@ gBattleAnims_General::
|
|||
.4byte General_IllusionOff
|
||||
.4byte General_FormChange
|
||||
.4byte General_SlideOffScreen
|
||||
.4byte General_RestoreBg
|
||||
|
||||
.align 2
|
||||
gBattleAnims_Special::
|
||||
|
@ -8453,6 +8454,8 @@ Move_GRASSY_TERRAIN::
|
|||
delay 4
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(31, 24, 31)
|
||||
waitforvisualfinish
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
Move_MISTY_TERRAIN::
|
||||
|
@ -8491,6 +8494,8 @@ Move_MISTY_TERRAIN::
|
|||
delay 4
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 7, 0, RGB(31, 24, 31)
|
||||
waitforvisualfinish
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
Move_ELECTRIFY::
|
||||
|
@ -9374,6 +9379,8 @@ Move_ELECTRIC_TERRAIN::
|
|||
delay 2
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(28, 28, 0)
|
||||
waitforvisualfinish
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
Move_DAZZLING_GLEAM::
|
||||
|
@ -9451,6 +9458,7 @@ Move_BABY_DOLL_EYES::
|
|||
loadspritegfx ANIM_TAG_PINK_CLOUD
|
||||
loadspritegfx ANIM_TAG_OPENING_EYE @eye
|
||||
setalpha 8, 8
|
||||
monbg ANIM_DEF_PARTNER
|
||||
launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x0 0x0 0xA 0x7FFF
|
||||
waitforvisualfinish
|
||||
launchtemplate gOpeningEyeSpriteTemplate 0x5 0x4 0x0 0x0 0x1 0x0
|
||||
|
@ -9463,6 +9471,7 @@ Move_BABY_DOLL_EYES::
|
|||
launchtask AnimTask_ShakeMon2 0x2 0x5 0x3 0x1 0x0 0x9 0x1
|
||||
launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x0 0xA 0x0 0x7FFF
|
||||
waitforvisualfinish
|
||||
clearmonbg ANIM_DEF_PARTNER
|
||||
blendoff
|
||||
end
|
||||
|
||||
|
@ -11027,6 +11036,8 @@ Move_PSYCHIC_TERRAIN::
|
|||
delay 4
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_BG, 3, 4, 0, RGB(27, 0, 13)
|
||||
waitforvisualfinish
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
Move_LUNGE::
|
||||
|
@ -24320,6 +24331,11 @@ General_TerrainElectric:
|
|||
General_TerrainPsychic:
|
||||
end
|
||||
|
||||
General_RestoreBg:
|
||||
restorebg
|
||||
waitbgfadein
|
||||
end
|
||||
|
||||
SnatchMoveTrySwapFromSubstitute:
|
||||
createvisualtask AnimTask_IsAttackerBehindSubstitute, 2
|
||||
jumprettrue SnatchMoveSwapSubstituteForMon
|
||||
|
|
|
@ -5424,21 +5424,25 @@ BattleScript_MagicRoomEnds::
|
|||
BattleScript_ElectricTerrainEnds::
|
||||
printstring STRINGID_ELECTRICTERRAINENDS
|
||||
waitmessage 0x40
|
||||
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL
|
||||
end2
|
||||
|
||||
BattleScript_MistyTerrainEnds::
|
||||
printstring STRINGID_MISTYTERRAINENDS
|
||||
waitmessage 0x40
|
||||
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL
|
||||
end2
|
||||
|
||||
BattleScript_GrassyTerrainEnds::
|
||||
printstring STRINGID_GRASSYTERRAINENDS
|
||||
waitmessage 0x40
|
||||
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL
|
||||
end2
|
||||
|
||||
BattleScript_PsychicTerrainEnds::
|
||||
printstring STRINGID_PSYCHICTERRAINENDS
|
||||
waitmessage 0x40
|
||||
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL
|
||||
end2
|
||||
|
||||
BattleScript_MudSportEnds::
|
||||
|
|
|
@ -68,6 +68,7 @@ s16 KeepPanInRange(s16 a, int oldPan);
|
|||
s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan);
|
||||
void sub_80A4720(u16 a, u16 *b, u32 c, u8 d);
|
||||
void sub_80A477C(bool8);
|
||||
void LoadMoveBg(u16 bgId);
|
||||
|
||||
// battle_intro.c
|
||||
void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value);
|
||||
|
|
|
@ -9,5 +9,6 @@ void LoadBattleTextboxAndBackground(void);
|
|||
void InitLinkBattleVsScreen(u8 taskId);
|
||||
void DrawBattleEntryBackground(void);
|
||||
bool8 LoadChosenBattleElement(u8 caseId);
|
||||
void DrawTerrainTypeBattleBackground(void);
|
||||
|
||||
#endif // GUARD_BATTLE_BG_H
|
||||
|
|
|
@ -234,6 +234,8 @@
|
|||
#define STATUS_FIELD_ION_DELUGE 0x400
|
||||
#define STATUS_FIELD_FAIRY_LOCK 0x800
|
||||
|
||||
#define STATUS_TERRAIN_ANY (STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN)
|
||||
|
||||
// Flags describing move's result
|
||||
#define MOVE_RESULT_MISSED (1 << 0)
|
||||
#define MOVE_RESULT_SUPER_EFFECTIVE (1 << 1)
|
||||
|
|
|
@ -525,6 +525,7 @@
|
|||
#define B_ANIM_ILLUSION_OFF 0x1C
|
||||
#define B_ANIM_FORM_CHANGE 0x1D
|
||||
#define B_ANIM_SLIDE_OFFSCREEN 0x1E // for Emergency Exit
|
||||
#define B_ANIM_RESTORE_BG 0x1F // for Terrain Endings
|
||||
|
||||
// special animations table
|
||||
#define B_ANIM_LVL_UP 0x0
|
||||
|
|
|
@ -165,5 +165,6 @@
|
|||
#define B_NEW_SURF_PARTICLE_PALETTE TRUE // If set to TRUE, it updates Surf's wave palette.
|
||||
|
||||
#define HIDE_HEALTHBOXES_DURING_ANIMS TRUE //if TRUE, hides healthboxes during move animations
|
||||
#define B_TERRAIN_BG_CHANGE TRUE // If TRUE, terrain moves permanently change the default battle background until the effect fades.
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_CONFIG_H
|
||||
|
|
|
@ -88,7 +88,6 @@ static void Task_PanFromInitialToTarget(u8 taskId);
|
|||
static void Task_LoopAndPlaySE(u8 taskId);
|
||||
static void Task_WaitAndPlaySE(u8 taskId);
|
||||
static void LoadDefaultBg(void);
|
||||
static void LoadMoveBg(u16 bgId);
|
||||
|
||||
// ewram
|
||||
EWRAM_DATA static const u8 *sBattleAnimScriptPtr = NULL;
|
||||
|
@ -3177,7 +3176,7 @@ static void Task_FadeToBg(u8 taskId)
|
|||
}
|
||||
}
|
||||
|
||||
static void LoadMoveBg(u16 bgId)
|
||||
void LoadMoveBg(u16 bgId)
|
||||
{
|
||||
if (IsContest())
|
||||
{
|
||||
|
@ -3205,6 +3204,10 @@ static void LoadDefaultBg(void)
|
|||
{
|
||||
if (IsContest())
|
||||
LoadContestBgAfterMoveAnim();
|
||||
#if B_TERRAIN_BG_CHANGE == TRUE
|
||||
else if (gFieldStatuses & STATUS_TERRAIN_ANY)
|
||||
DrawTerrainTypeBattleBackground();
|
||||
#endif
|
||||
else
|
||||
DrawMainBattleBackground();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_bg.h"
|
||||
#include "battle_main.h"
|
||||
#include "battle_message.h"
|
||||
|
@ -23,6 +24,7 @@
|
|||
#include "constants/map_types.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/trainers.h"
|
||||
#include "constants/battle_anim.h"
|
||||
|
||||
struct BattleBackground
|
||||
{
|
||||
|
@ -863,7 +865,11 @@ void LoadBattleTextboxAndBackground(void)
|
|||
CopyBgTilemapBufferToVram(0);
|
||||
LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40);
|
||||
LoadBattleMenuWindowGfx();
|
||||
DrawMainBattleBackground();
|
||||
#if B_TERRAIN_BG_CHANGE == TRUE
|
||||
DrawTerrainTypeBattleBackground();
|
||||
#else
|
||||
DrawMainBattleBackground();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY)
|
||||
|
@ -1413,3 +1419,26 @@ bool8 LoadChosenBattleElement(u8 caseId)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DrawTerrainTypeBattleBackground(void)
|
||||
{
|
||||
switch (gFieldStatuses & STATUS_TERRAIN_ANY)
|
||||
{
|
||||
case STATUS_FIELD_GRASSY_TERRAIN:
|
||||
LoadMoveBg(BG_GRASSY_TERRAIN);
|
||||
break;
|
||||
case STATUS_FIELD_MISTY_TERRAIN:
|
||||
LoadMoveBg(BG_MISTY_TERRAIN);
|
||||
break;
|
||||
case STATUS_FIELD_ELECTRIC_TERRAIN:
|
||||
LoadMoveBg(BG_ELECTRIC_TERRAIN);
|
||||
break;
|
||||
case STATUS_FIELD_PSYCHIC_TERRAIN:
|
||||
LoadMoveBg(BG_PSYCHIC_TERRAIN);
|
||||
break;
|
||||
default:
|
||||
DrawMainBattleBackground();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3432,7 +3432,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
|
|||
srcID += 2;
|
||||
break;
|
||||
case B_BUFF_ABILITY: // ability names
|
||||
StringAppend(dst, gAbilityNames[src[srcID + 1]]);
|
||||
StringAppend(dst, gAbilityNames[T1_READ_16(&src[srcID + 1])]);
|
||||
srcID += 3;
|
||||
break;
|
||||
case B_BUFF_ITEM: // item name
|
||||
|
|
|
@ -6973,7 +6973,7 @@ static void HandleTerrainMove(u32 moveEffect)
|
|||
}
|
||||
else
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN);
|
||||
gFieldStatuses &= ~STATUS_TERRAIN_ANY;
|
||||
gFieldStatuses |= statusFlag;
|
||||
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_TERRAIN_EXTENDER)
|
||||
*timer = 8;
|
||||
|
|
|
@ -45,7 +45,8 @@ void FreeBattleResources(void)
|
|||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
|
||||
FreeTrainerHillBattleStruct();
|
||||
|
||||
|
||||
gFieldStatuses = 0;
|
||||
if (gBattleResources != NULL)
|
||||
{
|
||||
FREE_AND_SET_NULL(gBattleStruct);
|
||||
|
|
Loading…
Reference in a new issue