battle2 more and more and more

This commit is contained in:
DizzyEggg 2017-10-06 00:12:01 +02:00
parent d87d19cfe5
commit 342e616d4b
16 changed files with 1046 additions and 2754 deletions

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,7 @@ _0813DA00:
adds r1, r4, 0 adds r1, r4, 0
adds r2, r5, 0 adds r2, r5, 0
adds r3, r6, 0 adds r3, r6, 0
bl evolution_cutscene bl EvolutionScene
_0813DA30: _0813DA30:
add sp, 0x4 add sp, 0x4
pop {r4-r7} pop {r4-r7}
@ -77,8 +77,8 @@ _0813DA30:
.pool .pool
thumb_func_end sub_813D9C0 thumb_func_end sub_813D9C0
thumb_func_start sub_813DA40 thumb_func_start BeginEvolutionScene
sub_813DA40: @ 813DA40 BeginEvolutionScene: @ 813DA40
push {r4-r6,lr} push {r4-r6,lr}
adds r4, r1, 0 adds r4, r1, 0
adds r5, r2, 0 adds r5, r2, 0
@ -110,10 +110,10 @@ sub_813DA40: @ 813DA40
pop {r0} pop {r0}
bx r0 bx r0
.pool .pool
thumb_func_end sub_813DA40 thumb_func_end BeginEvolutionScene
thumb_func_start evolution_cutscene thumb_func_start EvolutionScene
evolution_cutscene: @ 813DA8C EvolutionScene: @ 813DA8C
push {r4-r7,lr} push {r4-r7,lr}
mov r7, r10 mov r7, r10
mov r6, r9 mov r6, r9
@ -393,7 +393,7 @@ evolution_cutscene: @ 813DA8C
pop {r0} pop {r0}
bx r0 bx r0
.pool .pool
thumb_func_end evolution_cutscene thumb_func_end EvolutionScene
thumb_func_start sub_813DD7C thumb_func_start sub_813DD7C
sub_813DD7C: @ 813DD7C sub_813DD7C: @ 813DD7C

View File

@ -13868,7 +13868,7 @@ sub_81B7810: @ 81B7810
adds r0, r7, 0 adds r0, r7, 0
adds r1, r4, 0 adds r1, r4, 0
movs r2, 0x1 movs r2, 0x1
bl sub_813DA40 bl BeginEvolutionScene
adds r0, r5, 0 adds r0, r5, 0
bl DestroyTask bl DestroyTask
b _081B786E b _081B786E

View File

@ -221,7 +221,7 @@ _0806BEE0:
mov r0, r8 mov r0, r8
movs r2, 0 movs r2, 0
ldr r3, [sp, 0x10] ldr r3, [sp, 0x10]
bl sub_813DA40 bl BeginEvolutionScene
movs r0, 0 movs r0, 0
bl _0806CD5C bl _0806CD5C
_0806BEF0: _0806BEF0:

View File

