Document trainer battle scripts (#430)

This commit is contained in:
DizzyEggg 2018-12-07 23:50:56 +01:00 committed by Marcus Huderle
parent fe06bbe3f6
commit 6068495619
17 changed files with 1283 additions and 1291 deletions

View File

@ -668,7 +668,7 @@
.4byte \pointer2 @ text .4byte \pointer2 @ text
.4byte \pointer3 @ text .4byte \pointer3 @ text
.4byte \pointer4 @ event script .4byte \pointer4 @ event script
.elseif \type == TRAINER_BATTLE_9 .elseif \type == TRAINER_BATTLE_PYRAMID
.4byte \pointer1 @ text .4byte \pointer1 @ text
.4byte \pointer2 @ text .4byte \pointer2 @ text
.elseif \type == TRAINER_BATTLE_SET_TRAINER_A .elseif \type == TRAINER_BATTLE_SET_TRAINER_A

File diff suppressed because it is too large Load Diff

View File

@ -153,7 +153,7 @@ BattleFrontier_BattlePyramidEmptySquare_EventScript_252C45:: @ 8252C45
end end
BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F:: @ 8252C4F BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F:: @ 8252C4F
trainerbattle TRAINER_BATTLE_9, TRAINER_PHILLIP, 0, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D trainerbattle TRAINER_BATTLE_PYRAMID, TRAINER_PHILLIP, 0, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D
setvar VAR_0x8004, 10 setvar VAR_0x8004, 10
special CallBattlePyramidFunction special CallBattlePyramidFunction
waitmessage waitmessage

1115
data/scripts/secret_base.inc Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,128 @@
EventScript_ShowSecondTrainerIntro:: @ 8271356
special SetUpTrainerEncounterMusic
special EndTrainerApproach
waitstate
goto EventScript_ShowTrainerIntroMsg
EventScript_TryDoNormalTrainerBattle:: @ 8271362
lock
faceplayer
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
waitmovement 0
specialvar VAR_RESULT, GetTrainerFlag
compare VAR_RESULT, 0
goto_if 5, EventScript_NoNormalTrainerBattle
special SetUpTrainerEncounterMusic
special SetUpTrainerMovement
goto EventScript_ShowTrainerIntroMsg
EventScript_NoNormalTrainerBattle:: @ 8271389
gotopostbattlescript
EventScript_TryDoDoubleTrainerBattle:: @ 827138A
lock
faceplayer
call EventScript_RevealTrainer
specialvar VAR_RESULT, GetTrainerFlag
compare VAR_RESULT, 0
goto_if 5, EventScript_NoDoubleTrainerBattle
special HasEnoughMonsForDoubleBattle
compare VAR_RESULT, 0
goto_if 5, EventScript_NotEnoughMonsForDoubleBattle
special SetUpTrainerEncounterMusic
special SetUpTrainerMovement
goto EventScript_ShowTrainerIntroMsg
EventScript_NotEnoughMonsForDoubleBattle:: @ 82713BA
special ShowTrainerCantBattleSpeech
waitmessage
waitbuttonpress
release
end
EventScript_NoDoubleTrainerBattle:: @ 82713C1
gotopostbattlescript
EventScript_DoTainerBattle:: @ 82713C2
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
waitmovement 0
special SetUpTrainerEncounterMusic
trainerbattlebegin
gotopostbattlescript
EventScript_TryDoRematchBattle:: @ 82713D1
call EventScript_RevealTrainer
specialvar VAR_RESULT, IsTrainerReadyForRematch
compare VAR_RESULT, 0
goto_eq EventScript_NoRematchTrainerBattle
special SetUpTrainerEncounterMusic
special SetUpTrainerMovement
special ShowTrainerIntroSpeech
waitmessage
waitbuttonpress
special BattleSetup_StartRematchBattle
waitstate
releaseall
end
EventScript_NoRematchTrainerBattle:: @ 82713F7
gotopostbattlescript
EventScript_TryDoDoubleRematchBattle:: @ 82713F8
specialvar VAR_RESULT, IsTrainerReadyForRematch
compare VAR_RESULT, 0
goto_eq EventScript_NoDoubleRematchTrainerBattle
special HasEnoughMonsForDoubleBattle
compare VAR_RESULT, 0
goto_if 5, EventScript_NotEnoughMonsForDoubleRematchBattle
special SetUpTrainerEncounterMusic
special SetUpTrainerMovement
special ShowTrainerIntroSpeech
waitmessage
waitbuttonpress
special BattleSetup_StartRematchBattle
waitstate
releaseall
end
EventScript_NoDoubleRematchTrainerBattle:: @ 8271427
gotopostbattlescript
EventScript_NotEnoughMonsForDoubleRematchBattle:: @ 8271428
special ShowTrainerCantBattleSpeech
waitmessage
waitbuttonpress
release
end
EventScript_RevealTrainer:: @ 827142F
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
waitmovement 0
return
Movement_RevealTrainer: @ 827143A
reveal_trainer
step_end
EventScript_ShowTrainerIntroMsg:: @ 827143C
special ShowTrainerIntroSpeech
waitmessage
waitbuttonpress
special TryPrepareSecondApproachingTrainer
compare VAR_RESULT, TRUE
goto_eq EventScript_ShowSecondTrainerIntro
goto EventScript_DoTrainerBattle
EventScript_DoTrainerBattle:: @ 8271454
trainerbattlebegin
@ Pointless check, possibly used for debugging?
specialvar VAR_RESULT, GetTrainerBattleMode
compare VAR_RESULT, TRAINER_BATTLE_SINGLE
goto_eq EventScript_EndTrainerBattle
compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT
goto_eq EventScript_EndTrainerBattle
compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC
goto_eq EventScript_EndTrainerBattle
compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE
goto_eq EventScript_EndTrainerBattle
compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC
goto_eq EventScript_EndTrainerBattle
EventScript_EndTrainerBattle:: @ 8271491
gotobeatenscript
releaseall
end

View File

@ -324,7 +324,7 @@ gSpecials:: @ 81DBA64
def_special StartGroudonKyogreBattle def_special StartGroudonKyogreBattle
def_special BattleSetup_StartLegendaryBattle def_special BattleSetup_StartLegendaryBattle
def_special StartRegiBattle def_special StartRegiBattle
def_special sub_80B16D8 def_special SetUpTrainerMovement
def_special DoSealedChamberShakingEffect2 def_special DoSealedChamberShakingEffect2
def_special FoundBlackGlasses def_special FoundBlackGlasses
def_special sub_80AC81C def_special sub_80AC81C
@ -531,7 +531,7 @@ gSpecials:: @ 81DBA64
def_special sub_813B9A0 def_special sub_813B9A0
def_special sub_81B9918 def_special sub_81B9918
def_special sub_80722E0 def_special sub_80722E0
def_special sub_80B45D0 def_special TryPrepareSecondApproachingTrainer
def_special RemoveRecordsWindow def_special RemoveRecordsWindow
def_special sub_8139C10 def_special sub_8139C10
def_special sub_80B3BC4 def_special sub_80B3BC4

View File

@ -479,10 +479,10 @@ struct BattleStruct
u16 changedItems[MAX_BATTLERS_COUNT]; u16 changedItems[MAX_BATTLERS_COUNT];
u8 intimidateBattler; u8 intimidateBattler;
u8 switchInItemsCounter; u8 switchInItemsCounter;
u8 field_DA; u8 arenaTurnCounter;
u8 turnSideTracker; u8 turnSideTracker;
u8 fillerDC[0xDF-0xDC]; u8 fillerDC[0xDF-0xDC];
u8 field_DF; u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party.
u8 lastTakenMoveFrom[MAX_BATTLERS_COUNT * MAX_BATTLERS_COUNT * 2]; // a 3-D array [target][attacker][byte] u8 lastTakenMoveFrom[MAX_BATTLERS_COUNT * MAX_BATTLERS_COUNT * 2]; // a 3-D array [target][attacker][byte]
u16 castformPalette[MAX_BATTLERS_COUNT][16]; u16 castformPalette[MAX_BATTLERS_COUNT][16];
u8 field_180; u8 field_180;

View File

@ -38,7 +38,7 @@ void ConfigureAndSetUpOneTrainerBattle(u8 trainerEventObjId, const u8 *trainerSc
void ConfigureTwoTrainersBattle(u8 trainerEventObjId, const u8 *trainerScript); void ConfigureTwoTrainersBattle(u8 trainerEventObjId, const u8 *trainerScript);
void SetUpTwoTrainersBattle(void); void SetUpTwoTrainersBattle(void);
bool32 GetTrainerFlagFromScriptPointer(const u8 *data); bool32 GetTrainerFlagFromScriptPointer(const u8 *data);
void sub_80B16D8(void); void SetUpTrainerMovement(void);
u8 GetTrainerBattleMode(void); u8 GetTrainerBattleMode(void);
bool8 GetTrainerFlag(void); bool8 GetTrainerFlag(void);
bool8 HasTrainerBeenFought(u16 trainerId); bool8 HasTrainerBeenFought(u16 trainerId);

View File

@ -10,7 +10,7 @@
#define TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE 6 #define TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE 6
#define TRAINER_BATTLE_REMATCH_DOUBLE 7 #define TRAINER_BATTLE_REMATCH_DOUBLE 7
#define TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC 8 #define TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC 8
#define TRAINER_BATTLE_9 9 #define TRAINER_BATTLE_PYRAMID 9
#define TRAINER_BATTLE_SET_TRAINER_A 10 #define TRAINER_BATTLE_SET_TRAINER_A 10
#define TRAINER_BATTLE_SET_TRAINER_B 11 #define TRAINER_BATTLE_SET_TRAINER_B 11
#define TRAINER_BATTLE_12 12 #define TRAINER_BATTLE_12 12

View File

@ -10,11 +10,11 @@ extern const u8 EventScript_275D0C[];
extern const u8 EventScript_275D1F[]; extern const u8 EventScript_275D1F[];
extern const u8 EventScript_275D2E[]; extern const u8 EventScript_275D2E[];
extern const u8 EventScript_271354[]; extern const u8 EventScript_271354[];
extern const u8 EventScript_2713C2[]; extern const u8 EventScript_DoTainerBattle[];
extern const u8 EventScript_TryDoDoubleTrainerBattle[]; extern const u8 EventScript_TryDoDoubleTrainerBattle[];
extern const u8 EventScript_271362[]; extern const u8 EventScript_TryDoNormalTrainerBattle[];
extern const u8 EventScript_TryDoDoubleRematchBattle[]; extern const u8 EventScript_TryDoDoubleRematchBattle[];
extern const u8 EventScript_2713D1[]; extern const u8 EventScript_TryDoRematchBattle[];
extern const u8 EventScript_SecretPower1[]; extern const u8 EventScript_SecretPower1[];
extern const u8 EventScript_SecretPower2[]; extern const u8 EventScript_SecretPower2[];

View File

@ -19,7 +19,7 @@ extern u8 gApproachingTrainerId;
bool8 CheckForTrainersWantingBattle(void); bool8 CheckForTrainersWantingBattle(void);
void sub_80B4578(struct EventObject *var); void sub_80B4578(struct EventObject *var);
void EndTrainerApproach(void); void EndTrainerApproach(void);
void sub_80B45D0(void); void TryPrepareSecondApproachingTrainer(void);
u8 FldEff_ExclamationMarkIcon(void); u8 FldEff_ExclamationMarkIcon(void);
u8 FldEff_QuestionMarkIcon(void); u8 FldEff_QuestionMarkIcon(void);
u8 FldEff_HeartIcon(void); u8 FldEff_HeartIcon(void);

View File

@ -3071,7 +3071,7 @@ static void BattleStartClearSetData(void)
*(gBattleStruct->AI_monToSwitchIntoId + i) = PARTY_SIZE; *(gBattleStruct->AI_monToSwitchIntoId + i) = PARTY_SIZE;
} }
gBattleStruct->field_DF = 0; gBattleStruct->givenExpMons = 0;
gBattleStruct->field_92 = 0; gBattleStruct->field_92 = 0;
gRandomTurnNumber = Random(); gRandomTurnNumber = Random();
@ -3192,7 +3192,7 @@ void SwitchInClearSetData(void)
gBattleResources->flags->flags[gActiveBattler] = 0; gBattleResources->flags->flags[gActiveBattler] = 0;
gCurrentMove = 0; gCurrentMove = 0;
gBattleStruct->field_DA = 0xFF; gBattleStruct->arenaTurnCounter = 0xFF;
ClearBattlerMoveHistory(gActiveBattler); ClearBattlerMoveHistory(gActiveBattler);
ClearBattlerAbilityHistory(gActiveBattler); ClearBattlerAbilityHistory(gActiveBattler);
@ -3994,7 +3994,7 @@ void BattleTurnPassed(void)
if (gBattleResults.battleTurnCounter < 0xFF) if (gBattleResults.battleTurnCounter < 0xFF)
{ {
gBattleResults.battleTurnCounter++; gBattleResults.battleTurnCounter++;
gBattleStruct->field_DA++; gBattleStruct->arenaTurnCounter++;
} }
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
@ -4013,7 +4013,7 @@ void BattleTurnPassed(void)
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
BattleScriptExecute(BattleScript_82DB881); BattleScriptExecute(BattleScript_82DB881);
else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->field_DA == 0) else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->arenaTurnCounter == 0)
BattleScriptExecute(BattleScript_ArenaTurnBeginning); BattleScriptExecute(BattleScript_ArenaTurnBeginning);
} }

