summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/post_battle_event_funcs.s121
-rw-r--r--include/load_save.h1
-rw-r--r--include/overworld.h2
-rw-r--r--ld_script.txt2
-rw-r--r--src/post_battle_event_funcs.c59
5 files changed, 63 insertions, 122 deletions
diff --git a/asm/post_battle_event_funcs.s b/asm/post_battle_event_funcs.s
deleted file mode 100644
index 009bb7233..000000000
--- a/asm/post_battle_event_funcs.s
+++ /dev/null
@@ -1,121 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start Special_HallOfFame
-Special_HallOfFame: @ 80CA2E4
- push {r4-r7,lr}
- sub sp, 0x4
- bl sp000_heal_pokemon
- ldr r4, _080CA304 @ =0x0000082c
- adds r0, r4, 0
- bl FlagGet
- lsls r0, 24
- lsrs r1, r0, 24
- cmp r1, 0x1
- bne _080CA30C
- ldr r0, _080CA308 @ =gHasHallOfFameRecords
- strb r1, [r0]
- b _080CA318
- .align 2, 0
-_080CA304: .4byte 0x0000082c
-_080CA308: .4byte gHasHallOfFameRecords
-_080CA30C:
- ldr r1, _080CA3B0 @ =gHasHallOfFameRecords
- movs r0, 0
- strb r0, [r1]
- adds r0, r4, 0
- bl FlagSet
-_080CA318:
- movs r0, 0x1
- bl GetGameStat
- cmp r0, 0
- bne _080CA33A
- ldr r0, _080CA3B4 @ =gSaveBlock2Ptr
- ldr r2, [r0]
- ldrh r1, [r2, 0xE]
- lsls r1, 16
- ldrb r0, [r2, 0x10]
- lsls r0, 8
- orrs r1, r0
- ldrb r0, [r2, 0x11]
- orrs r1, r0
- movs r0, 0x1
- bl SetGameStat
-_080CA33A:
- bl sub_804C1AC
- movs r0, 0x1
- bl sub_8055738
- movs r6, 0
- movs r5, 0
- mov r7, sp
-_080CA34A:
- movs r0, 0x64
- adds r1, r5, 0
- muls r1, r0
- ldr r0, _080CA3B8 @ =gPlayerParty
- adds r4, r1, r0
- adds r0, r4, 0
- movs r1, 0x5
- bl GetMonData
- cmp r0, 0
- beq _080CA388
- adds r0, r4, 0
- movs r1, 0x6
- bl GetMonData
- cmp r0, 0
- bne _080CA388
- adds r0, r4, 0
- movs r1, 0x43
- bl GetMonData
- cmp r0, 0
- bne _080CA388
- movs r0, 0x1
- strb r0, [r7]
- adds r0, r4, 0
- movs r1, 0x43
- mov r2, sp
- bl SetMonData
- movs r6, 0x1
-_080CA388:
- adds r5, 0x1
- cmp r5, 0x5
- ble _080CA34A
- cmp r6, 0x1
- bne _080CA39E
- movs r0, 0x2A
- bl IncrementGameStat
- ldr r0, _080CA3BC @ =0x0000083b
- bl FlagSet
-_080CA39E:
- ldr r0, _080CA3C0 @ =CB2_DoHallOfFameScreen
- bl SetMainCallback2
- movs r0, 0
- add sp, 0x4
- pop {r4-r7}
- pop {r1}
- bx r1
- .align 2, 0
-_080CA3B0: .4byte gHasHallOfFameRecords
-_080CA3B4: .4byte gSaveBlock2Ptr
-_080CA3B8: .4byte gPlayerParty
-_080CA3BC: .4byte 0x0000083b
-_080CA3C0: .4byte CB2_DoHallOfFameScreen
- thumb_func_end Special_HallOfFame
-
- thumb_func_start sp0C8_whiteout_maybe
-sp0C8_whiteout_maybe: @ 80CA3C4
- push {lr}
- ldr r0, _080CA3D4 @ =CB2_WhiteOut
- bl SetMainCallback2
- movs r0, 0
- pop {r1}
- bx r1
- .align 2, 0
-_080CA3D4: .4byte CB2_WhiteOut
- thumb_func_end sp0C8_whiteout_maybe
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/include/load_save.h b/include/load_save.h
index 6162c30b9..10d1083a8 100644
--- a/include/load_save.h
+++ b/include/load_save.h
@@ -28,5 +28,6 @@ void ApplyNewEncryptionKeyToWord(u32 * word, u32 encryptionKey);
void ApplyNewEncryptionKeyToHword(u16 * hword, u32 encryptionKey);
void ClearContinueGameWarpStatus2(void);
void SetContinueGameWarpStatusToDynamicWarp(void);
+void sub_804C1AC(void);
#endif // GUARD_LOAD_SAVE_H
diff --git a/include/overworld.h b/include/overworld.h
index 08f9be912..845550a17 100644
--- a/include/overworld.h
+++ b/include/overworld.h
@@ -146,4 +146,6 @@ void c2_8056854(void);
void sub_8054F38(u32 newKey);
void sub_8055778(int);
+void sub_8055738(u8 loc);
+
#endif //GUARD_OVERWORLD_H
diff --git a/ld_script.txt b/ld_script.txt
index 86fee9467..41c2d52ae 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -186,7 +186,7 @@ SECTIONS {
src/fldeff_rocksmash.o(.text);
src/fldeff_dig.o(.text);
asm/fldeff_flash.o(.text);
- asm/post_battle_event_funcs.o(.text);
+ src/post_battle_event_funcs.o(.text);
src/prof_pc.o(.text);
src/hof_pc.o(.text);
src/field_specials.o(.text);
diff --git a/src/post_battle_event_funcs.c b/src/post_battle_event_funcs.c
new file mode 100644
index 000000000..6d4652f35
--- /dev/null
+++ b/src/post_battle_event_funcs.c
@@ -0,0 +1,59 @@
+#include "global.h"
+#include "script_pokemon_util_80A0058.h"
+#include "event_data.h"
+#include "credits.h"
+#include "overworld.h"
+#include "hall_of_fame.h"
+#include "load_save.h"
+#include "constants/flags.h"
+#include "constants/spawn_points.h"
+
+bool8 Special_HallOfFame(void)
+{
+ bool8 ribbonState;
+ bool8 *r7;
+ int i;
+ bool8 gaveAtLeastOneRibbon;
+ sp000_heal_pokemon();
+ if (FlagGet(FLAG_SYS_GAME_CLEAR) == TRUE)
+ {
+ gHasHallOfFameRecords = TRUE;
+ }
+ else
+ {
+ gHasHallOfFameRecords = FALSE;
+ FlagSet(FLAG_SYS_GAME_CLEAR);
+ }
+ if (GetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME) == 0)
+ {
+ SetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME, (gSaveBlock2Ptr->playTimeHours << 16) | (gSaveBlock2Ptr->playTimeMinutes << 8) | gSaveBlock2Ptr->playTimeSeconds);
+ }
+ sub_804C1AC();
+ sub_8055738(SPAWN_PALLET_TOWN);
+ gaveAtLeastOneRibbon = FALSE;
+ for (i = 0, r7 = &ribbonState; i < PARTY_SIZE; i++)
+ {
+ if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG))
+ {
+ if (!GetMonData(&gPlayerParty[i], MON_DATA_CHAMPION_RIBBON))
+ {
+ *r7 = TRUE;
+ SetMonData(&gPlayerParty[i], MON_DATA_CHAMPION_RIBBON, &ribbonState);
+ gaveAtLeastOneRibbon = TRUE;
+ }
+ }
+ }
+ if (gaveAtLeastOneRibbon == TRUE)
+ {
+ IncrementGameStat(GAME_STAT_RECEIVED_RIBBONS);
+ FlagSet(FLAG_SYS_RIBBON_GET);
+ }
+ SetMainCallback2(CB2_DoHallOfFameScreen);
+ return FALSE;
+}
+
+bool8 sp0C8_whiteout_maybe(void)
+{
+ SetMainCallback2(CB2_WhiteOut);
+ return FALSE;
+}