@ -45,34 +45,34 @@ gUnknown_082DA7C4:: @ 82DA7C4
gUnknown_082DA7CD:: @ 82DA7CD gUnknown_082DA7CD:: @ 82DA7CD
.incbin "baserom.gba", 0x2da7cd, 0x160 .incbin "baserom.gba", 0x2da7cd, 0x160
gUnknown_082DA92D:: @ 82DA92D BattleScript_LocalTrainerBattleWon:: @ 82DA92D
.incbin "baserom.gba", 0x2da92d, 0x3d .incbin "baserom.gba", 0x2da92d, 0x3d
gUnknown_082DA96A:: @ 82DA96A BattleScript_PayDayMoneyAndPickUpItems:: @ 82DA96A
.incbin "baserom.gba", 0x2da96a, 0x3 .incbin "baserom.gba", 0x2da96a, 0x3
gUnknown_082DA96D:: @ 82DA96D BattleScript_LocalBattleLost:: @ 82DA96D
.incbin "baserom.gba", 0x2da96d, 0x9e .incbin "baserom.gba", 0x2da96d, 0x9e
gUnknown_082DAA0B:: @ 82DAA0B gUnknown_082DAA0B:: @ 82DAA0B
.incbin "baserom.gba", 0x2daa0b, 0x2a .incbin "baserom.gba", 0x2daa0b, 0x2a
gUnknown_082DAA35:: @ 82DAA35 BattleScript_LinkBattleWonOrLost:: @ 82DAA35
.incbin "baserom.gba", 0x2daa35, 0x52 .incbin "baserom.gba", 0x2daa35, 0x52
gUnknown_082DAA87:: @ 82DAA87 BattleScript_FrontierTrainerBattleWon:: @ 82DAA87
.incbin "baserom.gba", 0x2daa87, 0x54 .incbin "baserom.gba", 0x2daa87, 0x54
gUnknown_082DAADB:: @ 82DAADB BattleScript_SmokeBallEscape:: @ 82DAADB
.incbin "baserom.gba", 0x2daadb, 0xe .incbin "baserom.gba", 0x2daadb, 0xe
gUnknown_082DAAE9:: @ 82DAAE9 BattleScript_RanAwayUsingMonAbility:: @ 82DAAE9
.incbin "baserom.gba", 0x2daae9, 0x7 .incbin "baserom.gba", 0x2daae9, 0x7
gUnknown_082DAAF0:: @ 82DAAF0 BattleScript_GotAwaySafely:: @ 82DAAF0
.incbin "baserom.gba", 0x2daaf0, 0x7 .incbin "baserom.gba", 0x2daaf0, 0x7
gUnknown_082DAAF7:: @ 82DAAF7 BattleScript_WildMonFled:: @ 82DAAF7
.incbin "baserom.gba", 0x2daaf7, 0x7 .incbin "baserom.gba", 0x2daaf7, 0x7
gUnknown_082DAAFE:: @ 82DAAFE gUnknown_082DAAFE:: @ 82DAAFE
@ -87,7 +87,7 @@ gUnknown_082DAB0B:: @ 82DAB0B
gUnknown_082DAB11:: @ 82DAB11 gUnknown_082DAB11:: @ 82DAB11
.incbin "baserom.gba", 0x2dab11, 0x4 .incbin "baserom.gba", 0x2dab11, 0x4
gUnknown_082DAB15:: @ 82DAB15 BattleScript_ActionSwitch:: @ 82DAB15
.incbin "baserom.gba", 0x2dab15, 0xa4 .incbin "baserom.gba", 0x2dab15, 0xa4
BattleScript_Pausex20:: @ 82DABB9 BattleScript_Pausex20:: @ 82DABB9
@ -255,7 +255,7 @@ BattleScript_OneHitKOMsg:: @ 82DB1CE
BattleScript_SAtkDown2:: @ 82DB1D5 BattleScript_SAtkDown2:: @ 82DB1D5
.incbin "baserom.gba", 0x2db1d5, 0x2a .incbin "baserom.gba", 0x2db1d5, 0x2a
gUnknown_082DB1FF:: @ 82DB1FF BattleScript_FocusPunchSetUp:: @ 82DB1FF
.incbin "baserom.gba", 0x2db1ff, 0x14 .incbin "baserom.gba", 0x2db1ff, 0x14
BattleScript_MoveUsedIsAsleep:: @ 82DB213 BattleScript_MoveUsedIsAsleep:: @ 82DB213

View File

@ -4,7 +4,7 @@
.section script_data, "aw", %progbits .section script_data, "aw", %progbits
.align 2 .align 2
gUnknown_082DBD08:: @ 82DBD08 gBattlescriptsForBallThrow:: @ 82DBD08
.4byte gUnknown_082DBD68 .4byte gUnknown_082DBD68
.4byte gUnknown_082DBD68 .4byte gUnknown_082DBD68
.4byte gUnknown_082DBD68 .4byte gUnknown_082DBD68
@ -29,8 +29,8 @@ gUnknown_082DBD3C:: @ 82DBD3C
.4byte gUnknown_082DBE91 .4byte gUnknown_082DBE91
.align 2 .align 2
gUnknown_082DBD54:: @ 82DBD54 gBattlescriptsForRunningByItem:: @ 82DBD54
.4byte gUnknown_082DBEB3 .4byte BattleScript_RunByUsingItem
.align 2 .align 2
gUnknown_082DBD58:: @ 82DBD58 gUnknown_082DBD58:: @ 82DBD58
@ -72,7 +72,7 @@ gUnknown_082DBE6F:: @ 82DBE6F
gUnknown_082DBE91:: @ 82DBE91 gUnknown_082DBE91:: @ 82DBE91
.incbin "baserom.gba", 0x2dbe91, 0x22 .incbin "baserom.gba", 0x2dbe91, 0x22
gUnknown_082DBEB3:: @ 82DBEB3 BattleScript_RunByUsingItem:: @ 82DBEB3
.incbin "baserom.gba", 0x2dbeb3, 0xA .incbin "baserom.gba", 0x2dbeb3, 0xA
gUnknown_082DBEBD:: @ 82DBEBD gUnknown_082DBEBD:: @ 82DBEBD

View File

@ -226,10 +226,10 @@ gTrainerMoneyTable:: @ 831AEB8
@ 831BAD4 @ 831BAD4
.include "data/text/ability_description_pointers.inc" .include "data/text/ability_description_pointers.inc"
gUnknown_0831BC0C:: @ 831BC0C gTurnActionsFuncsTable:: @ 831BC0C
.incbin "baserom.gba", 0x31bc0c, 0x38 .incbin "baserom.gba", 0x31bc0c, 0x38
gUnknown_0831BC44:: @ 831BC44 gEndTurnFuncsTable:: @ 831BC44
.incbin "baserom.gba", 0x31bc44, 0x2c .incbin "baserom.gba", 0x31bc44, 0x2c
gStatusConditionString_PoisonJpn:: @ 831BC70 gStatusConditionString_PoisonJpn:: @ 831BC70

View File

@ -56,6 +56,7 @@
#define BATTLE_TYPE_RAYQUAZA 0x40000000 #define BATTLE_TYPE_RAYQUAZA 0x40000000
#define BATTLE_TYPE_x80000000 0x80000000 #define BATTLE_TYPE_x80000000 0x80000000
#define TRAINER_OPPONENT_3FE 0x3FE
#define TRAINER_OPPONENT_C00 0xC00 #define TRAINER_OPPONENT_C00 0xC00
#define TRAINER_OPPONENT_800 0x800 #define TRAINER_OPPONENT_800 0x800
#define STEVEN_PARTNER_ID 0xC03 #define STEVEN_PARTNER_ID 0xC03
@ -71,8 +72,11 @@
#define BATTLE_PLAYER_TELEPORTED 0x5 #define BATTLE_PLAYER_TELEPORTED 0x5
#define BATTLE_POKE_FLED 0x6 #define BATTLE_POKE_FLED 0x6
#define BATTLE_CAUGHT 0x7 #define BATTLE_CAUGHT 0x7
#define BATTLE_FORFEITED 0x9
#define BATTLE_OPPONENT_TELEPORTED 0xA #define BATTLE_OPPONENT_TELEPORTED 0xA
#define BATTLE_OUTCOME_BIT_x80 0x80
#define STATUS_SLEEP 0x7 #define STATUS_SLEEP 0x7
#define STATUS_POISON 0x8 #define STATUS_POISON 0x8
#define STATUS_BURN 0x10 #define STATUS_BURN 0x10
@ -171,8 +175,10 @@
#define ACTION_GO_NEAR 7 #define ACTION_GO_NEAR 7
#define ACTION_SAFARI_ZONE_RUN 8 #define ACTION_SAFARI_ZONE_RUN 8
#define ACTION_9 9 #define ACTION_9 9
#define ACTION_CANCEL_PARTNER 12 #define ACTION_RUN_BATTLESCRIPT 10 // when executing an action
#define ACTION_NOTHING_FAINTED 13 #define ACTION_CANCEL_PARTNER 12 // when choosing an action
#define ACTION_FINISHED 12 // when executing an action
#define ACTION_NOTHING_FAINTED 13 // when choosing an action
#define ACTION_INIT_VALUE 0xFF #define ACTION_INIT_VALUE 0xFF
#define ABILITYEFFECT_ON_SWITCHIN 0x0 #define ABILITYEFFECT_ON_SWITCHIN 0x0
@ -559,22 +565,19 @@ struct BattleResults
u8 playerSwitchesCounter; // 0x2 u8 playerSwitchesCounter; // 0x2
u8 unk3; // 0x3 u8 unk3; // 0x3
u8 unk4; // 0x4 u8 unk4; // 0x4
u8 unk5_0:1; // 0x5 u8 unk5_0:1; // 0x5 , 0x1
u8 unk5_1:1; // 0x5 u8 unk5_1:1; // 0x5 , 0x2
u8 caughtMonBall:4; // 0x5 u8 caughtMonBall:4; // 0x5 , 0x4/0x8/0x10/0x20
u8 unk5_6:1; // 0x5 u8 unk5_6:1; // 0x5 , 0x40
u8 unk5_7:1; // 0x5 u8 unk5_7:1; // 0x5 , 0x80
u16 poke1Species; // 0x6 u16 playerMon1Species; // 0x6
u8 pokeString1[10]; // 0x8 u8 playerMon1Name[11]; // 0x8
u8 unk12;
u8 battleTurnCounter; // 0x13 u8 battleTurnCounter; // 0x13
u8 pokeString2[10]; // 0x14 u8 playerMon2Name[11]; // 0x14
u8 field_1E; // 0x1E
u8 field_1F; // 0x1F
u16 lastOpponentSpecies; // 0x20 u16 lastOpponentSpecies; // 0x20
u16 lastUsedMove; // 0x22 u16 lastUsedMovePlayer; // 0x22
u16 opponentMove; // 0x24 u16 lastUsedMoveOpponent; // 0x24
u16 opponentSpecies; // 0x26 u16 playerMon2Species; // 0x26
u16 caughtMonSpecies; // 0x28 u16 caughtMonSpecies; // 0x28
u8 caughtMonNick[10]; // 0x2A u8 caughtMonNick[10]; // 0x2A
u8 filler34[2]; u8 filler34[2];
@ -605,7 +608,7 @@ struct BattleStruct
u8 field_45; u8 field_45;
u8 field_46; u8 field_46;
u8 field_47; u8 field_47;
u8 field_48; u8 focusPunchBank;
u8 field_49; u8 field_49;
u8 moneyMultiplier; u8 moneyMultiplier;
u8 field_4B; u8 field_4B;
@ -620,7 +623,7 @@ struct BattleStruct
u8 field_58[4]; u8 field_58[4];
u8 field_5C[4]; u8 field_5C[4];
u8 field_60[4][3]; u8 field_60[4][3];
u8 field_6C; u8 runTries;
u8 caughtMonNick[11]; u8 caughtMonNick[11];
u8 field_78; u8 field_78;
u8 field_79; u8 field_79;
@ -630,7 +633,7 @@ struct BattleStruct
u8 field_7D; u8 field_7D;
u8 field_7E; u8 field_7E;
u8 formToChangeInto; u8 formToChangeInto;
u8 chosenMovesIds[BATTLE_BANKS_COUNT]; u8 chosenMovePositions[BATTLE_BANKS_COUNT];
u8 stateIdAfterSelScript[BATTLE_BANKS_COUNT]; u8 stateIdAfterSelScript[BATTLE_BANKS_COUNT];
u8 field_88; u8 field_88;
u8 field_89; u8 field_89;
@ -665,7 +668,9 @@ struct BattleStruct
u8 field_B3; u8 field_B3;
void (*savedCallback)(void); void (*savedCallback)(void);
u16 usedHeldItems[BATTLE_BANKS_COUNT]; u16 usedHeldItems[BATTLE_BANKS_COUNT];
u8 field_C0[8]; u8 field_C0[4];
u8 field_C4[2];
u8 field_C6[2];
u16 choicedMove[BATTLE_BANKS_COUNT]; u16 choicedMove[BATTLE_BANKS_COUNT];
u16 changedItems[BATTLE_BANKS_COUNT]; u16 changedItems[BATTLE_BANKS_COUNT];
u8 intimidateBank; u8 intimidateBank;
@ -818,6 +823,7 @@ extern struct BattleStruct* gBattleStruct;
#define VARIOUS_CANCEL_MULTI_TURN_MOVES 0 #define VARIOUS_CANCEL_MULTI_TURN_MOVES 0
#define VARIOUS_SET_MAGIC_COAT_TARGET 1 #define VARIOUS_SET_MAGIC_COAT_TARGET 1
#define VARIOUS_CAN_RUN_FROM_BATTLE 2
#define VARIOUS_GET_MOVE_TARGET 3 #define VARIOUS_GET_MOVE_TARGET 3
#define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5 #define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5
#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6 #define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6
@ -901,13 +907,15 @@ void sub_803FA70(u8 bank);
void BattleMainCB2(void); void BattleMainCB2(void);
void VBlankCB_Battle(void); void VBlankCB_Battle(void);
void ResetSentPokesToOpponentValue(void); void ResetSentPokesToOpponentValue(void);
bool8 CanRunFromBattle(u8 bank); bool8 TryRunFromBattle(u8 bank);
bool8 IsRunningFromBattleImpossible(void); bool8 IsRunningFromBattleImpossible(void);
void PressurePPLoseOnUsingPerishSong(u8 bankAtk); void PressurePPLoseOnUsingPerishSong(u8 bankAtk);
void PressurePPLoseOnUsingImprision(u8 bankAtk); void PressurePPLoseOnUsingImprision(u8 bankAtk);
u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves); u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves);
void SwapTurnOrder(u8, u8); void SwapTurnOrder(u8, u8);
void BattleTurnPassed(void); void BattleTurnPassed(void);
void RunBattleScriptCommands_PopCallbacksStack(void);
void RunBattleScriptCommands(void);
// battle_3 // battle_3
#define MOVE_LIMITATION_ZEROMOVE (1 << 0) #define MOVE_LIMITATION_ZEROMOVE (1 << 0)
@ -928,7 +936,7 @@ u8 UpdateTurnCounters(void);
u8 TurnBasedEffects(void); u8 TurnBasedEffects(void);
bool8 sub_8041364(void); bool8 sub_8041364(void);
bool8 sub_8041728(void); bool8 sub_8041728(void);
void b_clear_atk_up_if_hit_flag_unless_enraged(void); void TryClearRageStatuses(void);
u8 AtkCanceller_UnableToUseMove(void); u8 AtkCanceller_UnableToUseMove(void);
bool8 sub_80423F4(u8 bank, u8 r1, u8 r2); bool8 sub_80423F4(u8 bank, u8 r1, u8 r2);
u8 CastformDataTypeChange(u8 bank); u8 CastformDataTypeChange(u8 bank);
@ -936,7 +944,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
void BattleScriptExecute(const u8* BS_ptr); void BattleScriptExecute(const u8* BS_ptr);
void BattleScriptPushCursorAndCallback(const u8* BS_ptr); void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn); u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn);
void sub_8045868(u8 bank); void ClearFuryCutterDestinyBondGrudge(u8 bank);
void sub_80458B4(void); void sub_80458B4(void);
u8 GetMoveTarget(u16 move, u8 useMoveTarget); u8 GetMoveTarget(u16 move, u8 useMoveTarget);
u8 IsPokeDisobedient(void); u8 IsPokeDisobedient(void);