View File

@ -3270,7 +3270,7 @@ static void atk23_getexp(void)
else else
{ {
gBattleScripting.atk23_state++; gBattleScripting.atk23_state++;
gBattleStruct->field_DF |= gBitTable[gBattlerPartyIndexes[gBattlerFainted]]; gBattleStruct->givenExpMons |= gBitTable[gBattlerPartyIndexes[gBattlerFainted]];
} }
break; break;
case 1: // calculate experience points to redistribute case 1: // calculate experience points to redistribute

View File

@ -306,7 +306,7 @@ const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] =
{{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b}, {{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b},
{{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc}, {{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc},
{{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e}, {{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e},
{{TRAINER_WALLY_3, 0x292, 0x293, 0x294, 0x294}, 0x18, 0x2b}, {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b},
{{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3}, {{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3},
{{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb}, {{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb},
{{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2}, {{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2},
@ -1088,7 +1088,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
{ {
case TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT: case TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT:
TrainerBattleLoadArgs(sOrdinaryNoIntroBattleParams, data); TrainerBattleLoadArgs(sOrdinaryNoIntroBattleParams, data);
return EventScript_2713C2; return EventScript_DoTainerBattle;
case TRAINER_BATTLE_DOUBLE: case TRAINER_BATTLE_DOUBLE:
TrainerBattleLoadArgs(sDoubleBattleParams, data); TrainerBattleLoadArgs(sDoubleBattleParams, data);
SetMapVarsToTrainer(); SetMapVarsToTrainer();
@ -1103,11 +1103,11 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
{ {
TrainerBattleLoadArgs(sTrainerBContinueScriptBattleParams, data); TrainerBattleLoadArgs(sTrainerBContinueScriptBattleParams, data);
} }
return EventScript_271362; return EventScript_TryDoNormalTrainerBattle;
case TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC: case TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC:
TrainerBattleLoadArgs(sContinueScriptBattleParams, data); TrainerBattleLoadArgs(sContinueScriptBattleParams, data);
SetMapVarsToTrainer(); SetMapVarsToTrainer();
return EventScript_271362; return EventScript_TryDoNormalTrainerBattle;
case TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE: case TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE:
case TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC: case TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC:
TrainerBattleLoadArgs(sContinueScriptDoubleBattleParams, data); TrainerBattleLoadArgs(sContinueScriptDoubleBattleParams, data);
@ -1122,8 +1122,8 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
TrainerBattleLoadArgs(sOrdinaryBattleParams, data); TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
SetMapVarsToTrainer(); SetMapVarsToTrainer();
gTrainerBattleOpponent_A = GetRematchTrainerId(gTrainerBattleOpponent_A); gTrainerBattleOpponent_A = GetRematchTrainerId(gTrainerBattleOpponent_A);
return EventScript_2713D1; return EventScript_TryDoRematchBattle;
case TRAINER_BATTLE_9: case TRAINER_BATTLE_PYRAMID:
if (gApproachingTrainerId == 0) if (gApproachingTrainerId == 0)
{ {
TrainerBattleLoadArgs(sOrdinaryBattleParams, data); TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
@ -1135,7 +1135,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data); TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data);
gTrainerBattleOpponent_B = LocalIdToPyramidTrainerId(gSpecialVar_LastTalked); gTrainerBattleOpponent_B = LocalIdToPyramidTrainerId(gSpecialVar_LastTalked);
} }
return EventScript_271362; return EventScript_TryDoNormalTrainerBattle;
case TRAINER_BATTLE_SET_TRAINER_A: case TRAINER_BATTLE_SET_TRAINER_A:
TrainerBattleLoadArgs(sOrdinaryBattleParams, data); TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
return NULL; return NULL;
@ -1154,7 +1154,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data); TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data);
gTrainerBattleOpponent_B = sub_81D6180(gSpecialVar_LastTalked); gTrainerBattleOpponent_B = sub_81D6180(gSpecialVar_LastTalked);
} }
return EventScript_271362; return EventScript_TryDoNormalTrainerBattle;
default: default:
if (gApproachingTrainerId == 0) if (gApproachingTrainerId == 0)
{ {
@ -1165,7 +1165,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
{ {
TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data); TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data);
} }
return EventScript_271362; return EventScript_TryDoNormalTrainerBattle;
} }
} }
@ -1197,7 +1197,7 @@ bool32 GetTrainerFlagFromScriptPointer(const u8 *data)
return FlagGet(FLAG_TRAINER_FLAG_START + flag); return FlagGet(FLAG_TRAINER_FLAG_START + flag);
} }
void sub_80B16D8(void) void SetUpTrainerMovement(void)
{ {
struct EventObject *eventObject = &gEventObjects[gSelectedEventObject]; struct EventObject *eventObject = &gEventObjects[gSelectedEventObject];

View File

@ -1192,7 +1192,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
// fall through // fall through
case 2: case 2:
if ((gBattleTypeFlags & BATTLE_TYPE_ARENA) if ((gBattleTypeFlags & BATTLE_TYPE_ARENA)
&& gBattleStruct->field_DA == 2 && gBattleStruct->arenaTurnCounter == 2
&& gBattleMons[0].hp != 0 && gBattleMons[1].hp != 0) && gBattleMons[0].hp != 0 && gBattleMons[1].hp != 0)
{ {
s32 i; s32 i;
@ -1238,7 +1238,7 @@ bool8 HandleFaintedMonActions(void)
{ {
gBattlerFainted = gBattlerTarget = gBattleStruct->faintedActionsBattlerId; gBattlerFainted = gBattlerTarget = gBattleStruct->faintedActionsBattlerId;
if (gBattleMons[gBattleStruct->faintedActionsBattlerId].hp == 0 if (gBattleMons[gBattleStruct->faintedActionsBattlerId].hp == 0
&& !(gBattleStruct->field_DF & gBitTable[gBattlerPartyIndexes[gBattleStruct->faintedActionsBattlerId]]) && !(gBattleStruct->givenExpMons & gBitTable[gBattlerPartyIndexes[gBattleStruct->faintedActionsBattlerId]])
&& !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBattlerId])) && !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBattlerId]))
{ {
BattleScriptExecute(BattleScript_GiveExp); BattleScriptExecute(BattleScript_GiveExp);

View File

@ -19,6 +19,7 @@
#include "task.h" #include "task.h"
#include "window.h" #include "window.h"
#include "list_menu.h" #include "list_menu.h"
#include "overworld.h"
#define EGG_MOVES_ARRAY_COUNT 10 #define EGG_MOVES_ARRAY_COUNT 10
#define EGG_LVL_UP_MOVES_ARRAY_COUNT 50 #define EGG_LVL_UP_MOVES_ARRAY_COUNT 50
@ -39,12 +40,8 @@ extern const u8 gDaycareText_PlayOther[];
extern u8 GetCursorSelectionMonId(void); extern u8 GetCursorSelectionMonId(void);
extern u16 ItemIdToBattleMoveId(u16); extern u16 ItemIdToBattleMoveId(u16);
extern s32 ListMenuHandleInputGetItemId(u8);
extern void DestroyListMenuTask(u8, u16*, u16*);
extern void sub_819746C(u8, bool8); extern void sub_819746C(u8, bool8);
extern void NewMenuHelpers_DrawStdWindowFrame(u8, bool8);
extern void sub_81B9328(void); extern void sub_81B9328(void);
extern void CB2_ReturnToField(void);
// this file's functions // this file's functions
static void ClearDaycareMonMail(struct DayCareMail *mail); static void ClearDaycareMonMail(struct DayCareMail *mail);

View File

@ -630,26 +630,26 @@ static void Task_DestroyTrainerApproachTask(u8 taskId)
EnableBothScriptContexts(); EnableBothScriptContexts();
} }
void sub_80B45D0(void) void TryPrepareSecondApproachingTrainer(void)
{ {
if (gNoOfApproachingTrainers == 2) if (gNoOfApproachingTrainers == 2)
{ {
if (gApproachingTrainerId == 0) if (gApproachingTrainerId == 0)
{ {
gApproachingTrainerId++; gApproachingTrainerId++;
gSpecialVar_Result = 1; gSpecialVar_Result = TRUE;
UnfreezeEventObjects(); UnfreezeEventObjects();
FreezeEventObjectsExceptOne(gApproachingTrainers[1].eventObjectId); FreezeEventObjectsExceptOne(gApproachingTrainers[1].eventObjectId);
} }
else else
{ {
gApproachingTrainerId = 0; gApproachingTrainerId = 0;
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
} }
} }
else else
{ {
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
} }
} }