mirror of https://github.com/pret/pokeemerald.git
through CalcZoomScrollParams
This commit is contained in:
parent
35a6d2046a
commit
474df27136
|
@ -10864,7 +10864,7 @@ sub_81CC670: @ 81CC670
|
|||
movs r0, 0x4
|
||||
bl sub_81C763C
|
||||
adds r4, r0, 0
|
||||
bl sub_812305C
|
||||
bl FreeRegionMapIconResources
|
||||
bl sub_81CC9EC
|
||||
ldrb r0, [r4, 0x8]
|
||||
bl RemoveWindow
|
||||
|
@ -10994,7 +10994,7 @@ _081CC784:
|
|||
bl sub_8124288
|
||||
movs r0, 0x5
|
||||
movs r1, 0xA
|
||||
bl sub_81240D4
|
||||
bl CreateRegionMapCursor
|
||||
bl sub_812454C
|
||||
b _081CC77C
|
||||
_081CC7AC:
|
||||
|
|
408
asm/region_map.s
408
asm/region_map.s
|
@ -5,333 +5,9 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8123514
|
||||
sub_8123514: @ 8123514
|
||||
push {r4-r6,lr}
|
||||
sub sp, 0xC
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r3, [r0]
|
||||
adds r2, r3, 0
|
||||
adds r2, 0x6E
|
||||
ldrh r1, [r2]
|
||||
adds r5, r0, 0
|
||||
cmp r1, 0xF
|
||||
bls _08123530
|
||||
movs r0, 0
|
||||
b _081236B8
|
||||
.pool
|
||||
_08123530:
|
||||
adds r0, r1, 0x1
|
||||
movs r1, 0
|
||||
strh r0, [r2]
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
cmp r0, 0x10
|
||||
bne _081235A4
|
||||
str r1, [r3, 0x44]
|
||||
str r1, [r3, 0x48]
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x60
|
||||
ldrh r1, [r0]
|
||||
subs r0, 0x4
|
||||
strh r1, [r0]
|
||||
adds r0, 0x6
|
||||
ldrh r0, [r0]
|
||||
adds r1, r3, 0
|
||||
adds r1, 0x5E
|
||||
strh r0, [r1]
|
||||
adds r1, 0x1A
|
||||
ldrb r0, [r1]
|
||||
movs r2, 0x80
|
||||
lsls r2, 9
|
||||
cmp r0, 0
|
||||
bne _08123566
|
||||
movs r2, 0x80
|
||||
lsls r2, 8
|
||||
_08123566:
|
||||
str r2, [r3, 0x4C]
|
||||
movs r2, 0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
bne _08123572
|
||||
movs r2, 0x1
|
||||
_08123572:
|
||||
strb r2, [r1]
|
||||
ldr r1, [r5]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x78
|
||||
ldrb r0, [r0]
|
||||
ldr r2, =sub_8123254
|
||||
cmp r0, 0
|
||||
bne _08123584
|
||||
ldr r2, =sub_81230C4
|
||||
_08123584:
|
||||
str r2, [r1, 0x18]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x58
|
||||
ldrh r0, [r0]
|
||||
adds r1, 0x5A
|
||||
ldrh r1, [r1]
|
||||
bl sub_81240D4
|
||||
bl sub_81243DC
|
||||
movs r4, 0
|
||||
b _08123686
|
||||
.pool
|
||||
_081235A4:
|
||||
ldr r2, [r3, 0x3C]
|
||||
ldr r0, [r3, 0x44]
|
||||
adds r2, r0
|
||||
str r2, [r3, 0x3C]
|
||||
ldr r0, [r3, 0x40]
|
||||
ldr r1, [r3, 0x48]
|
||||
adds r0, r1
|
||||
str r0, [r3, 0x40]
|
||||
asrs r2, 8
|
||||
adds r4, r3, 0
|
||||
adds r4, 0x5C
|
||||
strh r2, [r4]
|
||||
ldr r0, [r3, 0x40]
|
||||
asrs r0, 8
|
||||
adds r1, r3, 0
|
||||
adds r1, 0x5E
|
||||
strh r0, [r1]
|
||||
ldr r0, [r3, 0x4C]
|
||||
ldr r1, [r3, 0x50]
|
||||
adds r0, r1
|
||||
str r0, [r3, 0x4C]
|
||||
ldr r2, [r3, 0x44]
|
||||
cmp r2, 0
|
||||
bge _081235E4
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x60
|
||||
movs r6, 0
|
||||
ldrsh r1, [r4, r6]
|
||||
movs r6, 0
|
||||
ldrsh r0, [r0, r6]
|
||||
cmp r1, r0
|
||||
blt _081235F8
|
||||
_081235E4:
|
||||
cmp r2, 0
|
||||
ble _08123608
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x60
|
||||
movs r2, 0
|
||||
ldrsh r1, [r4, r2]
|
||||
movs r6, 0
|
||||
ldrsh r0, [r0, r6]
|
||||
cmp r1, r0
|
||||
ble _08123608
|
||||
_081235F8:
|
||||
ldr r3, [r5]
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x60
|
||||
ldrh r2, [r0]
|
||||
subs r0, 0x4
|
||||
movs r1, 0
|
||||
strh r2, [r0]
|
||||
str r1, [r3, 0x44]
|
||||
_08123608:
|
||||
ldr r2, [r5]
|
||||
ldr r4, [r2, 0x48]
|
||||
cmp r4, 0
|
||||
bge _08123624
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x5E
|
||||
adds r3, r2, 0
|
||||
adds r3, 0x62
|
||||
movs r6, 0
|
||||
ldrsh r1, [r0, r6]
|
||||
movs r6, 0
|
||||
ldrsh r0, [r3, r6]
|
||||
cmp r1, r0
|
||||
blt _0812363C
|
||||
_08123624:
|
||||
cmp r4, 0
|
||||
ble _0812364E
|
||||
adds r1, r2, 0
|
||||
adds r1, 0x5E
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x62
|
||||
movs r2, 0
|
||||
ldrsh r1, [r1, r2]
|
||||
movs r6, 0
|
||||
ldrsh r0, [r0, r6]
|
||||
cmp r1, r0
|
||||
ble _0812364E
|
||||
_0812363C:
|
||||
ldr r2, [r5]
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x62
|
||||
ldrh r1, [r0]
|
||||
adds r3, r2, 0
|
||||
adds r3, 0x5E
|
||||
movs r0, 0
|
||||
strh r1, [r3]
|
||||
str r0, [r2, 0x48]
|
||||
_0812364E:
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r2, [r0]
|
||||
adds r0, r2, 0
|
||||
adds r0, 0x78
|
||||
ldrb r3, [r0]
|
||||
cmp r3, 0
|
||||
bne _08123674
|
||||
ldr r1, [r2, 0x4C]
|
||||
ldr r0, =0x00007fff
|
||||
cmp r1, r0
|
||||
bgt _08123684
|
||||
adds r0, 0x1
|
||||
str r0, [r2, 0x4C]
|
||||
str r3, [r2, 0x50]
|
||||
b _08123684
|
||||
.pool
|
||||
_08123674:
|
||||
ldr r0, [r2, 0x4C]
|
||||
movs r1, 0x80
|
||||
lsls r1, 9
|
||||
cmp r0, r1
|
||||
ble _08123684
|
||||
str r1, [r2, 0x4C]
|
||||
movs r0, 0
|
||||
str r0, [r2, 0x50]
|
||||
_08123684:
|
||||
movs r4, 0x1
|
||||
_08123686:
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r3, [r0]
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x5C
|
||||
movs r1, 0
|
||||
ldrsh r0, [r0, r1]
|
||||
adds r1, r3, 0
|
||||
adds r1, 0x5E
|
||||
movs r2, 0
|
||||
ldrsh r1, [r1, r2]
|
||||
ldr r2, [r3, 0x4C]
|
||||
lsls r2, 8
|
||||
lsrs r2, 16
|
||||
str r2, [sp]
|
||||
ldr r2, [r3, 0x4C]
|
||||
lsls r2, 8
|
||||
lsrs r2, 16
|
||||
str r2, [sp, 0x4]
|
||||
movs r2, 0
|
||||
str r2, [sp, 0x8]
|
||||
movs r2, 0x38
|
||||
movs r3, 0x48
|
||||
bl sub_81236C4
|
||||
adds r0, r4, 0
|
||||
_081236B8:
|
||||
add sp, 0xC
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8123514
|
||||
|
||||
thumb_func_start sub_81236C4
|
||||
sub_81236C4: @ 81236C4
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x4
|
||||
ldr r4, [sp, 0x24]
|
||||
ldr r7, [sp, 0x28]
|
||||
ldr r5, [sp, 0x2C]
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
mov r8, r4
|
||||
lsls r7, 16
|
||||
adds r4, r7, 0
|
||||
lsrs r4, 16
|
||||
mov r9, r4
|
||||
lsls r5, 24
|
||||
lsrs r5, 24
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r6, [r4]
|
||||
ldr r7, =gSineTable
|
||||
mov r12, r7
|
||||
adds r4, r5, 0
|
||||
adds r4, 0x40
|
||||
lsls r4, 1
|
||||
add r4, r12
|
||||
movs r7, 0
|
||||
ldrsh r4, [r4, r7]
|
||||
str r4, [sp]
|
||||
mov r7, r8
|
||||
muls r7, r4
|
||||
adds r4, r7, 0
|
||||
asrs r4, 8
|
||||
mov r10, r4
|
||||
str r4, [r6, 0x2C]
|
||||
lsls r5, 1
|
||||
add r5, r12
|
||||
movs r7, 0
|
||||
ldrsh r5, [r5, r7]
|
||||
negs r4, r5
|
||||
mov r7, r8
|
||||
muls r7, r4
|
||||
adds r4, r7, 0
|
||||
asrs r4, 8
|
||||
mov r12, r4
|
||||
str r4, [r6, 0x30]
|
||||
mov r7, r9
|
||||
muls r7, r5
|
||||
adds r5, r7, 0
|
||||
asrs r5, 8
|
||||
str r5, [r6, 0x34]
|
||||
ldr r7, [sp]
|
||||
mov r4, r9
|
||||
muls r4, r7
|
||||
asrs r4, 8
|
||||
mov r8, r4
|
||||
str r4, [r6, 0x38]
|
||||
lsls r0, 16
|
||||
asrs r0, 8
|
||||
lsls r2, 16
|
||||
asrs r2, 16
|
||||
lsls r4, r2, 8
|
||||
adds r0, r4
|
||||
lsls r3, 16
|
||||
asrs r3, 16
|
||||
adds r4, r3, 0
|
||||
muls r4, r5
|
||||
mov r5, r10
|
||||
muls r5, r2
|
||||
adds r4, r5
|
||||
subs r0, r4
|
||||
str r0, [r6, 0x24]
|
||||
lsls r1, 16
|
||||
asrs r1, 8
|
||||
lsls r0, r3, 8
|
||||
adds r1, r0
|
||||
mov r0, r8
|
||||
muls r0, r3
|
||||
mov r3, r12
|
||||
muls r3, r2
|
||||
adds r2, r3, 0
|
||||
adds r0, r2
|
||||
subs r1, r0
|
||||
str r1, [r6, 0x28]
|
||||
adds r6, 0x7D
|
||||
movs r0, 0x1
|
||||
strb r0, [r6]
|
||||
add sp, 0x4
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81236C4
|
||||
|
||||
thumb_func_start sub_812378C
|
||||
sub_812378C: @ 812378C
|
||||
ldr r2, =gUnknown_0203A144
|
||||
ldr r2, =gRegionMap
|
||||
ldr r2, [r2]
|
||||
lsls r0, 16
|
||||
asrs r0, 8
|
||||
|
@ -355,7 +31,7 @@ sub_812378C: @ 812378C
|
|||
thumb_func_start sub_81237B4
|
||||
sub_81237B4: @ 81237B4
|
||||
push {r4,lr}
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r4, =gRegionMap
|
||||
ldr r1, [r4]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7D
|
||||
|
@ -422,9 +98,9 @@ sub_8123824: @ 8123824
|
|||
adds r1, r5, 0
|
||||
movs r2, 0x38
|
||||
movs r3, 0x48
|
||||
bl sub_81236C4
|
||||
bl CalcZoomScrollParams
|
||||
bl sub_81237B4
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r2, [r0]
|
||||
ldr r1, [r2, 0x20]
|
||||
cmp r1, 0
|
||||
|
@ -533,7 +209,7 @@ _08123904:
|
|||
.4byte _08123A28
|
||||
.4byte _081239E4
|
||||
_08123928:
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r4, =gRegionMap
|
||||
ldr r0, [r4]
|
||||
ldr r3, =gMapHeader
|
||||
ldrb r1, [r3, 0x14]
|
||||
|
@ -586,7 +262,7 @@ _0812396C:
|
|||
lsrs r1, 16
|
||||
bl get_mapheader_by_bank_and_number
|
||||
adds r5, r0, 0
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
ldrb r1, [r5, 0x14]
|
||||
strh r1, [r0]
|
||||
|
@ -603,7 +279,7 @@ _0812396C:
|
|||
b _08123ABE
|
||||
.pool
|
||||
_081239C8:
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
ldrb r1, [r2, 0x14]
|
||||
strh r1, [r0]
|
||||
|
@ -630,7 +306,7 @@ _081239E4:
|
|||
lsrs r1, 16
|
||||
bl get_mapheader_by_bank_and_number
|
||||
adds r5, r0, 0
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
ldrb r1, [r5, 0x14]
|
||||
strh r1, [r0]
|
||||
|
@ -647,7 +323,7 @@ _081239E4:
|
|||
b _08123ABE
|
||||
.pool
|
||||
_08123A28:
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r4, =gRegionMap
|
||||
ldr r0, [r4]
|
||||
ldr r1, =gMapHeader
|
||||
ldrb r1, [r1, 0x14]
|
||||
|
@ -690,7 +366,7 @@ _08123A64:
|
|||
ldrb r0, [r5, 0x14]
|
||||
strh r0, [r1]
|
||||
_08123A8A:
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r4, =gRegionMap
|
||||
ldr r0, [r4]
|
||||
ldrb r0, [r0]
|
||||
bl sub_8123F74
|
||||
|
@ -716,7 +392,7 @@ _08123AB0:
|
|||
_08123ABE:
|
||||
str r6, [sp]
|
||||
ldr r5, =gRegionMapEntries
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r4, =gRegionMap
|
||||
ldr r0, [r4]
|
||||
mov r10, r0
|
||||
ldrh r7, [r0]
|
||||
|
@ -852,7 +528,7 @@ _08123BB8:
|
|||
bl sub_8123F30
|
||||
b _08123BEC
|
||||
_08123BC6:
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r2, [r0]
|
||||
ldrh r0, [r2]
|
||||
lsls r0, 3
|
||||
|
@ -923,28 +599,28 @@ _08123C40:
|
|||
.4byte _08123C74
|
||||
.4byte _08123C84
|
||||
_08123C54:
|
||||
ldr r2, =gUnknown_0203A144
|
||||
ldr r2, =gRegionMap
|
||||
ldr r1, [r2]
|
||||
movs r0, 0x8
|
||||
strh r0, [r1]
|
||||
b _08123D10
|
||||
.pool
|
||||
_08123C64:
|
||||
ldr r2, =gUnknown_0203A144
|
||||
ldr r2, =gRegionMap
|
||||
ldr r1, [r2]
|
||||
movs r0, 0xC
|
||||
strh r0, [r1]
|
||||
b _08123D10
|
||||
.pool
|
||||
_08123C74:
|
||||
ldr r2, =gUnknown_0203A144
|
||||
ldr r2, =gRegionMap
|
||||
ldr r1, [r2]
|
||||
movs r0, 0x27
|
||||
strh r0, [r1]
|
||||
b _08123D10
|
||||
.pool
|
||||
_08123C84:
|
||||
ldr r2, =gUnknown_0203A144
|
||||
ldr r2, =gRegionMap
|
||||
ldr r1, [r2]
|
||||
movs r0, 0x2E
|
||||
strh r0, [r1]
|
||||
|
@ -955,7 +631,7 @@ _08123C94:
|
|||
ldrb r0, [r0]
|
||||
ldrb r1, [r4]
|
||||
bl get_mapheader_by_bank_and_number
|
||||
ldr r1, =gUnknown_0203A144
|
||||
ldr r1, =gRegionMap
|
||||
mov r9, r1
|
||||
ldr r2, [r1]
|
||||
ldrb r1, [r0, 0x14]
|
||||
|
@ -1373,7 +1049,7 @@ sub_8123F9C: @ 8123F9C
|
|||
thumb_func_start sub_8123FB0
|
||||
sub_8123FB0: @ 8123FB0
|
||||
push {r4-r6,lr}
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r1, [r0]
|
||||
ldrh r0, [r1]
|
||||
cmp r0, 0xD5
|
||||
|
@ -1407,7 +1083,7 @@ _08123FE6:
|
|||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl sub_812386C
|
||||
ldr r1, =gUnknown_0203A144
|
||||
ldr r1, =gRegionMap
|
||||
ldr r1, [r1]
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
|
@ -1432,7 +1108,7 @@ _08124008:
|
|||
b _08124008
|
||||
.pool
|
||||
_08124028:
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
strb r6, [r0, 0x3]
|
||||
_0812402E:
|
||||
|
@ -1463,7 +1139,7 @@ _0812405A:
|
|||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl sub_812386C
|
||||
ldr r1, =gUnknown_0203A144
|
||||
ldr r1, =gRegionMap
|
||||
ldr r1, [r1]
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
|
@ -1488,7 +1164,7 @@ _0812407C:
|
|||
sub_8124088: @ 8124088
|
||||
push {r4,lr}
|
||||
adds r2, r0, 0
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r1, [r0]
|
||||
adds r3, r1, 0
|
||||
adds r3, 0x7A
|
||||
|
@ -1529,8 +1205,8 @@ TaskDummy8: @ 81240D0
|
|||
bx lr
|
||||
thumb_func_end TaskDummy8
|
||||
|
||||
thumb_func_start sub_81240D4
|
||||
sub_81240D4: @ 81240D4
|
||||
thumb_func_start CreateRegionMapCursor
|
||||
CreateRegionMapCursor: @ 81240D4
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x28
|
||||
lsls r0, 16
|
||||
|
@ -1554,7 +1230,7 @@ sub_81240D4: @ 81240D4
|
|||
str r1, [r2, 0x4]
|
||||
mov r0, sp
|
||||
strh r3, [r0]
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x58
|
||||
|
@ -1615,7 +1291,7 @@ _0812416E:
|
|||
lsrs r1, r0, 24
|
||||
cmp r1, 0x40
|
||||
beq _08124228
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r4, =gRegionMap
|
||||
ldr r2, [r4]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
|
@ -1669,7 +1345,7 @@ _081241DC:
|
|||
adds r0, 0x4
|
||||
strh r0, [r2, 0x22]
|
||||
_08124204:
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r4, =gRegionMap
|
||||
ldr r0, [r4]
|
||||
ldr r1, [r0, 0x1C]
|
||||
movs r0, 0x2
|
||||
|
@ -1692,12 +1368,12 @@ _08124228:
|
|||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81240D4
|
||||
thumb_func_end CreateRegionMapCursor
|
||||
|
||||
thumb_func_start sub_8124238
|
||||
sub_8124238: @ 8124238
|
||||
push {r4,lr}
|
||||
ldr r4, =gUnknown_0203A144
|
||||
ldr r4, =gRegionMap
|
||||
ldr r0, [r4]
|
||||
ldr r0, [r0, 0x1C]
|
||||
cmp r0, 0
|
||||
|
@ -1720,7 +1396,7 @@ _0812425C:
|
|||
|
||||
thumb_func_start sub_8124268
|
||||
sub_8124268: @ 8124268
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
ldr r1, [r0, 0x1C]
|
||||
movs r0, 0x1
|
||||
|
@ -1731,7 +1407,7 @@ sub_8124268: @ 8124268
|
|||
|
||||
thumb_func_start sub_8124278
|
||||
sub_8124278: @ 8124278
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
ldr r1, [r0, 0x1C]
|
||||
movs r0, 0
|
||||
|
@ -1780,7 +1456,7 @@ sub_8124288: @ 8124288
|
|||
bl sub_8124668
|
||||
cmp r0, 0
|
||||
beq _08124304
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
str r5, [r0, 0x20]
|
||||
b _081243A4
|
||||
|
@ -1807,7 +1483,7 @@ _08124316:
|
|||
bl CreateSprite
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r1, =gUnknown_0203A144
|
||||
ldr r1, =gRegionMap
|
||||
ldr r2, [r1]
|
||||
lsls r1, r0, 4
|
||||
adds r1, r0
|
||||
|
@ -1866,7 +1542,7 @@ _081243A4:
|
|||
thumb_func_start sub_81243B0
|
||||
sub_81243B0: @ 81243B0
|
||||
push {lr}
|
||||
ldr r3, =gUnknown_0203A144
|
||||
ldr r3, =gRegionMap
|
||||
ldr r0, [r3]
|
||||
ldr r2, [r0, 0x20]
|
||||
cmp r2, 0
|
||||
|
@ -1889,7 +1565,7 @@ _081243CE:
|
|||
thumb_func_start sub_81243DC
|
||||
sub_81243DC: @ 81243DC
|
||||
push {lr}
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r3, [r0]
|
||||
ldr r1, [r3, 0x20]
|
||||
cmp r1, 0
|
||||
|
@ -1955,7 +1631,7 @@ _08124452:
|
|||
sub_812445C: @ 812445C
|
||||
push {r4,lr}
|
||||
adds r3, r0, 0
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r1, [r0]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x5C
|
||||
|
@ -2041,7 +1717,7 @@ sub_81244EC: @ 81244EC
|
|||
sub_81244F8: @ 81244F8
|
||||
push {lr}
|
||||
adds r2, r0, 0
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x7E
|
||||
ldrb r0, [r0]
|
||||
|
@ -2086,7 +1762,7 @@ _08124548:
|
|||
thumb_func_start sub_812454C
|
||||
sub_812454C: @ 812454C
|
||||
push {lr}
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r1, [r0]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7F
|
||||
|
@ -2235,7 +1911,7 @@ sub_8124630: @ 8124630
|
|||
|
||||
thumb_func_start sub_8124658
|
||||
sub_8124658: @ 8124658
|
||||
ldr r0, =gUnknown_0203A144
|
||||
ldr r0, =gRegionMap
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x78
|
||||
ldrb r0, [r0]
|
||||
|
@ -2373,10 +2049,10 @@ _0812479C:
|
|||
ldr r0, [r4]
|
||||
adds r0, 0x8
|
||||
movs r1, 0
|
||||
bl sub_8122CDC
|
||||
bl InitRegionMap
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
bl sub_81240D4
|
||||
bl CreateRegionMapCursor
|
||||
movs r0, 0x1
|
||||
movs r1, 0x1
|
||||
bl sub_8124288
|
||||
|
@ -3142,7 +2818,7 @@ _08124E3E:
|
|||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08124F1A
|
||||
bl sub_812305C
|
||||
bl FreeRegionMapIconResources
|
||||
ldr r1, [r4]
|
||||
ldr r2, =0x00000a72
|
||||
adds r0, r1, r2
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef GUARD_REGION_MAP_H
|
||||
#define GUARD_REGION_MAP_H
|
||||
|
||||
#include "bg.h"
|
||||
|
||||
// Exported type declarations
|
||||
|
||||
enum {
|
||||
|
@ -219,12 +221,6 @@ enum {
|
|||
MAPSEC_TRAINER_HILL
|
||||
};
|
||||
|
||||
struct UnkStruct_8122CF8 {
|
||||
u32 unk_0_0:2;
|
||||
u32 unk_0_2:2;
|
||||
u32 unk_0_4:5;
|
||||
};
|
||||
|
||||
struct RegionMap {
|
||||
/*0x000*/ u16 mapSecId;
|
||||
/*0x002*/ u8 unk_002;
|
||||
|
@ -233,7 +229,12 @@ struct RegionMap {
|
|||
/*0x018*/ u8 (*inputCallback)(void);
|
||||
/*0x01c*/ struct Sprite *cursorSprite;
|
||||
/*0x020*/ struct Sprite *playerIconSprite;
|
||||
/*0x024*/ u8 filler_024[0x18];
|
||||
/*0x024*/ s32 bg2x;
|
||||
/*0x028*/ s32 bg2y;
|
||||
/*0x02c*/ u32 bg2pa;
|
||||
/*0x030*/ u32 bg2pb;
|
||||
/*0x034*/ u32 bg2pc;
|
||||
/*0x038*/ u32 bg2pd;
|
||||
/*0x03c*/ s32 unk_03c;
|
||||
/*0x040*/ s32 unk_040;
|
||||
/*0x044*/ s32 unk_044;
|
||||
|
@ -263,13 +264,13 @@ struct RegionMap {
|
|||
/*0x07a*/ s8 cursorMovementFrameCounter;
|
||||
/*0x07b*/ s8 cursorDeltaX;
|
||||
/*0x07c*/ s8 cursorDeltaY;
|
||||
/*0x07d*/ bool8 unk_07d;
|
||||
/*0x07d*/ bool8 needUpdateVideoRegs;
|
||||
/*0x07e*/ bool8 blinkPlayerIcon;
|
||||
/*0x07f*/ bool8 unk_07f;
|
||||
/*0x080*/ u8 bgNum;
|
||||
/*0x081*/ u8 unk_081;
|
||||
/*0x082*/ u8 unk_082;
|
||||
/*0x083*/ bool8 unk_083;
|
||||
/*0x081*/ u8 charBaseIdx;
|
||||
/*0x082*/ u8 mapBaseIdx;
|
||||
/*0x083*/ bool8 bgManaged;
|
||||
/*0x084*/ u8 filler_084[0x100];
|
||||
/*0x184*/ u8 cursorSmallImage[0x100];
|
||||
/*0x284*/ u8 cursorLargeImage[0x600];
|
||||
|
@ -288,13 +289,13 @@ enum
|
|||
// Exported RAM declarations
|
||||
|
||||
// Exported ROM declarations
|
||||
void sub_8122CF8(struct RegionMap *regionMap, struct UnkStruct_8122CF8 *arg1, bool8 arg2);
|
||||
void sub_8122CF8(struct RegionMap *regionMap, struct BgTemplate *template, bool8 zoomed);
|
||||
bool8 sub_8122DB0(void);
|
||||
void GetMapName(u8 *, u16, u16);
|
||||
void sub_8122CDC(struct RegionMap *regionMap, u8 argument);
|
||||
void InitRegionMap(struct RegionMap *regionMap, u8 argument);
|
||||
void sub_8124288(u16 x, u16 y);
|
||||
void sub_81240D4(u16 x, u16 y);
|
||||
void CreateRegionMapCursor(u16 x, u16 y);
|
||||
u8 sub_81230AC(void);
|
||||
void sub_812305C(void);
|
||||
void FreeRegionMapIconResources(void);
|
||||
|
||||
#endif //GUARD_REGION_MAP_H
|
||||
|
|
|
@ -120,9 +120,9 @@ void sub_8170290(void)
|
|||
switch (gUnknown_0203BCD0->state)
|
||||
{
|
||||
case 0:
|
||||
sub_8122CDC(&gUnknown_0203BCD0->regionMap, 0);
|
||||
InitRegionMap(&gUnknown_0203BCD0->regionMap, 0);
|
||||
sub_8124288(0, 0);
|
||||
sub_81240D4(1, 1);
|
||||
CreateRegionMapCursor(1, 1);
|
||||
gUnknown_0203BCD0->state ++;
|
||||
break;
|
||||
case 1:
|
||||
|
@ -166,7 +166,7 @@ void sub_8170290(void)
|
|||
case 6:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
sub_812305C();
|
||||
FreeRegionMapIconResources();
|
||||
SetMainCallback2(gUnknown_0203BCD0->callback);
|
||||
if (gUnknown_0203BCD0 != NULL)
|
||||
{
|
||||
|
|
387
src/region_map.c
387
src/region_map.c
|
@ -2,10 +2,10 @@
|
|||
// Includes
|
||||
#include "global.h"
|
||||
#include "main.h"
|
||||
#include "region_map.h"
|
||||
#include "menu.h"
|
||||
#include "palette.h"
|
||||
#include "bg.h"
|
||||
#include "trig.h"
|
||||
#include "region_map.h"
|
||||
|
||||
// Static type declarations
|
||||
|
||||
|
@ -15,25 +15,26 @@ struct UnkStruct_0203A148 {
|
|||
|
||||
// Static RAM declarations
|
||||
|
||||
EWRAM_DATA struct RegionMap *gUnknown_0203A144 = NULL;
|
||||
EWRAM_DATA struct RegionMap *gRegionMap = NULL;
|
||||
EWRAM_DATA struct UnkStruct_0203A148 *gUnknown_0203A148 = NULL;
|
||||
|
||||
// Static ROM declarations
|
||||
|
||||
u8 sub_81230C4(void);
|
||||
u8 sub_8123254(void);
|
||||
void sub_81236C4(s32 a0, s32 a1, s32 a2, s32 a3, u16 a4, u16 a5, u16 a6);
|
||||
static u8 ProcessRegionMapInput_Full(void);
|
||||
static u8 MoveRegionMapCursor_Full(void);
|
||||
static u8 ProcessRegionMapInput_Zoomed(void);
|
||||
static u8 MoveRegionMapCursor_Zoomed(void);
|
||||
void CalcZoomScrollParams(s16 scrollX, s16 scrollY, s16 c, s16 d, u16 e, u16 f, u8 rotation);
|
||||
void sub_81237B4(void);
|
||||
void sub_81238AC(void);
|
||||
u8 get_flagnr_blue_points(u16 mapSecId);
|
||||
u16 sub_8123EB4(u16 mapSecId);
|
||||
void sub_8123FB0(void);
|
||||
u8 _swiopen(void);
|
||||
u8 sub_8123334(void);
|
||||
u16 sub_812386C(u16 x, u16 y);
|
||||
void sub_812378C(s16 x, s16 y);
|
||||
void sub_8124238(void);
|
||||
void sub_81243B0(void);
|
||||
void sub_81243DC(void);
|
||||
|
||||
// .rodata
|
||||
|
||||
|
@ -45,50 +46,50 @@ extern const u8 gUnknown_0859F650[];
|
|||
|
||||
// .text
|
||||
|
||||
void sub_8122CDC(struct RegionMap *regionMap, u8 argument)
|
||||
void InitRegionMap(struct RegionMap *regionMap, bool8 zoomed)
|
||||
{
|
||||
sub_8122CF8(regionMap, NULL, argument);
|
||||
sub_8122CF8(regionMap, NULL, zoomed);
|
||||
while (sub_8122DB0());
|
||||
}
|
||||
|
||||
void sub_8122CF8(struct RegionMap *regionMap, struct UnkStruct_8122CF8 *arg1, u8 arg2)
|
||||
void sub_8122CF8(struct RegionMap *regionMap, struct BgTemplate *template, bool8 zoomed)
|
||||
{
|
||||
gUnknown_0203A144 = regionMap;
|
||||
gUnknown_0203A144->initStep = 0;
|
||||
gUnknown_0203A144->zoomed = arg2;
|
||||
gUnknown_0203A144->inputCallback = arg2 == TRUE ? sub_8123254 : sub_81230C4;
|
||||
if (arg1 != NULL)
|
||||
gRegionMap = regionMap;
|
||||
gRegionMap->initStep = 0;
|
||||
gRegionMap->zoomed = zoomed;
|
||||
gRegionMap->inputCallback = zoomed == TRUE ? ProcessRegionMapInput_Zoomed : ProcessRegionMapInput_Full;
|
||||
if (template != NULL)
|
||||
{
|
||||
gUnknown_0203A144->bgNum = arg1->unk_0_0;
|
||||
gUnknown_0203A144->unk_081 = arg1->unk_0_2;
|
||||
gUnknown_0203A144->unk_082 = arg1->unk_0_4;
|
||||
gUnknown_0203A144->unk_083 = TRUE;
|
||||
gRegionMap->bgNum = template->bg;
|
||||
gRegionMap->charBaseIdx = template->charBaseIndex;
|
||||
gRegionMap->mapBaseIdx = template->mapBaseIndex;
|
||||
gRegionMap->bgManaged = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203A144->bgNum = 2;
|
||||
gUnknown_0203A144->unk_081 = 2;
|
||||
gUnknown_0203A144->unk_082 = 28;
|
||||
gUnknown_0203A144->unk_083 = FALSE;
|
||||
gRegionMap->bgNum = 2;
|
||||
gRegionMap->charBaseIdx = 2;
|
||||
gRegionMap->mapBaseIdx = 28;
|
||||
gRegionMap->bgManaged = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8122D88(struct RegionMap *regionMap)
|
||||
{
|
||||
gUnknown_0203A144 = regionMap;
|
||||
gRegionMap = regionMap;
|
||||
sub_81238AC();
|
||||
gUnknown_0203A144->unk_074 = gUnknown_0203A144->cursorPosX;
|
||||
gUnknown_0203A144->unk_076 = gUnknown_0203A144->cursorPosY;
|
||||
gRegionMap->unk_074 = gRegionMap->cursorPosX;
|
||||
gRegionMap->unk_076 = gRegionMap->cursorPosY;
|
||||
}
|
||||
|
||||
bool8 sub_8122DB0(void)
|
||||
{
|
||||
switch (gUnknown_0203A144->initStep)
|
||||
switch (gRegionMap->initStep)
|
||||
{
|
||||
case 0:
|
||||
if (gUnknown_0203A144->unk_083)
|
||||
if (gRegionMap->bgManaged)
|
||||
{
|
||||
decompress_and_copy_tile_data_to_vram(gUnknown_0203A144->bgNum, gUnknown_0859F77C, 0, 0, 0);
|
||||
decompress_and_copy_tile_data_to_vram(gRegionMap->bgNum, gUnknown_0859F77C, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -96,11 +97,11 @@ bool8 sub_8122DB0(void)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (gUnknown_0203A144->unk_083)
|
||||
if (gRegionMap->bgManaged)
|
||||
{
|
||||
if (!free_temp_tile_data_buffers_if_possible())
|
||||
{
|
||||
decompress_and_copy_tile_data_to_vram(gUnknown_0203A144->bgNum, gUnknown_085A04E0, 0, 0, 1);
|
||||
decompress_and_copy_tile_data_to_vram(gRegionMap->bgNum, gUnknown_085A04E0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -115,54 +116,54 @@ bool8 sub_8122DB0(void)
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
LZ77UnCompWram(gUnknown_0859F60C, gUnknown_0203A144->cursorSmallImage);
|
||||
LZ77UnCompWram(gUnknown_0859F60C, gRegionMap->cursorSmallImage);
|
||||
break;
|
||||
case 4:
|
||||
LZ77UnCompWram(gUnknown_0859F650, gUnknown_0203A144->cursorLargeImage);
|
||||
LZ77UnCompWram(gUnknown_0859F650, gRegionMap->cursorLargeImage);
|
||||
break;
|
||||
case 5:
|
||||
sub_81238AC();
|
||||
gUnknown_0203A144->unk_074 = gUnknown_0203A144->cursorPosX;
|
||||
gUnknown_0203A144->unk_076 = gUnknown_0203A144->cursorPosY;
|
||||
gUnknown_0203A144->mapSecId = sub_8123EB4(gUnknown_0203A144->mapSecId);
|
||||
gUnknown_0203A144->unk_002 = get_flagnr_blue_points(gUnknown_0203A144->mapSecId);
|
||||
GetMapName(gUnknown_0203A144->mapSecName, gUnknown_0203A144->mapSecId, 16);
|
||||
gRegionMap->unk_074 = gRegionMap->cursorPosX;
|
||||
gRegionMap->unk_076 = gRegionMap->cursorPosY;
|
||||
gRegionMap->mapSecId = sub_8123EB4(gRegionMap->mapSecId);
|
||||
gRegionMap->unk_002 = get_flagnr_blue_points(gRegionMap->mapSecId);
|
||||
GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, 16);
|
||||
break;
|
||||
case 6:
|
||||
if (gUnknown_0203A144->zoomed == FALSE)
|
||||
if (gRegionMap->zoomed == FALSE)
|
||||
{
|
||||
sub_81236C4(0, 0, 0, 0, 0x100, 0x100, 0);
|
||||
CalcZoomScrollParams(0, 0, 0, 0, 0x100, 0x100, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203A144->scrollX = gUnknown_0203A144->cursorPosX * 8 - 0x34;
|
||||
gUnknown_0203A144->scrollY = gUnknown_0203A144->cursorPosY * 8 - 0x44;
|
||||
gUnknown_0203A144->unk_064 = gUnknown_0203A144->cursorPosX;
|
||||
gUnknown_0203A144->unk_066 = gUnknown_0203A144->cursorPosY;
|
||||
sub_81236C4(gUnknown_0203A144->scrollX, gUnknown_0203A144->scrollY, 0x38, 0x48, 0x80, 0x80, 0);
|
||||
gRegionMap->scrollX = gRegionMap->cursorPosX * 8 - 0x34;
|
||||
gRegionMap->scrollY = gRegionMap->cursorPosY * 8 - 0x44;
|
||||
gRegionMap->unk_064 = gRegionMap->cursorPosX;
|
||||
gRegionMap->unk_066 = gRegionMap->cursorPosY;
|
||||
CalcZoomScrollParams(gRegionMap->scrollX, gRegionMap->scrollY, 0x38, 0x48, 0x80, 0x80, 0);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
sub_8123FB0();
|
||||
sub_81237B4();
|
||||
gUnknown_0203A144->cursorSprite = NULL;
|
||||
gUnknown_0203A144->playerIconSprite = NULL;
|
||||
gUnknown_0203A144->cursorMovementFrameCounter = 0;
|
||||
gUnknown_0203A144->blinkPlayerIcon = FALSE;
|
||||
if (gUnknown_0203A144->unk_083)
|
||||
gRegionMap->cursorSprite = NULL;
|
||||
gRegionMap->playerIconSprite = NULL;
|
||||
gRegionMap->cursorMovementFrameCounter = 0;
|
||||
gRegionMap->blinkPlayerIcon = FALSE;
|
||||
if (gRegionMap->bgManaged)
|
||||
{
|
||||
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_MAPBASEINDEX, 2);
|
||||
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_VISIBLE, gUnknown_0203A144->unk_081);
|
||||
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_CHARBASEINDEX, gUnknown_0203A144->unk_082);
|
||||
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_SCREENSIZE, 1);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_MAPBASEINDEX, 2);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_VISIBLE, gRegionMap->charBaseIdx);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_CHARBASEINDEX, gRegionMap->mapBaseIdx);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_SCREENSIZE, 1);
|
||||
}
|
||||
gUnknown_0203A144->initStep ++;
|
||||
gRegionMap->initStep ++;
|
||||
return FALSE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
gUnknown_0203A144->initStep ++;
|
||||
gRegionMap->initStep ++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -172,52 +173,52 @@ void sub_8123030(u16 a0, u32 a1)
|
|||
CpuCopy16(gPlttBufferFaded + 0x70, gPlttBufferUnfaded + 0x70, 0x60);
|
||||
}
|
||||
|
||||
void sub_812305C(void)
|
||||
void FreeRegionMapIconResources(void)
|
||||
{
|
||||
if (gUnknown_0203A144->cursorSprite != NULL)
|
||||
if (gRegionMap->cursorSprite != NULL)
|
||||
{
|
||||
DestroySprite(gUnknown_0203A144->cursorSprite);
|
||||
FreeSpriteTilesByTag(gUnknown_0203A144->cursorTileTag);
|
||||
FreeSpritePaletteByTag(gUnknown_0203A144->cursorPaletteTag);
|
||||
DestroySprite(gRegionMap->cursorSprite);
|
||||
FreeSpriteTilesByTag(gRegionMap->cursorTileTag);
|
||||
FreeSpritePaletteByTag(gRegionMap->cursorPaletteTag);
|
||||
}
|
||||
if (gUnknown_0203A144->playerIconSprite != NULL)
|
||||
if (gRegionMap->playerIconSprite != NULL)
|
||||
{
|
||||
DestroySprite(gUnknown_0203A144->playerIconSprite);
|
||||
FreeSpriteTilesByTag(gUnknown_0203A144->playerIconTileTag);
|
||||
FreeSpritePaletteByTag(gUnknown_0203A144->playerIconPaletteTag);
|
||||
DestroySprite(gRegionMap->playerIconSprite);
|
||||
FreeSpriteTilesByTag(gRegionMap->playerIconTileTag);
|
||||
FreeSpritePaletteByTag(gRegionMap->playerIconPaletteTag);
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_81230AC(void)
|
||||
{
|
||||
return gUnknown_0203A144->inputCallback();
|
||||
return gRegionMap->inputCallback();
|
||||
}
|
||||
|
||||
u8 sub_81230C4(void)
|
||||
static u8 ProcessRegionMapInput_Full(void)
|
||||
{
|
||||
u8 input;
|
||||
|
||||
input = INPUT_EVENT_NONE;
|
||||
gUnknown_0203A144->cursorDeltaX = 0;
|
||||
gUnknown_0203A144->cursorDeltaY = 0;
|
||||
if (gMain.heldKeys & DPAD_UP && gUnknown_0203A144->cursorPosY > 2)
|
||||
gRegionMap->cursorDeltaX = 0;
|
||||
gRegionMap->cursorDeltaY = 0;
|
||||
if (gMain.heldKeys & DPAD_UP && gRegionMap->cursorPosY > 2)
|
||||
{
|
||||
gUnknown_0203A144->cursorDeltaY = -1;
|
||||
gRegionMap->cursorDeltaY = -1;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_DOWN && gUnknown_0203A144->cursorPosY < 16)
|
||||
if (gMain.heldKeys & DPAD_DOWN && gRegionMap->cursorPosY < 16)
|
||||
{
|
||||
gUnknown_0203A144->cursorDeltaY = +1;
|
||||
gRegionMap->cursorDeltaY = +1;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_LEFT && gUnknown_0203A144->cursorPosX > 1)
|
||||
if (gMain.heldKeys & DPAD_LEFT && gRegionMap->cursorPosX > 1)
|
||||
{
|
||||
gUnknown_0203A144->cursorDeltaX = -1;
|
||||
gRegionMap->cursorDeltaX = -1;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_RIGHT && gUnknown_0203A144->cursorPosX < 28)
|
||||
if (gMain.heldKeys & DPAD_RIGHT && gRegionMap->cursorPosX < 28)
|
||||
{
|
||||
gUnknown_0203A144->cursorDeltaX = +1;
|
||||
gRegionMap->cursorDeltaX = +1;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
|
@ -230,73 +231,73 @@ u8 sub_81230C4(void)
|
|||
}
|
||||
if (input == INPUT_EVENT_MOVE_START)
|
||||
{
|
||||
gUnknown_0203A144->cursorMovementFrameCounter = 4;
|
||||
gUnknown_0203A144->inputCallback = _swiopen;
|
||||
gRegionMap->cursorMovementFrameCounter = 4;
|
||||
gRegionMap->inputCallback = MoveRegionMapCursor_Full;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
u8 _swiopen(void)
|
||||
static u8 MoveRegionMapCursor_Full(void)
|
||||
{
|
||||
u16 mapSecId;
|
||||
|
||||
if (gUnknown_0203A144->cursorMovementFrameCounter != 0)
|
||||
if (gRegionMap->cursorMovementFrameCounter != 0)
|
||||
{
|
||||
return INPUT_EVENT_MOVE_CONT;
|
||||
}
|
||||
if (gUnknown_0203A144->cursorDeltaX > 0)
|
||||
if (gRegionMap->cursorDeltaX > 0)
|
||||
{
|
||||
gUnknown_0203A144->cursorPosX ++;
|
||||
gRegionMap->cursorPosX ++;
|
||||
}
|
||||
if (gUnknown_0203A144->cursorDeltaX < 0)
|
||||
if (gRegionMap->cursorDeltaX < 0)
|
||||
{
|
||||
gUnknown_0203A144->cursorPosX --;
|
||||
gRegionMap->cursorPosX --;
|
||||
}
|
||||
if (gUnknown_0203A144->cursorDeltaY > 0)
|
||||
if (gRegionMap->cursorDeltaY > 0)
|
||||
{
|
||||
gUnknown_0203A144->cursorPosY ++;
|
||||
gRegionMap->cursorPosY ++;
|
||||
}
|
||||
if (gUnknown_0203A144->cursorDeltaY < 0)
|
||||
if (gRegionMap->cursorDeltaY < 0)
|
||||
{
|
||||
gUnknown_0203A144->cursorPosY --;
|
||||
gRegionMap->cursorPosY --;
|
||||
}
|
||||
mapSecId = sub_812386C(gUnknown_0203A144->cursorPosX, gUnknown_0203A144->cursorPosY);
|
||||
gUnknown_0203A144->unk_002 = get_flagnr_blue_points(mapSecId);
|
||||
if (mapSecId != gUnknown_0203A144->mapSecId)
|
||||
mapSecId = sub_812386C(gRegionMap->cursorPosX, gRegionMap->cursorPosY);
|
||||
gRegionMap->unk_002 = get_flagnr_blue_points(mapSecId);
|
||||
if (mapSecId != gRegionMap->mapSecId)
|
||||
{
|
||||
gUnknown_0203A144->mapSecId = mapSecId;
|
||||
GetMapName(gUnknown_0203A144->mapSecName, gUnknown_0203A144->mapSecId, 16);
|
||||
gRegionMap->mapSecId = mapSecId;
|
||||
GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, 16);
|
||||
}
|
||||
sub_8123FB0();
|
||||
gUnknown_0203A144->inputCallback = sub_81230C4;
|
||||
gRegionMap->inputCallback = ProcessRegionMapInput_Full;
|
||||
return INPUT_EVENT_MOVE_END;
|
||||
}
|
||||
|
||||
u8 sub_8123254(void)
|
||||
static u8 ProcessRegionMapInput_Zoomed(void)
|
||||
{
|
||||
u8 input;
|
||||
|
||||
input = INPUT_EVENT_NONE;
|
||||
gUnknown_0203A144->zoomedCursorDeltaX = 0;
|
||||
gUnknown_0203A144->zoomedCursorDeltaY = 0;
|
||||
if (gMain.heldKeys & DPAD_UP && gUnknown_0203A144->scrollY > -0x34)
|
||||
gRegionMap->zoomedCursorDeltaX = 0;
|
||||
gRegionMap->zoomedCursorDeltaY = 0;
|
||||
if (gMain.heldKeys & DPAD_UP && gRegionMap->scrollY > -0x34)
|
||||
{
|
||||
gUnknown_0203A144->zoomedCursorDeltaY = -1;
|
||||
gRegionMap->zoomedCursorDeltaY = -1;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_DOWN && gUnknown_0203A144->scrollY < 0x3c)
|
||||
if (gMain.heldKeys & DPAD_DOWN && gRegionMap->scrollY < 0x3c)
|
||||
{
|
||||
gUnknown_0203A144->zoomedCursorDeltaY = +1;
|
||||
gRegionMap->zoomedCursorDeltaY = +1;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_LEFT && gUnknown_0203A144->scrollX > -0x2c)
|
||||
if (gMain.heldKeys & DPAD_LEFT && gRegionMap->scrollX > -0x2c)
|
||||
{
|
||||
gUnknown_0203A144->zoomedCursorDeltaX = -1;
|
||||
gRegionMap->zoomedCursorDeltaX = -1;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.heldKeys & DPAD_RIGHT && gUnknown_0203A144->scrollX < 0xac)
|
||||
if (gMain.heldKeys & DPAD_RIGHT && gRegionMap->scrollX < 0xac)
|
||||
{
|
||||
gUnknown_0203A144->zoomedCursorDeltaX = +1;
|
||||
gRegionMap->zoomedCursorDeltaX = +1;
|
||||
input = INPUT_EVENT_MOVE_START;
|
||||
}
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
|
@ -309,41 +310,41 @@ u8 sub_8123254(void)
|
|||
}
|
||||
if (input == INPUT_EVENT_MOVE_START)
|
||||
{
|
||||
gUnknown_0203A144->inputCallback = sub_8123334;
|
||||
gUnknown_0203A144->zoomedCursorMovementFrameCounter = 0;
|
||||
gRegionMap->inputCallback = MoveRegionMapCursor_Zoomed;
|
||||
gRegionMap->zoomedCursorMovementFrameCounter = 0;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
u8 sub_8123334(void)
|
||||
static u8 MoveRegionMapCursor_Zoomed(void)
|
||||
{
|
||||
u16 x;
|
||||
u16 y;
|
||||
u16 mapSecId;
|
||||
|
||||
gUnknown_0203A144->scrollY += gUnknown_0203A144->zoomedCursorDeltaY;
|
||||
gUnknown_0203A144->scrollX += gUnknown_0203A144->zoomedCursorDeltaX;
|
||||
sub_812378C(gUnknown_0203A144->scrollX, gUnknown_0203A144->scrollY);
|
||||
gUnknown_0203A144->zoomedCursorMovementFrameCounter ++;
|
||||
if (gUnknown_0203A144->zoomedCursorMovementFrameCounter == 8)
|
||||
gRegionMap->scrollY += gRegionMap->zoomedCursorDeltaY;
|
||||
gRegionMap->scrollX += gRegionMap->zoomedCursorDeltaX;
|
||||
sub_812378C(gRegionMap->scrollX, gRegionMap->scrollY);
|
||||
gRegionMap->zoomedCursorMovementFrameCounter ++;
|
||||
if (gRegionMap->zoomedCursorMovementFrameCounter == 8)
|
||||
{
|
||||
x = (gUnknown_0203A144->scrollX + 0x2c) / 8 + 1;
|
||||
y = (gUnknown_0203A144->scrollY + 0x34) / 8 + 2;
|
||||
if (x != gUnknown_0203A144->unk_064 || y != gUnknown_0203A144->unk_066)
|
||||
x = (gRegionMap->scrollX + 0x2c) / 8 + 1;
|
||||
y = (gRegionMap->scrollY + 0x34) / 8 + 2;
|
||||
if (x != gRegionMap->unk_064 || y != gRegionMap->unk_066)
|
||||
{
|
||||
gUnknown_0203A144->unk_064 = x;
|
||||
gUnknown_0203A144->unk_066 = y;
|
||||
gRegionMap->unk_064 = x;
|
||||
gRegionMap->unk_066 = y;
|
||||
mapSecId = sub_812386C(x, y);
|
||||
gUnknown_0203A144->unk_002 = get_flagnr_blue_points(mapSecId);
|
||||
if (mapSecId != gUnknown_0203A144->mapSecId)
|
||||
gRegionMap->unk_002 = get_flagnr_blue_points(mapSecId);
|
||||
if (mapSecId != gRegionMap->mapSecId)
|
||||
{
|
||||
gUnknown_0203A144->mapSecId = mapSecId;
|
||||
GetMapName(gUnknown_0203A144->mapSecName, gUnknown_0203A144->mapSecId, 16);
|
||||
gRegionMap->mapSecId = mapSecId;
|
||||
GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, 16);
|
||||
}
|
||||
sub_8123FB0();
|
||||
}
|
||||
gUnknown_0203A144->zoomedCursorMovementFrameCounter = 0;
|
||||
gUnknown_0203A144->inputCallback = sub_8123254;
|
||||
gRegionMap->zoomedCursorMovementFrameCounter = 0;
|
||||
gRegionMap->inputCallback = ProcessRegionMapInput_Zoomed;
|
||||
return INPUT_EVENT_MOVE_END;
|
||||
}
|
||||
return INPUT_EVENT_MOVE_CONT;
|
||||
|
@ -351,35 +352,119 @@ u8 sub_8123334(void)
|
|||
|
||||
void sub_8123418(void)
|
||||
{
|
||||
if (gUnknown_0203A144->zoomed == FALSE)
|
||||
if (gRegionMap->zoomed == FALSE)
|
||||
{
|
||||
gUnknown_0203A144->scrollY = 0;
|
||||
gUnknown_0203A144->scrollX = 0;
|
||||
gUnknown_0203A144->unk_040 = 0;
|
||||
gUnknown_0203A144->unk_03c = 0;
|
||||
gUnknown_0203A144->unk_060 = gUnknown_0203A144->cursorPosX * 8 - 0x34;
|
||||
gUnknown_0203A144->unk_062 = gUnknown_0203A144->cursorPosY * 8 - 0x44;
|
||||
gUnknown_0203A144->unk_044 = (gUnknown_0203A144->unk_060 << 8) / 16;
|
||||
gUnknown_0203A144->unk_048 = (gUnknown_0203A144->unk_062 << 8) / 16;
|
||||
gUnknown_0203A144->unk_064 = gUnknown_0203A144->cursorPosX;
|
||||
gUnknown_0203A144->unk_066 = gUnknown_0203A144->cursorPosY;
|
||||
gUnknown_0203A144->unk_04c = 0x10000;
|
||||
gUnknown_0203A144->unk_050 = -0x800;
|
||||
gRegionMap->scrollY = 0;
|
||||
gRegionMap->scrollX = 0;
|
||||
gRegionMap->unk_040 = 0;
|
||||
gRegionMap->unk_03c = 0;
|
||||
gRegionMap->unk_060 = gRegionMap->cursorPosX * 8 - 0x34;
|
||||
gRegionMap->unk_062 = gRegionMap->cursorPosY * 8 - 0x44;
|
||||
gRegionMap->unk_044 = (gRegionMap->unk_060 << 8) / 16;
|
||||
gRegionMap->unk_048 = (gRegionMap->unk_062 << 8) / 16;
|
||||
gRegionMap->unk_064 = gRegionMap->cursorPosX;
|
||||
gRegionMap->unk_066 = gRegionMap->cursorPosY;
|
||||
gRegionMap->unk_04c = 0x10000;
|
||||
gRegionMap->unk_050 = -0x800;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203A144->unk_03c = gUnknown_0203A144->scrollX * 256;
|
||||
gUnknown_0203A144->unk_040 = gUnknown_0203A144->scrollY * 256;
|
||||
gUnknown_0203A144->unk_060 = 0;
|
||||
gUnknown_0203A144->unk_062 = 0;
|
||||
gUnknown_0203A144->unk_044 = -(gUnknown_0203A144->unk_03c / 16);
|
||||
gUnknown_0203A144->unk_048 = -(gUnknown_0203A144->unk_040 / 16);
|
||||
gUnknown_0203A144->cursorPosX = gUnknown_0203A144->unk_064;
|
||||
gUnknown_0203A144->cursorPosY = gUnknown_0203A144->unk_066;
|
||||
gUnknown_0203A144->unk_04c = 0x8000;
|
||||
gUnknown_0203A144->unk_050 = 0x800;
|
||||
gRegionMap->unk_03c = gRegionMap->scrollX * 256;
|
||||
gRegionMap->unk_040 = gRegionMap->scrollY * 256;
|
||||
gRegionMap->unk_060 = 0;
|
||||
gRegionMap->unk_062 = 0;
|
||||
gRegionMap->unk_044 = -(gRegionMap->unk_03c / 16);
|
||||
gRegionMap->unk_048 = -(gRegionMap->unk_040 / 16);
|
||||
gRegionMap->cursorPosX = gRegionMap->unk_064;
|
||||
gRegionMap->cursorPosY = gRegionMap->unk_066;
|
||||
gRegionMap->unk_04c = 0x8000;
|
||||
gRegionMap->unk_050 = 0x800;
|
||||
}
|
||||
gUnknown_0203A144->unk_06e = 0;
|
||||
gRegionMap->unk_06e = 0;
|
||||
sub_8124238();
|
||||
sub_81243B0();
|
||||
}
|
||||
|
||||
u8 sub_8123514(void)
|
||||
{
|
||||
u8 r4;
|
||||
|
||||
if (gRegionMap->unk_06e >= 16)
|
||||
return 0;
|
||||
gRegionMap->unk_06e ++;
|
||||
if (gRegionMap->unk_06e == 16)
|
||||
{
|
||||
gRegionMap->unk_044 = 0;
|
||||
gRegionMap->unk_048 = 0;
|
||||
gRegionMap->scrollX = gRegionMap->unk_060;
|
||||
gRegionMap->scrollY = gRegionMap->unk_062;
|
||||
gRegionMap->unk_04c = (gRegionMap->zoomed == FALSE) ? (128 << 8) : (256 << 8);
|
||||
gRegionMap->zoomed = !gRegionMap->zoomed;
|
||||
gRegionMap->inputCallback = (gRegionMap->zoomed == FALSE) ? ProcessRegionMapInput_Full : ProcessRegionMapInput_Zoomed;
|
||||
CreateRegionMapCursor(gRegionMap->cursorTileTag, gRegionMap->cursorPaletteTag);
|
||||
sub_81243DC();
|
||||
r4 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gRegionMap->unk_03c += gRegionMap->unk_044;
|
||||
gRegionMap->unk_040 += gRegionMap->unk_048;
|
||||
gRegionMap->scrollX = gRegionMap->unk_03c >> 8;
|
||||
gRegionMap->scrollY = gRegionMap->unk_040 >> 8;
|
||||
gRegionMap->unk_04c += gRegionMap->unk_050;
|
||||
if ((gRegionMap->unk_044 < 0 && gRegionMap->scrollX < gRegionMap->unk_060)
|
||||
|| (gRegionMap->unk_044 > 0 && gRegionMap->scrollX > gRegionMap->unk_060))
|
||||
{
|
||||
gRegionMap->scrollX = gRegionMap->unk_060;
|
||||
gRegionMap->unk_044 = 0;
|
||||
}
|
||||
if ((gRegionMap->unk_048 < 0 && gRegionMap->scrollY < gRegionMap->unk_062)
|
||||
|| (gRegionMap->unk_048 > 0 && gRegionMap->scrollY > gRegionMap->unk_062))
|
||||
{
|
||||
gRegionMap->scrollY = gRegionMap->unk_062;
|
||||
gRegionMap->unk_048 = 0;
|
||||
}
|
||||
if (gRegionMap->zoomed == FALSE)
|
||||
{
|
||||
if (gRegionMap->unk_04c < (128 << 8))
|
||||
{
|
||||
gRegionMap->unk_04c = (128 << 8);
|
||||
gRegionMap->unk_050 = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gRegionMap->unk_04c > (256 << 8))
|
||||
{
|
||||
gRegionMap->unk_04c = (256 << 8);
|
||||
gRegionMap->unk_050 = 0;
|
||||
}
|
||||
}
|
||||
r4 = 1;
|
||||
}
|
||||
CalcZoomScrollParams(gRegionMap->scrollX, gRegionMap->scrollY, 0x38, 0x48, gRegionMap->unk_04c >> 8, gRegionMap->unk_04c >> 8, 0);
|
||||
return r4;
|
||||
}
|
||||
|
||||
void CalcZoomScrollParams(s16 scrollX, s16 scrollY, s16 c, s16 d, u16 e, u16 f, u8 rotation)
|
||||
{
|
||||
s32 var1;
|
||||
s32 var2;
|
||||
s32 var3;
|
||||
s32 var4;
|
||||
|
||||
gRegionMap->bg2pa = e * gSineTable[rotation + 64] >> 8;
|
||||
gRegionMap->bg2pb = e * -gSineTable[rotation] >> 8;
|
||||
gRegionMap->bg2pc = f * gSineTable[rotation] >> 8;
|
||||
gRegionMap->bg2pd = f * gSineTable[rotation + 64] >> 8;
|
||||
|
||||
var1 = (scrollX << 8) + (c << 8);
|
||||
var2 = d * gRegionMap->bg2pc + gRegionMap->bg2pa * c;
|
||||
gRegionMap->bg2x = var1 - var2;
|
||||
|
||||
var3 = (scrollY << 8) + (d << 8);
|
||||
var4 = gRegionMap->bg2pd * d + gRegionMap->bg2pb * c;
|
||||
gRegionMap->bg2y = var3 - var4;
|
||||
|
||||
gRegionMap->needUpdateVideoRegs = TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue