sub_8146C30
This commit is contained in:
@@ -5,53 +5,6 @@
|
|||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
thumb_func_start sub_8146C30
|
|
||||||
sub_8146C30: @ 8146C30
|
|
||||||
push {r4,r5,lr}
|
|
||||||
adds r4, r0, 0
|
|
||||||
bl sub_8143D94
|
|
||||||
adds r5, r0, 0
|
|
||||||
movs r0, 0x3
|
|
||||||
adds r1, r4, 0
|
|
||||||
ands r1, r0
|
|
||||||
ldrb r2, [r5]
|
|
||||||
movs r0, 0x4
|
|
||||||
negs r0, r0
|
|
||||||
ands r0, r2
|
|
||||||
orrs r0, r1
|
|
||||||
strb r0, [r5]
|
|
||||||
cmp r4, 0x2
|
|
||||||
bhi _08146C56
|
|
||||||
cmp r4, 0x1
|
|
||||||
bcs _08146C5C
|
|
||||||
b _08146C80
|
|
||||||
_08146C56:
|
|
||||||
cmp r4, 0x3
|
|
||||||
beq _08146C6E
|
|
||||||
b _08146C80
|
|
||||||
_08146C5C:
|
|
||||||
bl Random
|
|
||||||
lsls r0, 16
|
|
||||||
lsrs r0, 16
|
|
||||||
movs r1, 0xF
|
|
||||||
bl __umodsi3
|
|
||||||
adds r0, 0x10
|
|
||||||
b _08146C7E
|
|
||||||
_08146C6E:
|
|
||||||
bl Random
|
|
||||||
lsls r0, 16
|
|
||||||
lsrs r0, 16
|
|
||||||
movs r1, 0xF
|
|
||||||
bl __umodsi3
|
|
||||||
adds r0, 0x1
|
|
||||||
_08146C7E:
|
|
||||||
strb r0, [r5, 0x1]
|
|
||||||
_08146C80:
|
|
||||||
pop {r4,r5}
|
|
||||||
pop {r0}
|
|
||||||
bx r0
|
|
||||||
thumb_func_end sub_8146C30
|
|
||||||
|
|
||||||
thumb_func_start sub_8146C88
|
thumb_func_start sub_8146C88
|
||||||
sub_8146C88: @ 8146C88
|
sub_8146C88: @ 8146C88
|
||||||
push {lr}
|
push {lr}
|
||||||
|
|||||||
+20
-1
@@ -466,6 +466,14 @@ struct RecordMixingDayCareMail
|
|||||||
bool16 holdsItem[DAYCARE_MON_COUNT];
|
bool16 holdsItem[DAYCARE_MON_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct MysteryEventStruct
|
||||||
|
{
|
||||||
|
u8 unk_0_0:2;
|
||||||
|
u8 unk_0_2:6;
|
||||||
|
u8 unk_1;
|
||||||
|
u8 filler_2[0x1ba];
|
||||||
|
};
|
||||||
|
|
||||||
#define MAP_OBJECTS_COUNT 16
|
#define MAP_OBJECTS_COUNT 16
|
||||||
#define BERRY_TREES_COUNT 128
|
#define BERRY_TREES_COUNT 128
|
||||||
#define FLAGS_COUNT 300
|
#define FLAGS_COUNT 300
|
||||||
@@ -476,7 +484,18 @@ struct SaveBlock1
|
|||||||
{
|
{
|
||||||
/*0x0000*/ u8 filler[0x4];
|
/*0x0000*/ u8 filler[0x4];
|
||||||
/*0x0004*/ struct WarpData location;
|
/*0x0004*/ struct WarpData location;
|
||||||
/*0x000C*/ u8 fillerC[0x3610];
|
/*0x0C*/ struct WarpData warp1;
|
||||||
|
/*0x14*/ struct WarpData warp2;
|
||||||
|
/*0x1C*/ struct WarpData lastHealLocation;
|
||||||
|
/*0x24*/ struct WarpData warp4;
|
||||||
|
/*0x002C*/ u8 filler2C[0x60C];
|
||||||
|
/*0x638*/ u8 trainerRematchStepCounter;
|
||||||
|
u8 filler_639;
|
||||||
|
/*0x63a*/ u8 trainerRematches[100];
|
||||||
|
/*0x06A0*/ struct MapObject mapObjects[MAP_OBJECTS_COUNT];
|
||||||
|
/*0x08E0*/ struct MapObjectTemplate mapObjectTemplates[64];
|
||||||
|
/*0x0EE0*/ u8 fillerEE0[0x2580];
|
||||||
|
/*0x3460*/ struct MysteryEventStruct unk_3460;
|
||||||
/*0x361C*/ struct RamScript ramScript;
|
/*0x361C*/ struct RamScript ramScript;
|
||||||
/*0x3A08*/ u8 filler3A08[0x44];
|
/*0x3A08*/ u8 filler3A08[0x44];
|
||||||
/*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH];
|
/*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH];
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef GUARD_MEVENT_H
|
||||||
|
#define GUARD_MEVENT_H
|
||||||
|
|
||||||
|
struct MysteryEventStruct * sub_8143D94(void);
|
||||||
|
|
||||||
|
#endif //GUARD_MEVENT_H
|
||||||
@@ -249,6 +249,7 @@ SECTIONS {
|
|||||||
asm/mevent.o(.text);
|
asm/mevent.o(.text);
|
||||||
asm/mevent_server.o(.text);
|
asm/mevent_server.o(.text);
|
||||||
asm/mevent_8145654.o(.text);
|
asm/mevent_8145654.o(.text);
|
||||||
|
src/menews_jisan.o(.text);
|
||||||
asm/menews_jisan.o(.text);
|
asm/menews_jisan.o(.text);
|
||||||
asm/seagallop.o(.text);
|
asm/seagallop.o(.text);
|
||||||
asm/unk_8147500.o(.text);
|
asm/unk_8147500.o(.text);
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "mevent.h"
|
||||||
|
#include "random.h"
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
|
void sub_8146C30(u32 a0)
|
||||||
|
{
|
||||||
|
struct MysteryEventStruct *r5 = sub_8143D94();
|
||||||
|
|
||||||
|
r5->unk_0_0 = a0;
|
||||||
|
asm_comment("The switch logic does not match. Specifically, the \"bhi\" is replaced with a \"bls\" and the comparisons with 1 and 3 are swapped chronologically.");
|
||||||
|
switch (a0)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
r5->unk_1 = (Random() % 15) + 16;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
r5->unk_1 = (Random() % 15) + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
void sub_8146C30(u32 a0)
|
||||||
|
{
|
||||||
|
asm_unified("\tpush {r4,r5,lr}\n"
|
||||||
|
"\tadds r4, r0, 0\n"
|
||||||
|
"\tbl sub_8143D94\n"
|
||||||
|
"\tadds r5, r0, 0\n"
|
||||||
|
"\tmovs r0, 0x3\n"
|
||||||
|
"\tadds r1, r4, 0\n"
|
||||||
|
"\tands r1, r0\n"
|
||||||
|
"\tldrb r2, [r5]\n"
|
||||||
|
"\tmovs r0, 0x4\n"
|
||||||
|
"\tnegs r0, r0\n"
|
||||||
|
"\tands r0, r2\n"
|
||||||
|
"\torrs r0, r1\n"
|
||||||
|
"\tstrb r0, [r5]\n"
|
||||||
|
"\tcmp r4, 0x2\n"
|
||||||
|
"\tbhi _08146C56\n"
|
||||||
|
"\tcmp r4, 0x1\n"
|
||||||
|
"\tbcs _08146C5C\n"
|
||||||
|
"\tb _08146C80\n"
|
||||||
|
"_08146C56:\n"
|
||||||
|
"\tcmp r4, 0x3\n"
|
||||||
|
"\tbeq _08146C6E\n"
|
||||||
|
"\tb _08146C80\n"
|
||||||
|
"_08146C5C:\n"
|
||||||
|
"\tbl Random\n"
|
||||||
|
"\tlsls r0, 16\n"
|
||||||
|
"\tlsrs r0, 16\n"
|
||||||
|
"\tmovs r1, 0xF\n"
|
||||||
|
"\tbl __umodsi3\n"
|
||||||
|
"\tadds r0, 0x10\n"
|
||||||
|
"\tb _08146C7E\n"
|
||||||
|
"_08146C6E:\n"
|
||||||
|
"\tbl Random\n"
|
||||||
|
"\tlsls r0, 16\n"
|
||||||
|
"\tlsrs r0, 16\n"
|
||||||
|
"\tmovs r1, 0xF\n"
|
||||||
|
"\tbl __umodsi3\n"
|
||||||
|
"\tadds r0, 0x1\n"
|
||||||
|
"_08146C7E:\n"
|
||||||
|
"\tstrb r0, [r5, 0x1]\n"
|
||||||
|
"_08146C80:\n"
|
||||||
|
"\tpop {r4,r5}\n"
|
||||||
|
"\tpop {r0}\n"
|
||||||
|
"\tbx r0");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user