10
include/evolution_scene.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef GUARD_EVOLUTION_SCENE_H
#define GUARD_EVOLUTION_SCENE_H
void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID);
void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID);
void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID);
extern void (*gCB2_AfterEvolution)(void);
#endif // GUARD_EVOLUTION_SCENE_H

View File

@ -634,6 +634,12 @@ bool16 sub_806D82C(u8 id);
u16 MonTryLearningNewMove(struct Pokemon* mon, bool8); u16 MonTryLearningNewMove(struct Pokemon* mon, bool8);
void sub_8068AA4(void); // sets stats for deoxys void sub_8068AA4(void); // sets stats for deoxys
bool8 HasTwoFramesAnimation(u16 species); bool8 HasTwoFramesAnimation(u16 species);
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem);
void RandomlyGivePartyPokerus(struct Pokemon *party);
u8 CheckPartyPokerus(struct Pokemon *party, u8 selection);
u8 CheckPartyHasHadPokerus(struct Pokemon *party, u8 selection);
void UpdatePartyPokerusTime(u16 days);
void PartySpreadPokerus(struct Pokemon *party);
#include "sprite.h" #include "sprite.h"

View File

@ -14,5 +14,6 @@ u8 sub_8185FB8(void);
u8 MoveRecordedBattleToSaveData(void); u8 MoveRecordedBattleToSaveData(void);
void sub_818603C(u8); void sub_818603C(u8);
void sub_8185FD0(void); void sub_8185FD0(void);
void sub_8186444(void);
#endif // GUARD_RECORDED_BATTLE_H #endif // GUARD_RECORDED_BATTLE_H

View File

@ -252,23 +252,23 @@ enum
SE_W114, SE_W114,
SE_W063B, SE_W063B,
BGM_STOP = 349, BGM_STOP = 349,
BGM_TETSUJI, /*0x15E*/ BGM_TETSUJI,
BGM_FIELD13, /*0x15F*/ BGM_FIELD13,
BGM_KACHI22, /*0x160*/ BGM_KACHI22,
BGM_KACHI2, /*0x161*/ BGM_KACHI2,
BGM_KACHI3, /*0x162*/ BGM_KACHI3,
BGM_KACHI5, /*0x163*/ BGM_KACHI5,
BGM_PCC, /*0x164*/ BGM_PCC,
BGM_NIBI, /*0x165*/ BGM_NIBI,
BGM_SUIKUN, /*0x166*/ BGM_SUIKUN,
BGM_DOORO1, /*0x167*/ BGM_DOORO1,
BGM_DOORO_X1, /*0x168*/ BGM_DOORO_X1,
BGM_DOORO_X3, /*0x169*/ BGM_DOORO_X3,
BGM_MACHI_S2, /*0x16A*/ BGM_MACHI_S2,
BGM_MACHI_S4, /*0x16B*/ BGM_MACHI_S4,
BGM_GIM, /*0x16C*/ BGM_GIM,
BGM_NAMINORI, /*0x16D*/ BGM_NAMINORI,
BGM_DAN01, /*0x16E*/ BGM_DAN01,
/*0x16F*/ BGM_FANFA1, /*0x16F*/ BGM_FANFA1,
/*0x170*/ BGM_ME_ASA, /*0x170*/ BGM_ME_ASA,
/*0x171*/ BGM_ME_BACHI, /*0x171*/ BGM_ME_BACHI,
@ -306,31 +306,31 @@ enum
/*0x191*/ BGM_NEXTROAD, /*0x191*/ BGM_NEXTROAD,
/*0x192*/ BGM_GRANROAD, /*0x192*/ BGM_GRANROAD,
/*0x193*/ BGM_CYCLING, /*0x193*/ BGM_CYCLING,
BGM_FRIENDLY, /*0x194*/ BGM_FRIENDLY,
BGM_MISHIRO, /*0x195*/ BGM_MISHIRO,
BGM_TOZAN, /*0x196*/ BGM_TOZAN,
BGM_GIRLEYE, /*0x197*/ BGM_GIRLEYE,
BGM_MINAMO, /*0x198*/ BGM_MINAMO,
BGM_ASHROAD, /*0x199*/ BGM_ASHROAD,
BGM_EVENT0, /*0x19A*/ BGM_EVENT0,
BGM_DEEPDEEP, /*0x19B*/ BGM_DEEPDEEP,
BGM_KACHI1, /*0x19C*/ BGM_KACHI1,
BGM_TITLE3, /*0x19D*/ BGM_TITLE3,
BGM_DEMO1, /*0x19E*/ BGM_DEMO1,
BGM_GIRL_SUP, /*0x19F*/ BGM_GIRL_SUP,
BGM_HAGESHII, /*0x1A0*/ BGM_HAGESHII,
BGM_KAKKOII, /*0x1A1*/ BGM_KAKKOII,
BGM_KAZANBAI, /*0x1A2*/ BGM_KAZANBAI,
BGM_AQA_0, /*0x1A3*/ BGM_AQA_0,
BGM_TSURETEK, /*0x1A4*/ BGM_TSURETEK,
BGM_BOY_SUP, /*0x1A5*/ BGM_BOY_SUP,
BGM_RAINBOW, /*0x1A6*/ BGM_RAINBOW,
BGM_AYASII, /*0x1A7*/ BGM_AYASII,
BGM_KACHI4, /*0x1A8*/ BGM_KACHI4,
BGM_ROPEWAY, /*0x1A9*/ BGM_ROPEWAY,
BGM_CASINO, /*0x1AA*/ BGM_CASINO,
BGM_HIGHTOWN, /*0x1AB*/ BGM_HIGHTOWN,
BGM_SAFARI, /*0x1AC*/ BGM_SAFARI,
BGM_C_ROAD, BGM_C_ROAD,
BGM_AJITO, BGM_AJITO,
BGM_M_BOAT, BGM_M_BOAT,

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ extern u8 gBattleMoveFlags;
extern s32 gTakenDmg[BATTLE_BANKS_COUNT]; extern s32 gTakenDmg[BATTLE_BANKS_COUNT];
extern u8 gTakenDmgBanks[BATTLE_BANKS_COUNT]; extern u8 gTakenDmgBanks[BATTLE_BANKS_COUNT];
extern u8 gLastUsedAbility; extern u8 gLastUsedAbility;
extern u8 gFightStateTracker; extern u8 gCurrentActionFuncId;
extern u32 gBattleExecBuffer; extern u32 gBattleExecBuffer;
extern u16 gRandomMove; extern u16 gRandomMove;
extern u8 gCurrMovePos; extern u8 gCurrMovePos;
@ -181,8 +181,6 @@ extern const u16 gSoundMovesTable[];
extern void sub_803F9EC(); extern void sub_803F9EC();
extern bool8 sub_80423F4(u8 bank, u8, u8); extern bool8 sub_80423F4(u8 bank, u8, u8);
extern u8 weather_get_current(void); extern u8 weather_get_current(void);
extern void sub_803E08C(void);
extern void bc_move_exec_returning(void);
extern s8 GetFlavourRelationByPersonality(u32 personality, u8 flavor); extern s8 GetFlavourRelationByPersonality(u32 personality, u8 flavor);
void BattleScriptPush(const u8* bsPtr) void BattleScriptPush(const u8* bsPtr)
@ -1156,7 +1154,7 @@ bool8 sub_8041728(void)
return FALSE; return FALSE;
} }
void b_clear_atk_up_if_hit_flag_unless_enraged(void) void TryClearRageStatuses(void)
{ {
int i; int i;
for (i = 0; i < gNoOfAllBanks; i++) for (i = 0; i < gNoOfAllBanks; i++)
@ -5441,8 +5439,8 @@ void BattleScriptExecute(const u8* BS_ptr)
{ {
gBattlescriptCurrInstr = BS_ptr; gBattlescriptCurrInstr = BS_ptr;
BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc; BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc;
gBattleMainFunc = bc_move_exec_returning; gBattleMainFunc = RunBattleScriptCommands_PopCallbacksStack;
gFightStateTracker = 0; gCurrentActionFuncId = 0;
} }
void BattleScriptPushCursorAndCallback(const u8* BS_ptr) void BattleScriptPushCursorAndCallback(const u8* BS_ptr)
@ -5450,7 +5448,7 @@ void BattleScriptPushCursorAndCallback(const u8* BS_ptr)
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BS_ptr; gBattlescriptCurrInstr = BS_ptr;
BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc; BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc;
gBattleMainFunc = sub_803E08C; gBattleMainFunc = RunBattleScriptCommands;
} }
enum enum
@ -5520,7 +5518,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
switch (caseID) switch (caseID)
{ {
case 0: case ITEMEFFECT_ON_SWITCH_IN:
switch (bankHoldEffect) switch (bankHoldEffect)
{ {
case HOLD_EFFECT_DOUBLE_PRIZE: case HOLD_EFFECT_DOUBLE_PRIZE:
@ -6185,7 +6183,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
return effect; return effect;
} }
void sub_8045868(u8 bank) void ClearFuryCutterDestinyBondGrudge(u8 bank)
{ {
gDisableStructs[bank].furyCutterCounter = 0; gDisableStructs[bank].furyCutterCounter = 0;
gBattleMons[bank].status2 &= ~(STATUS2_DESTINY_BOND); gBattleMons[bank].status2 &= ~(STATUS2_DESTINY_BOND);

View File

@ -67,7 +67,7 @@ extern u8 gBankAttacker;
extern u8 gBankTarget; extern u8 gBankTarget;
extern const u8* gBattlescriptCurrInstr; extern const u8* gBattlescriptCurrInstr;
extern u8 gCurrMovePos; extern u8 gCurrMovePos;
extern u8 gFightStateTracker; extern u8 gCurrentActionFuncId;
extern u32 gHitMarker; extern u32 gHitMarker;
extern u8 gBattleMoveFlags; extern u8 gBattleMoveFlags;
extern u8 gBattleCommunication[]; extern u8 gBattleCommunication[];
@ -92,7 +92,7 @@ extern u16 gMoveToLearn;
extern u16 gRandomMove; extern u16 gRandomMove;
extern u8 gBankInMenu; extern u8 gBankInMenu;
extern u8 gActionForBanks[BATTLE_BANKS_COUNT]; extern u8 gActionForBanks[BATTLE_BANKS_COUNT];
extern u8 gCurrentMoveTurn; extern u8 gCurrentTurnActionNumber;
extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200]; extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200];
extern u16 gLockedMoves[BATTLE_BANKS_COUNT]; extern u16 gLockedMoves[BATTLE_BANKS_COUNT];
extern u16 gPartnerTrainerId; extern u16 gPartnerTrainerId;
@ -377,7 +377,7 @@ static void atk6E_set_atk_to_player0(void);
static void atk6F_set_visible(void); static void atk6F_set_visible(void);
static void atk70_record_last_used_ability(void); static void atk70_record_last_used_ability(void);
static void atk71_buffer_move_to_learn(void); static void atk71_buffer_move_to_learn(void);
static void atk72_jump_if_can_run_frombattle(void); static void atk72_jump_if_run_attempt_success(void);
static void atk73_hp_thresholds(void); static void atk73_hp_thresholds(void);
static void atk74_hp_thresholds2(void); static void atk74_hp_thresholds2(void);
static void atk75_item_effect_on_opponent(void); static void atk75_item_effect_on_opponent(void);
@ -509,8 +509,8 @@ static void atkF2_display_dex_info(void);
static void atkF3_nickname_caught_poke(void); static void atkF3_nickname_caught_poke(void);
static void atkF4_subattackerhpbydmg(void); static void atkF4_subattackerhpbydmg(void);
static void atkF5_removeattackerstatus1(void); static void atkF5_removeattackerstatus1(void);
static void atkF6_802BF48(void); static void atkF6_action_finished(void);
static void atkF7_802BF54(void); static void atkF7_turn_finished(void);
static void atkF8_trainer_slide_back(void); static void atkF8_trainer_slide_back(void);
void (* const gBattleScriptingCommandsTable[])(void) = void (* const gBattleScriptingCommandsTable[])(void) =
@ -629,7 +629,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atk6F_set_visible, atk6F_set_visible,
atk70_record_last_used_ability, atk70_record_last_used_ability,
atk71_buffer_move_to_learn, atk71_buffer_move_to_learn,
atk72_jump_if_can_run_frombattle, atk72_jump_if_run_attempt_success,
atk73_hp_thresholds, atk73_hp_thresholds,
atk74_hp_thresholds2, atk74_hp_thresholds2,
atk75_item_effect_on_opponent, atk75_item_effect_on_opponent,
@ -761,8 +761,8 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atkF3_nickname_caught_poke, atkF3_nickname_caught_poke,
atkF4_subattackerhpbydmg, atkF4_subattackerhpbydmg,
atkF5_removeattackerstatus1, atkF5_removeattackerstatus1,
atkF6_802BF48, atkF6_action_finished,
atkF7_802BF54, atkF7_turn_finished,
atkF8_trainer_slide_back atkF8_trainer_slide_back
}; };
@ -1097,9 +1097,9 @@ static void atk00_attackcanceler(void)
{ {
s32 i; s32 i;
if (gBattleOutcome) if (gBattleOutcome != 0)
{ {
gFightStateTracker = 0xC; gCurrentActionFuncId = ACTION_FINISHED;
return; return;
} }
if (gBattleMons[gBankAttacker].hp == 0 && !(gHitMarker & HITMARKER_NO_ATTACKSTRING)) if (gBattleMons[gBankAttacker].hp == 0 && !(gHitMarker & HITMARKER_NO_ATTACKSTRING))
@ -2736,7 +2736,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
} }
else else
{ {
if (BankGetTurnOrder(gEffectBank) > gCurrentMoveTurn) if (BankGetTurnOrder(gEffectBank) > gCurrentTurnActionNumber)
gBattleMons[gEffectBank].status2 |= sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]]; gBattleMons[gEffectBank].status2 |= sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]];
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
@ -3208,7 +3208,7 @@ static void atk19_faint_pokemon(void)
&& gBattleMons[gBankAttacker].hp != 0 && gBattleMons[gBankAttacker].hp != 0
&& gCurrentMove != MOVE_STRUGGLE) && gCurrentMove != MOVE_STRUGGLE)
{ {
u8 moveIndex = *(gBattleStruct->chosenMovesIds + gBankAttacker); u8 moveIndex = *(gBattleStruct->chosenMovePositions + gBankAttacker);
gBattleMons[gBankAttacker].pp[moveIndex] = 0; gBattleMons[gBankAttacker].pp[moveIndex] = 0;
BattleScriptPush(gBattlescriptCurrInstr); BattleScriptPush(gBattlescriptCurrInstr);
@ -4421,13 +4421,13 @@ static void atk3D_end(void)
gBattleMoveFlags = 0; gBattleMoveFlags = 0;
gActiveBank = 0; gActiveBank = 0;
gFightStateTracker = 0xB; gCurrentActionFuncId = 0xB;
} }
static void atk3E_end2(void) static void atk3E_end2(void)
{ {
gActiveBank = 0; gActiveBank = 0;
gFightStateTracker = 0xB; gCurrentActionFuncId = 0xB;
} }
static void atk3F_end3(void) // pops the main function stack static void atk3F_end3(void) // pops the main function stack
@ -6956,9 +6956,9 @@ static void atk71_buffer_move_to_learn(void)
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
static void atk72_jump_if_can_run_frombattle(void) static void atk72_jump_if_run_attempt_success(void)
{ {
if (CanRunFromBattle(gBank1)) if (TryRunFromBattle(gBank1))
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
else else
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
@ -7045,7 +7045,7 @@ static void atk76_various(void)
else else
gBankTarget = gActiveBank; gBankTarget = gActiveBank;
break; break;
case 2: case VARIOUS_CAN_RUN_FROM_BATTLE:
gBattleCommunication[0] = IsRunningFromBattleImpossible(); gBattleCommunication[0] = IsRunningFromBattleImpossible();
break; break;
case VARIOUS_GET_MOVE_TARGET: case VARIOUS_GET_MOVE_TARGET:
@ -7196,7 +7196,7 @@ static void atk76_various(void)
gBattleOutcome = BATTLE_OPPONENT_TELEPORTED; gBattleOutcome = BATTLE_OPPONENT_TELEPORTED;
break; break;
case VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC: case VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC:
EmitPlaySound(0, 0x19C, 1); EmitPlaySound(0, BGM_KACHI1, 1);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
break; break;
} }
@ -7212,7 +7212,7 @@ static void atk77_set_protect_like(void) // protect and endure
if (lastMove != MOVE_PROTECT && lastMove != MOVE_DETECT && lastMove != MOVE_ENDURE) if (lastMove != MOVE_PROTECT && lastMove != MOVE_DETECT && lastMove != MOVE_ENDURE)
gDisableStructs[gBankAttacker].protectUses = 0; gDisableStructs[gBankAttacker].protectUses = 0;
if (gCurrentMoveTurn == (gNoOfAllBanks - 1)) if (gCurrentTurnActionNumber == (gNoOfAllBanks - 1))
notLastTurn = FALSE; notLastTurn = FALSE;
if (sProtectSuccessRates[gDisableStructs[gBankAttacker].protectUses] >= Random() && notLastTurn) if (sProtectSuccessRates[gDisableStructs[gBankAttacker].protectUses] >= Random() && notLastTurn)
@ -9715,7 +9715,7 @@ static void atkBA_jumpifnopursuitswitchdmg(void)
} }
gCurrentMove = MOVE_PURSUIT; gCurrentMove = MOVE_PURSUIT;
gCurrMovePos = gUnknown_020241E9 = *(gBattleStruct->chosenMovesIds + gBankTarget); gCurrMovePos = gUnknown_020241E9 = *(gBattleStruct->chosenMovePositions + gBankTarget);
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
gBattleScripting.animTurn = 1; gBattleScripting.animTurn = 1;
gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED); gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED);
@ -10631,7 +10631,7 @@ static void atkDF_setmagiccoat(void)
{ {
gBankTarget = gBankAttacker; gBankTarget = gBankAttacker;
gSpecialStatuses[gBankAttacker].flag20 = 1; gSpecialStatuses[gBankAttacker].flag20 = 1;
if (gCurrentMoveTurn == gNoOfAllBanks - 1) // moves last turn if (gCurrentTurnActionNumber == gNoOfAllBanks - 1) // moves last turn
{ {
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
} }
@ -10645,7 +10645,7 @@ static void atkDF_setmagiccoat(void)
static void atkE0_setstealstatchange(void) // snatch static void atkE0_setstealstatchange(void) // snatch
{ {
gSpecialStatuses[gBankAttacker].flag20 = 1; gSpecialStatuses[gBankAttacker].flag20 = 1;
if (gCurrentMoveTurn == gNoOfAllBanks - 1) // moves last turn if (gCurrentTurnActionNumber == gNoOfAllBanks - 1) // moves last turn
{ {
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
} }
@ -11393,15 +11393,15 @@ static void atkF5_removeattackerstatus1(void)
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
static void atkF6_802BF48(void) static void atkF6_action_finished(void)
{ {
gFightStateTracker = 0xC; gCurrentActionFuncId = ACTION_FINISHED;
} }
static void atkF7_802BF54(void) static void atkF7_turn_finished(void)
{ {
gFightStateTracker = 0xC; gCurrentActionFuncId = ACTION_FINISHED;
gCurrentMoveTurn = gNoOfAllBanks; gCurrentTurnActionNumber = gNoOfAllBanks;
} }
static void atkF8_trainer_slide_back(void) static void atkF8_trainer_slide_back(void)

View File

@ -310,10 +310,10 @@ gActionsByTurnOrder: @ 202407A
gBanksByTurnOrder: @ 202407E gBanksByTurnOrder: @ 202407E
.space 0x4 .space 0x4
gCurrentMoveTurn: @ 2024082 gCurrentTurnActionNumber: @ 2024082
.space 0x1 .space 0x1
gFightStateTracker: @ 2024083 gCurrentActionFuncId: @ 2024083
.space 0x1 .space 0x1
gBattleMons: @ 2024084 gBattleMons: @ 2024084