up to x48 and troubles

This commit is contained in:
DizzyEggg 2017-09-22 21:33:49 +02:00
parent cf26b0e125
commit d5afb0c6e9
22 changed files with 2013 additions and 6095 deletions

View File

@ -6513,7 +6513,7 @@ _0803A0AE:
ldr r5, =gPauseCounterBattle
ldr r6, =gBattleMoveDamage
ldr r7, =gUnknown_020243FC
ldr r0, =gUnknown_03005D54
ldr r0, =gLeveledUpInBattle
mov r8, r0
ldr r1, =gAbsentBankFlags
mov r9, r1
@ -7256,8 +7256,8 @@ _0803A6B4:
.pool
thumb_func_end sub_803A284
thumb_func_start sub_803A75C
sub_803A75C: @ 803A75C
thumb_func_start UndoEffectsAfterFainting
UndoEffectsAfterFainting: @ 803A75C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
@ -7786,7 +7786,7 @@ _0803AB6C:
pop {r0}
bx r0
.pool
thumb_func_end sub_803A75C
thumb_func_end UndoEffectsAfterFainting
thumb_func_start bc_8012FAC
bc_8012FAC: @ 803ABC0
@ -12891,7 +12891,7 @@ _0803D920:
ands r2, r0
cmp r2, 0
beq _0803D95C
bl sub_805EA60
bl BattleMusicStop
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DAA87
str r0, [r1]
@ -12912,7 +12912,7 @@ _0803D95C:
beq _0803D968
b _0803DA9E
_0803D968:
bl sub_805EA60
bl BattleMusicStop
ldr r1, =gBattlescriptCurrInstr
ldr r0, =gUnknown_082DA92D
str r0, [r1]
@ -13371,7 +13371,7 @@ sub_803DE40: @ 803DE40
cmp r0, 0
bne _0803DE86
bl ResetSpriteData
ldr r0, =gUnknown_03005D54
ldr r0, =gLeveledUpInBattle
ldrb r0, [r0]
cmp r0, 0
beq _0803DE62
@ -13409,7 +13409,7 @@ _0803DEA2:
thumb_func_start bc_evolution_cutscene
bc_evolution_cutscene: @ 803DEB4
push {r4-r6,lr}
ldr r0, =gUnknown_03005D54
ldr r0, =gLeveledUpInBattle
ldrb r1, [r0]
adds r3, r0, 0
cmp r1, 0
@ -13454,7 +13454,7 @@ _0803DEC2:
.pool
_0803DF20:
adds r6, 0x1
ldr r3, =gUnknown_03005D54
ldr r3, =gLeveledUpInBattle
cmp r6, 0x5
ble _0803DEC2
ldrb r0, [r3]
@ -16323,7 +16323,7 @@ PrepareStringBattle: @ 803F964
sub_803F988: @ 803F988
push {r4-r6,lr}
movs r3, 0
ldr r0, =gUnknown_020243FE
ldr r0, =gSentPokesToOpponent
strb r3, [r0]
strb r3, [r0, 0x1]
movs r1, 0
@ -16351,7 +16351,7 @@ _0803F9B6:
ldrb r0, [r2]
cmp r1, r0
bge _0803F9D6
ldr r5, =gUnknown_020243FE
ldr r5, =gSentPokesToOpponent
movs r4, 0x2
_0803F9C4:
adds r0, r1, 0
@ -16389,7 +16389,7 @@ sub_803F9EC: @ 803F9EC
lsls r0, 24
lsrs r0, 25
mov r12, r0
ldr r1, =gUnknown_020243FE
ldr r1, =gSentPokesToOpponent
adds r0, r1
strb r4, [r0]
adds r5, r4, 0
@ -16453,7 +16453,7 @@ _0803FA8C:
ldrb r0, [r5]
cmp r3, r0
bge _0803FAC2
ldr r0, =gUnknown_020243FE
ldr r0, =gSentPokesToOpponent
mov r12, r0
movs r7, 0x2
ldr r6, =gBitTable

File diff suppressed because it is too large Load Diff

View File

@ -183,8 +183,8 @@ _080570D0:
.pool
thumb_func_end sub_8057028
thumb_func_start sub_80570F4
sub_80570F4: @ 80570F4
thumb_func_start AdjustFriendshipOnBattleFaint
AdjustFriendshipOnBattleFaint: @ 80570F4
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
@ -285,7 +285,7 @@ _080571CE:
pop {r0}
bx r0
.pool
thumb_func_end sub_80570F4
thumb_func_end AdjustFriendshipOnBattleFaint
thumb_func_start sub_80571DC
sub_80571DC: @ 80571DC
@ -414,7 +414,7 @@ _0805729A:
ldr r1, =0xf7ffffff
ands r0, r1
str r0, [r2]
bl b_movescr_stack_push_cursor
bl BattleScriptPushCursor
movs r0, 0x1
mov r2, r10
strb r0, [r2, 0x5]
@ -474,7 +474,7 @@ _08057354:
ldr r1, =0xf7ffffff
ands r0, r1
str r0, [r2]
bl b_movescr_stack_push_cursor
bl BattleScriptPushCursor
ldr r0, =gBattleCommunication
strb r4, [r0, 0x5]
ldr r1, =gBattlescriptCurrInstr
@ -523,7 +523,7 @@ _080573D4:
negs r1, r1
ands r0, r1
str r0, [r4]
bl b_movescr_stack_push_cursor
bl BattleScriptPushCursor
ldr r1, =gBattlescriptCurrInstr
ldr r0, =BattleScript_MoveUsedUnfroze
str r0, [r1]

View File

@ -2937,8 +2937,8 @@ _0805EA5A:
bx r0
thumb_func_end sub_805E990
thumb_func_start sub_805EA60
sub_805EA60: @ 805EA60
thumb_func_start BattleMusicStop
BattleMusicStop: @ 805EA60
push {r4-r6,lr}
movs r0, 0
bl GetBankByPlayerAI
@ -2977,7 +2977,7 @@ _0805EAA2:
pop {r0}
bx r0
.pool
thumb_func_end sub_805EA60
thumb_func_end BattleMusicStop
thumb_func_start sub_805EAB4
sub_805EAB4: @ 805EAB4

View File

@ -5565,7 +5565,7 @@ sub_806743C: @ 806743C
ldrb r0, [r0]
cmp r0, 0
beq _08067478
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -4874,7 +4874,7 @@ sub_814D9D8: @ 814D9D8
ldrb r0, [r0]
cmp r0, 0
beq _0814DA14
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -6015,7 +6015,7 @@ sub_8062630: @ 8062630
ldrb r0, [r0]
cmp r0, 0
beq _0806266C
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -8913,7 +8913,7 @@ _0805C3BC:
sub_805C3EC: @ 805C3EC
push {lr}
sub sp, 0x4
bl sub_805EA60
bl BattleMusicStop
movs r0, 0x1
negs r0, r0
movs r1, 0
@ -9595,7 +9595,7 @@ sub_805C9B0: @ 805C9B0
ldrb r0, [r0]
cmp r0, 0
beq _0805C9EC
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -5661,7 +5661,7 @@ sub_81BE03C: @ 81BE03C
ldrb r0, [r0]
cmp r0, 0
beq _081BE078
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -5304,7 +5304,7 @@ sub_818936C: @ 818936C
ldrb r0, [r0]
cmp r0, 0
beq _081893A8
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -5455,7 +5455,7 @@ sub_818C994: @ 818C994
ldrb r0, [r0]
cmp r0, 0
beq _0818C9D0
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -1161,7 +1161,7 @@ dp01t_34_6_move_anim_start_t3: @ 8159CC4
ldrb r0, [r0]
cmp r0, 0
beq _08159D00
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -4150,7 +4150,7 @@ sub_816A840: @ 816A840
ldrb r0, [r0]
cmp r0, 0
beq _0816A87C
bl sub_805EA60
bl BattleMusicStop
ldrb r1, [r5]
lsls r1, 9
adds r0, r4, 0x1

View File

