mirror of https://github.com/pret/pokeemerald.git
_swiopen
This commit is contained in:
parent
f07307dc73
commit
8d35bf1c9e
102
asm/region_map.s
102
asm/region_map.s
|
@ -5,108 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start _swiopen
|
||||
_swiopen: @ 8123190
|
||||
push {r4,r5,lr}
|
||||
ldr r5, =gUnknown_0203A144
|
||||
ldr r1, [r5]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7A
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
cmp r0, 0
|
||||
beq _081231AC
|
||||
movs r0, 0x2
|
||||
b _08123248
|
||||
.pool
|
||||
_081231AC:
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7B
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
cmp r0, 0
|
||||
ble _081231C2
|
||||
adds r1, 0x54
|
||||
ldrh r0, [r1]
|
||||
adds r0, 0x1
|
||||
strh r0, [r1]
|
||||
_081231C2:
|
||||
ldr r1, [r5]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7B
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
cmp r0, 0
|
||||
bge _081231DA
|
||||
adds r1, 0x54
|
||||
ldrh r0, [r1]
|
||||
subs r0, 0x1
|
||||
strh r0, [r1]
|
||||
_081231DA:
|
||||
ldr r1, [r5]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7C
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
cmp r0, 0
|
||||
ble _081231F2
|
||||
adds r1, 0x56
|
||||
ldrh r0, [r1]
|
||||
adds r0, 0x1
|
||||
strh r0, [r1]
|
||||
_081231F2:
|
||||
ldr r1, [r5]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7C
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
cmp r0, 0
|
||||
bge _0812320A
|
||||
adds r1, 0x56
|
||||
ldrh r0, [r1]
|
||||
subs r0, 0x1
|
||||
strh r0, [r1]
|
||||
_0812320A:
|
||||
ldr r1, [r5]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x54
|
||||
ldrh r0, [r0]
|
||||
adds r1, 0x56
|
||||
ldrh r1, [r1]
|
||||
bl sub_812386C
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
adds r0, r4, 0
|
||||
bl get_flagnr_blue_points
|
||||
ldr r1, [r5]
|
||||
strb r0, [r1, 0x2]
|
||||
ldr r1, [r5]
|
||||
ldrh r0, [r1]
|
||||
cmp r4, r0
|
||||
beq _0812323C
|
||||
strh r4, [r1]
|
||||
adds r0, r1, 0x4
|
||||
ldrh r1, [r1]
|
||||
movs r2, 0x10
|
||||
bl GetMapName
|
||||
_0812323C:
|
||||
bl sub_8123FB0
|
||||
ldr r1, [r5]
|
||||
ldr r0, =sub_81230C4
|
||||
str r0, [r1, 0x18]
|
||||
movs r0, 0x3
|
||||
_08123248:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end _swiopen
|
||||
|
||||
thumb_func_start sub_8123254
|
||||
sub_8123254: @ 8123254
|
||||
push {r4-r6,lr}
|
||||
|
|
|
@ -252,7 +252,7 @@ struct RegionMap {
|
|||
/*0x079*/ u8 unk_079;
|
||||
/*0x07a*/ s8 unk_07a;
|
||||
/*0x07b*/ s8 unk_07b;
|
||||
/*0x07c*/ u8 unk_07c;
|
||||
/*0x07c*/ s8 unk_07c;
|
||||
/*0x07d*/ u8 unk_07d;
|
||||
/*0x07e*/ u8 unk_07e;
|
||||
/*0x07f*/ u8 unk_07f;
|
||||
|
@ -265,6 +265,16 @@ struct RegionMap {
|
|||
/*0x284*/ u8 unk_284[0x600];
|
||||
}; // size = 0x884
|
||||
|
||||
enum
|
||||
{
|
||||
INPUT_EVENT_NONE,
|
||||
INPUT_EVENT_MOVE_START,
|
||||
INPUT_EVENT_MOVE_CONT,
|
||||
INPUT_EVENT_MOVE_END,
|
||||
INPUT_EVENT_A_BUTTON,
|
||||
INPUT_EVENT_B_BUTTON,
|
||||
};
|
||||
|
||||
// Exported RAM declarations
|
||||
|
||||
// Exported ROM declarations
|
||||
|
|
|
@ -150,11 +150,11 @@ void sub_8170290(void)
|
|||
case 4:
|
||||
switch (sub_81230AC())
|
||||
{
|
||||
case 3:
|
||||
case INPUT_EVENT_MOVE_END:
|
||||
sub_8170428();
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
case INPUT_EVENT_A_BUTTON:
|
||||
case INPUT_EVENT_B_BUTTON:
|
||||
gUnknown_0203BCD0->state ++;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -13,17 +13,6 @@ struct UnkStruct_0203A148 {
|
|||
u8 filler_000[0xa74];
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
INPUT_EVENT_NONE,
|
||||
INPUT_EVENT_DPAD,
|
||||
INPUT_EVENT_2,
|
||||
INPUT_EVENT_3,
|
||||
INPUT_EVENT_A_BUTTON,
|
||||
INPUT_EVENT_B_BUTTON,
|
||||
};
|
||||
|
||||
|
||||
// Static RAM declarations
|
||||
|
||||
EWRAM_DATA struct RegionMap *gUnknown_0203A144 = NULL;
|
||||
|
@ -40,6 +29,7 @@ u8 get_flagnr_blue_points(u16 mapSecId);
|
|||
u16 sub_8123EB4(u16 mapSecId);
|
||||
void sub_8123FB0(void);
|
||||
u8 _swiopen(void);
|
||||
u16 sub_812386C(u16 x, u16 y);
|
||||
|
||||
// .rodata
|
||||
|
||||
|
@ -209,22 +199,22 @@ u8 sub_81230C4(void)
|
|||
if (gMain.heldKeys & DPAD_UP && gUnknown_0203A144->unk_056 > 2)
|
||||
{
|
||||
gUnknown_0203A144->unk_07c = -1;
|
||||
input = INPUT_EVENT_DPAD;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_DOWN && gUnknown_0203A144->unk_056 < 16)
|
||||
{
|
||||
gUnknown_0203A144->unk_07c = +1;
|
||||
input = INPUT_EVENT_DPAD;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_LEFT && gUnknown_0203A144->unk_054 > 1)
|
||||
{
|
||||
gUnknown_0203A144->unk_07b = -1;
|
||||
input = INPUT_EVENT_DPAD;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_RIGHT && gUnknown_0203A144->unk_054 < 28)
|
||||
{
|
||||
gUnknown_0203A144->unk_07b = +1;
|
||||
input = INPUT_EVENT_DPAD;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
|
@ -234,10 +224,46 @@ u8 sub_81230C4(void)
|
|||
{
|
||||
input = INPUT_EVENT_B_BUTTON;
|
||||
}
|
||||
if (input == INPUT_EVENT_DPAD)
|
||||
if (input == INPUT_EVENT_MOVE_START)
|
||||
{
|
||||
gUnknown_0203A144->unk_07a = 4;
|
||||
gUnknown_0203A144->inputCallback = _swiopen;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
u8 _swiopen(void)
|
||||
{
|
||||
u16 mapSecId;
|
||||
|
||||
if (gUnknown_0203A144->unk_07a != 0)
|
||||
{
|
||||
return INPUT_EVENT_MOVE_CONT;
|
||||
}
|
||||
if (gUnknown_0203A144->unk_07b > 0)
|
||||
{
|
||||
gUnknown_0203A144->unk_054 ++;
|
||||
}
|
||||
if (gUnknown_0203A144->unk_07b < 0)
|
||||
{
|
||||
gUnknown_0203A144->unk_054 --;
|
||||
}
|
||||
if (gUnknown_0203A144->unk_07c > 0)
|
||||
{
|
||||
gUnknown_0203A144->unk_056 ++;
|
||||
}
|
||||
if (gUnknown_0203A144->unk_07c < 0)
|
||||
{
|
||||
gUnknown_0203A144->unk_056 --;
|
||||
}
|
||||
mapSecId = sub_812386C(gUnknown_0203A144->unk_054, gUnknown_0203A144->unk_056);
|
||||
gUnknown_0203A144->unk_002 = get_flagnr_blue_points(mapSecId);
|
||||
if (mapSecId != gUnknown_0203A144->mapSecId)
|
||||
{
|
||||
gUnknown_0203A144->mapSecId = mapSecId;
|
||||
GetMapName(gUnknown_0203A144->mapSecName, gUnknown_0203A144->mapSecId, 16);
|
||||
}
|
||||
sub_8123FB0();
|
||||
gUnknown_0203A144->inputCallback = sub_81230C4;
|
||||
return INPUT_EVENT_MOVE_END;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue