diff options
-rw-r--r-- | asm/menews_jisan.s | 50 | ||||
-rw-r--r-- | include/event_data.h | 1 | ||||
-rw-r--r-- | include/global.h | 10 | ||||
-rw-r--r-- | src/menews_jisan.c | 25 |
4 files changed, 32 insertions, 54 deletions
diff --git a/asm/menews_jisan.s b/asm/menews_jisan.s index 160d0e4c8..4661c1a50 100644 --- a/asm/menews_jisan.s +++ b/asm/menews_jisan.s @@ -5,56 +5,6 @@ .text - thumb_func_start sub_8146C88 -sub_8146C88: @ 8146C88 - push {lr} - bl sub_8143D94 - movs r1, 0 - strb r1, [r0] - strb r1, [r0, 0x1] - ldr r0, _08146CA0 @ =0x00004028 - bl VarSet - pop {r0} - bx r0 - .align 2, 0 -_08146CA0: .4byte 0x00004028 - thumb_func_end sub_8146C88 - - thumb_func_start sub_8146CA4 -sub_8146CA4: @ 8146CA4 - push {r4,lr} - ldr r0, _08146CE0 @ =0x00004028 - bl sub_806E454 - adds r4, r0, 0 - bl sub_8143D94 - adds r2, r0, 0 - ldr r0, [r2] - lsls r0, 24 - lsrs r0, 29 - cmp r0, 0x4 - bls _08146CD8 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - lsls r0, 16 - ldr r1, _08146CE4 @ =0x01f30000 - cmp r0, r1 - bls _08146CD8 - ldrb r0, [r2] - movs r1, 0x1F - ands r1, r0 - strb r1, [r2] - movs r0, 0 - strh r0, [r4] -_08146CD8: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08146CE0: .4byte 0x00004028 -_08146CE4: .4byte 0x01f30000 - thumb_func_end sub_8146CA4 - thumb_func_start sub_8146CE8 sub_8146CE8: @ 8146CE8 push {r4-r6,lr} diff --git a/include/event_data.h b/include/event_data.h index f829d3b87..a5c9efe0d 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -29,6 +29,7 @@ u8 *GetFlagPointer(u16 id); u8 FlagSet(u16 id); u8 FlagClear(u16 id); bool8 FlagGet(u16 id); +u16 * sub_806E454(u16 id); extern u16 gSpecialVar_0x8000; extern u16 gSpecialVar_0x8001; diff --git a/include/global.h b/include/global.h index 2b35e303d..5a7cc134d 100644 --- a/include/global.h +++ b/include/global.h @@ -468,10 +468,11 @@ struct RecordMixingDayCareMail struct MysteryEventStruct { - u8 unk_0_0:2; - u8 unk_0_2:6; - u8 unk_1; - u8 filler_2[0x1ba]; + u32 unk_0_0:2; + u32 unk_0_2:3; + u32 unk_0_5:3; + u32 unk_1:8; + u32 unk_2:16; }; #define MAP_OBJECTS_COUNT 16 @@ -496,6 +497,7 @@ struct SaveBlock1 /*0x08E0*/ struct MapObjectTemplate mapObjectTemplates[64]; /*0x0EE0*/ u8 fillerEE0[0x2580]; /*0x3460*/ struct MysteryEventStruct unk_3460; + /*0x3464*/ u8 filler_3464[0x1b8]; /*0x361C*/ struct RamScript ramScript; /*0x3A08*/ u8 filler3A08[0x44]; /*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH]; diff --git a/src/menews_jisan.c b/src/menews_jisan.c index afaef7cf9..6e9be8318 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -1,6 +1,7 @@ #include "global.h" #include "mevent.h" #include "random.h" +#include "event_data.h" #ifdef NONMATCHING void sub_8146C30(u32 a0) @@ -72,3 +73,27 @@ void sub_8146C30(u32 a0) "\tbx r0"); } #endif + +void sub_8146C88(void) +{ + struct MysteryEventStruct *r5 = sub_8143D94(); + + r5->unk_0_0 = 0; + r5->unk_0_2 = 0; + r5->unk_0_5 = 0; + r5->unk_1 = 0; + VarSet(0x4028, 0); +} + +void sub_8146CA4(void) +{ + u16 *r4 = sub_806E454(0x4028); + struct MysteryEventStruct *r5 = sub_8143D94(); + struct MysteryEventStruct r0 = *r5; + + if ((u8)r0.unk_0_5 > 4 && ++(*r4) > 0x1f3) + { + r5->unk_0_5 = 0; + *r4 = 0; + } +} |