@ -2355,8 +2355,8 @@ dp01_build_cmdbuf_x09_9_9_9: @ 8033A24
.pool
thumb_func_end dp01_build_cmdbuf_x09_9_9_9
thumb_func_start dp01_build_cmdbuf_x0A_A_A_A
dp01_build_cmdbuf_x0A_A_A_A: @ 8033A44
thumb_func_start EmitFaintAnimation
EmitFaintAnimation: @ 8033A44
push {lr}
lsls r0, 24
lsrs r0, 24
@ -2371,7 +2371,7 @@ dp01_build_cmdbuf_x0A_A_A_A: @ 8033A44
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x0A_A_A_A
thumb_func_end EmitFaintAnimation
thumb_func_start dp01_build_cmdbuf_x0B_B_B_B
dp01_build_cmdbuf_x0B_B_B_B: @ 8033A64
@ -2967,8 +2967,8 @@ EmitHealthBarUpdate: @ 8033EFC
.pool
thumb_func_end EmitHealthBarUpdate
thumb_func_start dp01_build_cmdbuf_x19_a_bb
dp01_build_cmdbuf_x19_a_bb: @ 8033F34
thumb_func_start EmitExpUpdate
EmitExpUpdate: @ 8033F34
push {r4,lr}
adds r4, r1, 0
lsls r0, 24
@ -2993,7 +2993,7 @@ dp01_build_cmdbuf_x19_a_bb: @ 8033F34
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x19_a_bb
thumb_func_end EmitExpUpdate
thumb_func_start dp01_build_cmdbuf_x1A_aaaa_bbbb
dp01_build_cmdbuf_x1A_aaaa_bbbb: @ 8033F68
@ -3661,8 +3661,8 @@ dp01_build_cmdbuf_x33_a_33_33: @ 8034414
.pool
thumb_func_end dp01_build_cmdbuf_x33_a_33_33
thumb_func_start dp01_build_cmdbuf_x34_a_bb_aka_battle_anim
dp01_build_cmdbuf_x34_a_bb_aka_battle_anim: @ 8034438
thumb_func_start EmitBattleAnimation
EmitBattleAnimation: @ 8034438
push {r4,lr}
adds r4, r1, 0
lsls r0, 24
@ -3682,7 +3682,7 @@ dp01_build_cmdbuf_x34_a_bb_aka_battle_anim: @ 8034438
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x34_a_bb_aka_battle_anim
thumb_func_end EmitBattleAnimation
thumb_func_start sub_8034464
sub_8034464: @ 8034464

View File

@ -33,10 +33,10 @@ gUnknown_082D9EFB:: @ 82D9EFB
gUnknown_082D9F1C:: @ 82D9F1C
.incbin "baserom.gba", 0x2d9f1c, 0x88e
gUnknown_082DA7AA:: @ 82DA7AA
BattleScript_FaintAttacker:: @ 82DA7AA
.incbin "baserom.gba", 0x2da7aa, 0xd
gUnknown_082DA7B7:: @ 82DA7B7
BattleScript_FaintTarget:: @ 82DA7B7
.incbin "baserom.gba", 0x2da7b7, 0xd
gUnknown_082DA7C4:: @ 82DA7C4
@ -93,7 +93,7 @@ gUnknown_082DAB15:: @ 82DAB15
BattleScript_Pausex20:: @ 82DABB9
.incbin "baserom.gba", 0x2dabb9, 0x4
gUnknown_082DABBD:: @ 82DABBD
BattleScript_LevelUp:: @ 82DABBD
.incbin "baserom.gba", 0x2dabbd, 0x6f
gUnknown_082DAC2C:: @ 82DAC2C
@ -156,7 +156,7 @@ gUnknown_082DAE2A:: @ 82DAE2A
BattleScript_EncoredNoMore:: @ 82DAE37
.incbin "baserom.gba", 0x2dae37, 0x7
gUnknown_082DAE3E:: @ 82DAE3E
BattleScript_DestinyBondTakesLife:: @ 82DAE3E
.incbin "baserom.gba", 0x2dae3e, 0x1b
gUnknown_082DAE59:: @ 82DAE59
@ -237,7 +237,7 @@ gUnknown_082DB181:: @ 82DB181
gUnknown_082DB185:: @ 82DB185
.incbin "baserom.gba", 0x2db185, 0x8
gUnknown_082DB18D:: @ 82DB18D
BattleScript_GrudgeTakesPp:: @ 82DB18D
.incbin "baserom.gba", 0x2db18d, 0x7
BattleScript_MagicCoatBounce:: @ 82DB194
@ -411,7 +411,7 @@ BattleScript_SoundproofProtected:: @ 82DB61F
gUnknown_082DB62F:: @ 82DB62F
.incbin "baserom.gba", 0x2db62f, 0x10
gUnknown_082DB63F:: @ 82DB63F
BattleScript_StickyHoldOnKnockOff:: @ 82DB63F
.incbin "baserom.gba", 0x2db63f, 0xe
BattleScript_ColorChangeActivates:: @ 82DB64D

View File

