summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2022-06-06 12:42:25 +0200
committeroctorock <79596758+octorock@users.noreply.github.com>2022-06-11 22:58:02 +0200
commite11cfed066a3c7cc2fdbbdb34ca15e80b224997b (patch)
treedafeda60efe80c74e94c1e073b7c80f0578dd70b
parent06d6f7aaa4502698ddef83821c258f835ea41fbd (diff)
Decompile some functions
-rwxr-xr-xasm/macros/map.inc14
-rw-r--r--asm/non_matching/arm_proxy/NPCUpdate.inc4
-rw-r--r--asm/non_matching/armos/sub_080306C4.inc8
-rw-r--r--asm/non_matching/beanstalkSubtask/sub_0801AFE4.inc4
-rw-r--r--asm/non_matching/delayedEntityLoadManager/DelayedEntityLoadManager_Main.inc6
-rw-r--r--asm/non_matching/game/sub_08053800.inc67
-rw-r--r--asm/non_matching/gyorg_female/sub_08046518.inc6
-rw-r--r--asm/non_matching/playerUtils/sub_08078CD0.inc73
-rw-r--r--asm/non_matching/playerUtils/sub_08079FD4.inc65
-rw-r--r--asm/non_matching/playerUtils/sub_0807BFD0.inc10
-rw-r--r--asm/non_matching/scroll/sub_08080278.inc16
-rw-r--r--asm/non_matching/scroll/sub_08080368.inc51
-rw-r--r--asm/non_matching/scroll/sub_08080BC4.inc98
-rw-r--r--asm/src/veneer.s56
-rwxr-xr-xdata/map/map_headers.s2
-rw-r--r--linker.ld16
-rw-r--r--src/enemy/armos.c4
-rw-r--r--src/enemy/gyorgFemale.c13
-rw-r--r--src/enemy/helmasaur.c7
-rw-r--r--src/enemy/sensorBladeTrap.c9
-rw-r--r--src/game.c33
-rw-r--r--src/movement.c6
-rw-r--r--src/npc.c6
-rw-r--r--src/npc/npc5.c23
-rw-r--r--src/object/fan.c14
-rw-r--r--src/object/objectB2.c11
-rw-r--r--src/playerUtils.c61
-rw-r--r--src/projectile/guardLineOfSight.c3
-rw-r--r--src/scroll.c91
29 files changed, 264 insertions, 513 deletions
diff --git a/asm/macros/map.inc b/asm/macros/map.inc
index 90682690..c731112d 100755
--- a/asm/macros/map.inc
+++ b/asm/macros/map.inc
@@ -27,27 +27,27 @@
.endm
.macro metatiles_bottom src_offset, size, compressed, terminator=0
- map_data \src_offset, gMetatilesBottom, \size, \compressed, \terminator
+ map_data \src_offset, gMapBottom+0x7004, \size, \compressed, \terminator
.endm
.macro metatiles_top src_offset, size, compressed, terminator=0
- map_data \src_offset, gMetatilesTop, \size, \compressed, \terminator
+ map_data \src_offset, gMapTop+0x7004, \size, \compressed, \terminator
.endm
.macro metatile_types_bottom src_offset, size, compressed, terminator=0
- map_data \src_offset, gMetatileTypesBottom, \size, \compressed, \terminator
+ map_data \src_offset, gMapBottom+0x5004, \size, \compressed, \terminator
.endm
.macro metatile_types_top src_offset, size, compressed, terminator=0
- map_data \src_offset, gMetatileTypesTop, \size, \compressed, \terminator
+ map_data \src_offset, gMapTop+0x5004, \size, \compressed, \terminator
.endm
.macro map_bottom src_offset, size, compressed, terminator=0
- map_data \src_offset, gMapDataBottom, \size, \compressed, \terminator
+ map_data \src_offset, gMapBottom+0x0004, \size, \compressed, \terminator
.endm
.macro map_top src_offset, size, compressed, terminator=0
- map_data \src_offset, gMapDataTop, \size, \compressed, \terminator
+ map_data \src_offset, gMapTop+0x0004, \size, \compressed, \terminator
.endm
.macro map_top_special src_offset, size, compressed, terminator=0
@@ -55,7 +55,7 @@
.endm
.macro collision_bottom src_offset, size, compressed, terminator=0
- map_data \src_offset, gUnk_02027EB4, \size, \compressed, \terminator
+ map_data \src_offset, gMapBottom+0x2004, \size, \compressed, \terminator
.endm
.macro map_bottom_special src_offset, size, compressed, terminator=0
diff --git a/asm/non_matching/arm_proxy/NPCUpdate.inc b/asm/non_matching/arm_proxy/NPCUpdate.inc
index 67ad06ec..14b81b2b 100644
--- a/asm/non_matching/arm_proxy/NPCUpdate.inc
+++ b/asm/non_matching/arm_proxy/NPCUpdate.inc
@@ -62,7 +62,7 @@ _080175A4:
ands r0, r1
cmp r0, #0
beq _080175CC
- ldr r2, _080175E0 @ =gUnk_02031EC0
+ ldr r2, _080175E0 @ =gNPCData
lsls r0, r1, #4
subs r0, #0x10
adds r2, r0, r2
@@ -85,6 +85,6 @@ _080175D2:
.align 2, 0
_080175D8: .4byte gUnk_020342F8
_080175DC: .4byte gNPCFunctions
-_080175E0: .4byte gUnk_02031EC0
+_080175E0: .4byte gNPCData
_080175E4: .4byte gRoomControls
.syntax divided
diff --git a/asm/non_matching/armos/sub_080306C4.inc b/asm/non_matching/armos/sub_080306C4.inc
index f5a094d8..e7d602d7 100644
--- a/asm/non_matching/armos/sub_080306C4.inc
+++ b/asm/non_matching/armos/sub_080306C4.inc
@@ -66,11 +66,11 @@ _08030746:
adds r0, r4, #0
adds r0, #0x38
ldrb r0, [r0]
- ldr r1, _080307B4 @ =gUnk_02027EB4
+ ldr r1, _080307B4 @ =gMapBottom+0x2004
mov ip, r1
cmp r0, #2
bne _08030758
- ldr r7, _080307B8 @ =gUnk_0200D654
+ ldr r7, _080307B8 @ =gMapTop+0x2004
mov ip, r7
_08030758:
movs r0, #0x2e
@@ -118,8 +118,8 @@ _0803079E:
b _080307CC
.align 2, 0
_080307B0: .4byte gUnk_020000B0
-_080307B4: .4byte gUnk_02027EB4
-_080307B8: .4byte gUnk_0200D654
+_080307B4: .4byte gMapBottom+0x2004
+_080307B8: .4byte gMapTop+0x2004
_080307BC: .4byte gUnk_080CE164
_080307C0:
movs r0, #4
diff --git a/asm/non_matching/beanstalkSubtask/sub_0801AFE4.inc b/asm/non_matching/beanstalkSubtask/sub_0801AFE4.inc
index 0e23e085..5aa6bf6d 100644
--- a/asm/non_matching/beanstalkSubtask/sub_0801AFE4.inc
+++ b/asm/non_matching/beanstalkSubtask/sub_0801AFE4.inc
@@ -4,7 +4,7 @@
mov r6, sb
mov r5, r8
push {r5, r6, r7}
- ldr r3, _0801B018 @ =gUnk_02027EB4
+ ldr r3, _0801B018 @ =gMapBottom+0x2004
ldr r0, _0801B01C @ =gRoomControls
ldrh r1, [r0, #0x1e]
lsrs r1, r1, #4
@@ -27,7 +27,7 @@ _0801B00E:
adds r5, r2, #1
b _0801B026
.align 2, 0
-_0801B018: .4byte gUnk_02027EB4
+_0801B018: .4byte gMapBottom+0x2004
_0801B01C: .4byte gRoomControls
_0801B020: .4byte gUnk_080B44D0
_0801B024:
diff --git a/asm/non_matching/delayedEntityLoadManager/DelayedEntityLoadManager_Main.inc b/asm/non_matching/delayedEntityLoadManager/DelayedEntityLoadManager_Main.inc
index 0e8bf5a5..24da0211 100644
--- a/asm/non_matching/delayedEntityLoadManager/DelayedEntityLoadManager_Main.inc
+++ b/asm/non_matching/delayedEntityLoadManager/DelayedEntityLoadManager_Main.inc
@@ -26,7 +26,7 @@ _0805AB68:
adds r0, r6, #0
movs r1, #6
bl SetDefaultPriority
- ldr r2, _0805ABF4 @ =gUnk_02031EC0
+ ldr r2, _0805ABF4 @ =gNPCData
ldrb r0, [r6, #0xb]
mov r3, r8
ldrb r1, [r3]
@@ -62,7 +62,7 @@ _0805ABBE:
mov r1, ip
strb r2, [r1]
_0805ABC8:
- ldr r4, _0805ABF4 @ =gUnk_02031EC0
+ ldr r4, _0805ABF4 @ =gNPCData
ldrb r2, [r6, #0xb]
mov r3, r8
ldrb r1, [r3]
@@ -84,7 +84,7 @@ _0805ABC8:
b _0805ACAA
.align 2, 0
_0805ABF0: .4byte gArea
-_0805ABF4: .4byte gUnk_02031EC0
+_0805ABF4: .4byte gNPCData
_0805ABF8: .4byte gSave
_0805ABFC: .4byte gUnk_020342F8
_0805AC00:
diff --git a/asm/non_matching/game/sub_08053800.inc b/asm/non_matching/game/sub_08053800.inc
deleted file mode 100644
index 3cbbb182..00000000
--- a/asm/non_matching/game/sub_08053800.inc
+++ /dev/null
@@ -1,67 +0,0 @@
- .syntax unified
- push {r4, r5, lr}
- ldr r0, _0805387C @ =gFadeControl
- ldrb r0, [r0]
- cmp r0, #0
- bne _0805387A
- ldr r1, _08053880 @ =gMenu
- ldrb r5, [r1, #0x10]
- lsls r4, r5, #1
- adds r4, r4, r5
- lsls r4, r4, #2
- ldr r0, _08053884 @ =gUnk_080FCCB4
- adds r4, r4, r0
- ldrh r0, [r4, #8]
- movs r2, #0
- strh r0, [r1, #8]
- movs r0, #0x1e
- strh r0, [r1, #0xa]
- ldrb r0, [r1, #0x10]
- adds r0, #1
- strb r0, [r1, #0x10]
- ldrb r0, [r1, #6]
- adds r0, #1
- strb r0, [r1, #6]
- strb r2, [r1, #7]
- adds r0, r5, #0
- adds r0, #0x8a
- bl LoadPaletteGroup
- adds r0, r5, #0
- adds r0, #0x3a
- bl LoadGfxGroup
- ldr r0, _08053888 @ =gBG1Buffer
- movs r1, #0x80
- lsls r1, r1, #4
- bl MemClear
- ldr r0, _0805388C @ =0x00000F01
- adds r5, r5, r0
- ldr r1, [r4]
- adds r0, r5, #0
- bl sub_0805F46C
- ldr r2, _08053890 @ =gScreen
- movs r0, #1
- strh r0, [r2, #0x1a]
- adds r1, r2, #0
- adds r1, #0x68
- movs r0, #0x10
- strh r0, [r1]
- ldrh r1, [r4, #4]
- adds r0, r2, #0
- adds r0, #0x58
- strh r1, [r0]
- ldrh r1, [r4, #6]
- adds r0, #4
- strh r1, [r0]
- ldrh r1, [r4, #0xa]
- movs r0, #4
- bl SetFade
-_0805387A:
- pop {r4, r5, pc}
- .align 2, 0
-_0805387C: .4byte gFadeControl
-_08053880: .4byte gMenu
-_08053884: .4byte gUnk_080FCCB4
-_08053888: .4byte gBG1Buffer
-_0805388C: .4byte 0x00000F01
-_08053890: .4byte gScreen
- .syntax divided
diff --git a/asm/non_matching/gyorg_female/sub_08046518.inc b/asm/non_matching/gyorg_female/sub_08046518.inc
index b7515753..34dd8dc2 100644
--- a/asm/non_matching/gyorg_female/sub_08046518.inc
+++ b/asm/non_matching/gyorg_female/sub_08046518.inc
@@ -5,7 +5,7 @@
mov r5, r8
push {r5, r6, r7}
sub sp, #8
- ldr r1, _080465AC @ =gMetatileTypesTop
+ ldr r1, _080465AC @ =gMapTop+0x5004
ldr r2, _080465B0 @ =0xFFFFBCB0
adds r0, r1, r2
ldr r3, _080465B4 @ =0xFFFFECB0
@@ -41,7 +41,7 @@ _08046560:
strh r0, [r4]
ldrh r0, [r3]
lsls r0, r0, #1
- ldr r7, _080465AC @ =gMetatileTypesTop
+ ldr r7, _080465AC @ =gMapTop+0x5004
adds r0, r0, r7
ldrh r1, [r0]
ldr r0, [sp, #4]
@@ -75,7 +75,7 @@ _08046560:
mov sl, r5
pop {r4, r5, r6, r7, pc}
.align 2, 0
-_080465AC: .4byte gMetatileTypesTop
+_080465AC: .4byte gMapTop+0x5004
_080465B0: .4byte 0xFFFFBCB0
_080465B4: .4byte 0xFFFFECB0
_080465B8: .4byte 0x00006658
diff --git a/asm/non_matching/playerUtils/sub_08078CD0.inc b/asm/non_matching/playerUtils/sub_08078CD0.inc
deleted file mode 100644
index 806d1494..00000000
--- a/asm/non_matching/playerUtils/sub_08078CD0.inc
+++ /dev/null
@@ -1,73 +0,0 @@
- .syntax unified
- push {r4, r5, lr}
- adds r5, r0, #0
- ldr r4, [r5, #0x70]
- ldrh r0, [r5, #0x36]
- subs r0, #1
- strh r0, [r4, #0x36]
- ldrb r1, [r5, #0x1b]
- lsrs r1, r1, #6
- lsls r1, r1, #6
- ldrb r2, [r4, #0x1b]
- movs r0, #0x3f
- ands r0, r2
- orrs r0, r1
- strb r0, [r4, #0x1b]
- adds r0, r5, #0
- adds r0, #0x38
- ldrb r1, [r0]
- adds r0, r4, #0
- adds r0, #0x38
- strb r1, [r0]
- ldr r1, _08078D28 @ =gUnk_0811C01C
- ldr r0, _08078D2C @ =gPlayerState
- ldr r0, [r0, #0x2c]
- ldrb r0, [r0, #0x1e]
- adds r0, r0, r1
- ldrb r2, [r0]
- ldr r3, _08078D30 @ =gUnk_0811C0B0
- ldrb r1, [r4, #0x1c]
- movs r0, #0x30
- ands r0, r1
- lsrs r0, r0, #2
- adds r0, r0, r3
- lsls r2, r2, #1
- ldr r0, [r0]
- adds r2, r0, r2
- ldrb r0, [r5, #0x18]
- lsls r0, r0, #0x19
- cmp r0, #0
- bge _08078D34
- movs r1, #0
- ldrsb r1, [r2, r1]
- ldrh r0, [r5, #0x2e]
- subs r0, r0, r1
- b _08078D3C
- .align 2, 0
-_08078D28: .4byte gUnk_0811C01C
-_08078D2C: .4byte gPlayerState
-_08078D30: .4byte gUnk_0811C0B0
-_08078D34:
- movs r0, #0
- ldrsb r0, [r2, r0]
- ldrh r1, [r5, #0x2e]
- adds r0, r0, r1
-_08078D3C:
- strh r0, [r4, #0x2e]
- movs r0, #1
- ldrsb r0, [r2, r0]
- ldrh r1, [r5, #0x32]
- adds r0, r0, r1
- strh r0, [r4, #0x32]
- adds r0, r5, #0
- movs r1, #0
- adds r2, r4, #0
- bl sub_0806FEBC
- ldr r1, [r4, #0x50]
- cmp r1, #0
- beq _08078D5E
- adds r0, r4, #0
- bl CopyPosition
-_08078D5E:
- pop {r4, r5, pc}
- .syntax divided
diff --git a/asm/non_matching/playerUtils/sub_08079FD4.inc b/asm/non_matching/playerUtils/sub_08079FD4.inc
deleted file mode 100644
index 9a5f0296..00000000
--- a/asm/non_matching/playerUtils/sub_08079FD4.inc
+++ /dev/null
@@ -1,65 +0,0 @@
- .syntax unified
- push {r4, r5, r6, lr}
- sub sp, #4
- adds r5, r0, #0
- movs r0, #0x2e
- ldrsh r2, [r5, r0]
- ldr r3, _0807A008 @ =gRoomControls
- ldrh r0, [r3, #6]
- subs r2, r2, r0
- asrs r2, r2, #4
- movs r4, #0x3f
- ands r2, r4
- movs r6, #0x32
- ldrsh r0, [r5, r6]
- ldrh r3, [r3, #8]
- subs r0, r0, r3
- asrs r0, r0, #4
- ands r0, r4
- lsls r0, r0, #6
- orrs r2, r0
- lsls r2, r2, #1
- ldr r6, _0807A00C @ =gUnk_02027EB4
- cmp r1, #2
- bne _0807A004
- ldr r6, _0807A010 @ =gUnk_0200D654
-_0807A004:
- movs r4, #0
- b _0807A028
- .align 2, 0
-_0807A008: .4byte gRoomControls
-_0807A00C: .4byte gUnk_02027EB4
-_0807A010: .4byte gUnk_0200D654
-_0807A014:
- cmp r1, #0x23
- beq _0807A028
- cmp r1, #0x27
- beq _0807A028
- ldr r0, _0807A04C @ =gUnk_080082DC
- subs r1, #0x10
- adds r1, r1, r0
- ldrb r0, [r1]
- cmp r0, #0
- beq _0807A046
-_0807A028:
- adds r4, #1
- adds r0, r5, #0
- mov r1, sp
- bl sub_08004202
- adds r2, r0, #0
- lsrs r0, r2, #1
- adds r0, r6, r0
- ldrb r1, [r0]
- cmp r1, #0xe
- bls _0807A046
- cmp r1, #0xf
- bls _0807A028
- cmp r1, #0x1d
- bne _0807A014
-_0807A046:
- adds r0, r4, #0
- add sp, #4
- pop {r4, r5, r6, pc}
- .align 2, 0
-_0807A04C: .4byte gUnk_080082DC
- .syntax divided
diff --git a/asm/non_matching/playerUtils/sub_0807BFD0.inc b/asm/non_matching/playerUtils/sub_0807BFD0.inc
index 6426a853..f53eb74d 100644
--- a/asm/non_matching/playerUtils/sub_0807BFD0.inc
+++ b/asm/non_matching/playerUtils/sub_0807BFD0.inc
@@ -5,7 +5,7 @@
bl ClearBgAnimations
bl sub_0807BFA8
ldr r7, _0807C0B8 @ =0x0000FFFF
- ldr r6, _0807C0BC @ =gMetatileTypesBottom
+ ldr r6, _0807C0BC @ =gMapBottom+0x5004
movs r0, #0x80
lsls r0, r0, #5
mov r8, r0
@@ -15,7 +15,7 @@
bl MemFill16
movs r5, #0
strh r5, [r6]
- ldr r4, _0807C0C0 @ =gMetatileTypesTop
+ ldr r4, _0807C0C0 @ =gMapTop+0x5004
adds r0, r7, #0
adds r1, r4, #0
mov r2, r8
@@ -84,7 +84,7 @@ _0807C078:
ble _0807C066
movs r2, #0x80
lsls r2, r2, #5
- ldr r5, _0807C0C0 @ =gMetatileTypesTop
+ ldr r5, _0807C0C0 @ =gMapTop+0x5004
adds r6, r5, r2
ldr r4, _0807C0B8 @ =0x0000FFFF
adds r0, r4, #0
@@ -112,8 +112,8 @@ _0807C0A8:
pop {r4, r5, r6, r7, pc}
.align 2, 0
_0807C0B8: .4byte 0x0000FFFF
-_0807C0BC: .4byte gMetatileTypesBottom
-_0807C0C0: .4byte gMetatileTypesTop
+_0807C0BC: .4byte gMapBottom+0x5004
+_0807C0C0: .4byte gMapTop+0x5004
_0807C0C4: .4byte gRoomControls
_0807C0C8: .4byte gArea
_0807C0CC: .4byte 0x0000085C
diff --git a/asm/non_matching/scroll/sub_08080278.inc b/asm/non_matching/scroll/sub_08080278.inc
index 0d83261e..fb055fc3 100644
--- a/asm/non_matching/scroll/sub_08080278.inc
+++ b/asm/non_matching/scroll/sub_08080278.inc
@@ -26,13 +26,13 @@ _080802A2:
ldr r0, [sp]
cmp r8, r0
bhs _08080328
- ldr r4, _0808034C @ =gMapDataTop
+ ldr r4, _0808034C @ =gMapTop+0x0004
add r4, sb
- ldr r7, _08080350 @ =gUnk_0200E654
+ ldr r7, _08080350 @ =gMapTop+0x3004
add r7, sb
- ldr r3, _08080354 @ =gMapDataBottom
+ ldr r3, _08080354 @ =gMapBottom+0x0004
add r3, sb
- ldr r6, _08080358 @ =gUnk_02028EB4
+ ldr r6, _08080358 @ =gMapBottom+0x3004
add r6, sb
_080802BC:
mov r2, sl
@@ -110,10 +110,10 @@ _08080336:
.align 2, 0
_08080344: .4byte gUnk_02022830
_08080348: .4byte gRoomControls
-_0808034C: .4byte gMapDataTop
-_08080350: .4byte gUnk_0200E654
-_08080354: .4byte gMapDataBottom
-_08080358: .4byte gUnk_02028EB4
+_0808034C: .4byte gMapTop+0x0004
+_08080350: .4byte gMapTop+0x3004
+_08080354: .4byte gMapBottom+0x0004
+_08080358: .4byte gMapBottom+0x3004
_0808035C: .4byte 0x00003FFF
_08080360: .4byte 0x000005FF
_08080364: .4byte 0x000007FF
diff --git a/asm/non_matching/scroll/sub_08080368.inc b/asm/non_matching/scroll/sub_08080368.inc
deleted file mode 100644
index 5dd28da6..00000000
--- a/asm/non_matching/scroll/sub_08080368.inc
+++ /dev/null
@@ -1,51 +0,0 @@
- .syntax unified
- push {r4, r5, r6, r7, lr}
- ldr r0, _08080384 @ =gDiggingCaveEntranceTransition
- ldr r1, _08080388 @ =gRoomControls
- ldrb r0, [r0, #0xa]
- ldrb r1, [r1, #4]
- cmp r0, r1
- beq _08080390
- cmp r0, #0xff
- beq _08080390
- ldr r1, _0808038C @ =gUnk_02034480
- movs r0, #0
- strh r0, [r1]
- b _080803BE
- .align 2, 0
-_08080384: .4byte gDiggingCaveEntranceTransition
-_08080388: .4byte gRoomControls
-_0808038C: .4byte gUnk_02034480
-_08080390:
- ldr r5, _080803C0 @ =gUnk_020246B0
- ldr r0, _080803C4 @ =gUnk_02034480
- ldrh r0, [r0]
- lsls r6, r0, #1
- movs r4, #0
- cmp r4, r6
- bhs _080803B8
- ldr r0, _080803C8 @ =0x00000FFF
- adds r7, r0, #0
-_080803A2:
- ldrh r0, [r5, #2]
- ldrh r2, [r5]
- adds r1, r7, #0
- ands r1, r2
- lsrs r2, r2, #0xe
- bl sub_0807B9B8
- adds r5, #4
- adds r4, #2
- cmp r4, r6
- blo _080803A2
-_080803B8:
- ldr r1, _080803CC @ =gUpdateVisibleTiles
- movs r0, #0
- strb r0, [r1]
-_080803BE:
- pop {r4, r5, r6, r7, pc}
- .align 2, 0
-_080803C0: .4byte gUnk_020246B0
-_080803C4: .4byte gUnk_02034480
-_080803C8: .4byte 0x00000FFF
-_080803CC: .4byte gUpdateVisibleTiles
- .syntax divided
diff --git a/asm/non_matching/scroll/sub_08080BC4.inc b/asm/non_matching/scroll/sub_08080BC4.inc
deleted file mode 100644
index 4a515069..00000000
--- a/asm/non_matching/scroll/sub_08080BC4.inc
+++ /dev/null
@@ -1,98 +0,0 @@
- .syntax unified
- push {r4, r5, r6, lr}
- ldr r3, _08080C40 @ =gRoomControls
- movs r0, #0xa
- ldrsh r1, [r3, r0]
- ldrh r0, [r3, #6]
- subs r5, r1, r0
- movs r2, #0xf
- ands r5, r2
- movs r1, #0xc
- ldrsh r0, [r3, r1]
- ldrh r1, [r3, #8]
- subs r0, r0, r1
- ands r0, r2
- adds r6, r0, #0
- adds r6, #8
- ldrh r2, [r3, #0x16]
- adds r4, r2, #0
- cmp r4, #0
- beq _08080C50
- subs r2, #1
- strh r2, [r3, #0x16]
- ldrb r0, [r3, #0x14]
- lsls r0, r0, #4
- movs r1, #0xe
- ands r2, r1
- adds r0, r0, r2
- ldr r1, _08080C44 @ =gUnk_080169A4
- adds r2, r0, r1
- ldr r4, _08080C48 @ =gMapBottom
- ldr r1, [r4]
- cmp r1, #0
- beq _08080C16
- movs r0, #0
- ldrsb r0, [r2, r0]
- adds r0, r0, r5
- strh r0, [r1, #2]
- ldr r1, [r4]
- movs r0, #1
- ldrsb r0, [r2, r0]
- adds r0, r0, r6
- strh r0, [r1, #4]
-_08080C16:
- ldr r4, _08080C4C @ =gMapTop
- ldr r1, [r4]
- cmp r1, #0
- beq _08080C30
- movs r0, #0
- ldrsb r0, [r2, r0]
- adds r0, r0, r5
- strh r0, [r1, #2]
- ldr r1, [r4]
- movs r0, #1
- ldrsb r0, [r2, r0]
- adds r0, r0, r6
- strh r0, [r1, #4]
-_08080C30:
- ldrb r1, [r2]
- adds r0, r3, #0
- adds r0, #0x24
- strb r1, [r0]
- ldrb r1, [r2, #1]
- adds r0, #1
- strb r1, [r0]
- b _08080C76
- .align 2, 0
-_08080C40: .4byte gRoomControls
-_08080C44: .4byte gUnk_080169A4
-_08080C48: .4byte gMapBottom
-_08080C4C: .4byte gMapTop
-_08080C50:
- ldr r0, _08080C78 @ =gMapBottom
- ldr r1, [r0]
- cmp r1, #0
- beq _08080C5E
- strh r5, [r1, #2]
- ldr r0, [r0]
- strh r6, [r0, #4]
-_08080C5E:
- ldr r0, _08080C7C @ =gMapTop
- ldr r1, [r0]
- cmp r1, #0
- beq _08080C6C
- strh r5, [r1, #2]
- ldr r0, [r0]
- strh r6, [r0, #4]
-_08080C6C:
- adds r0, r3, #0
- adds r0, #0x24
- strb r4, [r0]
- adds r0, #1
- strb r4, [r0]
-_08080C76:
- pop {r4, r5, r6, pc}
- .align 2, 0
-_08080C78: .4byte gMapBottom
-_08080C7C: .4byte gMapTop
- .syntax divided
diff --git a/asm/src/veneer.s b/asm/src/veneer.s
index b7497472..42a0af6b 100644
--- a/asm/src/veneer.s
+++ b/asm/src/veneer.s
@@ -99,10 +99,10 @@ _0800019A:
bl DeleteLoadedTileEntity
pop {r4, r5, r6, r7, pc}
.align 2, 0
-_080001C0: .4byte gUnk_0202BEB4
-_080001C4: .4byte gUnk_0202BEB4
-_080001C8: .4byte gUnk_02011654
-_080001CC: .4byte gUnk_0202BEB4
+_080001C0: .4byte gMapBottom+0x6004
+_080001C4: .4byte gMapBottom+0x6004
+_080001C8: .4byte gMapTop+0x6004
+_080001CC: .4byte gMapBottom+0x6004
thumb_func_start sub_080001D0
sub_080001D0: @ 0x080001D0
@@ -138,34 +138,34 @@ _0800021C: .4byte gUnk_080B3E80
_08000220: .4byte gUnk_08000278
_08000224: .4byte gUnk_08000228
gUnk_08000228::
- .4byte gMapDataBottom
+ .4byte gMapBottom+0x0004
gUnk_0800022C::
- .4byte gMetatileTypesBottom
- .4byte gMapDataBottom
- .4byte gMetatileTypesBottom
- .4byte gMapDataTop
- .4byte gMetatileTypesTop
- .4byte gMapDataBottom
- .4byte gMetatileTypesBottom
+ .4byte gMapBottom+0x5004
+ .4byte gMapBottom+0x0004
+ .4byte gMapBottom+0x5004
+ .4byte gMapTop+0x0004
+ .4byte gMapTop+0x5004
+ .4byte gMapBottom+0x0004
+ .4byte gMapBottom+0x5004
gUnk_08000248::
- .4byte gUnk_02027EB4
- .4byte gUnk_02027EB4
- .4byte gUnk_0200D654
- .4byte gUnk_02027EB4
+ .4byte gMapBottom+0x2004
+ .4byte gMapBottom+0x2004
+ .4byte gMapTop+0x2004
+ .4byte gMapBottom+0x2004
gUnk_08000258::
- .4byte gUnk_02028EB4
- .4byte gMetatileTypesBottom
- .4byte gUnk_02028EB4
- .4byte gMetatileTypesBottom
- .4byte gUnk_0200E654
- .4byte gMetatileTypesTop
- .4byte gUnk_02028EB4
- .4byte gMetatileTypesBottom
+ .4byte gMapBottom+0x3004
+ .4byte gMapBottom+0x5004
+ .4byte gMapBottom+0x3004
+ .4byte gMapBottom+0x5004
+ .4byte gMapTop+0x3004
+ .4byte gMapTop+0x5004
+ .4byte gMapBottom+0x3004
+ .4byte gMapBottom+0x5004
gUnk_08000278::
- .4byte gUnk_02030EB4
- .4byte gUnk_02030EB4
- .4byte gUnk_02016654
- .4byte gUnk_02030EB4
+ .4byte gMapBottom+0xb004
+ .4byte gMapBottom+0xb004
+ .4byte gMapTop+0xb004
+ .4byte gMapBottom+0xb004
@ call 0x80B19CC
@ ========
diff --git a/data/map/map_headers.s b/data/map/map_headers.s
index 25643f08..bda80cb2 100755
--- a/data/map/map_headers.s
+++ b/data/map/map_headers.s
@@ -241,7 +241,7 @@ gAreaRoomMap_Beanstalks_4:: @ 081037B8
map_bottom offset_gAreaRoomMap_Beanstalks_4_0, 0x12C, 0, 1
gAreaRoomMap_Beanstalks_5:: @ 081037C4
- .4byte 0x80000000, gMapDataBottom, 0x80002000
+ .4byte 0x80000000, gMapBottom+0x0004, 0x80002000
map_top_special offset_gAreaRoomMap_Beanstalks_5_1, 0x800, 1, 1
gAreaRoomMaps_Beanstalks:: @ 081037DC
diff --git a/linker.ld b/linker.ld
index 27f3346d..03aee1c6 100644
--- a/linker.ld
+++ b/linker.ld
@@ -43,13 +43,6 @@ SECTIONS {
. = 0x0000B640; gUnk_0200B640 = .;
. = 0x0000B644; gUsedPalettes = .;
. = 0x0000B650; gMapTop = .;
- . = 0x0000B654; gMapDataTop = .;
- . = 0x0000D654; gUnk_0200D654 = .;
- . = 0x0000E654; gUnk_0200E654 = .;
- . = 0x00010654; gMetatileTypesTop = .;
- . = 0x00011654; gUnk_02011654 = .;
- . = 0x00012654; gMetatilesTop = .;
- . = 0x00016654; gUnk_02016654 = .;
. = 0x00017654; gCurrentRoomProperties = .;
. = 0x00017660; gSmallChests = .;
. = 0x000176A0; gPaletteBuffer = .;
@@ -91,14 +84,7 @@ SECTIONS {
. = 0x00024494; gUnk_02024494 = .;
. = 0x000246B0; gUnk_020246B0 = .;
. = 0x00025EB0; gMapBottom = .;
- . = 0x00025EB4; gMapDataBottom = .;
- . = 0x00027EB4; gUnk_02027EB4 = .;
- . = 0x00028EB4; gUnk_02028EB4 = .;
- . = 0x0002AEB4; gMetatileTypesBottom = .;
- . = 0x0002BEB4; gUnk_0202BEB4 = .;
- . = 0x0002CEB4; gMetatilesBottom = .;
- . = 0x00030EB4; gUnk_02030EB4 = .;
- . = 0x00031EC0; gUnk_02031EC0 = .;
+ . = 0x00031EC0; gNPCData = .;
. = 0x00032EC0; gUI = .;
. = 0x00033280; gActiveScriptInfo = .;
. = 0x00033290; gUnk_02033290 = .;
diff --git a/src/enemy/armos.c b/src/enemy/armos.c
index 076c278d..a2be046f 100644
--- a/src/enemy/armos.c
+++ b/src/enemy/armos.c
@@ -28,8 +28,6 @@ typedef struct {
} ArmosEntity;
extern Entity* gUnk_020000B0;
-extern u8 gUnk_02027EB4[];
-extern u8 gUnk_0200D654[];
extern void (*const gUnk_080CE124[])(ArmosEntity*);
extern void (*const gUnk_080CE13C[])(ArmosEntity*);
@@ -380,7 +378,7 @@ void sub_080306C4(ArmosEntity* this) {
if (!var) {
super->direction = (4 + uVar3 + ((Random() & 2) - 1) * 8) & 0x18;
}
- if (IsTileCollision(super->collisionLayer == 2 ? gUnk_0200D654 : gUnk_02027EB4,
+ if (IsTileCollision(super->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData,
super->x.HALF.HI + gUnk_080CE164[super->direction >> 2],
super->y.HALF.HI + gUnk_080CE164[(super->direction >> 2) + 1], 0)) {
super->direction = ((u8)(((uVar3 & 4) ^ 4) << 1)) | (uVar3 & 0x10);
diff --git a/src/enemy/gyorgFemale.c b/src/enemy/gyorgFemale.c
index a5f35588..a5948446 100644
--- a/src/enemy/gyorgFemale.c
+++ b/src/enemy/gyorgFemale.c
@@ -30,7 +30,6 @@ void sub_080467DC(GyorgFemaleEntity*);
extern u8 gUpdateVisibleTiles;
extern u8 gUnk_080B3E80[];
extern u8 gUnk_080B37A0[];
-extern u16 gMetatileTypesTop[];
extern const u8 gUnk_080D1A94[];
extern const u8 gUnk_080D1AAC[];
@@ -249,17 +248,17 @@ NONMATCH("asm/non_matching/gyorg_female/sub_08046518.inc", void sub_08046518(voi
u8* r6;
u32 i;
u16* sl;
- sl = &gMetatileTypesTop[0xFFFFBCB0];
- stack1 = &gMetatileTypesTop[0xFFFFECB0];
- stack2 = (u8*)&gMetatileTypesTop[0x00006658];
- r6 = (u8*)&gMetatileTypesTop[0xFFFFD658];
+ sl = &gMapTop.metatileTypes[0xFFFFBCB0];
+ stack1 = &gMapTop.metatileTypes[0xFFFFECB0];
+ stack2 = (u8*)&gMapTop.metatileTypes[0x00006658];
+ r6 = (u8*)&gMapTop.metatileTypes[0xFFFFD658];
for (i = 0; i < 0x10; i++) {
sl += 0x40;
stack1 += 0x40;
for (r5 = 0; r5 < 0x10; r5++) {
stack1[r5] = sl[r5];
- stack2[r5] = gUnk_080B37A0[gMetatileTypesTop[sl[r5]]];
- r6[r5] = gUnk_080B3E80[gMetatileTypesTop[sl[r5]]];
+ stack2[r5] = gUnk_080B37A0[gMapTop.metatileTypes[sl[r5]]];
+ r6[r5] = gUnk_080B3E80[gMapTop.metatileTypes[sl[r5]]];
}
stack2 = stack2 + 0x40;
r6 = r6 + 0x40;
diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c
index 553e20e9..dd279482 100644
--- a/src/enemy/helmasaur.c
+++ b/src/enemy/helmasaur.c
@@ -12,9 +12,6 @@
extern u32 sub_0804A024(Entity*, u32, u32);
-extern u8 gUnk_0200D654[];
-extern u8 gUnk_02027EB4[];
-
void sub_0802C18C(Entity*);
void sub_0802C218(Entity*);
void sub_0802C1C0(Entity*);
@@ -317,7 +314,7 @@ bool32 sub_0802C06C(Entity* this) {
u32 xdiff = gUnk_080CD45C[(this->direction >> 2) + 0];
u32 ydiff = gUnk_080CD45C[(this->direction >> 2) + 1];
- u8* layer = this->collisionLayer == 2 ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = this->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData;
u32 i;
for (i = 0; i < 8; i++) {
@@ -340,7 +337,7 @@ bool32 sub_0802C0E8(Entity* this) {
s32 x = this->x.HALF.HI + this->hitbox->offset_x + ptr[0] * 6;
s32 y = this->y.HALF.HI + this->hitbox->offset_y + ptr[1] * 6;
- u8* layer = this->collisionLayer == 2 ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = this->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData;
u32 ret = FALSE;
if (!sub_0806FC24(TILE(x, y), 9)) {
if (IsTileCollision(layer, x, y, 0)) {
diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c
index 3736305c..627a75bb 100644
--- a/src/enemy/sensorBladeTrap.c
+++ b/src/enemy/sensorBladeTrap.c
@@ -4,16 +4,13 @@
*
* @brief Sensor Blade Trap enemy
*/
-
+#include "collision.h"
#include "enemy.h"
+#include "map.h"
#include "physics.h"
-#include "collision.h"
extern u32 sub_0804A024(Entity*, u32, u32);
-extern u8 gUnk_02027EB4[];
-extern u8 gUnk_0200D654[];
-
void sub_0802BB10(Entity*);
bool32 sub_0802BB2C(Entity*, u32);
@@ -99,7 +96,7 @@ void sub_0802BB10(Entity* this) {
}
bool32 sub_0802BB2C(Entity* this, u32 param_2) {
- u8* layer = this->collisionLayer == 2 ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = this->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData;
const s8* ptr = &gUnk_080CD3DC[param_2 >> 2];
return IsTileCollision(layer, this->x.HALF.HI + ptr[0], this->y.HALF.HI + ptr[1], 0);
}
diff --git a/src/game.c b/src/game.c
index bad05016..d68ffc85 100644
--- a/src/game.c
+++ b/src/game.c
@@ -242,6 +242,16 @@ extern void sub_0806F38C(void);
extern void sub_08018710(u32);
+typedef struct {
+ Font* font;
+ u16 width;
+ u16 height;
+ u16 transitionTimer;
+ u16 fadeSpeed;
+} struct_080FCCB4;
+
+extern struct_080FCCB4 gUnk_080FCCB4[];
+
void GameTask(void) {
static GameState* const sStates[] = {
GameTask_Transition,
@@ -1888,7 +1898,28 @@ void sub_08053758(void) {
SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100);
}
-ASM_FUNC("asm/non_matching/game/sub_08053800.inc", void sub_08053800())
+void sub_08053800(void) {
+ u32 index;
+ struct_080FCCB4* ptr;
+ if (gFadeControl.active == 0) {
+ index = gGenericMenu.unk10.a[0];
+ ptr = &gUnk_080FCCB4[index];
+ gGenericMenu.base.transitionTimer = ptr->transitionTimer;
+ gGenericMenu.base.field_0xa = 0x1e;
+ gGenericMenu.unk10.a[0]++;
+ gGenericMenu.base.overlayType++;
+ gGenericMenu.base.storyPanelIndex = 0;
+ LoadPaletteGroup(index + 0x8a);
+ LoadGfxGroup(index + 0x3a);
+ MemClear(&gBG1Buffer, 0x800);
+ sub_0805F46C(index + 0xf01, ptr->font);
+ gScreen.bg1.updated = 1;
+ gScreen.controls.alphaBlend = 0x10;
+ gScreen.controls.window0HorizontalDimensions = ptr->width;
+ gScreen.controls.window0VerticalDimensions = ptr->height;
+ SetFade(FADE_INSTANT, ptr->fadeSpeed);
+ }
+}
void sub_08053894(void) {
u32 tmp;
diff --git a/src/movement.c b/src/movement.c
index 3224af88..87c70b0c 100644
--- a/src/movement.c
+++ b/src/movement.c
@@ -281,14 +281,14 @@ bool32 TileCollisionFunction9(s32 x, s32 y) {
return gUnk_081339F8[y & 0xf] >> (x & 0xf) & 1;
}
-bool32 IsTileCollision(const u8* layer, s32 x, s32 y, u32 collisionType) {
+bool32 IsTileCollision(const u8* collisionData, s32 x, s32 y, u32 collisionType) {
static bool32 (*const tileCollisionFunctions[])(s32, s32) = {
TileCollisionFunction0, TileCollisionFunction1, TileCollisionFunction2, TileCollisionFunction3,
TileCollisionFunction4, TileCollisionFunction5, TileCollisionFunction6, TileCollisionFunction7,
TileCollisionFunction8, TileCollisionFunction9,
};
- u32 tileType = layer[TILE(x, y)];
+ u32 tileType = collisionData[TILE(x, y)];
if (tileType == 0) {
if (collisionType == 4) {
return TRUE;
@@ -311,7 +311,7 @@ bool32 IsTileCollision(const u8* layer, s32 x, s32 y, u32 collisionType) {
}
// Calculation for 0xff in previous lookup.
if ((y & 8) == 0) {
- tileType = layer[TILE(x, y)];
+ tileType = collisionData[TILE(x, y)];
tileType >>= 2;
}
if ((x & 8) == 0) {
diff --git a/src/npc.c b/src/npc.c
index 12a9364a..8a07afbc 100644
--- a/src/npc.c
+++ b/src/npc.c
@@ -144,7 +144,7 @@ typedef struct {
u16 x;
u16 y;
} NPCStruct;
-extern NPCStruct gUnk_02031EC0[100];
+extern NPCStruct gNPCData[100];
void InitNPC(Entity*);
@@ -161,8 +161,8 @@ NONMATCH("asm/non_matching/arm_proxy/NPCUpdate.inc", void NPCUpdate(Entity* this
gNPCFunctions[this->id][1](this);
if ((this->health & 0x7f) != 0) {
u32 temp = this->health & 0x7f;
- gUnk_02031EC0[temp * 2 - 2].x = this->x.HALF.HI - gRoomControls.origin_x;
- gUnk_02031EC0[temp * 2 - 2].y = this->y.HALF.HI - gRoomControls.origin_y;
+ gNPCData[temp * 2 - 2].x = this->x.HALF.HI - gRoomControls.origin_x;
+ gNPCData[temp * 2 - 2].y = this->y.HALF.HI - gRoomControls.origin_y;
}
DrawEntity(this);
}
diff --git a/src/npc/npc5.c b/src/npc/npc5.c
index dc198f48..ecfc685f 100644
--- a/src/npc/npc5.c
+++ b/src/npc/npc5.c
@@ -48,9 +48,6 @@ void sub_08061B18(Entity*);
u32 PointInsideRadius(s32, s32, s32);
-extern u8 gUnk_0200D654[];
-extern u8 gUnk_02027EB4[];
-
u32 sub_080611D4(Entity*);
extern u32 sub_08079FD4(Entity*, u32);
extern void sub_08016AD2(Entity*);
@@ -376,9 +373,9 @@ bool32 sub_08060FD0(Entity* this, u32 a, u32 b) {
sVar2 = gSineTable[(iVar3 + 0x40)] * 6;
if (this->collisionLayer != 2) {
- puVar8 = gUnk_02027EB4;
+ puVar8 = gMapBottom.collisionData;
} else {
- puVar8 = gUnk_0200D654;
+ puVar8 = gMapTop.collisionData;
}
while (1) {
@@ -685,7 +682,7 @@ void sub_08061464(Entity* this, u32 param_a, u32 param_b) {
bool32 sub_08061630(Entity* this, s32 x, s32 y, s32 param) {
u32 param_y = y;
- u8* layer = (this->collisionLayer == 2) ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData;
while (!IsTileCollision(layer, x, y, 6)) {
if (sub_08061A74(layer, x, y, param)) {
((UnkHeap*)this->myHeap)->unk_7 = x;
@@ -702,7 +699,7 @@ bool32 sub_08061630(Entity* this, s32 x, s32 y, s32 param) {
bool32 sub_080616A8(Entity* this, s32 x, s32 y, s32 param) {
u32 param_y = y;
- u8* layer = (this->collisionLayer == 2) ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData;
while (!IsTileCollision(layer, x, y, 6)) {
if (sub_08061A1C(layer, x, y, param)) {
((UnkHeap*)this->myHeap)->unk_7 = x;
@@ -719,7 +716,7 @@ bool32 sub_080616A8(Entity* this, s32 x, s32 y, s32 param) {
bool32 sub_08061720(Entity* this, s32 x, s32 y, s32 param) {
u32 param_x = x;
- u8* layer = (this->collisionLayer == 2) ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData;
while (!IsTileCollision(layer, x, y, 6)) {
if (sub_080619F0(layer, x, y, param)) {
((UnkHeap*)this->myHeap)->unk_7 = param_x;
@@ -736,7 +733,7 @@ bool32 sub_08061720(Entity* this, s32 x, s32 y, s32 param) {
bool32 sub_08061798(Entity* this, s32 x, s32 y, s32 param) {
u32 param_x = x;
- u8* layer = (this->collisionLayer == 2) ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData;
while (!IsTileCollision(layer, x, y, 6)) {
if (sub_08061A48(layer, x, y, param)) {
((UnkHeap*)this->myHeap)->unk_7 = param_x;
@@ -753,7 +750,7 @@ bool32 sub_08061798(Entity* this, s32 x, s32 y, s32 param) {
bool32 sub_08061810(Entity* this, s32 x, s32 y, s32 param) {
u32 param_y = y;
- u8* layer = (this->collisionLayer == 2) ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData;
while (!IsTileCollision(layer, x, y, 6)) {
if (sub_08061A74(layer, x, y, param)) {
((UnkHeap*)this->myHeap)->unk_7 = x;
@@ -770,7 +767,7 @@ bool32 sub_08061810(Entity* this, s32 x, s32 y, s32 param) {
bool32 sub_08061888(Entity* this, s32 x, s32 y, s32 param) {
u32 param_y = y;
- u8* layer = (this->collisionLayer == 2) ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData;
while (!IsTileCollision(layer, x, y, 6)) {
if (sub_08061A1C(layer, x, y, param)) {
((UnkHeap*)this->myHeap)->unk_7 = x;
@@ -787,7 +784,7 @@ bool32 sub_08061888(Entity* this, s32 x, s32 y, s32 param) {
bool32 sub_08061900(Entity* this, s32 x, s32 y, s32 param) {
u32 param_x = x;
- u8* layer = (this->collisionLayer == 2) ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData;
while (!IsTileCollision(layer, x, y, 6)) {
if (sub_080619F0(layer, x, y, param)) {
((UnkHeap*)this->myHeap)->unk_7 = param_x;
@@ -804,7 +801,7 @@ bool32 sub_08061900(Entity* this, s32 x, s32 y, s32 param) {
bool32 sub_08061978(Entity* this, s32 x, s32 y, s32 param) {
u32 param_x = x;
- u8* layer = (this->collisionLayer == 2) ? gUnk_0200D654 : gUnk_02027EB4;
+ u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData;
while (!IsTileCollision(layer, x, y, 6)) {
if (sub_08061A48(layer, x, y, param)) {
((UnkHeap*)this->myHeap)->unk_7 = param_x;
diff --git a/src/object/fan.c b/src/object/fan.c
index b9a98d01..0a3c3550 100644
--- a/src/object/fan.c
+++ b/src/object/fan.c
@@ -37,8 +37,6 @@ void Fan_Action2(FanEntity* this);
void Fan_Action3(FanEntity* this);
bool32 sub_0809EF78(FanEntity*, Entity*);
-extern const u8 gUnk_02027EB4[];
-
void Fan(Entity* this) {
static void (*const actionFuncs[])(FanEntity*) = {
Fan_Init,
@@ -172,19 +170,19 @@ void sub_0809EFB0(FanEntity* this) {
s32 sVar4;
int iVar6;
int iVar7;
- const u8* ptr;
+ const u8* collisionData;
cVar1 = tileTypeOffsets[super->type * 2];
cVar2 = tileTypeOffsets[super->type * 2 + 1];
iVar7 = super->x.HALF.HI;
iVar6 = super->y.HALF.HI;
- ptr = gUnk_02027EB4;
+ collisionData = gMapBottom.collisionData;
sVar4 = 0;
do {
sVar4++;
iVar7 = iVar7 + cVar1;
iVar6 = iVar6 + cVar2;
- } while (!IsTileCollision(ptr, iVar7, iVar6, 9));
+ } while (!IsTileCollision(collisionData, iVar7, iVar6, 9));
sVar4 = (sVar4 - 1) << 4;
switch (super->type) {
@@ -237,13 +235,13 @@ void sub_0809F08C(FanEntity* this) {
void sub_0809F0E4(FanEntity* this) {
static const s8 typeOffsets[] = { 0, 12, -12, 0, 0, -12, 12, 0 };
Entity* pEVar1;
- const s8* ptr;
+ const s8* collisionData;
EnqueueSFX(SFX_183);
pEVar1 = CreateObject(OBJECT_B2, super->type ^ 2, 0);
if (pEVar1 != NULL) {
pEVar1->parent = super;
- ptr = typeOffsets + super->type * 2;
- PositionRelative(super, pEVar1, ptr[0] << 0x10, ptr[1] << 0x10);
+ collisionData = typeOffsets + super->type * 2;
+ PositionRelative(super, pEVar1, collisionData[0] << 0x10, collisionData[1] << 0x10);
}
}
diff --git a/src/object/objectB2.c b/src/object/objectB2.c
index dae02bf1..7cbff895 100644
--- a/src/object/objectB2.c
+++ b/src/object/objectB2.c
@@ -3,22 +3,19 @@
#include "functions.h"
#include "collision.h"
-extern u8 gUnk_02027EB4[];
-extern u8 gUnk_0200D654[];
-
void ObjectB2(Entity* this) {
- u8* layer;
+ u8* collisionData;
if (this->action == 0) {
this->action = 1;
this->timer = 0x10;
this->direction = this->type << 3;
if (this->collisionLayer == 2) {
- layer = gUnk_0200D654;
+ collisionData = gMapTop.collisionData;
} else {
- layer = gUnk_02027EB4;
+ collisionData = gMapBottom.collisionData;
}
- this->child = (Entity*)layer;
+ this->child = (Entity*)collisionData;
InitializeAnimation(this, this->type);
}
this->speed = this->parent->speed;
diff --git a/src/playerUtils.c b/src/playerUtils.c
index f262b98b..684693eb 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -150,7 +150,6 @@ extern const u8 gUnk_080B3E80[];
// collisions for tiles > 0x4000
extern const u8 gUnk_080B79A7[];
-extern void sub_08080B60(LayerStruct*);
extern void sub_0801AB08(u16*, LayerStruct*);
extern u8 gUnk_02006F00[];
@@ -166,6 +165,12 @@ void sub_0807BC84(void);
void sub_0807C5F4(u16*, u16*);
void sub_0807C5B0(void);
+extern u8 gUnk_080082DC[];
+extern u32 sub_08004202(Entity*, u8*, u32);
+
+extern s8* gUnk_0811C0B0[];
+extern u8 gUnk_0811C01C[];
+
void sub_08077698(PlayerEntity* this) {
ItemBehavior* puVar2;
u32 idx;
@@ -1207,7 +1212,28 @@ void UpdateCarriedObject(void) {
}
}
-ASM_FUNC("asm/non_matching/playerUtils/sub_08078CD0.inc", void sub_08078CD0())
+void sub_08078CD0(PlayerEntity* this) {
+ Entity* entity;
+ u32 tmp;
+ s8* ptr;
+
+ entity = this->unk_70;
+ entity->z.HALF.HI = super->z.HALF.HI - 1;
+ entity->spriteOrientation.flipY = super->spriteOrientation.flipY;
+ entity->collisionLayer = super->collisionLayer;
+ tmp = gUnk_0811C01C[gPlayerState.item->frameIndex];
+ ptr = (gUnk_0811C0B0[(((entity->gustJarFlags & 0x30) / 16))] + (tmp * 2));
+ if (super->spriteSettings.flipX) {
+ entity->x.HALF.HI = -ptr[0] + super->x.HALF_U.HI;
+ } else {
+ entity->x.HALF.HI = super->x.HALF_U.HI + ptr[0];
+ }
+ entity->y.HALF.HI = super->y.HALF.HI + ptr[1];
+ sub_0806FEBC(super, 0, entity);
+ if (entity->parent != NULL) {
+ CopyPosition(entity, entity->parent);
+ }
+}
ASM_FUNC("asm/non_matching/playerUtils/sub_08078D60.inc", void sub_08078D60())
@@ -1655,7 +1681,36 @@ u32 sub_08079FC4(u32 param_1) {
return sub_08079FD4(&gPlayerEntity, param_1);
}
-ASM_FUNC("asm/non_matching/playerUtils/sub_08079FD4.inc", u32 sub_08079FD4(Entity* a, u32 b))
+u32 sub_08079FD4(Entity* this, u32 param_2) {
+ u32 tilePosition;
+ u8* collisionData;
+ u32 collision;
+ u32 index;
+ u8 auStack20[4];
+
+ tilePosition = COORD_TO_TILE(this) * 2;
+ collisionData = gMapBottom.collisionData;
+ if (param_2 == 2) {
+ collisionData = gMapTop.collisionData;
+ }
+ index = 0;
+ while (TRUE) {
+ do {
+ index++;
+ tilePosition = sub_08004202(this, auStack20, tilePosition);
+ collision = collisionData[tilePosition / 2];
+ if (collision < 0xf) {
+ return index;
+ }
+ } while (collision < 0x10);
+ if (collision == 0x1d)
+ break;
+ if (((collision != 0x23) && (collision != 0x27)) && (gUnk_080082DC[collision - 0x10] == 0)) {
+ return index;
+ }
+ }
+ return index;
+}
void sub_0807A050(void) {
u32 palette;
diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c
index 37027b06..52c8cada 100644
--- a/src/projectile/guardLineOfSight.c
+++ b/src/projectile/guardLineOfSight.c
@@ -7,7 +7,6 @@
#include "collision.h"
extern u32 sub_080644C8(Entity*);
-extern u8 gUnk_02027EB4[];
extern const u8 gUnk_081299C8[];
@@ -63,7 +62,7 @@ void GuardLineOfSight(Entity* this) {
DeleteThisEntity();
}
LinearMoveUpdate(this);
- if (IsTileCollision(gUnk_02027EB4, this->x.HALF.HI, this->y.HALF.HI, 2)) {
+ if (IsTileCollision(gMapBottom.collisionData, this->x.HALF.HI, this->y.HALF.HI, 2)) {
DeleteThisEntity();
}
}
diff --git a/src/scroll.c b/src/scroll.c
index 4a3c4742..7a4abdc0 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -13,8 +13,8 @@
extern void sub_08080BC4(void);
extern void sub_080197D4(const void*);
-extern void sub_0807C8B0(u8*, u32, u32);
-extern void sub_0801AB08(u8*, u8*);
+extern void sub_0807C8B0(u16*, u32, u32);
+extern void sub_0801AB08(u8*, LayerStruct*);
extern void sub_0807C810();
extern void DeleteSleepingEntities(void);
extern void sub_0807BBE4();
@@ -24,10 +24,8 @@ extern void sub_0805E248();
extern u8 gUpdateVisibleTiles;
extern u16 gUnk_0200B640;
extern u32** gUnk_08109194[];
-extern u8 gMapDataTop[];
-extern u8 gMapDataBottom[];
extern u8 gUnk_02022830[];
-extern u8 gUnk_020246B0[];
+extern u16 gUnk_020246B0[];
void sub_0807FC64(RoomControls*);
void sub_0807FC7C(RoomControls*);
@@ -51,7 +49,7 @@ u32 sub_080803D0();
u32 sub_08080278();
void sub_08080C80(u32*);
void sub_08080368();
-void sub_08080B60(u8*);
+void sub_08080B60(LayerStruct*);
bool32 sub_08080794(const Transition* transition, u32 param_2, u32 param_3, u32 param_4);
bool32 sub_08080808(const Transition* transition, u32 param_2, u32 param_3, u32 param_4);
void sub_080808D8(s32);
@@ -61,6 +59,8 @@ void sub_08080910(s32);
extern u8 gMapDataTopSpecial[];
+extern const s8 gUnk_080169A4[];
+
void UpdateScroll(void) {
static void (*const gUnk_0811E768[])(RoomControls*) = {
sub_0807FC64, sub_0807FC7C, sub_0807FDB0, NULL, sub_0807FEF0, sub_0807FF54,
@@ -214,8 +214,8 @@ void sub_0807FFE4(RoomControls* controls) {
controls->filler2[0] = sub_080803D0() + 6;
gUnk_0200B640 = sub_08080278();
sub_080197D4(*gUnk_08109194[gDiggingCaveEntranceTransition.entrance->type]);
- sub_0807C8B0(gMapDataTop, controls->width >> 4, controls->height >> 4);
- sub_0801AB08(gMapDataTopSpecial, gMapDataTop - 4);
+ sub_0807C8B0(gMapTop.mapData, controls->width >> 4, controls->height >> 4);
+ sub_0801AB08(gMapDataTopSpecial, &gMapTop);
}
void sub_08080040(RoomControls* controls) {
@@ -262,18 +262,18 @@ void sub_08080040(RoomControls* controls) {
void sub_08080108(RoomControls* controls) {
controls->unk4 = 4;
- MemCopy(gMapDataBottom, gMapDataBottom + 0x3000, 0x2000);
- MemCopy(gMapDataTop, gMapDataTop + 0x3000, 0x2000);
+ MemCopy(gMapBottom.mapData, gMapBottom.mapDataClone, sizeof(gMapBottom.mapData));
+ MemCopy(gMapTop.mapData, gMapTop.mapDataClone, sizeof(gMapTop.mapData));
sub_08080368();
gUnk_02034480.unk_00 = gUnk_0200B640;
MemCopy(gUnk_02022830, gUnk_020246B0, 0x1800);
- sub_08080B60(gMapDataBottom - 4);
- sub_08080B60(gMapDataTop - 4);
+ sub_08080B60(&gMapBottom);
+ sub_08080B60(&gMapTop);
sub_0807BBE4();
sub_0807BC84();
sub_0805E248();
- sub_0801AB08((u8*)&gMapDataBottomSpecial, gMapDataBottom - 4);
- sub_0801AB08(gMapDataTopSpecial, gMapDataTop - 4);
+ sub_0801AB08((u8*)&gMapDataBottomSpecial, &gMapBottom);
+ sub_0801AB08(gMapDataTopSpecial, &gMapTop);
}
void sub_08080198(RoomControls* controls) {
@@ -332,7 +332,26 @@ void sub_080801BC(RoomControls* controls) {
ASM_FUNC("asm/non_matching/scroll/sub_08080278.inc", u32 sub_08080278())
-ASM_FUNC("asm/non_matching/scroll/sub_08080368.inc", void sub_08080368())
+void sub_08080368(void) {
+ u32 tmp;
+ u32 index;
+ u16* ptr;
+
+ if ((gDiggingCaveEntranceTransition.previousArea != gRoomControls.area) &&
+ (gDiggingCaveEntranceTransition.previousArea != 0xff)) {
+ gUnk_02034480.unk_00 = 0;
+ } else {
+ ptr = gUnk_020246B0;
+ tmp = gUnk_02034480.unk_00 << 1;
+ index = 0;
+ while (index < tmp) {
+ sub_0807B9B8(ptr[1], ptr[0] & 0xfff, (ptr[0] >> 0xe));
+ ptr += 2;
+ index += 2;
+ }
+ gUpdateVisibleTiles = 0;
+ }
+}
ASM_FUNC("asm/non_matching/scroll/sub_080803D0.inc", u32 sub_080803D0())
@@ -614,14 +633,46 @@ void sub_080809D4(void) {
ASM_FUNC("asm/non_matching/scroll/UpdateDoorTransition.inc", void UpdateDoorTransition())
-ASM_FUNC("asm/non_matching/scroll/sub_08080B60.inc", void sub_08080B60(u8* param_1))
-
-ASM_FUNC("asm/non_matching/scroll/sub_08080BC4.inc", void sub_08080BC4())
+ASM_FUNC("asm/non_matching/scroll/sub_08080B60.inc", void sub_08080B60(LayerStruct* param_1))
+
+void sub_08080BC4(void) {
+ const s8* ptr;
+ s32 tmpX;
+ s32 tmpY;
+
+ tmpX = (gRoomControls.scroll_x - gRoomControls.origin_x) & 0xf;
+ tmpY = ((gRoomControls.scroll_y - gRoomControls.origin_y) & 0xf) + 8;
+ if (gRoomControls.shake_duration != 0) {
+ gRoomControls.shake_duration--;
+ ptr = &gUnk_080169A4[gRoomControls.shake_magnitude * 0x10 + (gRoomControls.shake_duration & 0xe)];
+ if (gMapBottom.bgSettings != NULL) {
+ gMapBottom.bgSettings->xOffset = ptr[0] + tmpX;
+ gMapBottom.bgSettings->yOffset = ptr[1] + tmpY;
+ }
+ if (gMapTop.bgSettings != NULL) {
+ gMapTop.bgSettings->xOffset = ptr[0] + tmpX;
+ gMapTop.bgSettings->yOffset = ptr[1] + tmpY;
+ }
+ gRoomControls.aff_x = ptr[0];
+ gRoomControls.aff_y = ptr[1];
+ } else {
+ if (gMapBottom.bgSettings != NULL) {
+ gMapBottom.bgSettings->xOffset = tmpX;
+ gMapBottom.bgSettings->yOffset = tmpY;
+ }
+ if (gMapTop.bgSettings != NULL) {
+ gMapTop.bgSettings->xOffset = tmpX;
+ gMapTop.bgSettings->yOffset = tmpY;
+ }
+ gRoomControls.aff_x = 0;
+ gRoomControls.aff_y = 0;
+ }
+}
void sub_08080C80(u32* param_1) {
sub_080197D4(param_1);
- sub_0807C8B0(gMapDataBottom, gRoomControls.width >> 4, gRoomControls.height >> 4);
- sub_0807C8B0(gMapDataTop, gRoomControls.width >> 4, gRoomControls.height >> 4);
+ sub_0807C8B0(gMapBottom.mapData, gRoomControls.width >> 4, gRoomControls.height >> 4);
+ sub_0807C8B0(gMapTop.mapData, gRoomControls.width >> 4, gRoomControls.height >> 4);
}
ASM_FUNC("asm/non_matching/scroll/sub_08080CB4.inc", void sub_08080CB4(Entity* a))