summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-10-08 14:40:46 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2018-10-08 14:40:46 -0400
commit6b27e999f242f51a81bef70c40a378d5adbaf9e2 (patch)
tree759cd469c8dfdec415a6d25875778f2a17c64878
parent4dd5029fdc505636d8ac00add5425bb22fd082ba (diff)
through sub_8146D94
-rw-r--r--asm/menews_jisan.s95
-rw-r--r--include/event_data.h1
-rw-r--r--include/mevent.h1
-rw-r--r--src/menews_jisan.c68
4 files changed, 67 insertions, 98 deletions
diff --git a/asm/menews_jisan.s b/asm/menews_jisan.s
index 4661c1a50..155ea3f28 100644
--- a/asm/menews_jisan.s
+++ b/asm/menews_jisan.s
@@ -5,101 +5,6 @@
.text
- thumb_func_start sub_8146CE8
-sub_8146CE8: @ 8146CE8
- push {r4-r6,lr}
- ldr r6, _08146D08 @ =gUnknown_20370D0
- bl sub_8143D94
- adds r4, r0, 0
- bl sub_806E2BC
- cmp r0, 0
- beq _08146D02
- bl sub_8143E1C
- cmp r0, 0
- bne _08146D0C
-_08146D02:
- movs r0, 0
- b _08146D6E
- .align 2, 0
-_08146D08: .4byte gUnknown_20370D0
-_08146D0C:
- adds r0, r4, 0
- bl sub_8146E0C
- lsls r0, 16
- lsrs r5, r0, 16
- cmp r5, 0x6
- bhi _08146D6C
- lsls r0, r5, 2
- ldr r1, _08146D24 @ =_08146D28
- adds r0, r1
- ldr r0, [r0]
- mov pc, r0
- .align 2, 0
-_08146D24: .4byte _08146D28
- .align 2, 0
-_08146D28:
- .4byte _08146D6C
- .4byte _08146D44
- .4byte _08146D44
- .4byte _08146D6C
- .4byte _08146D4E
- .4byte _08146D5E
- .4byte _08146D6C
-_08146D44:
- adds r0, r4, 0
- bl sub_8146D74
- strh r0, [r6]
- b _08146D6C
-_08146D4E:
- adds r0, r4, 0
- bl sub_8146D74
- strh r0, [r6]
- adds r0, r4, 0
- bl sub_8146DA0
- b _08146D6C
-_08146D5E:
- adds r0, r4, 0
- bl sub_8146D74
- strh r0, [r6]
- adds r0, r4, 0
- bl sub_8146D94
-_08146D6C:
- adds r0, r5, 0
-_08146D6E:
- pop {r4-r6}
- pop {r1}
- bx r1
- thumb_func_end sub_8146CE8
-
- thumb_func_start sub_8146D74
-sub_8146D74: @ 8146D74
- push {r4,lr}
- ldrb r2, [r0]
- movs r1, 0x4
- negs r1, r1
- ands r1, r2
- strb r1, [r0]
- ldrb r4, [r0, 0x1]
- adds r4, 0x84
- movs r1, 0
- strb r1, [r0, 0x1]
- bl sub_8146DD8
- adds r0, r4, 0
- pop {r4}
- pop {r1}
- bx r1
- thumb_func_end sub_8146D74
-
- thumb_func_start sub_8146D94
-sub_8146D94: @ 8146D94
- ldrb r2, [r0]
- movs r1, 0x1D
- negs r1, r1
- ands r1, r2
- strb r1, [r0]
- bx lr
- thumb_func_end sub_8146D94
-
thumb_func_start sub_8146DA0
sub_8146DA0: @ 8146DA0
push {r4,lr}
diff --git a/include/event_data.h b/include/event_data.h
index a5c9efe0d..914217588 100644
--- a/include/event_data.h
+++ b/include/event_data.h
@@ -30,6 +30,7 @@ u8 FlagSet(u16 id);
u8 FlagClear(u16 id);
bool8 FlagGet(u16 id);
u16 * sub_806E454(u16 id);
+bool32 sub_806E2BC(void);
extern u16 gSpecialVar_0x8000;
extern u16 gSpecialVar_0x8001;
diff --git a/include/mevent.h b/include/mevent.h
index b196d655b..a611a98a8 100644
--- a/include/mevent.h
+++ b/include/mevent.h
@@ -2,5 +2,6 @@
#define GUARD_MEVENT_H
struct MysteryEventStruct * sub_8143D94(void);
+bool32 sub_8143E1C(void);
#endif //GUARD_MEVENT_H
diff --git a/src/menews_jisan.c b/src/menews_jisan.c
index 6e9be8318..93f98ab7a 100644
--- a/src/menews_jisan.c
+++ b/src/menews_jisan.c
@@ -3,6 +3,14 @@
#include "random.h"
#include "event_data.h"
+extern EWRAM_DATA u16 gUnknown_20370D0;
+
+u32 sub_8146D74(struct MysteryEventStruct *);
+void sub_8146DD8(struct MysteryEventStruct *);
+u16 sub_8146E0C(struct MysteryEventStruct *);
+void sub_8146DA0(struct MysteryEventStruct *);
+void sub_8146D94(struct MysteryEventStruct *);
+
#ifdef NONMATCHING
void sub_8146C30(u32 a0)
{
@@ -88,12 +96,66 @@ void sub_8146C88(void)
void sub_8146CA4(void)
{
u16 *r4 = sub_806E454(0x4028);
- struct MysteryEventStruct *r5 = sub_8143D94();
- struct MysteryEventStruct r0 = *r5;
+ struct MysteryEventStruct *r2 = sub_8143D94();
+ struct MysteryEventStruct r0 = *r2;
if ((u8)r0.unk_0_5 > 4 && ++(*r4) > 0x1f3)
{
- r5->unk_0_5 = 0;
+ r2->unk_0_5 = 0;
*r4 = 0;
}
}
+
+u16 sub_8146CE8(void)
+{
+ u16 *r6 = &gUnknown_20370D0;
+ struct MysteryEventStruct *r4 = sub_8143D94();
+ u16 r5;
+
+ if (!sub_806E2BC() || !sub_8143E1C())
+ return 0;
+
+ r5 = sub_8146E0C(r4);
+
+ switch (r5)
+ {
+ case 0:
+ break;
+ case 1:
+ *r6 = sub_8146D74(r4);
+ break;
+ case 2:
+ *r6 = sub_8146D74(r4);
+ break;
+ case 3:
+ break;
+ case 4:
+ *r6 = sub_8146D74(r4);
+ sub_8146DA0(r4);
+ break;
+ case 5:
+ *r6 = sub_8146D74(r4);
+ sub_8146D94(r4);
+ break;
+ case 6:
+ break;
+ }
+
+ return r5;
+}
+
+u32 sub_8146D74(struct MysteryEventStruct *a0)
+{
+ u32 r4;
+
+ a0->unk_0_0 = 0;
+ r4 = a0->unk_1 + 0x84;
+ a0->unk_1 = 0;
+ sub_8146DD8(a0);
+ return r4;
+}
+
+void sub_8146D94(struct MysteryEventStruct *a0)
+{
+ a0->unk_0_2 = 0;
+}