@ -218,13 +218,23 @@
#define TYPE_MUL_NORMAL 10
#define TYPE_MUL_SUPER_EFFECTIVE 20
#define BS_GET_TARGET 0
#define BS_GET_ATTACKER 1
#define BS_GET_EFFECT_BANK 2
#define BS_GET_SCRIPTING_BANK 10
#define BS_GET_OPPONENT1 12
#define BS_GET_PLAYER2 13
#define BS_GET_OPPONENT2 14
#define BS_GET_TARGET 0
#define BS_GET_ATTACKER 1
#define BS_GET_EFFECT_BANK 2
#define BS_GET_ATTACKER_SIDE 8 // for atk1E_jumpifability
#define BS_GET_NOT_ATTACKER_SIDE 9 // for atk1E_jumpifability
#define BS_GET_SCRIPTING_BANK 10
#define BS_GET_OPPONENT1 12
#define BS_GET_PLAYER2 13
#define BS_GET_OPPONENT2 14
// for battle script commands
#define CMP_EQUAL 0x0
#define CMP_NOT_EQUAL 0x1
#define CMP_GREATER_THAN 0x2
#define CMP_LESS_THAN 0x3
#define CMP_COMMON_BITS 0x4
#define CMP_NO_COMMON_BITS 0x5
struct Trainer
{
@ -422,13 +432,23 @@ struct BattleCallbacksStack
u8 size;
};
struct StatsArray
{
u16 hp;
u16 atk;
u16 def;
u16 spd;
u16 spAtk;
u16 spDef;
};
struct BattleResources
{
struct SecretBaseRecord* secretBase;
struct UnknownFlags *flags;
struct BattleScriptsStack* battleScriptsStack;
struct BattleCallbacksStack* battleCallbackStack;
void* statsBeforeLvlUp;
struct StatsArray* statsBeforeLvlUp;
struct AI_ThinkingStruct *ai;
struct BattleHistory *battleHistory;
struct BattleScriptsStack *AI_ScriptsStack;
@ -438,6 +458,7 @@ extern struct BattleResources* gBattleResources;
#define BATTLESCRIPTS_STACK (gBattleResources->battleScriptsStack)
#define BATTLE_CALLBACKS_STACK (gBattleResources->battleCallbackStack)
#define BATTLE_LVLUP_STATS (gBattleResources->statsBeforeLvlUp)
struct BattleResults
{
@ -536,14 +557,10 @@ struct BattleStruct
u8 field_4D;
u8 field_4E;
u8 field_4F;
u8 field_50;
u8 field_51;
u16 expValue;
u8 field_52;
u8 field_53;
u8 field_54;
u8 field_55;
u8 field_56;
u8 field_57;
u8 sentInPokes;
u8 field_54[4];
u8 field_58;
u8 field_59;
u8 field_5A;
@ -642,6 +659,11 @@ struct BattleStruct
u8 field_1A1;
u8 filler1A2;
u8 atkCancellerTracker;
u8 field_1A4[240];
u8 field_294[4];
u8 field_298[8];
u8 field_2A0;
u8 field_2A1;
};
extern struct BattleStruct* gBattleStruct;
@ -677,6 +699,20 @@ extern struct BattleStruct* gBattleStruct;
#define MOVE_EFFECT_CHARGING 0xC
#define MOVE_EFFECT_WRAP 0xD
#define MOVE_EFFECT_RECOIL_25 0xE
#define MOVE_EFFECT_ATK_PLUS_1 0xF
#define MOVE_EFFECT_DEF_PLUS_1 0x10
#define MOVE_EFFECT_SPD_PLUS_1 0x11
#define MOVE_EFFECT_SP_ATK_PLUS_1 0x12
#define MOVE_EFFECT_SP_DEF_PLUS_1 0x13
#define MOVE_EFFECT_ACC_PLUS_1 0x14
#define MOVE_EFFECT_EVS_PLUS_1 0x15
#define MOVE_EFFECT_ATK_MINUS_1 0x16
#define MOVE_EFFECT_DEF_MINUS_1 0x17
#define MOVE_EFFECT_SPD_MINUS_1 0x18
#define MOVE_EFFECT_SP_ATK_MINUS_1 0x19
#define MOVE_EFFECT_SP_DEF_MINUS_1 0x1A
#define MOVE_EFFECT_ACC_MINUS_1 0x1B
#define MOVE_EFFECT_EVS_MINUS_1 0x1C
#define MOVE_EFFECT_RECHARGE 0x1D
#define MOVE_EFFECT_RAGE 0x1E
#define MOVE_EFFECT_STEAL_ITEM 0x1F
@ -687,10 +723,73 @@ extern struct BattleStruct* gBattleStruct;
#define MOVE_EFFECT_REMOVE_PARALYSIS 0x24
#define MOVE_EFFECT_ATK_DEF_DOWN 0x25
#define MOVE_EFFECT_RECOIL_33_PARALYSIS 0x26
#define MOVE_EFFECT_ATK_PLUS_2 0x27
#define MOVE_EFFECT_DEF_PLUS_2 0x28
#define MOVE_EFFECT_SPD_PLUS_2 0x29
#define MOVE_EFFECT_SP_ATK_PLUS_2 0x2A
#define MOVE_EFFECT_SP_DEF_PLUS_2 0x2B
#define MOVE_EFFECT_ACC_PLUS_2 0x2C
#define MOVE_EFFECT_EVS_PLUS_2 0x2D
#define MOVE_EFFECT_ATK_MINUS_2 0x2E
#define MOVE_EFFECT_DEF_MINUS_2 0x2F
#define MOVE_EFFECT_SPD_MINUS_2 0x30
#define MOVE_EFFECT_SP_ATK_MINUS_2 0x31
#define MOVE_EFFECT_SP_DEF_MINUS_2 0x32
#define MOVE_EFFECT_ACC_MINUS_2 0x33
#define MOVE_EFFECT_EVS_MINUS_2 0x34
#define MOVE_EFFECT_THRASH 0x35
#define MOVE_EFFECT_KNOCK_OFF 0x36
#define MOVE_EFFECT_NOTHING_37 0x37
#define MOVE_EFFECT_NOTHING_38 0x38
#define MOVE_EFFECT_NOTHING_39 0x39
#define MOVE_EFFECT_NOTHING_3A 0x3A
#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B
#define MOVE_EFFECT_NOTHING_3C 0x3C
#define MOVE_EFFECT_NOTHING_3D 0x3D
#define MOVE_EFFECT_NOTHING_3E 0x3E
#define MOVE_EFFECT_NOTHING_3F 0x3F
#define MOVE_EFFECT_AFFECTS_USER 0x40
#define MOVE_EFFECT_CERTAIN 0x80
// battle animations ids
#define B_ANIM_CASTFORM_CHANGE 0x0
#define B_ANIM_STATS_CHANGE 0x1
#define B_ANIM_SUBSTITUTE_FADE 0x2
#define B_ANIM_SUBSTITUTE_APPEAR 0x3
#define B_ANIM_x4 0x4
#define B_ANIM_ITEM_KNOCKOFF 0x5
#define B_ANIM_TURN_TRAP 0x6
#define B_ANIM_ITEM_EFFECT 0x7
#define B_ANIM_SMOKEBALL_ESCAPE 0x8
#define B_ANIM_HANGED_ON 0x9
#define B_ANIM_RAIN_CONTINUES 0xA
#define B_ANIM_SUN_CONTINUES 0xB
#define B_ANIM_SANDSTORM_CONTINUES 0xC
#define B_ANIM_HAIL_CONTINUES 0xD
#define B_ANIM_LEECH_SEED_DRAIN 0xE
#define B_ANIM_MON_HIT 0xF
#define B_ANIM_ITEM_STEAL 0x10
#define B_ANIM_SNATCH_MOVE 0x11
#define B_ANIM_FUTURE_SIGHT_HIT 0x12
#define B_ANIM_x13 0x13
#define B_ANIM_x14 0x14
#define B_ANIM_INGRAIN_HEAL 0x15
#define B_ANIM_WISH_HEAL 0x16
#define B_ANIM_x17 0x17
#define B_ANIM_x18 0x18
#define B_ANIM_x19 0x19
#define B_ANIM_x1A 0x1A
#define B_ANIM_x1B 0x1B
#define B_ANIM_x1C 0x1C
#define B_ANIM_x1D 0x1D
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
#define GET_STAT_BUFF_VALUE(n)((n & 0xF0) >> 4) // 0x10, 0x20, 0x40
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
#define SET_STAT_BUFF_ID(n)((n & 0xF))
#define SET_STAT_BUFF_VALUE(n)(((s8)(((s8)(n) << 4)) & 0xF0))
struct BattleScripting
{
@ -718,6 +817,8 @@ struct BattleScripting
u8 animTurn;
u8 animTargetsHit;
u8 statChanger;
u8 field_1B;
u8 atk23_state;
};
extern struct BattleScripting gBattleScripting;
@ -729,10 +830,12 @@ void CancelMultiTurnMoves(u8 bank);
void PressurePPLose(u8 bankAtk, u8 bankDef, u16 move);
void PrepareStringBattle(u16 stringId, u8 bank);
u8 GetBattleBank(u8 caseId);
void UndoEffectsAfterFainting(void);
// battle_3
void b_movescr_stack_push(const u8* bsPtr);
void b_movescr_stack_push_cursor(void);
void BattleScriptPush(const u8* bsPtr);
void BattleScriptPushCursor(void);
void BattleScriptPop(void);
u8 sub_803FB4C(void); // msg, can't select a move
u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check);
bool8 AreAllMovesUnusable(void);
@ -760,6 +863,13 @@ u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef);
u8 AI_TypeCalc(u16 move, u16 species, u8 ability);
u8 BankGetTurnOrder(u8 bank);
// battle_5
void AdjustFriendshipOnBattleFaint(u8 bank);
// battle 7
void BattleMusicStop(void);
void sub_805E990(struct Pokemon* mon, u8 bank);
// rom_80A5C6C
u8 GetBankSide(u8 bank);
u8 GetBankIdentity(u8 bank);

