summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/menews_jisan.s134
-rw-r--r--data/data_84827AC.s8
-rw-r--r--include/global.h9
-rw-r--r--ld_script.txt3
-rw-r--r--src/menews_jisan.c41
5 files changed, 47 insertions, 148 deletions
diff --git a/asm/menews_jisan.s b/asm/menews_jisan.s
deleted file mode 100644
index 155ea3f28..000000000
--- a/asm/menews_jisan.s
+++ /dev/null
@@ -1,134 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start sub_8146DA0
-sub_8146DA0: @ 8146DA0
- push {r4,lr}
- adds r3, r0, 0
- ldr r0, [r3]
- lsls r0, 27
- lsrs r0, 29
- adds r0, 0x1
- movs r1, 0x7
- ands r0, r1
- lsls r0, 2
- ldrb r1, [r3]
- movs r4, 0x1D
- negs r4, r4
- adds r2, r4, 0
- ands r2, r1
- orrs r2, r0
- strb r2, [r3]
- ldr r0, [r3]
- lsls r0, 27
- lsrs r0, 29
- cmp r0, 0x4
- bls _08146DD2
- ands r2, r4
- movs r0, 0x10
- orrs r2, r0
- strb r2, [r3]
-_08146DD2:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_8146DA0
-
- thumb_func_start sub_8146DD8
-sub_8146DD8: @ 8146DD8
- push {r4,lr}
- adds r3, r0, 0
- ldr r0, [r3]
- lsls r0, 24
- lsrs r0, 29
- adds r0, 0x1
- lsls r0, 5
- ldrb r1, [r3]
- movs r4, 0x1F
- adds r2, r4, 0
- ands r2, r1
- orrs r2, r0
- strb r2, [r3]
- ldr r0, [r3]
- lsls r0, 24
- lsrs r0, 29
- cmp r0, 0x5
- bls _08146E04
- ands r2, r4
- movs r0, 0xA0
- orrs r2, r0
- strb r2, [r3]
-_08146E04:
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end sub_8146DD8
-
- thumb_func_start sub_8146E0C
-sub_8146E0C: @ 8146E0C
- push {lr}
- adds r2, r0, 0
- ldrb r1, [r2]
- movs r0, 0xE0
- ands r0, r1
- cmp r0, 0xA0
- bne _08146E1E
- movs r0, 0x6
- b _08146E66
-_08146E1E:
- ldr r1, [r2]
- lsls r0, r1, 30
- lsrs r0, 30
- cmp r0, 0x1
- beq _08146E40
- cmp r0, 0x1
- bgt _08146E32
- cmp r0, 0
- beq _08146E3C
- b _08146E58
-_08146E32:
- cmp r0, 0x2
- beq _08146E44
- cmp r0, 0x3
- beq _08146E48
- b _08146E58
-_08146E3C:
- movs r0, 0x3
- b _08146E66
-_08146E40:
- movs r0, 0x1
- b _08146E66
-_08146E44:
- movs r0, 0x2
- b _08146E66
-_08146E48:
- lsls r0, r1, 27
- lsrs r0, 29
- cmp r0, 0x2
- bhi _08146E54
- movs r0, 0x4
- b _08146E66
-_08146E54:
- movs r0, 0x5
- b _08146E66
-_08146E58:
- ldr r0, _08146E6C @ =gUnknown_8468C5C "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c"
- ldr r1, _08146E70 @ =0x0000017f
- ldr r2, _08146E74 @ =gUnknown_8468C94 "0"
- movs r3, 0x1
- bl AGBAssert
- movs r0, 0
-_08146E66:
- pop {r1}
- bx r1
- .align 2, 0
-_08146E6C: .4byte gUnknown_8468C5C
-_08146E70: .4byte 0x0000017f
-_08146E74: .4byte gUnknown_8468C94
- thumb_func_end sub_8146E0C
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/data/data_84827AC.s b/data/data_84827AC.s
index 2c69a76d7..565a6adf2 100644
--- a/data/data_84827AC.s
+++ b/data/data_84827AC.s
@@ -5014,13 +5014,7 @@ gUnknown_8468B6C:: @ 8468B6C
gUnknown_8468BCC:: @ 8468BCC
.incbin "baserom.gba", 0x468BCC, 0x90
- .align 2
-gUnknown_8468C5C:: @ 8468C5C
- .asciz "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c"
-
- .align 2
-gUnknown_8468C94:: @ 8468C94
- .asciz "0"
+ .section .rodata.8468C98
.align 2
gUnknown_8468C98:: @ 8468C98
diff --git a/include/global.h b/include/global.h
index 5a7cc134d..11a79ebe8 100644
--- a/include/global.h
+++ b/include/global.h
@@ -468,11 +468,10 @@ struct RecordMixingDayCareMail
struct MysteryEventStruct
{
- u32 unk_0_0:2;
- u32 unk_0_2:3;
- u32 unk_0_5:3;
- u32 unk_1:8;
- u32 unk_2:16;
+ u8 unk_0_0:2;
+ u8 unk_0_2:3;
+ u8 unk_0_5:3;
+ u8 unk_1;
};
#define MAP_OBJECTS_COUNT 16
diff --git a/ld_script.txt b/ld_script.txt
index 777735b7c..70084ef0e 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -250,7 +250,6 @@ SECTIONS {
asm/mevent_server.o(.text);
asm/mevent_8145654.o(.text);
src/menews_jisan.o(.text);
- asm/menews_jisan.o(.text);
asm/seagallop.o(.text);
asm/unk_8147500.o(.text);
asm/unk_8147AA8.o(.text);
@@ -370,6 +369,8 @@ SECTIONS {
data/data.o(.rodata);
src/battle_ai_script_commands.o(.rodata);
data/data_84827AC.o(.rodata);
+ src/menews_jisan.o(.rodata);
+ data/data_84827AC.o(.rodata.8468C98);
src/m4a_tables.o(.rodata);
data/sound_data.o(.rodata);
} =0
diff --git a/src/menews_jisan.c b/src/menews_jisan.c
index 93f98ab7a..6c3f669eb 100644
--- a/src/menews_jisan.c
+++ b/src/menews_jisan.c
@@ -7,7 +7,7 @@ extern EWRAM_DATA u16 gUnknown_20370D0;
u32 sub_8146D74(struct MysteryEventStruct *);
void sub_8146DD8(struct MysteryEventStruct *);
-u16 sub_8146E0C(struct MysteryEventStruct *);
+u32 sub_8146E0C(struct MysteryEventStruct *);
void sub_8146DA0(struct MysteryEventStruct *);
void sub_8146D94(struct MysteryEventStruct *);
@@ -159,3 +159,42 @@ void sub_8146D94(struct MysteryEventStruct *a0)
{
a0->unk_0_2 = 0;
}
+
+void sub_8146DA0(struct MysteryEventStruct *a0)
+{
+ a0->unk_0_2++;
+ if ((u8)a0->unk_0_2 > 4)
+ a0->unk_0_2 = 4;
+}
+
+void sub_8146DD8(struct MysteryEventStruct *a0)
+{
+ a0->unk_0_5++;
+ if ((u8)a0->unk_0_5 > 5)
+ a0->unk_0_5 = 5;
+}
+
+u32 sub_8146E0C(struct MysteryEventStruct *a0)
+{
+ struct MysteryEventStruct r0;
+ if ((u8)a0->unk_0_5 == 5)
+ return 6;
+
+ r0 = *a0;
+ switch (r0.unk_0_0)
+ {
+ case 0:
+ return 3;
+ case 1:
+ return 1;
+ case 2:
+ return 2;
+ case 3:
+ if ((u8)r0.unk_0_2 < 3)
+ return 4;
+ return 5;
+ default:
+ AGBAssert("C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c", 383, "0", 1);
+ return 0;
+ }
+}