diff options
author | JaceCearK1 <JaceCearK1@users.noreply.github.com> | 2017-07-01 21:04:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-01 21:04:18 +0200 |
commit | 0dd804a99e5455a0eac8ff6ed87d9de16c7380b7 (patch) | |
tree | 7b3567978b63ee6548a7b945e075ea8ba37bef51 /src/post_battle_event_funcs.c | |
parent | f1344efd2aff92292f58f7323bd9297a38fe9b02 (diff) | |
parent | 8d82578d3a101b06f9d2ced31738021007c4e533 (diff) |
Merge pull request #1 from pret/master
Update fork to match main fork.
Diffstat (limited to 'src/post_battle_event_funcs.c')
-rw-r--r-- | src/post_battle_event_funcs.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/post_battle_event_funcs.c b/src/post_battle_event_funcs.c new file mode 100644 index 000000000..8d85705c8 --- /dev/null +++ b/src/post_battle_event_funcs.c @@ -0,0 +1,69 @@ +#include "global.h" +#include "event_data.h" +#include "hall_of_fame.h" +#include "load_save.h" +#include "main.h" +#include "pokemon.h" +#include "rom4.h" +#include "script_pokemon_80C4.h" + +extern u8 gUnknown_02039324; + +int GameClear(void) +{ + int i; + bool32 ribbonGet; + + HealPlayerParty(); + + if (FlagGet(SYS_GAME_CLEAR) == TRUE) + { + gUnknown_02039324 = 1; + } + else + { + gUnknown_02039324 = 0; + FlagSet(SYS_GAME_CLEAR); + } + + if (!GetGameStat(1)) + SetGameStat(1, (gSaveBlock2.playTimeHours << 16) | (gSaveBlock2.playTimeMinutes << 8) | gSaveBlock2.playTimeSeconds); + + SetSecretBase2Field_9(); + + if (gSaveBlock2.playerGender == MALE) + sub_80537CC(1); + else + sub_80537CC(2); + + ribbonGet = FALSE; + + for (i = 0; i < 6; i++) + { + u8 val; + u8 *ptr = &val; + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT2) + && !GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT3) + && !GetMonData(&gPlayerParty[i], MON_DATA_CHAMPION_RIBBON)) + { + *ptr = 1; + SetMonData(&gPlayerParty[i], MON_DATA_CHAMPION_RIBBON, ptr); + ribbonGet = TRUE; + } + } + + if (ribbonGet == TRUE) + { + IncrementGameStat(42); + FlagSet(SYS_RIBBON_GET); + } + + SetMainCallback2(sub_8141F90); + return 0; +} + +int sp0C8_whiteout_maybe(void) +{ + SetMainCallback2(CB2_WhiteOut); + return 0; +} |