View File

@ -7,6 +7,9 @@ void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32
void EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
void EmitEffectivenessSound(u8 bufferId, u16 songId);
void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId);
void EmitFaintAnimation(u8 bufferId);
void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints);
void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
void MarkBufferBankForExecution(u8 bank);

View File

@ -620,6 +620,9 @@ bool8 IsPokeSpriteNotFlipped(u16 species);
bool8 IsMonShiny(struct Pokemon *mon);
bool8 IsShinyOtIdPersonality(u32 otId, u32 personality);
void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies);
bool8 IsTradedMon(struct Pokemon *mon);
#include "sprite.h"
void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);

View File

@ -196,17 +196,17 @@ extern void sub_803E08C(void);
extern void bc_move_exec_returning(void);
extern s8 GetFlavourRelationByPersonality(u32 personality, u8 flavor);
void b_movescr_stack_push(const u8* bsPtr)
void BattleScriptPush(const u8* bsPtr)
{
BATTLESCRIPTS_STACK->ptr[BATTLESCRIPTS_STACK->size++] = bsPtr;
}
void b_movescr_stack_push_cursor(void)
void BattleScriptPushCursor(void)
{
BATTLESCRIPTS_STACK->ptr[BATTLESCRIPTS_STACK->size++] = gBattlescriptCurrInstr;
}
void b_movescr_stack_pop_cursor(void)
void BattleScriptPop(void)
{
gBattlescriptCurrInstr = BATTLESCRIPTS_STACK->ptr[--BATTLESCRIPTS_STACK->size];
}
@ -1206,7 +1206,7 @@ u8 AtkCanceller_UnableToUseMove(void)
{
gBattleMons[gBankAttacker].status1 &= ~(STATUS_SLEEP);
gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp;
effect = 2;
@ -1234,7 +1234,7 @@ u8 AtkCanceller_UnableToUseMove(void)
else
{
gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp;
effect = 2;
@ -1262,7 +1262,7 @@ u8 AtkCanceller_UnableToUseMove(void)
else // unfreeze
{
gBattleMons[gBankAttacker].status1 &= ~(STATUS_FREEZE);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze;
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
}
@ -1349,7 +1349,7 @@ u8 AtkCanceller_UnableToUseMove(void)
if (Random() & 1)
{
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
}
else // confusion dmg
{
@ -1363,7 +1363,7 @@ u8 AtkCanceller_UnableToUseMove(void)
}
else // snapped out of confusion
{
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MoveUsedIsConfusedNoMore;
}
effect = 1;
@ -1387,10 +1387,10 @@ u8 AtkCanceller_UnableToUseMove(void)
{
gBattleScripting.bank = CountTrailingZeroBits((gBattleMons[gBankAttacker].status2 & STATUS2_INFATUATION) >> 0x10);
if (Random() & 1)
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
else
{
b_movescr_stack_push(BattleScript_MoveUsedIsParalyzedCantAttack);
BattleScriptPush(BattleScript_MoveUsedIsParalyzedCantAttack);
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
gProtectStructs[gBankAttacker].loveImmobility = 1;
CancelMultiTurnMoves(gBankAttacker);
@ -1432,7 +1432,7 @@ u8 AtkCanceller_UnableToUseMove(void)
if (gBattleMoves[gCurrentMove].effect == EFFECT_THAW_HIT)
{
gBattleMons[gBankAttacker].status1 &= ~(STATUS_FREEZE);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze;
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
}
@ -1969,7 +1969,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleTextBuff1[1] = 3;
gBattleTextBuff1[2] = moveType;
gBattleTextBuff1[3] = 0xFF;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ColorChangeActivates;
effect++;
}
@ -1985,7 +1985,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleMoveDamage = gBattleMons[gBankAttacker].maxHP / 16;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_RoughSkinActivates;
effect++;
}
@ -2006,7 +2006,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
if (gBattleCommunication[MOVE_EFFECT_BYTE] == 3)
gBattleCommunication[MOVE_EFFECT_BYTE] += 2;
gBattleCommunication[MOVE_EFFECT_BYTE] += 0x40;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
@ -2021,7 +2021,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
&& (Random() % 3) == 0)
{
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x42;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
@ -2036,7 +2036,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
&& (Random() % 3) == 0)
{
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x45;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
@ -2051,7 +2051,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
&& (Random() % 3) == 0)
{
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x43;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
@ -2073,7 +2073,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
&& GetGenderFromSpeciesAndPersonality(speciesDef, pidDef) != 0xFF)
{
gBattleMons[gBankAttacker].status2 |= (gBitTable[gBankTarget] << 0x10);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_CuteCharmActivates;
effect++;
}
@ -2155,7 +2155,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleMons[i].status2 &= ~(STATUS2_INFATUATION);
break;
}
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = gUnknown_082DB68C;
gBattleScripting.bank = i;
gActiveBank = i;
@ -2197,7 +2197,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleStruct->synchronizeMoveEffect = 2;
gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect + 0x40;
gBattleScripting.bank = gBankTarget;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
@ -2212,7 +2212,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleStruct->synchronizeMoveEffect = 2;
gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect;
gBattleScripting.bank = gBankAttacker;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
@ -2303,7 +2303,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
{
gLastUsedAbility = ABILITY_INTIMIDATE;
gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = gUnknown_082DB4C1;
gBattleStruct->intimidateBank = i;
effect++;
@ -3592,7 +3592,7 @@ _0804330E:\n\
strb r3, [r1, 0x2]\n\
movs r0, 0xFF\n\
strb r0, [r1, 0x3]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_ColorChangeActivates\n\
str r0, [r1]\n\
@ -3668,7 +3668,7 @@ _080433CA:\n\
bne _080433D8\n\
str r2, [r1]\n\
_080433D8:\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_RoughSkinActivates\n\
str r0, [r1]\n\
@ -3763,7 +3763,7 @@ _080434BC:\n\
ldrb r0, [r1, 0x3]\n\
adds r0, 0x40\n\
strb r0, [r1, 0x3]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_ApplySecondaryEffect\n\
str r0, [r1]\n\
@ -3849,7 +3849,7 @@ _08043598:\n\
ldr r1, =gBattleCommunication\n\
movs r0, 0x42\n\
strb r0, [r1, 0x3]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_ApplySecondaryEffect\n\
str r0, [r1]\n\
@ -3935,7 +3935,7 @@ _08043674:\n\
ldr r1, =gBattleCommunication\n\
movs r0, 0x45\n\
strb r0, [r1, 0x3]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_ApplySecondaryEffect\n\
str r0, [r1]\n\
@ -4021,7 +4021,7 @@ _08043750:\n\
ldr r1, =gBattleCommunication\n\
movs r0, 0x43\n\
strb r0, [r1, 0x3]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_ApplySecondaryEffect\n\
str r0, [r1]\n\
@ -4183,7 +4183,7 @@ _080438B6:\n\
ldr r0, [r2]\n\
orrs r0, r1\n\
str r0, [r2]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_CuteCharmActivates\n\
str r0, [r1]\n\
@ -4484,7 +4484,7 @@ _08043BF8:\n\
_08043BFA:\n\
str r0, [r2]\n\
_08043BFC:\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =gUnknown_082DB68C\n\
str r0, [r1]\n\
@ -4607,7 +4607,7 @@ _08043CF8:\n\
ldr r0, =gBankTarget\n\
ldrb r0, [r0]\n\
strb r0, [r1, 0x17]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_SynchronizeActivates\n\
str r0, [r1]\n\
@ -4662,7 +4662,7 @@ _08043D7C:\n\
ldr r0, =gBankAttacker\n\
ldrb r0, [r0]\n\
strb r0, [r1, 0x17]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =BattleScript_SynchronizeActivates\n\
str r0, [r1]\n\
@ -5380,7 +5380,7 @@ _080443B4:\n\
ldr r1, =0xfff7ffff\n\
ands r0, r1\n\
str r0, [r2]\n\
bl b_movescr_stack_push_cursor\n\
bl BattleScriptPushCursor\n\
ldr r1, =gBattlescriptCurrInstr\n\
ldr r0, =gUnknown_082DB4C1\n\
str r0, [r1]\n\
@ -5465,7 +5465,7 @@ void b_call_bc_move_exec(const u8* BS_ptr)
void b_push_move_exec(const u8* BS_ptr)
{
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BS_ptr;
BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc;
gBattleMainFunc = sub_803E08C;
@ -6029,7 +6029,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status1 & STATUS_PARALYSIS)
{
gBattleMons[bank].status1 &= ~(STATUS_PARALYSIS);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BerryCureParRet;
effect = ITEM_STATUS_CHANGE;
}
@ -6038,7 +6038,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status1 & STATUS_PSN_ANY)
{
gBattleMons[bank].status1 &= ~(STATUS_PSN_ANY | STATUS_TOXIC_COUNTER);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BerryCurePsnRet;
effect = ITEM_STATUS_CHANGE;
}
@ -6047,7 +6047,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status1 & STATUS_BURN)
{
gBattleMons[bank].status1 &= ~(STATUS_BURN);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BerryCureBrnRet;
effect = ITEM_STATUS_CHANGE;
}
@ -6056,7 +6056,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status1 & STATUS_FREEZE)
{
gBattleMons[bank].status1 &= ~(STATUS_FREEZE);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BerryCureFrzRet;
effect = ITEM_STATUS_CHANGE;
}
@ -6066,7 +6066,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
{
gBattleMons[bank].status1 &= ~(STATUS_SLEEP);
gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BerryCureSlpRet;
effect = ITEM_STATUS_CHANGE;
}
@ -6075,7 +6075,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status2 & STATUS2_CONFUSION)
{
gBattleMons[bank].status2 &= ~(STATUS2_CONFUSION);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BerryCureConfusionRet;
effect = ITEM_EFFECT_OTHER;
}
@ -6085,7 +6085,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
{
gBattleMons[bank].status2 &= ~(STATUS2_INFATUATION);
StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet;
effect = ITEM_EFFECT_OTHER;
@ -6121,7 +6121,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
}
gBattleMons[bank].status1 = 0;
gBattleMons[bank].status2 &= ~(STATUS2_CONFUSION);
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet;
effect = ITEM_STATUS_CHANGE;
@ -6140,7 +6140,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
{
gBattleScripting.bank = bank;
gStringBank = bank;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_WhiteHerbRet;
return effect; // unnecessary return
}
@ -6170,9 +6170,9 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
&& gBattleMons[gBankTarget].hp)
{
gBattleCommunication[MOVE_EFFECT_BYTE] = 8;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
SetMoveEffect(0, 0);
b_movescr_stack_pop_cursor();
BattleScriptPop();
}
break;
case HOLD_EFFECT_SHELL_BELL:
@ -6190,7 +6190,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMoveDamage == 0)
gBattleMoveDamage = -1;
gSpecialStatuses[gBankTarget].moveturnLostHP = 0;
b_movescr_stack_push_cursor();
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret;
effect++;
}

File diff suppressed because it is too large Load Diff

View File

@ -218,7 +218,7 @@ gUnknown_03005D3A: @ 3005D3A
gUnknown_03005D46: @ 3005D46
.space 0xE
gUnknown_03005D54: @ 3005D54
gLeveledUpInBattle: @ 3005D54
.space 0xC
gBattleBankFunc: @ 3005D60

View File

@ -475,13 +475,13 @@ gWishFutureKnock: @ 20243D0
gUnknown_020243FC: @ 20243FC
.space 0x2
gUnknown_020243FE: @ 20243FE
gSentPokesToOpponent: @ 20243FE
.space 0x2
gDynamicBasePower: @ 2024400
.space 0x2
gUnknown_02024402: @ 2024402
gExpShareExp: @ 2024402
.space 0x2
gEnigmaBerries: @ 2024404