summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2017-04-07 22:39:56 -0700
committerYamaArashi <shadow962@live.com>2017-04-07 22:39:56 -0700
commit9d39cca19c6987c5e861f9bce9979e5516e9eaf5 (patch)
treeb5591ee386f5a01461f29230ae370dab961c548c /src
parent4dca3bbb988f4d574faf7410bf6616f802f8cc8c (diff)
decompile post_battle_event_funcs
Diffstat (limited to 'src')
-rw-r--r--src/post_battle_event_funcs.c70
1 files changed, 70 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..56e1518eb
--- /dev/null
+++ b/src/post_battle_event_funcs.c
@@ -0,0 +1,70 @@
+#include "global.h"
+#include "main.h"
+#include "script_pokemon_80C4.h"
+#include "event_data.h"
+#include "pokemon.h"
+#include "rom4.h"
+#include "load_save.h"
+
+extern void sub_8141F90(void);
+
+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;
+}