Merge branch 'master' into stuff

This commit is contained in:
Kermalis 2025-03-10 00:26:55 -04:00
commit 6e102abc92
54 changed files with 1800 additions and 4022 deletions

View File

@ -142,7 +142,7 @@ _08009B6E:
adds r4, r1, 0
b _08009B82
.align 2, 0
_08009B74: .4byte gUnknown_202B038
_08009B74: .4byte gBgTilemaps
_08009B78: .4byte gUnknown_202D2A0
_08009B7C: .4byte 0x000003ff
_08009B80:
@ -264,6 +264,6 @@ _08009C36:
bx r0
.align 2, 0
_08009C54: .4byte gUnknown_202D2A0
_08009C58: .4byte gUnknown_202B038
_08009C58: .4byte gBgTilemaps
thumb_func_end sub_8009BE4

View File

@ -428,7 +428,7 @@ _0800E030:
bl sub_8000728
cmp r0, 0x1
bne _0800E058
bl sub_8040238
bl LoadDungeonMapPalette
movs r0, 0
movs r1, 0
bl sub_803EAF0

View File

@ -1,254 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_803E250
sub_803E250:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
ldr r1, _0803E3FC
ldr r0, _0803E400
str r0, [r1]
ldr r0, _0803E404
movs r1, 0
str r1, [r0]
ldr r0, _0803E408
strb r1, [r0]
ldr r0, _0803E40C
strh r1, [r0]
ldr r5, _0803E410
ldrh r0, [r5, 0x6]
movs r3, 0xF
adds r2, r3, 0
ands r2, r0
ldrh r4, [r5]
ldr r1, _0803E414
adds r0, r1, 0
ands r0, r4
ldr r4, _0803E418
ands r0, r4
ldr r6, _0803E41C
ands r0, r6
ldr r7, _0803E420
ands r0, r7
ldr r4, _0803E424
mov r12, r4
ands r0, r4
ldr r4, _0803E428
ands r0, r4
strh r0, [r5]
movs r0, 0x80
lsls r0, 7
strh r0, [r5, 0x2]
movs r0, 0
strh r0, [r5, 0x4]
ldr r0, _0803E42C
mov r10, r0
ands r2, r0
subs r0, 0x1
mov r9, r0
ands r2, r0
subs r0, 0x2
mov r8, r0
ands r2, r0
strh r2, [r5, 0x6]
ldr r2, _0803E430
ldrh r0, [r2, 0x6]
ands r3, r0
ldrh r0, [r2]
ands r1, r0
ldr r0, _0803E418
ands r1, r0
ands r1, r6
ands r1, r7
mov r7, r12
ands r1, r7
ands r1, r4
strh r1, [r2]
movs r0, 0
strh r0, [r2, 0x2]
movs r0, 0xB8
lsls r0, 7
strh r0, [r2, 0x4]
mov r0, r10
ands r3, r0
mov r1, r9
ands r3, r1
mov r7, r8
ands r3, r7
strh r3, [r2, 0x6]
movs r0, 0
mov r8, r0
_0803E2EE:
movs r1, 0
mov r9, r1
mov r2, r8
lsls r0, r2, 3
lsls r2, 1
mov r12, r2
mov r3, r8
adds r3, 0x1
str r3, [sp]
mov r10, r1
add r0, r8
lsls r5, r0, 3
ldr r4, _0803E434
adds r4, r5, r4
str r4, [sp, 0x4]
ldr r7, _0803E438
adds r6, r5, r7
ldr r0, _0803E43C
adds r3, r5, r0
ldr r1, _0803E440
adds r4, r5, r1
_0803E318:
mov r7, r10
adds r2, r5, r7
ldrh r1, [r3]
ldr r0, _0803E414
ands r0, r1
ldr r1, _0803E418
ands r0, r1
ldr r1, _0803E41C
ands r0, r1
ldr r1, _0803E420
ands r0, r1
ldr r1, _0803E424
ands r0, r1
strh r0, [r3]
ldr r1, [r4]
movs r7, 0x3
ands r1, r7
lsls r1, 14
ldr r7, _0803E428
ands r0, r7
orrs r0, r1
strh r0, [r3]
ldrh r1, [r3, 0x2]
ldr r0, _0803E444
ands r0, r1
strh r0, [r3, 0x2]
ldr r1, _0803E440
adds r1, 0x4
adds r2, r1
ldr r1, [r2]
movs r2, 0x3
ands r1, r2
lsls r1, 14
ands r0, r7
orrs r0, r1
strh r0, [r3, 0x2]
ldr r1, [r6]
ldr r0, _0803E448
ands r1, r0
ldrh r2, [r3, 0x4]
movs r0, 0xFC
lsls r0, 8
ands r0, r2
orrs r0, r1
ldr r7, _0803E41C
ands r0, r7
movs r1, 0xC0
lsls r1, 4
orrs r0, r1
movs r2, 0
orrs r0, r2
ldr r1, _0803E44C
ands r0, r1
strh r0, [r3, 0x4]
ldrh r1, [r3, 0x6]
ldr r0, _0803E42C
ands r0, r1
ldr r1, _0803E450
ands r0, r1
strh r0, [r3, 0x6]
mov r7, r9
lsls r1, r7, 2
mov r0, r12
add r0, r8
lsls r0, 3
adds r1, r0
ldr r0, _0803E454
adds r1, r0, r1
ldr r0, [r1]
ldr r1, [sp, 0x4]
str r0, [r1]
adds r1, 0xC
str r1, [sp, 0x4]
adds r6, 0xC
adds r3, 0xC
adds r4, 0xC
movs r2, 0xC
add r10, r2
movs r7, 0x1
add r9, r7
mov r0, r9
cmp r0, 0x5
ble _0803E318
ldr r1, [sp]
mov r8, r1
cmp r1, 0x1
ble _0803E2EE
movs r2, 0
ldr r3, _0803E458
ldr r0, [r3]
ldr r4, _0803E45C
adds r0, r4
movs r1, 0x1
strb r1, [r0]
ldr r0, [r3]
ldr r7, _0803E460
adds r0, r7
strb r1, [r0]
ldr r0, _0803E464
str r2, [r0]
movs r0, 0xF8
ldr r1, _0803E468
movs r3, 0
bl SetBGPaletteBufferColorRGB
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0803E3FC: .4byte gUnknown_202EDD0
_0803E400: .4byte 0x000003e7
_0803E404: .4byte gUnknown_202EDD4
_0803E408: .4byte gUnknown_203B40D
_0803E40C: .4byte gUnknown_202EDE8
_0803E410: .4byte gUnknown_202EDC0
_0803E414: .4byte 0x0000feff
_0803E418: .4byte 0x0000fdff
_0803E41C: .4byte 0x0000f3ff
_0803E420: .4byte 0x0000efff
_0803E424: .4byte 0x0000dfff
_0803E428: .4byte 0x00003fff
_0803E42C: .4byte 0x0000fffe
_0803E430: .4byte gUnknown_202EDB8
_0803E434: .4byte gUnknown_202ED30
_0803E438: .4byte gUnknown_80F6224
_0803E43C: .4byte gUnknown_202ED28
_0803E440: .4byte gUnknown_80F621C
_0803E444: .4byte 0x0000c1ff
_0803E448: .4byte 0x000003ff
_0803E44C: .4byte 0x00000fff
_0803E450: .4byte 0x0000fffd
_0803E454: .4byte gUnknown_80F61EC
_0803E458: .4byte gDungeon
_0803E45C: .4byte 0x00018217
_0803E460: .4byte 0x00018218
_0803E464: .4byte gDungeonBrightness
_0803E468: .4byte gFontPalette + 0x20
thumb_func_end sub_803E250

File diff suppressed because it is too large Load Diff

View File

@ -1,162 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_804225C
sub_804225C:
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x4
mov r8, r0
adds r5, r1, 0
lsls r2, 24
lsrs r4, r2, 24
adds r7, r4, 0
cmp r4, 0x11
bne _08042274
b _08042384
_08042274:
adds r0, r5, 0
bl sub_803F428
lsls r0, 24
cmp r0, 0
bne _08042282
b _08042384
_08042282:
adds r0, r4, 0
bl sub_800EF28
bl sub_800EF64
movs r0, 0x4
movs r1, 0x42
bl sub_803E708
movs r0, 0
ldrsh r1, [r5, r0]
lsls r0, r1, 1
adds r0, r1
lsls r0, 11
movs r1, 0xC0
lsls r1, 4
adds r0, r1
cmp r0, 0
bge _080422AA
adds r0, 0xFF
_080422AA:
lsls r0, 8
lsrs r0, 16
ldr r1, _080422FC
ldr r2, [sp]
ands r2, r1
orrs r2, r0
str r2, [sp]
movs r0, 0x2
ldrsh r1, [r5, r0]
lsls r0, r1, 1
adds r0, r1
lsls r0, 11
movs r1, 0x80
lsls r1, 5
adds r0, r1
cmp r0, 0
bge _080422CE
adds r0, 0xFF
_080422CE:
lsls r0, 8
lsrs r0, 16
lsls r0, 16
ldr r1, _08042300
ands r2, r1
orrs r2, r0
str r2, [sp]
adds r0, r4, 0
mov r1, sp
bl sub_800E448
adds r6, r0, 0
cmp r4, 0x4
bne _08042308
ldr r1, _08042304
movs r0, 0
bl sub_80421C0
movs r0, 0x28
movs r1, 0x33
bl sub_803E708
b _08042360
.align 2, 0
_080422FC: .4byte 0xffff0000
_08042300: .4byte 0x0000ffff
_08042304: .4byte 0x00000193
_08042308:
cmp r7, 0x8
bne _08042358
mov r0, r8
ldr r7, [r0, 0x70]
adds r0, r7, 0
adds r0, 0x46
ldrb r4, [r0]
movs r5, 0
b _0804231C
_0804231A:
adds r5, 0x2
_0804231C:
ldr r0, _08042354
cmp r5, r0
bgt _08042346
subs r4, 0x1
movs r0, 0x7
ands r4, r0
mov r0, r8
movs r1, 0
adds r2, r4, 0
bl sub_806CDD4
movs r0, 0x2
movs r1, 0x33
bl sub_803E708
adds r0, r6, 0
bl sub_800E9A8
lsls r0, 24
cmp r0, 0
bne _0804231A
_08042346:
movs r0, 0x7
ands r4, r0
adds r0, r7, 0
adds r0, 0x46
strb r4, [r0]
b _08042360
.align 2, 0
_08042354: .4byte 0x000003e7
_08042358:
movs r0, 0x28
movs r1, 0x33
bl sub_803E708
_08042360:
movs r5, 0
ldr r4, _08042368
b _0804236E
.align 2, 0
_08042368: .4byte 0x000003e7
_0804236C:
adds r5, 0x1
_0804236E:
cmp r5, r4
bgt _08042384
movs r0, 0x42
bl sub_803E46C
adds r0, r6, 0
bl sub_800E9A8
lsls r0, 24
cmp r0, 0
bne _0804236C
_08042384:
add sp, 0x4
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_804225C
.align 2,0

View File

@ -1108,7 +1108,7 @@ _08046644:
mov r4, sp
movs r2, 0x2
ldrsh r1, [r4, r2]
bl sub_80402AC
bl ShowDungeonMapAtPos
mov r0, sp
movs r3, 0
ldrsh r0, [r0, r3]

View File

@ -6426,7 +6426,7 @@ _08064D36:
bne _08064D4C
b _08064C14
_08064D4C:
bl sub_8040A84
bl ShowWholeRevealedDungeonMap
movs r0, 0
movs r1, 0
bl sub_803EAF0
@ -6828,7 +6828,7 @@ _08065062:
ldr r0, [r0]
str r0, [r1]
bl sub_803E13C
bl sub_8040238
bl LoadDungeonMapPalette
_08065088:
pop {r4}
pop {r0}

View File

@ -917,7 +917,7 @@ _08069018:
ldrsh r0, [r2, r3]
movs r3, 0x6
ldrsh r1, [r2, r3]
bl sub_80402AC
bl ShowDungeonMapAtPos
movs r5, 0
adds r6, r7, 0
adds r6, 0xC8

View File

@ -5,116 +5,6 @@
.text
@ https://decomp.me/scratch/lb4jF (kermalis 87.53%) `bool8 sub_8085B80(struct_8085B80 *)`
thumb_func_start sub_8085B80
sub_8085B80:
push {r4-r7,lr}
mov r7, r8
push {r7}
adds r1, r0, 0
movs r0, 0
mov r8, r0
movs r7, 0
ldr r0, _08085BE4
ldr r0, [r0]
cmp r8, r0
bge _08085C3E
adds r5, r1, 0
_08085B98:
ldr r6, [r5, 0x4]
ldr r2, [r6, 0x70]
adds r3, r2, 0
ldr r4, [r5, 0xC]
ldrb r0, [r5]
cmp r0, 0
beq _08085C32
movs r1, 0x1
mov r8, r1
ldr r0, [r5, 0x8]
cmp r0, 0
bne _08085C08
adds r4, 0x8
movs r1, 0x4
ldrsh r0, [r4, r1]
cmp r0, 0
bne _08085BE8
strb r0, [r5]
ldrb r1, [r4]
movs r0, 0x7
ands r0, r1
adds r1, r2, 0
adds r1, 0x46
strb r0, [r1]
movs r3, 0
ldrsh r2, [r4, r3]
adds r0, r6, 0
movs r1, 0x7
bl sub_806CDD4
movs r0, 0xA
ldrsh r1, [r4, r0]
movs r3, 0xC
ldrsh r2, [r4, r3]
adds r0, r6, 0
bl sub_80856C8
b _08085C32
.align 2, 0
_08085BE4: .4byte gUnknown_202F3D8
_08085BE8:
movs r1, 0x4
ldrsh r0, [r4, r1]
str r0, [r5, 0x8]
str r4, [r5, 0xC]
ldrb r1, [r4]
movs r0, 0x7
ands r0, r1
adds r1, r3, 0
adds r1, 0x46
strb r0, [r1]
movs r3, 0
ldrsh r2, [r4, r3]
adds r0, r6, 0
movs r1, 0
bl sub_806CDD4
_08085C08:
ldr r0, [r5, 0x8]
subs r0, 0x1
str r0, [r5, 0x8]
ldr r1, _08085C4C
movs r2, 0
ldrsh r0, [r4, r2]
lsls r0, 2
adds r0, r1
movs r3, 0
ldrsh r1, [r0, r3]
movs r3, 0x2
ldrsh r2, [r4, r3]
muls r1, r2
lsls r1, 8
movs r3, 0x2
ldrsh r0, [r0, r3]
muls r2, r0
lsls r2, 8
adds r0, r6, 0
bl IncreaseEntityPixelPos
_08085C32:
adds r5, 0x10
adds r7, 0x1
ldr r0, _08085C50
ldr r0, [r0]
cmp r7, r0
blt _08085B98
_08085C3E:
mov r0, r8
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.align 2, 0
_08085C4C: .4byte gAdjacentTileOffsets
_08085C50: .4byte gUnknown_202F3D8
thumb_func_end sub_8085B80
thumb_func_start SetDungeonBGColorRGB
SetDungeonBGColorRGB:
push {r4-r7,lr}

View File

@ -107,7 +107,7 @@ _080A2BFC: .4byte 0x0000052c
_080A2C00: .4byte 0x00000534
_080A2C04: .4byte 0x00000554
_080A2C08: .4byte 0x00000536
_080A2C0C: .4byte gUnknown_202B038
_080A2C0C: .4byte gBgTilemaps
_080A2C10: .4byte 0x0000053c
_080A2C14: .4byte 0x0000054c
_080A2C18: .4byte 0x0000053a

View File

@ -2,76 +2,6 @@
.section .rodata
#.incbin "baserom.gba", 0xF59C4, 0x4
.string "pksdir0\0"
.global gUnknown_80F6490
gUnknown_80F6490: @ 80F6490
@ replacing .incbin "baserom.gba", 0x000f6490, 0x24
.byte 0x00, 0x00, 0x00, 0x0
.byte 0x0f, 0x00, 0x00, 0x00
.byte 0xff, 0x00, 0x00, 0x00
.byte 0xff, 0x0f, 0x00, 0x00
.byte 0xff, 0xff, 0x00, 0x00
.byte 0xff, 0xff, 0x0f, 0x00
.byte 0xff, 0xff, 0xff, 0x00
.byte 0xff, 0xff, 0xff, 0x0f
.byte 0xff, 0xff, 0xff, 0xff
.global gUnknown_80F64B4
gUnknown_80F64B4: @ 80F64B4
@ replacing .incbin "baserom.gba", 0x000f64b4, 0x24
.byte 0x5a, 0x00, 0x00, 0x00
.byte 0x50, 0x00, 0x00, 0x00
.byte 0x46, 0x00, 0x00, 0x00
.byte 0x3c, 0x00, 0x00, 0x00
.byte 0x32, 0x00, 0x00, 0x00
.byte 0x28, 0x00, 0x00, 0x00
.byte 0x1e, 0x00, 0x00, 0x00
.byte 0x14, 0x00, 0x00, 0x00
.byte 0x0a, 0x00, 0x00, 0x00
.global gUnknown_80F64D8
gUnknown_80F64D8: @ 80F64D8
@ replacing .incbin "baserom.gba", 0x000f64d8, 0x24
.byte 0x91, 0xf2, 0x90, 0xf2, 0x8f, 0xf2, 0x8e, 0xf2, 0x8d, 0xf2, 0x8c, 0xf2, 0x8b, 0xf2, 0x8a, 0xf2, 0x89, 0xf2, 0xc8, 0xf2, 0xc7, 0xf2, 0xc6, 0xf2, 0xc5, 0xf2, 0xc4, 0xf2, 0xc3, 0xf2, 0xc2, 0xf2
.byte 0xc1, 0xf2, 0xc0, 0xf2
.global gUnknown_80F64FC
gUnknown_80F64FC: @ 80F64FC
@ replacing .incbin "baserom.gba", 0x000f64fc, 0x24
.byte 0x84, 0x03, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0xbc, 0x02, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00
.byte 0x64, 0x00, 0x00, 0x00
.global gUnknown_80F6520
gUnknown_80F6520: @ 80F6520
@ replacing .incbin "baserom.gba", 0x000f6520, 0x24
.byte 0x5a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
.byte 0x0a, 0x00, 0x00, 0x00
.global gUnknown_80F6544
gUnknown_80F6544: @ 80F6544
@ replacing .incbin "baserom.gba", 0x000f6544, 0x24
.byte 0x91, 0xf2, 0x90, 0xf2, 0x8f, 0xf2, 0x8e, 0xf2, 0x8d, 0xf2, 0x8c, 0xf2, 0x8b, 0xf2, 0x8a, 0xf2, 0x89, 0xf2, 0xc8, 0xf2, 0xc7, 0xf2, 0xc6, 0xf2, 0xc5, 0xf2, 0xc4, 0xf2, 0xc3, 0xf2, 0xc2, 0xf2
.byte 0xc1, 0xf2, 0xc0, 0xf2
.global gUnknown_80F6568
gUnknown_80F6568: @ 80F6568
@ replacing .incbin "baserom.gba", 0x000f6568, 0x88
.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff
.byte 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff
.byte 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff
.byte 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff
.byte 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00
.global gUnknown_80F65F0
gUnknown_80F65F0: @ 80F65F0
@ replacing .incbin "baserom.gba", 0x000f65f0, 0x14
.byte 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04
.global gUnknown_80F6604
gUnknown_80F6604: @ 80F6604
@ replacing .incbin "baserom.gba", 0x000f6604, 0x20
.string "zmappat\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"

62
data/data_80F59C8_0.s Normal file
View File

@ -0,0 +1,62 @@
#include "constants/status.h"
.section .rodata
#.incbin "baserom.gba", 0xF59C4, 0x4
.string "pksdir0\0"
.global gUnknown_80F6490
gUnknown_80F6490: @ 80F6490
@ replacing .incbin "baserom.gba", 0x000f6490, 0x24
.byte 0x00, 0x00, 0x00, 0x0
.byte 0x0f, 0x00, 0x00, 0x00
.byte 0xff, 0x00, 0x00, 0x00
.byte 0xff, 0x0f, 0x00, 0x00
.byte 0xff, 0xff, 0x00, 0x00
.byte 0xff, 0xff, 0x0f, 0x00
.byte 0xff, 0xff, 0xff, 0x00
.byte 0xff, 0xff, 0xff, 0x0f
.byte 0xff, 0xff, 0xff, 0xff
.global gUnknown_80F64B4
gUnknown_80F64B4: @ 80F64B4
@ replacing .incbin "baserom.gba", 0x000f64b4, 0x24
.byte 0x5a, 0x00, 0x00, 0x00
.byte 0x50, 0x00, 0x00, 0x00
.byte 0x46, 0x00, 0x00, 0x00
.byte 0x3c, 0x00, 0x00, 0x00
.byte 0x32, 0x00, 0x00, 0x00
.byte 0x28, 0x00, 0x00, 0x00
.byte 0x1e, 0x00, 0x00, 0x00
.byte 0x14, 0x00, 0x00, 0x00
.byte 0x0a, 0x00, 0x00, 0x00
.global gUnknown_80F64D8
gUnknown_80F64D8: @ 80F64D8
@ replacing .incbin "baserom.gba", 0x000f64d8, 0x24
.byte 0x91, 0xf2, 0x90, 0xf2, 0x8f, 0xf2, 0x8e, 0xf2, 0x8d, 0xf2, 0x8c, 0xf2, 0x8b, 0xf2, 0x8a, 0xf2, 0x89, 0xf2, 0xc8, 0xf2, 0xc7, 0xf2, 0xc6, 0xf2, 0xc5, 0xf2, 0xc4, 0xf2, 0xc3, 0xf2, 0xc2, 0xf2
.byte 0xc1, 0xf2, 0xc0, 0xf2
.global gUnknown_80F64FC
gUnknown_80F64FC: @ 80F64FC
@ replacing .incbin "baserom.gba", 0x000f64fc, 0x24
.byte 0x84, 0x03, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0xbc, 0x02, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00
.byte 0x64, 0x00, 0x00, 0x00
.global gUnknown_80F6520
gUnknown_80F6520: @ 80F6520
@ replacing .incbin "baserom.gba", 0x000f6520, 0x24
.byte 0x5a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
.byte 0x0a, 0x00, 0x00, 0x00
.global gUnknown_80F6544
gUnknown_80F6544: @ 80F6544
@ replacing .incbin "baserom.gba", 0x000f6544, 0x24
.byte 0x91, 0xf2, 0x90, 0xf2, 0x8f, 0xf2, 0x8e, 0xf2, 0x8d, 0xf2, 0x8c, 0xf2, 0x8b, 0xf2, 0x8a, 0xf2, 0x89, 0xf2, 0xc8, 0xf2, 0xc7, 0xf2, 0xc6, 0xf2, 0xc5, 0xf2, 0xc4, 0xf2, 0xc3, 0xf2, 0xc2, 0xf2
.byte 0xc1, 0xf2, 0xc0, 0xf2
.global gUnknown_80F6568
gUnknown_80F6568: @ 80F6568
@ replacing .incbin "baserom.gba", 0x000f6568, 0x88
.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff
.byte 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff
.byte 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff
.byte 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff

20
include/dungeon_map.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef GUARD_DUNGEON_MAP_H
#define GUARD_DUNGEON_MAP_H
extern bool8 gShowMonsterDotsInDungeonMap;
extern bool8 gShowDungeonMap;
void SetDungeonMapToNotShown(void);
void OpenDungeonMapFile(void);
void InitDungeonMap(bool8 a0);
void CloseDungeonMapFile(void);
void LoadDungeonMapPalette(void);
void ShowDungeonMapAtPos(s32 x, s32 y);
void CopyDungeonMapToVram(void);
void ShowPlayerDotOnMap(void);
void ResetMapPlayerDotFrames(void);
void ShowWholeRevealedDungeonMap(void);
void UpdateBgTilemapForDungeonMap(bool8 a0);
void TryResetDungeonMapTilesScheduledForCopy(void);
#endif

View File

@ -8,6 +8,10 @@
#include "constants/global.h"
#include "constants/monster.h"
#define VERSION_BLUE 0
#define VERSION_RED 1
#define GAME_VERSION VERSION_RED
// IDE support
#if defined(__APPLE__) || defined(__CYGWIN__)
#define _(x) x

View File

@ -52,6 +52,9 @@ enum SpawnFlags
SPAWN_FLAG_UNK7 = 1 << 7, // 0x80 - Not fully understood field. In the dungeon algorithm, it is set to true for all tiles in a Divider secondary structure room.
};
#define VISIBILITY_FLAG_REVEALED 1 // When using Luminous Orb - whole layout is shown, but grayed-out
#define VISIBILITY_FLAG_VISITED 2 // Tile was visited, show filled/white layout
// size: 0x18
typedef struct Tile
{

View File

@ -1,11 +1,12 @@
#ifndef GUARD_STR_202ED28_H
#define GUARD_STR_202ED28_H
#include "structs/str_position.h"
struct unkStruct_202ED28
{
SpriteOAM sprite;
s16 x;
s16 y;
DungeonPos pos;
};
extern struct unkStruct_202ED28 gUnknown_202ED28[][6];

View File

@ -0,0 +1,18 @@
#ifndef GUARD_STR_202EDE8_H
#define GUARD_STR_202EDE8_H
#include "structs/dungeon_entity.h"
struct UnkStruct_202EDE8
{
s16 unk0;
s16 unk2;
Entity *unk4;
s32 unk8;
s32 unkC;
s32 unk10;
};
extern struct UnkStruct_202EDE8 gUnknown_202EDE8;
#endif

View File

@ -82,16 +82,16 @@ typedef struct UnkDungeonGlobal_unk181E8_sub
u8 priority; // x20
/* 0x18209 */ u8 visibilityRange; // x21 Dungeon light level.
/* 0x1820A */ bool8 blinded; // x22 Blacks out the screen when the player has the Blinker status.
bool8 unk1820B; // x23
bool8 allTilesRevealed; // x23
bool8 unk1820C; // x24
bool8 unk1820D; // x25
bool8 unk1820E; // x26
bool8 unk1820F; // x27
bool8 showAllFloorItems; // x26
bool8 showInvisibleTrapsMonsters; // x27
/* 0x18210 */ bool8 hallucinating; // x28 Displays Substitute and flower sprites when the player has the Cross-Eyed status.
bool8 unk18211; // x29
u8 unk18212; // x2A
bool8 unk18213; // x2B
u8 unk18214; // x2C
bool8 inFloorMapMode; // x2C
u8 unk18215; // x2D
u8 unk18216; // x2E
u8 unk18217; // x2F
@ -332,6 +332,35 @@ typedef struct unkDungeon57C
#define UNK12A18_ARR_COUNT 29
#define UNK12A18_ARR_COUNT_2 9
// Some palette?
struct UnkDungeonGlobal_1822C_Sub
{
u32 arr[8];
};
#define DUNGEON_MAP_MAX_Y (DUNGEON_MAX_SIZE_Y / 2)
#define DUNGEON_MAP_MAX_X (DUNGEON_MAX_SIZE_X / 2)
struct DungeonMapVramCopy
{
u32 *vramPtr;
u32 *mapArrayPtr;
bool8 *boolPtr;
};
#define MAX_SCHEDULED_DUNGEON_MAP_COPIES 40
struct DungeonMap
{
struct UnkDungeonGlobal_1822C_Sub perTile[DUNGEON_MAP_MAX_Y][DUNGEON_MAP_MAX_X];
bool8 tileScheduledForCopy[DUNGEON_MAP_MAX_Y][DUNGEON_MAP_MAX_X];
struct DungeonMapVramCopy vramCopies[MAX_SCHEDULED_DUNGEON_MAP_COPIES];
s32 scheduledVramCopiesCount;
bool8 copyToVram;
bool8 copyAllAtOnce;
bool8 resetTilesScheduledForCopy;
};
// size: 0x1CEDC
typedef struct Dungeon
{
@ -447,8 +476,8 @@ typedef struct Dungeon
/* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX];
/* 0x181E4 */ OpenedFile *paletFile;
/* 0x181E8 */ UnkDungeonGlobal_unk181E8_sub unk181e8;
u8 fill18220[0x1BDD4 - 0x1822C];
struct UnkStructDungeon1BDD4 unk1BDD4;
/* 0x1822C */ struct DungeonMap dungeonMap;
/* 0x1BDD4 */ struct UnkStructDungeon1BDD4 unk1BDD4;
/* 0x1BE14 */ struct MessageLogString messageLogStrings[MESSAGE_LOG_STRINGS_COUNT];
/* 0x1C570 */ DungeonLocation unk1C570;
/* 0x1C574 */ FloorProperties unk1C574;

View File

@ -52,7 +52,13 @@ struct UnkDrawStringStruct
extern UnkTextStruct1 gUnknown_2027370[4];
extern u8 gUnknown_202749A[11];
extern bool8 gUnknown_20274A5;
extern u16 gUnknown_202B038[4][32][32]; // Usage points to these dimensions
// These should probably go to code_8009804.h
#define TILEMAP_TILE_NUM(num)(num & 0x3FF) // bits 0-9
#define TILEMAP_FLIP_HORIZONTAL(f)((f & 1) << 10) // bit 10
#define TILEMAP_FLIP_VERTICAL(f)((f & 1) << 11) // bit 11
#define TILEMAP_PAL(pal)((pal & 0xF) << 12) // bits 12-15
extern u16 gBgTilemaps[4][32][32]; // 4 bgs, 32x32 tiles, y dimension goes before x [bgId][y][x]
extern void (*gIwramTextFunc1)(s32 a0);
extern void (*gIwramTextFunc2)(s32 a0);
extern void (*gIwramTextFunc3)(s32 a0);

View File

@ -194,13 +194,12 @@ SECTIONS {
src/personality_test2.o(.text);
src/code_803D0D8.o(.text);
src/code_803D110.o(.text);
asm/code_803D110.o(.text);
src/code_803E46C.o(.text);
src/code_803E724.o(.text);
src/code_8040094.o(.text);
asm/code_8040094.o(.text);
src/dungeon_map.o(.text);
src/code_8040094_1.o(.text);
src/code_8041AD0.o(.text);
asm/code_8041AD0.o(.text);
src/code_804267C.o(.text);
src/code_8042B34.o(.text);
src/dungeon_engine.o(.text);
@ -535,6 +534,9 @@ SECTIONS {
src/code_803D110.o(.rodata);
data/data_80F59C8_3.o(.rodata);
src/code_803E724.o(.rodata);
data/data_80F59C8_0.o(.rodata);
src/dungeon_map.o(.rodata);
src/code_8040094_1.o(.rodata);
data/data_80F59C8.o(.rodata);
src/dungeon_message.o(.rodata);
src/dungeon_move.o(.rodata);

View File

@ -123,26 +123,26 @@ void sub_8009908(void)
gUnknown_202D23C = 0;
if (gUnknown_202D238[0] != 0) {
gUnknown_202D238[0] = 0;
CpuCopy(BG_SCREEN_ADDR(12), gUnknown_202B038[0], BG_SCREEN_SIZE);
CpuCopy(BG_SCREEN_ADDR(12), gBgTilemaps[0], BG_SCREEN_SIZE);
}
if (gUnknown_202D238[1] != 0) {
gUnknown_202D238[1] = 0;
CpuCopy(BG_SCREEN_ADDR(13), gUnknown_202B038[1], BG_SCREEN_SIZE);
CpuCopy(BG_SCREEN_ADDR(13), gBgTilemaps[1], BG_SCREEN_SIZE);
}
if (gUnknown_202D238[2] != 0) {
gUnknown_202D238[2] = 0;
CpuCopy(BG_SCREEN_ADDR(14), gUnknown_202B038[2], BG_SCREEN_SIZE);
CpuCopy(BG_SCREEN_ADDR(14), gBgTilemaps[2], BG_SCREEN_SIZE);
}
if (gUnknown_202D238[3] != 0) {
gUnknown_202D238[3] = 0;
CpuCopy(BG_SCREEN_ADDR(15), gUnknown_202B038[3], BG_SCREEN_SIZE);
CpuCopy(BG_SCREEN_ADDR(15), gBgTilemaps[3], BG_SCREEN_SIZE);
}
}
void sub_80099C0(void)
{
CpuCopy(BG_SCREEN_ADDR(12), gUnknown_202B038[0], BG_SCREEN_SIZE);
CpuCopy(BG_SCREEN_ADDR(13), gUnknown_202B038[1], BG_SCREEN_SIZE);
CpuCopy(BG_SCREEN_ADDR(12), gBgTilemaps[0], BG_SCREEN_SIZE);
CpuCopy(BG_SCREEN_ADDR(13), gBgTilemaps[1], BG_SCREEN_SIZE);
}
void SetFontsBaseColor(RGB a0)

View File

@ -7,6 +7,7 @@
#include "file_system.h"
#include "main_loops.h"
#include "memory.h"
#include "dungeon_map.h"
EWRAM_INIT struct unkStruct_203B0CC *gUnknown_203B0CC = NULL;
@ -19,7 +20,6 @@ struct unkStruct_800F18C
extern s32 sub_800E2C0(u32);
extern u32 sub_800E900(void);
extern void sub_8009BE4(void);
extern void sub_8040238(void);
extern void sub_800F204(void);
extern void sub_803EAF0(u32, u32);
extern struct unkStruct_800F18C *sub_800F18C(s32);
@ -136,7 +136,7 @@ void sub_800DC14(s32 param_1)
if (preload->unk34 == 4) {
sub_8009BE4();
if (sub_8000728() == 1) {
sub_8040238();
LoadDungeonMapPalette();
sub_803EAF0(0,0);
sub_800CD64(0x8000,0);
}

View File

@ -12,6 +12,8 @@
#include "game_options.h"
#include "text.h"
#include "constants/dungeon.h"
#include "structs/str_202ED28.h"
#include "structs/str_202EDE8.h"
extern void sub_803E13C(void);
extern void sub_80901D8(DungeonLocation *param_1,DungeonLocation *param_2);
@ -662,5 +664,90 @@ void sub_803E214(void)
void nullsub_56(void) {}
// sub_803E250 left, but it seems to be sprite related, and I'd rather not deal with it now lol
extern u8 gUnknown_203B40D;
extern u32 gUnknown_202EDD0;
extern s32 gUnknown_202EDD4;
extern s32 gDungeonBrightness;
extern SpriteOAM gUnknown_202EDC0;
extern SpriteOAM gUnknown_202EDB8;
extern const DungeonPos gUnknown_80F61EC[2][6];
struct Unk80F6224Struct
{
s32 shape;
s32 size;
s32 tileNum;
};
extern const struct Unk80F6224Struct gUnknown_80F621C[2][6];
void sub_803E250(void)
{
s32 i, j;
gUnknown_202EDD0 = 999;
gUnknown_202EDD4 = 0;
gUnknown_203B40D = 0;
gUnknown_202EDE8.unk0 = 0;
SpriteSetY(&gUnknown_202EDC0, 0);
SpriteSetAffine1(&gUnknown_202EDC0, 0);
SpriteSetAffine2(&gUnknown_202EDC0, 0);
SpriteSetObjMode(&gUnknown_202EDC0, 0);
SpriteSetMosaic(&gUnknown_202EDC0, 0);
SpriteSetBpp(&gUnknown_202EDC0, 0);
SpriteSetShape(&gUnknown_202EDC0, 0);
SpriteSetMatrixNum(&gUnknown_202EDC0, 0);
SpriteSetSize(&gUnknown_202EDC0, 1);
SpriteSetX(&gUnknown_202EDC0, 0);
SpriteSetTileNum(&gUnknown_202EDC0, 0);
SpriteSetPriority(&gUnknown_202EDC0, 0);
SpriteSetPalNum(&gUnknown_202EDC0, 0);
SpriteSetUnk6_0(&gUnknown_202EDC0, 0);
SpriteSetUnk6_1(&gUnknown_202EDC0, 0);
SpriteSetUnk6_2(&gUnknown_202EDC0, 0);
SpriteSetY(&gUnknown_202EDB8, 0);
SpriteSetAffine1(&gUnknown_202EDB8, 0);
SpriteSetAffine2(&gUnknown_202EDB8, 0);
SpriteSetObjMode(&gUnknown_202EDB8, 0);
SpriteSetMosaic(&gUnknown_202EDB8, 0);
SpriteSetBpp(&gUnknown_202EDB8, 0);
SpriteSetShape(&gUnknown_202EDB8, 0);
SpriteSetMatrixNum(&gUnknown_202EDB8, 0);
SpriteSetSize(&gUnknown_202EDB8, 0);
SpriteSetX(&gUnknown_202EDB8, 0);
SpriteSetTileNum(&gUnknown_202EDB8, 0);
SpriteSetPriority(&gUnknown_202EDB8, 3);
SpriteSetPalNum(&gUnknown_202EDB8, 5);
SpriteSetUnk6_0(&gUnknown_202EDB8, 0);
SpriteSetUnk6_1(&gUnknown_202EDB8, 0);
SpriteSetUnk6_2(&gUnknown_202EDB8, 0);
for (i = 0; i < 2; i++) {
for (j = 0; j < 6; j++) {
SpriteSetAffine1(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetAffine2(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetObjMode(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetMosaic(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetBpp(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetShape(&gUnknown_202ED28[i][j].sprite, gUnknown_80F621C[i][j].shape);
SpriteSetMatrixNum(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetSize(&gUnknown_202ED28[i][j].sprite, gUnknown_80F621C[i][j].size);
SpriteSetTileNum(&gUnknown_202ED28[i][j].sprite, gUnknown_80F621C[i][j].tileNum);
SpriteSetPriority(&gUnknown_202ED28[i][j].sprite, 3);
SpriteSetPalNum(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetUnk6_0(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetUnk6_1(&gUnknown_202ED28[i][j].sprite, 0);
gUnknown_202ED28[i][j].pos = gUnknown_80F61EC[i][j];
}
}
gDungeon->unk181e8.unk18217 = 1;
gDungeon->unk181e8.unk18218 = 1;
gDungeonBrightness = 0;
SetBGPaletteBufferColorRGB(0xf8, &gFontPalette[8],0,NULL);
}

View File

@ -7,7 +7,7 @@
#include "code_800C9CC.h"
#include "code_80118A4.h"
#include "code_803E668.h"
#include "dungeon_map.h"
#include "bg_palette_buffer.h"
#include "bg_control.h"
#include "dungeon_music.h"
@ -32,13 +32,10 @@ void sub_806CC10();
void sub_804522C();
void sub_803F9CC();
extern void xxx_call_update_bg_vram(void);
void sub_8040894();
void sub_803ECE0();
void sub_803EDF0();
void sub_800E90C();
void sub_8042E5C();
void sub_8040B60();
void sub_8040788();
void sub_800F7D0(DungeonPos *);
void sub_803E874(s32, s32);
void sub_803EAF0(s32, s32);
@ -82,7 +79,7 @@ void sub_803E490(u32 unused)
sub_8042E5C();
if(gUnknown_202EDD0 == 0 || gUnknown_202EDD0 == 3 || gGameOptionsRef->mapOption == TOP_MAP_AND_TEAM_NO_BOTTOM)
sub_8040894();
ShowPlayerDotOnMap();
sub_803ECE0();
sub_803EDF0();
@ -108,13 +105,13 @@ void sub_803E490(u32 unused)
TransferBGPaletteBuffer();
sub_8009908();
xxx_call_update_bg_vram();
sub_8040788();
CopyDungeonMapToVram();
xxx_call_update_bg_sound_input();
gDungeon->unk181e8.unk18213 = 0;
UpdateDungeonMusic();
sub_8011860();
sub_8040B60();
TryResetDungeonMapTilesScheduledForCopy();
ResetSprites(FALSE);
nullsub_10(FALSE);
gUnknown_202EDD4--;

View File

@ -14,6 +14,7 @@
#include "dungeon_map_access.h"
#include "sprite.h"
#include "bg_control.h"
#include "dungeon_map.h"
#include "game_options.h"
#include "code_800558C.h"
#include "dungeon_range.h"
@ -23,6 +24,7 @@
#include "constants/item.h"
#include "constants/status.h"
#include "code_803E724.h"
#include "structs/str_202EDE8.h"
extern s32 gDungeonBrightness;
extern u32 gUnknown_202EDD0;
@ -54,15 +56,14 @@ extern u8 gUnknown_20274A5;
extern s32 gUnknown_202EDCC;
extern void sub_8040A84();
extern void ShowWholeRevealedDungeonMap();
extern void sub_8083D44(void);
extern void sub_8040A84(void);
extern void ShowWholeRevealedDungeonMap(void);
extern void sub_80400D4(void);
extern void sub_8041888(u8 param_1);
extern void sub_80402AC(s32, s32);
extern void ShowDungeonMapAtPos(s32, s32);
void sub_803EC94(void);
void sub_8040ABC(u8 a0);
s32 sub_803EF90(s32 a0, u8 a1);
void sub_803F580(u8 a0);
void sub_803F7BC(void);
@ -279,14 +280,14 @@ void sub_803EAF0(u32 a0, u8 *a1)
sub_803EC94();
ShowWindows(NULL, TRUE, TRUE);
if (gUnknown_203B40C != 0) {
sub_8040A84();
sub_8040ABC(0);
ShowWholeRevealedDungeonMap();
UpdateBgTilemapForDungeonMap(FALSE);
}
break;
case 3:
ShowWindows(&gUnknown_80F62B0, TRUE, TRUE);
if (gUnknown_203B40C != 0) {
sub_8040ABC(1);
UpdateBgTilemapForDungeonMap(TRUE);
}
break;
case 6:
@ -372,18 +373,6 @@ void sub_803ECE0(void)
sub_80098BC((void *)VRAM + 0x14400, gUnknown_202EC94->unk4 + ((gUnknown_202EDD8 / 4) * 0x240), 0x240);
}
struct UnkStruct_202EDE8
{
s16 unk0;
s16 unk2;
Entity *unk4;
s32 unk8;
s32 unkC;
s32 unk10;
};
extern struct UnkStruct_202EDE8 gUnknown_202EDE8;
void sub_803ED30(s32 a0, Entity *mon, u8 a2, s32 a3)
{
s32 i, var;
@ -686,11 +675,11 @@ void sub_803F27C(bool8 a0)
if (!a0) {
strPtr->blinded = 0;
strPtr->hallucinating = 0;
strPtr->unk1820F = 0;
strPtr->showInvisibleTrapsMonsters = 0;
strPtr->unk1820D = FALSE;
strPtr->unk18211 = 0;
strPtr->unk1820E = FALSE;
strPtr->unk1820B = 0;
strPtr->showAllFloorItems = FALSE;
strPtr->allTilesRevealed = 0;
strPtr->unk1820C = 0;
}
@ -700,7 +689,7 @@ void sub_803F27C(bool8 a0)
strPtr->unk18212 = 0;
strPtr->unk1821B = 0;
strPtr->unk1821C = 0;
strPtr->unk18214 = 0;
strPtr->inFloorMapMode = 0;
strPtr->unk18215 = 1;
sub_803F38C();
@ -742,7 +731,7 @@ bool8 sub_803F428(DungeonPos *pos)
Entity *cameraEntity = strPtr->cameraTarget;
if (abs(strPtr->cameraPos.x - pos->x) <= 6 && abs(strPtr->cameraPos.y - pos->y) <= 5) {
if (strPtr->unk1820B == 0 && strPtr->unk1820C == 0 && cameraEntity != NULL) {
if (strPtr->allTilesRevealed == 0 && strPtr->unk1820C == 0 && cameraEntity != NULL) {
return IsPositionActuallyInSight(&strPtr->cameraPos, pos);
}
return TRUE;
@ -795,7 +784,7 @@ void sub_803F508(Entity *a0)
sub_806CD90();
}
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
void sub_803F580(u8 a0)
@ -805,7 +794,7 @@ void sub_803F580(u8 a0)
if (cameraTarget != NULL && EntityIsValid(cameraTarget)) {
s32 i;
u32 before, unk18214;
u32 before, inFloorMapMode;
EntityInfo *info = GetEntInfo(cameraTarget);
strPtr->cameraPixelPosMirror = strPtr->cameraPixelPos;
@ -818,24 +807,24 @@ void sub_803F580(u8 a0)
if (HasHeldItem(cameraTarget, ITEM_X_RAY_SPECS) && info->isTeamLeader) {
strPtr->unk1820D = TRUE;
strPtr->unk1820E = TRUE;
strPtr->showAllFloorItems = TRUE;
}
else {
strPtr->unk1820D = info->powerEars;
strPtr->unk1820E = info->scanning;
strPtr->showAllFloorItems = info->scanning;
}
strPtr->unk18211 = info->stairSpotter;
before = strPtr->blinded;
unk18214 = strPtr->unk18214;
if (unk18214 == 0) {
inFloorMapMode = strPtr->inFloorMapMode;
if (inFloorMapMode == 0) {
u32 unkVar;
if (info->blinkerClassStatus.status == STATUS_BLINKER) {
strPtr->blinded = 1;
unkVar = 0xE;
}
else {
strPtr->blinded = unk18214;
strPtr->blinded = inFloorMapMode;
unkVar = 0;
}
@ -865,17 +854,17 @@ void sub_803F580(u8 a0)
sub_8041888(0);
}
before = strPtr->unk1820F;
before = strPtr->showInvisibleTrapsMonsters;
if (CanSeeInvisibleMonsters(cameraTarget)) {
strPtr->unk1820F = 1;
strPtr->showInvisibleTrapsMonsters = 1;
}
else {
strPtr->unk1820F = 0;
strPtr->showInvisibleTrapsMonsters = 0;
}
if (before != strPtr->unk1820F) {
if (before != strPtr->showInvisibleTrapsMonsters) {
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
sub_8041888(0);
}
@ -905,7 +894,7 @@ void sub_803F580(u8 a0)
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon)) {
sub_80402AC(mon->pos.x, mon->pos.y);
ShowDungeonMapAtPos(mon->pos.x, mon->pos.y);
}
}
}
@ -921,7 +910,7 @@ void sub_803F7BC(void)
const Tile *tile = GetTile(strPtr->cameraPos.x, strPtr->cameraPos.y);
u32 roomId = tile->room;
if (strPtr->unk1820B != 0 || strPtr->unk1820C != 0 || strPtr->unk18217 != 0) {
if (strPtr->allTilesRevealed != 0 || strPtr->unk1820C != 0 || strPtr->unk18217 != 0) {
sub_8005838(NULL, 0);
}
else if (roomId == CORRIDOR_ROOM) {
@ -951,7 +940,7 @@ void sub_803F878(s32 a0, s32 a1)
strPtr->cameraPos.x = a0 / 6144;
strPtr->cameraPos.y = a1 / 6144;
strPtr->unk1820D = FALSE;
strPtr->unk1820E = FALSE;
strPtr->showAllFloorItems = FALSE;
strPtr->unk18211 = 0;
strPtr->unk18216 = 0;
@ -1010,7 +999,7 @@ void sub_803F9CC(void)
if (!r5) {
for (i = 1; i < 30; i++) {
gUnknown_202B038[0][0][i] = 0;
gBgTilemaps[0][0][i] = 0;
}
sub_803F38C();
}
@ -1151,7 +1140,7 @@ void sub_803FB74(void)
nullsub_5(0xFF, &gFontPalette[15 + r6]);
}
arrPtr = gUnknown_202B038[0][0];
arrPtr = gBgTilemaps[0][0];
unkFloor = gDungeon->unk14 + gDungeon->unk644.dungeonLocation.floor;
if (strPtr->unk3A != unkFloor) {
strPtr->unk3A = unkFloor;
@ -1203,7 +1192,7 @@ void sub_803FB74(void)
}
for (i = 0; i < 12; i++) {
gUnknown_202B038[0][0][18 + i] = (0x2CC + i) | 0xF000;
gBgTilemaps[0][0][18 + i] = (0x2CC + i) | 0xF000;
}
}

View File

@ -11,15 +11,13 @@
#include "play_time.h"
extern s32 gUnknown_80F6568[];
extern u8 gUnknown_202EE01;
extern const char gUnknown_80F6604; // "zmappat"
extern struct FileArchive gDungeonFileArchive;
extern OpenedFile *gUnknown_202EE04;
extern void sub_803F7BC(void);
extern void sub_803F580(u32);
extern void sub_8040A84();
extern void ShowWholeRevealedDungeonMap();
extern const char *gUnknown_80FD040; // It became brighter on the floor
@ -29,19 +27,19 @@ void HandleLuminousOrbAction(Entity *pokemon)
int XCoord;
int YCoord;
gDungeon->unk181e8.unk1820B = 1;
gDungeon->unk181e8.allTilesRevealed = TRUE;
for(YCoord = 0; YCoord < DUNGEON_MAX_SIZE_Y; YCoord++)
{
for(XCoord = 0; XCoord < DUNGEON_MAX_SIZE_X; XCoord++)
{
Tile *mapTile = GetTileMut(XCoord, YCoord);
mapTile->spawnOrVisibilityFlags |= 1;
mapTile->spawnOrVisibilityFlags |= VISIBILITY_FLAG_REVEALED;
}
}
sub_803F580(0);
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD040);
}
@ -71,13 +69,3 @@ void sub_80400D4(void)
if(gDungeon->unk181e8.unk18200 == 0)
gDungeon->unk181e8.unk18200 = gDungeon->unk181e8.unk18204;
}
void sub_8040124(void)
{
gUnknown_202EE01 = 0;
}
void sub_8040130(void)
{
gUnknown_202EE04 = OpenFileAndGetFileDataPtr(&gUnknown_80F6604, &gDungeonFileArchive);
}

485
src/code_8040094_1.c Normal file
View File

@ -0,0 +1,485 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_message.h"
#include "dungeon_random.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "dungeon_music.h"
#include "dungeon.h"
#include "code_8009804.h"
#include "code_800E9E4.h"
#include "dungeon_util.h"
#include "code_804267C.h"
#include "weather.h"
#include "tile_types.h"
#include "constants/move_id.h"
#include "constants/weather.h"
#include "constants/type.h"
struct UnkStruct_8040094
{
u16 unk0;
u16 unk2;
DungeonPos unk4;
DungeonPos unk8;
s32 unkC;
s32 unk10;
};
extern u8 sub_800EC94(s32 param_1);
extern s32 sub_800E710(s32 a0, u16 a1);
extern void sub_800569C(DungeonPos *, axdata *, u8);
extern void sub_800EEC8(u16 r0);
extern void sub_800EF64(void);
extern void sub_8042DD4(s32 a0, Entity *a1, s32 a2);
extern void sub_803E46C(u32);
extern u8 sub_800EA44(s32 species, u16 a2);
extern s32 sub_800E790(s32 species, u16 a2);
extern void sub_806CDD4(Entity *entity, u8, u32 direction);
extern s32 sub_800E52C(struct UnkStruct_8040094 *a0);
extern s32 sub_800EA84(struct UnkStruct_8040094 *a0);
extern bool8 sub_800E838(struct UnkStruct_8040094 *a0, s32 a1);
extern bool8 sub_800E9A8(s32 a0);
extern void sub_803EA10(void);
extern void sub_803E708(s32, u32);
extern void sub_800EEF8(u16 a0);
extern bool8 sub_803F428(DungeonPos *pos);
extern void sub_800EEE0(u16 a0);
extern s32 sub_800EBC8(struct UnkStruct_8040094 *a0);
extern bool8 sub_800E7D0(struct UnkStruct_8040094 *a0);
extern s32 sub_800ED20(u16 param_1);
extern u8 sub_800EC84(s32 param_1);
extern bool8 MoveMatchesBideClassStatus(Entity *pokemon, Move *move);
extern bool8 IsSleeping(Entity *pokemon);
extern void sub_80421C0(Entity *pokemon, u16);
extern u8 gUnknown_203B40D;
extern s16 gUnknown_2026E4E;
extern s32 gDungeonBrightness;
extern s32 gUnknown_202F224;
extern const u8 *const gPtrMagnitudeMessage;
extern const s32 gUnknown_8106A8C[];
u16 sub_80412E0(u16 moveId, u8 weather, bool32 a2);
static bool32 sub_804143C(Entity *entity, Move *move);
static bool8 sub_80414C0(Entity *entity, Move *move);
static bool8 sub_804141C(u16 moveId, u8 weather, bool32 a2);
static void sub_8040C4C(Entity *entity, Move *move, bool32 a2);
static void sub_8041038(struct UnkStruct_8040094 *a0, Entity *entity, Move *move, bool32 a2);
static void sub_8041108(struct UnkStruct_8040094 *a0, Entity *entity, Move *move, bool32 a2);
static void sub_8041500(struct UnkStruct_8040094 *a0);
bool8 sub_8040BB0(Entity *entity, Move *move, bool8 a2)
{
bool32 r8 = sub_804143C(entity, move);
bool8 r9 = sub_804141C(move->id, GetApparentWeather(entity), r8);
s32 r4 = sub_800ECB8(sub_80412E0(move->id, GetApparentWeather(entity), r8))->unk0;
if (!sub_8042768(entity))
return r9;
if (sub_80414C0(entity, move))
return r9;
if (!a2)
return r9;
if (r4 != 0) {
sub_8040C4C(entity, move, r8);
}
return r9;
}
static void sub_8040C4C(Entity *entity, Move *move, bool32 a2)
{
u8 savedUnkVar;
s32 r4;
struct UnkStruct_8040094 sp;
u16 r9 = sub_80412E0(move->id, GetApparentWeather(entity), a2);
EntityInfo *entInfo = GetEntInfo(entity);
bool8 r8 = sub_800EC94(move->id);
s32 apparentId = entInfo->apparentID;
s32 r2 = sub_800E710(apparentId, sub_80412E0(move->id, GetApparentWeather(entity), TRUE));
if (r2 != -1) {
sub_800569C(&sp.unk8, &entity->axObj.axdata, r2);
}
else {
sp.unk8 = (DungeonPos) {0};
}
sp.unk0 = r9;
sp.unk2 = entInfo->apparentID;
sp.unk4.x = entity->pixelPos.x / 256;
sp.unk4.y = entity->pixelPos.y / 256;
sp.unkC = entInfo->action.direction;
sp.unk10 = 0;
sub_8041500(&sp);
sub_800EEC8(r9);
sub_800EF64();
sub_803E46C(0x58);
r4 = sub_800EA84(&sp);
sub_8042DD4(r4, entity, 5);
savedUnkVar = gUnknown_203B40D;
while (1) {
if (!sub_800E9A8(r4))
break;
if (!r8)
break;
gUnknown_203B40D = 1;
if (gUnknown_2026E4E != 0x1010) {
gUnknown_2026E4E += 0x101;
}
if (gDungeonBrightness >= 5) {
gDungeonBrightness -= 4;
}
else {
gDungeonBrightness = 0;
r8 = FALSE;
}
sub_803EA10();
sub_803E46C(0x26);
}
gUnknown_203B40D = savedUnkVar;
}
void sub_8040DA0(Entity *entity, Move *move)
{
s32 i;
s32 soundEffectId;
Entity *anotherEntity;
struct UnkStruct_8040094 sp;
bool32 r9 = sub_804143C(entity, move);
bool8 var_28 = FALSE;
EntityInfo *entInfo = GetEntInfo(entity);
u8 var_24 = sub_800EA44(entInfo->apparentID, sub_80412E0(move->id, GetApparentWeather(entity), r9));
sub_8041038(&sp, entity, move, r9);
if (sub_800E838(&sp, 1)) {
anotherEntity = gDungeon->unk181e8.cameraTarget;
}
else if (move->id == MOVE_SILVER_WIND) {
anotherEntity = gDungeon->unk181e8.cameraTarget;
}
else {
anotherEntity = entity;
}
if (!EntityIsValid(anotherEntity)) {
anotherEntity = entity;
}
sp.unk4.x = anotherEntity->pixelPos.x / 256;
sp.unk4.y = anotherEntity->pixelPos.y / 256;
if (!sub_8042768(anotherEntity))
return;
if (sub_80414C0(entity, move))
return;
if (move->id == MOVE_MAGNITUDE) {
gUnknown_202F224 = DungeonRandInt(7);
gDungeon->unk181e8.unk18204 = gDungeon->unk181e8.unk18200 = gUnknown_8106A8C[gUnknown_202F224];
gFormatArgs[0] = gUnknown_202F224 + 4;
LogMessageByIdWithPopupCheckUser(anotherEntity, gPtrMagnitudeMessage);
sub_80421C0(anotherEntity, 0x1A4);
}
else if (move->id == MOVE_EARTHQUAKE) {
gDungeon->unk181e8.unk18204 = gDungeon->unk181e8.unk18200 = 12;
sub_80421C0(anotherEntity, 0x1A4);
}
soundEffectId = sub_800E790(entInfo->apparentID, sub_80412E0(move->id, GetApparentWeather(entity), r9));
if (soundEffectId != 0x3E5) {
PlaySoundEffect((u16) soundEffectId);
}
if (var_24 == 99) {
if (sub_8042768(anotherEntity)) {
s32 direction = entInfo->action.direction;
sub_8041108(&sp, entity, move, r9);
for (i = 0; i < NUM_DIRECTIONS; i++) {
direction--;
direction &= DIRECTION_MASK;
sub_806CDD4(entity, 0, direction);
sub_803E708(2, 0x15);
}
}
}
else if (var_24 == 98) {
if (sub_8042768(anotherEntity)) {
s32 direction = entInfo->action.direction;
sub_8041108(&sp, entity, move, r9);
for (i = 0; i < NUM_DIRECTIONS + 1; i++) {
direction &= DIRECTION_MASK;
sub_806CDD4(entity, 0, direction);
sub_803E708(2, 0x15);
direction++;
}
}
}
else {
sub_806CDD4(entity, var_24, entInfo->action.direction);
entity->unk21 = 0;
for (i = 0; i < 120; i++) {
u32 unk;
sub_803E46C(0x59);
unk = entity->axObj.axdata.sub1.unk10;
if (var_24 == 9) {
unk |= 2;
}
if ((unk & 2) && !var_28) {
sub_8041108(&sp, entity, move, r9);
var_28 = TRUE;
}
if (unk & 1)
break;
if (entity->unk21 != 0)
break;
}
entity->unk21 = 0;
}
}
static void sub_8041038(struct UnkStruct_8040094 *a0, Entity *entity, Move *move, bool32 a2)
{
EntityInfo *entInfo = GetEntInfo(entity);
u16 var_24 = sub_80412E0(move->id, GetApparentWeather(entity), a2);
if (sub_800ECB8(var_24)->unk2 != 0) {
s32 r2 = sub_800E710(entInfo->apparentID, sub_80412E0(move->id, GetApparentWeather(entity), a2));
if (r2 != -1) {
sub_800569C(&a0->unk8, &entity->axObj.axdata, r2);
}
else {
a0->unk8 = (DungeonPos) {0};
}
a0->unk0 = var_24;
a0->unk2 = entInfo->apparentID;
a0->unk4.x = entity->pixelPos.x / 256;
a0->unk4.y = entity->pixelPos.y / 256;
a0->unkC = entInfo->action.direction;
a0->unk10 = 0;
}
else {
a0->unk0 = 0;
}
}
static void sub_8041108(struct UnkStruct_8040094 *a0, Entity *entity, Move *move, bool32 a2)
{
u16 r4 = sub_80412E0(move->id, GetApparentWeather(entity), a2);
s32 var = sub_800ECB8(r4)->unk2;
if (a0->unk0 != 0 && var != 0) {
sub_8041500(a0);
sub_800EEF8(r4);
sub_800EF64();
sub_803E46C(0x5A);
sub_8042DD4(sub_800E52C(a0), entity, 1);
}
}
void sub_8041168(Entity *entity, Entity *entity2, Move *move, DungeonPos *pos)
{
s32 var2;
s32 var3;
struct UnkStruct_8040094 sp;
bool32 r5 = (sub_804143C(entity, move) != 0);
u16 r10 = sub_80412E0(move->id, GetApparentWeather(entity), r5);
s32 var = sub_800ECB8(r10)->unk4;
EntityInfo *ent2Info = NULL;
if (EntityIsValid(entity2)) {
ent2Info = GetEntInfo(entity2);
if (!sub_8042768(entity2))
return;
}
else {
if (!sub_803F428(pos))
return;
}
if (sub_80414C0(entity, move))
return;
if (var == 0)
return;
var2 = sub_800ECA4(var)->unk1c;
if (var2 != -1) {
if (EntityIsValid(entity2)) {
sub_800569C(&sp.unk8, &entity2->axObj.axdata, var2);
}
else {
sp.unk8 = (DungeonPos) {0};
}
}
else {
sp.unk8 = (DungeonPos) {0};
}
sp.unk0 = r10;
if (ent2Info != NULL) {
sp.unk2 = ent2Info->apparentID;
sp.unk4.x = entity2->pixelPos.x / 256;
sp.unk4.y = entity2->pixelPos.y / 256;
sp.unkC = 0;
}
else {
s32 x, y;
sp.unk2 = 1;
x = X_POS_TO_PIXELPOS(pos->x);
sp.unk4.x = x / 256;
y = Y_POS_TO_PIXELPOS(pos->y);
sp.unk4.y = y / 256;
sp.unkC = 0;
}
sp.unk10 = 0;
sub_8041500(&sp);
sub_800EEE0(r10);
sub_800EF64();
var3 = sub_800EBC8(&sp);
sub_803E46C(0x5B);
sub_8042DD4(var3, entity2, 6);
while (1) {
if (!sub_800E9A8(var3))
break;
sub_803E46C(0x28);
}
}
u16 sub_80412E0(u16 moveId, u8 weather, bool32 a2)
{
u16 ret = moveId;
if (moveId == MOVE_WEATHER_BALL) {
switch (weather) {
case WEATHER_CLEAR:
case WEATHER_FOG:
case WEATHER_CLOUDY:
ret = moveId;
break;
case WEATHER_SUNNY:
ret = 0x19E;
break;
case WEATHER_SANDSTORM:
ret = 0x1A1;
break;
case WEATHER_RAIN:
ret = 0x1A0;
break;
case WEATHER_HAIL:
case WEATHER_SNOW:
ret = 0x19F;
break;
}
}
else if (a2) {
switch (moveId) {
case MOVE_DIG:
ret = 0x1A2;
break;
case MOVE_RAZOR_WIND:
ret = 0x1A3;
break;
case MOVE_FOCUS_PUNCH:
ret = 0x1A4;
break;
case MOVE_SKY_ATTACK:
ret = 0x1A5;
break;
case MOVE_SOLARBEAM:
ret = 0x1A6;
break;
case MOVE_FLY:
ret = 0x1A7;
break;
case MOVE_DIVE:
ret = 0x1A8;
break;
case MOVE_BOUNCE:
ret = 0x1A9;
break;
case MOVE_SKULL_BASH:
ret = 0x1AA;
break;
case MOVE_CURSE:
ret = 0x1AB;
break;
case MOVE_SNORE:
ret = 0x1AC;
break;
case MOVE_SLEEP_TALK:
ret = 0x1AD;
break;
default:
ret = moveId;
break;
}
}
return ret;
}
UNUSED static s32 sub_8041400(u16 moveId, u8 weather, bool32 a2)
{
return sub_800ED20(sub_80412E0(moveId, weather, a2));
}
static bool8 sub_804141C(u16 moveId, u8 weather, bool32 a2)
{
return sub_800EC84(sub_80412E0(moveId, weather, a2));
}
static bool32 sub_804143C(Entity *entity, Move *move)
{
if (move->id == MOVE_CURSE) {
if (EntityIsValid(entity) && GetEntityType(entity) == ENTITY_MONSTER) {
if (GetEntInfo(entity)->types[0] == TYPE_GHOST || GetEntInfo(entity)->types[1] == TYPE_GHOST)
return TRUE;
else
return FALSE;
}
}
else if (move->id == MOVE_SNORE || move->id == MOVE_SLEEP_TALK) {
if (!IsSleeping(entity))
return TRUE;
else
return FALSE;
}
else if (move->id == MOVE_SOLARBEAM) {
if (GetApparentWeather(entity) == WEATHER_SUNNY)
return TRUE;
}
return MoveMatchesBideClassStatus(entity, move) != FALSE;
}
static bool8 sub_80414C0(Entity *entity, Move *move)
{
if (move->id == MOVE_DIVE) {
if (IsTileGround(GetTileAtEntitySafe(entity)))
return TRUE;
}
if (move->id == MOVE_DIG) {
if (GetTerrainType(GetTileAtEntitySafe(entity)) != TERRAIN_TYPE_NORMAL)
return TRUE;
}
return FALSE;
}
static void sub_8041500(struct UnkStruct_8040094 *a0)
{
if (sub_800E7D0(a0)) {
sub_803E46C(0x5C);
sub_8052740(0x5D);
}
}

View File

@ -32,12 +32,11 @@ extern u32 gStatusSpriteMasks_InvisibleClassStatus[];
extern u32 gStatusSpriteMasks_BlinkerClassStatus[];
extern u32 gStatusSpriteMasks_MuzzledStatus[];
extern void sub_803ED30(u8, Entity *pokemon, u8, u8);
extern void sub_804151C(Entity *pokemon, u32 r1, u8 r2);
extern u32 sub_806F62C(u32);
extern u32 sub_800DC9C(s32 a0);
extern void sub_800569C(DungeonPos *, axdata *, u8);
extern void PlaySoundEffect(u32);
extern void sub_8041550(Entity *pokemon, u32, u32, u32, u32, u32);
void EntityUpdateStatusSprites(Entity *entity);
@ -51,8 +50,78 @@ extern void sub_8042E98(void);
extern void sub_800EE5C(u32);
extern void sub_800EF64(void);
void sub_804178C(u8 param_1);
u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2);
s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3);
s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5);
s32 sub_804151C(Entity *entity, s32 r1, u8 r2)
{
u8 r3 = sub_800DC9C(r1);
return sub_8041550(entity, r1, r2, r3, 2, 0);
}
s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5)
{
s32 i;
EntityInfo *entInfo;
DungeonPos pos;
unkStruct_80416E0 sp;
unkStruct_2039DB0 unkStruct;
PixelPos pixelPos;
s32 var;
s32 r4;
if (!EntityIsValid(entity))
return -1;
entInfo = GetEntInfo(entity);
if (!sub_8042768(entity))
return -1;
if (!a5 && entInfo->unkFF == 2)
return -1;
if (a4 != 0) {
sub_804178C(a4 == 2);
}
sub_800569C(&pos, &entity->axObj.axdata, a3);
if (pos.x != 99 && pos.y != 99) {
pixelPos.x = entity->pixelPos.x + (pos.x << 8);
pixelPos.y = (entity->pixelPos.y + (pos.y << 8)) - entInfo->unk174.raw;
}
else {
pixelPos.x = entity->pixelPos.x;
pixelPos.y = entity->pixelPos.y - entInfo->unk174.raw;
}
var = entity->pixelPos.y / 256;
var -= gDungeon->unk181e8.cameraPixelPos.y;
var /= 2;
var++;
sp.unk0 = a1;
sp.unk4 = 0;
sp.dir = -1;
sp.x = pixelPos.x / 256;
sp.y = pixelPos.y / 256;
sp.unk14 = -1;
sp.unk10 = 0;
sp.unk12 = 0;
sp.unk18 = var;
sub_8004E8C(&unkStruct);
r4 = sub_8041764(&sp, FALSE);
if (a2) {
for (i = 0; i < 100; i++) {
if (!sub_800E9A8(r4)) {
break;
}
sub_803E46C(0x42);
}
r4 = -1;
}
return r4;
}
s32 sub_80416A4(DungeonPos *pos_1, u32 param_2, bool8 param_3)
{
@ -893,3 +962,57 @@ void sub_8042238(Entity *pokemon, Entity *target)
else
PlaySoundEffect(0x156);
}
extern void sub_800EF28(u8);
extern void sub_803E708(u32, u32);
extern u32 sub_800E448(u8, DungeonPos *);
void sub_804225C(Entity *entity, DungeonPos *pos, u8 trapId)
{
s32 uVar6;
DungeonPos newPos;
s32 i, x, y;
if (trapId == TRAP_WONDER_TILE)
return;
if (!sub_803F428(pos))
return;
sub_800EF28(trapId);
sub_800EF64();
sub_803E708(4,0x42);
x = X_POS_TO_PIXELPOS(pos->x);
newPos.x = x / 256;
y = Y_POS_TO_PIXELPOS(pos->y);
newPos.y = y / 256;
uVar6 = sub_800E448(trapId,&newPos);
if (trapId == TRAP_SUMMON_TRAP) {
sub_80421C0(0,0x193);
sub_803E708(0x28,0x33);
}
else if (trapId == TRAP_SPIN_TRAP) {
EntityInfo *info = GetEntInfo(entity);
s32 direction = info->action.direction;
for (i = 0; i < 1000; i += 2) {
direction--;
direction &= DIRECTION_MASK;
sub_806CDD4(entity,0,direction);
sub_803E708(2,0x33);
if (!sub_800E9A8(uVar6))
break;
}
info->action.direction = direction & DIRECTION_MASK;
}
else {
sub_803E708(0x28,0x33);
}
for (i = 0; i < 1000; i++) {
sub_803E46C(0x42);
if (!sub_800E9A8(uVar6))
break;
}
}

View File

@ -8,6 +8,7 @@
#include "code_806CD90.h"
#include "dungeon.h"
#include "dungeon_engine.h"
#include "dungeon_map.h"
#include "dungeon_leader.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
@ -22,7 +23,6 @@ extern const u32 gUnknown_80F680C[8];
extern const u16 gUnknown_80F682C[8];
extern const u8 *gPtrFeralFoundItemMessage[];
extern void sub_8040238(void);
extern void sub_804151C(Entity *pokemon, u32 r1, u8 r2);
extern void sub_804178C(u32);
extern void sub_80416A4(DungeonPos *r0, u32 r1, bool8 r2);
@ -182,7 +182,7 @@ void sub_80426C8(u32 a0, u32 a1)
sub_803E46C(0x46);
sub_8042D7C();
sub_8040238();
LoadDungeonMapPalette();
sub_8052210(1);
}

View File

@ -40,7 +40,7 @@
#include "constants/trap.h"
#include "dungeon_serializer.h"
#include "dungeon_config.h"
#include "code_8042B34.h"
#include "dungeon_map.h"
extern void sub_800EE5C(s32);
extern void sub_800EF64(void);
@ -56,7 +56,7 @@ struct UnkStruct_203B414
struct DungeonPos unk8C[16];
};
EWRAM_INIT DungeonPos gUnknown_203B410 = {100, 100};
EWRAM_INIT DungeonPos gPlayerDotMapPosition = {100, 100};
static EWRAM_INIT struct UnkStruct_203B414 *sUnknown_203B414 = NULL;
EWRAM_INIT Dungeon *gDungeon = NULL;
EWRAM_INIT u8 *gSerializedData_203B41C = NULL;
@ -256,17 +256,13 @@ extern void sub_8040094(u8 r0);
extern void sub_8068BDC(u8 r0);
extern s16 GetTurnLimit(u8 dungeon);
extern void sub_8041888(u8 param_1);
extern void sub_8040150(bool8 param_1);
extern void sub_803D4AC(void);
extern void sub_804513C(void);
extern void sub_8043CD8(void);
extern void sub_803E250(void);
extern void sub_8040130(void);
extern void sub_8040124(void);
extern void sub_803E830(void);
extern void sub_803E214(void);
extern void nullsub_56(void);
extern void sub_8040218(void);
extern void sub_8047104(void);
extern void sub_8068F28(void);
extern void sub_806C1D8(void);
@ -292,7 +288,7 @@ extern void sub_8071DA4(Entity *);
extern void sub_803E748(void);
extern void sub_8083D68(void);
extern void sub_803E7C8(void);
extern void sub_8040A84(void);
extern void ShowWholeRevealedDungeonMap(void);
extern void sub_807E5AC(void);
extern void TriggerWeatherAbilities(void);
extern void sub_807E88C(void);
@ -393,8 +389,8 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
dungeonPtr[i] = 0;
}
gUnknown_203B410.x = 0; // Needed to match
gUnknown_203B410.x = 100;
gPlayerDotMapPosition.x = 0; // Needed to match
gPlayerDotMapPosition.x = 100;
if (!r6) {
gDungeon->unk644.unk34 = r8->unkF;
@ -417,8 +413,8 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
sub_8043CD8();
sub_80495E4();
sub_803E250();
sub_8040130();
sub_8040124();
OpenDungeonMapFile();
SetDungeonMapToNotShown();
sub_803F27C(1);
gUnknown_2026E4E = 2056;
sub_80095CC(1, 0x14);
@ -437,7 +433,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
}
if (!r6) {
gDungeon->unk181e8.unk1820B = 1;
gDungeon->unk181e8.allTilesRevealed = 1;
gDungeon->unk181e8.unk1820C = 1;
if (gDungeon->unk644.unk34 == 1) {
gDungeon->unk644.dungeonLocation.id = r8->unk14.unk0;
@ -591,7 +587,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
sub_8049840();
sub_803E178();
gDungeonBrightness = 0;
sub_8040124();
SetDungeonMapToNotShown();
sub_803EAF0(4, 0);
sub_8052210(0);
sub_803F27C(r6);
@ -663,8 +659,8 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
}
sub_8040094(0);
sub_803EAF0(0, 0);
sub_8040150(r6);
sub_8040A84();
InitDungeonMap(r6);
ShowWholeRevealedDungeonMap();
gDungeon->unkB8 = NULL;
gDungeon->unk644.unk28 = 0;
gDungeon->unk644.unk29 = 0;
@ -688,7 +684,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
}
else {
sub_803F4A0(GetLeader());
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
}
@ -747,7 +743,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
sub_8052740(0x4F);
}
sub_8040124();
SetDungeonMapToNotShown();
sub_803EAF0(1, 0);
gDungeon->unk181e8.unk18219 = 0;
gDungeon->unk181e8.unk18218 = 1;
@ -917,7 +913,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
CloseDungeonPaletteFile();
sub_803E214();
nullsub_56();
sub_8040218();
CloseDungeonMapFile();
if (r8->unk7C == 1 || r8->unk7C == 4 || r8->unk7C == 2) {
sub_8047104();
}

View File

@ -217,10 +217,10 @@ bool8 sub_8045804(Entity *ent)
if (!monInfo->isNotTeamMember)
return TRUE;
if (!saveTyping->unk1820F && monInfo->invisibleClassStatus.status == STATUS_INVISIBLE)
if (!saveTyping->showInvisibleTrapsMonsters && monInfo->invisibleClassStatus.status == STATUS_INVISIBLE)
return FALSE;
if (saveTyping->unk1820B || saveTyping->unk1820D)
if (saveTyping->allTilesRevealed || saveTyping->unk1820D)
return TRUE;
if (camTarget != NULL)
@ -252,7 +252,7 @@ bool8 sub_8045888(Entity *ent)
switch (GetEntityType(ent)) {
case ENTITY_ITEM: {
if (!saveTyping->unk1820E && !sub_803F428(&ent->pos))
if (!saveTyping->showAllFloorItems && !sub_803F428(&ent->pos))
return FALSE;
break;
}
@ -260,7 +260,7 @@ bool8 sub_8045888(Entity *ent)
EntityInfo *monInfo = GetEntInfo(ent);
if (monInfo->isNotTeamMember) {
if (!gDungeon->unk181e8.unk1820F && monInfo->invisibleClassStatus.status == STATUS_INVISIBLE)
if (!gDungeon->unk181e8.showInvisibleTrapsMonsters && monInfo->invisibleClassStatus.status == STATUS_INVISIBLE)
return FALSE;
if (!saveTyping->unk1820D && !sub_803F428(&ent->pos))
@ -269,7 +269,7 @@ bool8 sub_8045888(Entity *ent)
break;
}
case ENTITY_TRAP: {
if (!gDungeon->unk181e8.unk1820F && !ent->isVisible)
if (!gDungeon->unk181e8.showInvisibleTrapsMonsters && !ent->isVisible)
return FALSE;
break;
}

View File

@ -9,6 +9,7 @@
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_map.h"
#include "pokemon.h"
#include "moves.h"
#include "items.h"
@ -76,12 +77,11 @@ bool8 sub_80701A4(Entity *a0);
void sub_80647F0(Entity *a0);
void sub_805E738(Entity *a0);
void sub_803E708(s32 a0, s32 a1);
void sub_8040A78(void);
void sub_805E804(void);
void sub_8064BE0(void);
void sub_8075680(u32);
void sub_8094C88(void);
void sub_8040A84(void);
void ShowWholeRevealedDungeonMap(void);
void sub_8047158(void);
void sub_806A914(u8 a0, u8 a1, u8 a2);
void sub_8044C10(u8 a0);
@ -118,7 +118,6 @@ extern bool8 sub_8071A8C(Entity *pokemon);
extern void sub_80643AC(Entity *pokemon);
extern u8 sub_8062F90(Entity *, u32, u32, u32, u32);
extern u8 gUnknown_202EE00;
extern Entity *gLeaderPointer;
extern const u8 *gUnknown_80F8A84;
@ -168,7 +167,7 @@ void DungeonHandlePlayerInput(void)
}
gDungeon->unk644.unk2F = 0;
sub_8040A78();
ResetMapPlayerDotFrames();
if (gDungeon->unk1 != 0) {
gDungeon->unk1 = 0;
if (!ShouldMonsterRunAwayAndShowEffect(GetLeader(), TRUE)) {
@ -424,15 +423,15 @@ void DungeonHandlePlayerInput(void)
}
// SELECT button
if (!gDungeon->unk181e8.blinded && gGameOptionsRef->mapOption != 6 && gRealInputs.pressed & SELECT_BUTTON) {
if (!gDungeon->unk181e8.blinded && gGameOptionsRef->mapOption != TOP_MAP_AND_TEAM_NO_BOTTOM && gRealInputs.pressed & SELECT_BUTTON) {
s32 prevMapOption = gGameOptionsRef->mapOption;
gUnknown_202EE00 = 1;
gDungeon->unk181e8.unk18214 = 1;
gShowMonsterDotsInDungeonMap = TRUE;
gDungeon->unk181e8.inFloorMapMode = TRUE;
if (!sub_8094C48()) {
sub_8094C88();
}
sub_8052210(1);
sub_8040A84();
ShowWholeRevealedDungeonMap();
SetBGOBJEnableFlags(0x1E);
sub_803E708(0xA, 0x2F);
while (1) {
@ -443,14 +442,14 @@ void DungeonHandlePlayerInput(void)
break;
if (gRealInputs.pressed & A_BUTTON) {
gUnknown_202EE00 = (gUnknown_202EE00 == 0) ? 1 : 0; // Flip
sub_8040A84();
gShowMonsterDotsInDungeonMap = (gShowMonsterDotsInDungeonMap == FALSE) ? TRUE : FALSE; // Flip
ShowWholeRevealedDungeonMap();
}
}
gDungeon->unk181e8.unk18214 = 0;
gDungeon->unk181e8.inFloorMapMode = FALSE;
gGameOptionsRef->mapOption = prevMapOption;
gUnknown_202EE00 = 1;
sub_8040A84();
gShowMonsterDotsInDungeonMap = TRUE;
ShowWholeRevealedDungeonMap();
SetBGOBJEnableFlags(0);
sub_803E46C(0x2F);
sub_803E46C(0x2F);
@ -845,7 +844,7 @@ bool8 sub_805E874(void)
if (tile->object != NULL && GetEntityType(tile->object) == ENTITY_TRAP && GetEntityType(tile->object) == ENTITY_TRAP) {
if (tile->object->isVisible)
return FALSE;
if (gDungeon->unk181e8.unk1820F)
if (gDungeon->unk181e8.showInvisibleTrapsMonsters)
return FALSE;
}
}
@ -853,7 +852,7 @@ bool8 sub_805E874(void)
if (tile->object != NULL && GetEntityType(tile->object) == ENTITY_TRAP) {
if (tile->object->isVisible)
return FALSE;
if (gDungeon->unk181e8.unk1820F)
if (gDungeon->unk181e8.showInvisibleTrapsMonsters)
return FALSE;
}
}

View File

@ -17,11 +17,11 @@ extern u8 gUnknown_810AC62; // 0xC
extern u8 gUnknown_810AC68; // 0x8
extern u8 gUnknown_810AC64; // 0x8
extern u8 gUnknown_810AC66; // 0x8
extern DungeonPos gUnknown_203B410;
extern DungeonPos gPlayerDotMapPosition;
extern DungeonPos gUnknown_202EE0C;
s32 sub_806A4DC(EntityInfo *info);
bool8 sub_8070F80(Entity * pokemon, s32 direction);
void sub_80402AC(s32, s32);
void ShowDungeonMapAtPos(s32, s32);
void sub_80694C0(Entity *target,s32 x,int y,char param_4)
{
@ -44,15 +44,15 @@ void sub_80694C0(Entity *target,s32 x,int y,char param_4)
if (tile2->monster == target) {
tile2->monster = NULL;
}
sub_80402AC((target->pos).x,(target->pos).y);
ShowDungeonMapAtPos((target->pos).x,(target->pos).y);
}
(target->prevPos).x = (target->pos).x;
(target->prevPos).y = (target->pos).y;
(target->pos).x = x;
(target->pos).y = y;
if (info->isTeamLeader) {
gUnknown_203B410.x = x;
gUnknown_203B410.y = y;
gPlayerDotMapPosition.x = x;
gPlayerDotMapPosition.y = y;
}
tile->monster = target;
if (info->isTeamLeader) {
@ -60,7 +60,7 @@ void sub_80694C0(Entity *target,s32 x,int y,char param_4)
gUnknown_202EE0C.y = y;
gDungeon->unk1 = 0;
}
sub_80402AC(x,y);
ShowDungeonMapAtPos(x,y);
switch(param_4)
{
@ -247,7 +247,7 @@ void sub_8069844(struct unkStruct_808FF20 *param_1, Entity *target) {
param_1->unk44[1].level = 0;
param_1->IQSkills = info->IQSkillMenuFlags;
if (gDungeon->unk644.unk16 != 0) {
param_1->unk4C = sub_806A4DC(info);
param_1->unk4C = sub_806A4DC(info);
}
else {
param_1->unk4C = 3;
@ -265,7 +265,7 @@ void sub_8069844(struct unkStruct_808FF20 *param_1, Entity *target) {
}
if (FixedPointToInt(info->belly) == 0) {
if (info->isTeamLeader) {
param_1->unk58[uVar15] = 19;
param_1->unk58[uVar15] = 19;
}
else {
param_1->unk58[uVar15] = 59;

View File

@ -80,7 +80,7 @@ extern void sub_8042EC8(Entity *a0, s32 a1);
extern Entity *sub_804550C(s16 a);
extern Entity *sub_80453AC(s16 id);
extern void sub_803F580(s32);
extern void sub_8040A84(void);
extern void ShowWholeRevealedDungeonMap(void);
extern void sub_806B678(void);
extern void EntityUpdateStatusSprites(Entity *);
extern Entity *sub_80696A8(Entity *a0);
@ -543,7 +543,7 @@ void sub_806A6E8(Entity *entity)
else {
if (info->heldItem.id == ITEM_X_RAY_SPECS || info->unk64 == ITEM_X_RAY_SPECS) {
sub_803F580(1);
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
}
sub_807AA30();
@ -2061,7 +2061,7 @@ void sub_806C51C(Entity *entity)
if (entInfo->isNotTeamMember && (entInfo->apparentID == MONSTER_DEOXYS_ATTACK || entInfo->apparentID == MONSTER_DEOXYS_DEFENSE || entInfo->apparentID == MONSTER_DEOXYS_SPEED)) {
r4 = TRUE;
}
if (entInfo->invisibleClassStatus.status == STATUS_INVISIBLE && !gDungeon->unk181e8.unk1820F) {
if (entInfo->invisibleClassStatus.status == STATUS_INVISIBLE && !gDungeon->unk181e8.showInvisibleTrapsMonsters) {
r4 = TRUE;
}
if (r4) {
@ -2106,8 +2106,8 @@ void sub_806C51C(Entity *entity)
if (xSprite >= -32 && ySprite >= -32 && xSprite <= 271 && ySprite <= 191 && r7 != 6 && entity->unk22 == 0) {
struct unkStruct_202ED28 *spriteStructPtr = &gUnknown_202ED28[var_34][r7];
if (entInfo->unk156 != 0) {
SpriteSetX(&spriteStructPtr->sprite, xSprite + spriteStructPtr->x);
SpriteSetY(&spriteStructPtr->sprite, ySprite + spriteStructPtr->y);
SpriteSetX(&spriteStructPtr->sprite, xSprite + spriteStructPtr->pos.x);
SpriteSetY(&spriteStructPtr->sprite, ySprite + spriteStructPtr->pos.y);
AddSprite(&spriteStructPtr->sprite, 0, NULL, NULL);
}

View File

@ -147,7 +147,7 @@ extern u8 *gUnknown_80FBF28[];
extern u8 *gUnknown_80FBF68[];
extern u8 *gUnknown_80FBF84[];
extern void sub_8040A84();
extern void ShowWholeRevealedDungeonMap();
extern void EntityUpdateStatusSprites(Entity *);
extern void sub_8042A74(Entity *r0);
extern void sub_807EC28(bool8);
@ -372,7 +372,7 @@ void BlindTarget(Entity *pokemon, Entity *target)
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB7F4);
sub_803E46C(0x31);
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
else
{
@ -399,7 +399,7 @@ void CrossEyeVisionTarget(Entity *pokemon, Entity *target)
entityInfo->blinkerClassStatus.turns = CalculateStatusTurns(target,gCrossEyedTurnRange, TRUE) + 1;
sub_803F580(0x1);
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
else
{
@ -425,7 +425,7 @@ void RestoreVisionTarget(Entity *pokemon, Entity *target)
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB880);
sub_803E46C(0x31);
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
else
{
@ -1508,7 +1508,7 @@ void SendEyesightEndMessage(Entity * pokemon,Entity * target)
if (entityInfo->isTeamLeader) {
sub_803E46C(0x31);
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
}

View File

@ -60,7 +60,7 @@ EWRAM_INIT u32 gUnknown_203B444[3] = {0x28, 0x28, 0x50};
void sub_804EB30();
bool8 ExposeTrap(s32 x, s32 y);
void sub_8040A84();
void ShowWholeRevealedDungeonMap();
void sub_8049ED4();
void sub_806A5B8(Entity *);
u8 sub_8045888(Entity *);
@ -76,7 +76,7 @@ bool8 sub_808384C(DungeonPos *, DungeonPos *);
u8 sub_8083660(DungeonPos *);
void sub_80460F8(DungeonPos *, Item *, u32);
void sub_80462AC(Entity * ,u32, u32, u8, u32);
extern void sub_80402AC(s32, s32);
extern void ShowDungeonMapAtPos(s32, s32);
void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction)
{
@ -385,7 +385,7 @@ void sub_807D3CC(Entity *param_1)
}
if (flag) {
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80FD2F8); // All traps were exposed
sub_8040A84();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
}
else {
@ -503,7 +503,7 @@ void HandleTrawlOrbAction(Entity *user, Entity *target)
for (i = 0; i < itemsCount; i++) {
if (EntityIsValid(&itemEntities[i])) {
sub_80461C8(&itemEntities[i].pos, 1);
sub_80402AC(itemEntities[i].pos.x, itemEntities[i].pos.y);
ShowDungeonMapAtPos(itemEntities[i].pos.x, itemEntities[i].pos.y);
itemVelocity[i].x = (((targetTilePos[i].x * 24 + 4) * 256) - itemEntities[i].pixelPos.x) / 60;
itemVelocity[i].y = (((targetTilePos[i].y * 24 + 4) * 256) - itemEntities[i].pixelPos.y) / 60;
}
@ -534,7 +534,7 @@ void HandleTrawlOrbAction(Entity *user, Entity *target)
for (i = 0; i < itemsCount; i++) {
if (targetTilePos[i].x >= 0) {
sub_80460F8(&targetTilePos[i], GetItemData(&itemEntities[i]), 1);
sub_80402AC(targetTilePos[i].x, targetTilePos[i].y);
ShowDungeonMapAtPos(targetTilePos[i].x, targetTilePos[i].y);
hasTrawled = TRUE;
}
}
@ -652,7 +652,7 @@ void HandleDroughtOrbAction(Entity *pokemon, Entity *target) {
}
gDungeon->unk644.unk2C = 1;
sub_806CF60();
sub_8040A84();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
}
@ -757,7 +757,7 @@ void HandleOneRoomOrb(Entity *pokemon, Entity *target) {
sub_804AAD4();
sub_8049884();
sub_806CF60();
sub_8040A84();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FD3A0);
sub_803E708(0x28,0x2b);
@ -861,7 +861,7 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para
sub_8049BB0(x,y);
}
}
sub_8040A84();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
}
}

View File

@ -877,7 +877,7 @@ extern SpriteOAM gUnknown_202EDC0;
void sub_807FA9C(void)
{
s32 x, y;
bool8 unkBool = gDungeon->unk181e8.unk1820F;
bool8 unkBool = gDungeon->unk181e8.showInvisibleTrapsMonsters;
for (y = gDungeon->unk181e8.cameraPos.y - 5; y < gDungeon->unk181e8.cameraPos.y + 5; y++) {
for (x = gDungeon->unk181e8.cameraPos.x - 6; x < gDungeon->unk181e8.cameraPos.x + 6; x++) {

View File

@ -9,8 +9,8 @@ bool8 sub_8083568(s32 inX, s32 inY, u8 index)
if (x >= -16 && y >= -16 && x <= 255 && y <= 175)
{
SpriteSetX(&gUnknown_202ED28[0][index].sprite, x + gUnknown_202ED28[0][index].x);
SpriteSetY(&gUnknown_202ED28[0][index].sprite, y + gUnknown_202ED28[0][index].y);
SpriteSetX(&gUnknown_202ED28[0][index].sprite, x + gUnknown_202ED28[0][index].pos.x);
SpriteSetY(&gUnknown_202ED28[0][index].sprite, y + gUnknown_202ED28[0][index].pos.y);
AddSprite(&gUnknown_202ED28[0][index].sprite, 0, NULL, NULL);
return TRUE;

View File

@ -14,7 +14,7 @@
#include "structs/str_806B7F8.h"
extern const DungeonPos gUnknown_80F4598[];
extern void sub_8040A84(void);
extern void ShowWholeRevealedDungeonMap(void);
struct unkData_8107234
{
@ -32,7 +32,7 @@ void sub_80847D4(void)
gDungeon->unk3A0D = 0;
gDungeon->unk1356C = 0;
sub_8040A84();
ShowWholeRevealedDungeonMap();
for(index = 0; index < 0x3e7 && gUnknown_8107234[index].unk0[0] != 0; index++) {
fixedRoomNumber = gDungeon->fixedRoomNumber;
if (fixedRoomNumber - 0x1c < 0x16) {

View File

@ -374,7 +374,7 @@ extern void BgColorCallNullsub4(void);
extern void sub_8085EB0(void);
extern void sub_8049884(void);
extern void sub_8049B8C(void);
extern void sub_8040A84(void);
extern void ShowWholeRevealedDungeonMap(void);
extern void sub_8086A54(Entity *);
extern void ResetMonEntityData(EntityInfo *, u32);
extern void sub_808BBA8(Entity * );
@ -3721,7 +3721,7 @@ void sub_808B1CC(u8 itemID)
sub_80460F8(&pos,&item,1);
}
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
void SetupRegiFacingDirection(Entity *regiEntity)
@ -3812,7 +3812,7 @@ void sub_808B3E4(u8 param_1, u8 param_2, u8 param_3)
sub_808B50C();
}
gDungeon->unk1356C = uVar1;
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
}
}
@ -4181,7 +4181,7 @@ void CreateJirachiWishWarpTile(void)
sub_8049884();
sub_8049B8C();
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
void EnableJirachiWishWarpTile(void)
@ -4197,7 +4197,7 @@ void EnableJirachiWishWarpTile(void)
sub_8049884();
sub_8049B8C();
sub_8049ED4();
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
u8 JirachiFriendAreaSearch(void)

View File

@ -24,7 +24,7 @@ extern void sub_80416E0(PixelPos *r0, u32, bool8);
extern void sub_80855E4(void *);
extern void PlaySoundEffect(u32);
extern void sub_804178C(u32);
extern void sub_8040A84(void);
extern void ShowWholeRevealedDungeonMap(void);
static void MusicBoxCreation(void);
static u8 sub_8046D70(void);
@ -157,7 +157,7 @@ void MusicBoxCreation(void)
sub_803E708(10,0x41);
sub_804178C(1);
gDungeon->unk1356C = 0;
sub_8040A84();
ShowWholeRevealedDungeonMap();
}
}

597
src/dungeon_map.c Normal file
View File

@ -0,0 +1,597 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_map.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_music.h"
#include "file_system.h"
#include "cpu.h"
#include "dungeon.h"
#include "game_options.h"
#include "bg_palette_buffer.h"
#include "code_8009804.h"
#include "code_800E9E4.h"
#include "dungeon_generation.h"
#include "dungeon_util.h"
#include "trap.h"
#include "text.h"
#include "constants/dungeon.h"
#include "constants/trap.h"
extern struct FileArchive gDungeonFileArchive;
extern DungeonPos gPlayerDotMapPosition;
extern s32 gUnknown_202EDD0;
extern void nullsub_11(SpriteOAM *, s32, UnkSpriteMem *, unkStruct_2039DB0 *);
extern u8 GetFloorType(void);
extern bool8 sub_8094C48(void);
extern bool8 sub_8045804(Entity *ent);
extern bool8 DoesNotHaveShadedMap(void);
struct UnkStruct1
{
u32 **unk0;
};
struct DungeonMapGfx
{
struct UnkStruct1 *gfx;
RGB *pal;
};
enum {
MAP_GFX_NOTHING,
MAP_GFX_UNK1, // Appears to be nothing too
MAP_GFX_ENEMY,
MAP_GFX_ITEM,
MAP_GFX_TRAP,
MAP_GFX_SPECIAL_STAIRS,
MAP_GFX_STAIRS,
MAP_GFX_WONDER_TILE,
MAP_GFX_PLAYER,
MAP_GFX_WHITE_SQUARE, // Possibly unused? It's like Stairs, but white instead of blue
MAP_GFX_ALLY,
MAP_GFX_GREEN_DOT, // Used when hallucinating
};
#define MAP_GFX_TERRAIN_TILES_VISITED 0x10
#define MAP_GFX_TERRAIN_TILES_REVEALED 0x20
#define MAP_GFX_TERRAIN_LINE_UP 0x1
#define MAP_GFX_TERRAIN_LINE_RIGHT 0x2
#define MAP_GFX_TERRAIN_LINE_DOWN 0x4
#define MAP_GFX_TERRAIN_LINE_LEFT 0x8
EWRAM_DATA bool8 gShowMonsterDotsInDungeonMap = FALSE;
EWRAM_DATA bool8 gShowDungeonMap = FALSE;
EWRAM_DATA static u8 sPlayerDotFrames = 0;
EWRAM_DATA static OpenedFile *sDungeonMapGfxFile = NULL;
EWRAM_DATA static void *sDungeonMapVramDst = NULL;
// All traps look the same on Map, except for the Wonder Tile.
static const u8 sTrapToMapGfxId[NUM_TRAPS] =
{
[TRAP_TRIP_TRAP] = MAP_GFX_TRAP,
[TRAP_MUD_TRAP] = MAP_GFX_TRAP,
[TRAP_STICKY_TRAP] = MAP_GFX_TRAP,
[TRAP_GRIMY_TRAP] = MAP_GFX_TRAP,
[TRAP_SUMMON_TRAP] = MAP_GFX_TRAP,
[TRAP_PITFALL_TRAP] = MAP_GFX_TRAP,
[TRAP_WARP_TRAP] = MAP_GFX_TRAP,
[TRAP_WHIRLWIND_TRAP] = MAP_GFX_TRAP,
[TRAP_SPIN_TRAP] = MAP_GFX_TRAP,
[TRAP_SLUMBER_TRAP] = MAP_GFX_TRAP,
[TRAP_SLOW_TRAP] = MAP_GFX_TRAP,
[TRAP_SEAL_TRAP] = MAP_GFX_TRAP,
[TRAP_POISON_TRAP] = MAP_GFX_TRAP,
[TRAP_SELFDESTRUCT_TRAP] = MAP_GFX_TRAP,
[TRAP_EXPLOSION_TRAP] = MAP_GFX_TRAP,
[TRAP_PP_ZERO_TRAP] = MAP_GFX_TRAP,
[TRAP_CHESTNUT_TRAP] = MAP_GFX_TRAP,
[TRAP_WONDER_TILE] = MAP_GFX_WONDER_TILE,
[TRAP_POKEMON_TRAP] = MAP_GFX_TRAP,
[TRAP_SPIKE_TRAP] = MAP_GFX_TRAP,
};
void SetDungeonMapToNotShown(void)
{
gShowDungeonMap = FALSE;
}
void OpenDungeonMapFile(void)
{
sDungeonMapGfxFile = OpenFileAndGetFileDataPtr("zmappat", &gDungeonFileArchive);
}
void InitDungeonMap(bool8 a0)
{
s32 i, j;
for (i = 0; i < DUNGEON_MAP_MAX_Y; i++) {
for (j = 0; j < DUNGEON_MAP_MAX_X; j++) {
CpuClear(&gDungeon->dungeonMap.perTile[i][j], sizeof(struct UnkDungeonGlobal_1822C_Sub));
gDungeon->dungeonMap.tileScheduledForCopy[i][j] = FALSE;
}
}
if (!a0) {
gPlayerDotMapPosition.x = 100;
gPlayerDotMapPosition.y = 100;
}
gDungeon->dungeonMap.scheduledVramCopiesCount = 0;
gDungeon->dungeonMap.copyToVram = TRUE;
gDungeon->dungeonMap.resetTilesScheduledForCopy = FALSE;
gShowMonsterDotsInDungeonMap = TRUE;
sDungeonMapVramDst = (void *) VRAM + 0x1700;
gShowDungeonMap = TRUE;
LoadDungeonMapPalette();
}
void CloseDungeonMapFile(void)
{
if (sDungeonMapGfxFile != NULL) {
CloseFile(sDungeonMapGfxFile);
}
SetDungeonMapToNotShown();
}
// Used in Pmd's Blue version. Stores different Vram address in sDungeonMapVramDst(maybe?), depending on TOP_MAP_AND_TEAM_NO_BOTTOM map option.
UNUSED static void nullsub_203(void)
{
}
void LoadDungeonMapPalette(void)
{
s32 i;
if (sDungeonMapGfxFile == NULL)
return;
if (!gShowDungeonMap)
return;
for (i = 0; i < 16; i++) {
if (i == 14) {
SetBGPaletteBufferColorArray(238, &gFontPalette[1]);
nullsub_5(238, &gFontPalette[1]);
}
else {
SetBGPaletteBufferColorArray(i + 224, &((struct DungeonMapGfx *)(sDungeonMapGfxFile->data))->pal[i]);
nullsub_5(i + 224, &((struct DungeonMapGfx *)(sDungeonMapGfxFile->data))->pal[i]);
}
}
}
void ShowDungeonMapAtPos(s32 x, s32 y)
{
s32 yAdd = 0;
const Tile *tile;
Dungeon *dungeon;
bool8 blinded;
u32 terrainType;
bool8 hallucinating;
bool8 showItems;
bool8 showHiddenTraps;
bool8 allTilesRevealed;
bool8 var_24;
bool8 tileKnown;
s32 mapGfxType;
s32 xDiv2, yDiv2;
u32 *src, *dst;
bool8 lookForMapObject;
s32 r3, yMinus;
dungeon = gDungeon;
lookForMapObject = TRUE;
if (sDungeonMapGfxFile == NULL)
return;
if (!gShowDungeonMap)
return;
if (sub_800EC74())
return;
if (GAME_VERSION == VERSION_BLUE) {
if (gGameOptionsRef->mapOption == TOP_MAP_AND_TEAM_NO_BOTTOM) {
if (x < 0 || y < 1 || x >= DUNGEON_MAX_SIZE_X || y >= DUNGEON_MAX_SIZE_Y)
return;
yAdd = 1;
}
else {
if (x < 0 || y < 2 || x >= DUNGEON_MAX_SIZE_X || y >= DUNGEON_MAX_SIZE_Y)
return;
yAdd = 0;
}
// FUN_0001d198(); Unknown function call which doesn't exist in red
}
else if (GAME_VERSION == VERSION_RED) {
if (x < 0 || y < 2 || x >= DUNGEON_MAX_SIZE_X || y >= DUNGEON_MAX_SIZE_Y - 1)
return;
}
tile = GetTile(x, y);
terrainType = GetTerrainType(tile);
hallucinating = gDungeon->unk181e8.hallucinating;
blinded = gDungeon->unk181e8.blinded;
showHiddenTraps = gDungeon->unk181e8.showInvisibleTrapsMonsters;
showItems = gDungeon->unk181e8.showAllFloorItems;
allTilesRevealed = gDungeon->unk181e8.allTilesRevealed;
if (blinded) {
tileKnown = tile->spawnOrVisibilityFlags & VISIBILITY_FLAG_REVEALED;
var_24 = FALSE;
}
else {
if (allTilesRevealed) {
tileKnown = TRUE;
}
else {
tileKnown = tile->spawnOrVisibilityFlags & VISIBILITY_FLAG_REVEALED;
}
if (GetFloorType() == FLOOR_TYPE_NORMAL) {
var_24 = gDungeon->unk181e8.unk18211;
}
else {
var_24 = FALSE;
}
}
if (sub_8094C48() && !gDungeon->unk1356C) {
mapGfxType = MAP_GFX_NOTHING;
if (!blinded) {
Entity *entity = tile->monster;
if (entity != NULL) {
s32 entType = GetEntityType(entity);
if (gShowMonsterDotsInDungeonMap && entType == ENTITY_MONSTER && sub_8045804(entity)) {
EntityInfo *entInfo = GetEntInfo(entity);
if (IsExperienceLocked(entInfo->joinedAt.id) || entInfo->monsterBehavior == 1 || entInfo->monsterBehavior == 4) {
mapGfxType = MAP_GFX_ALLY;
}
else {
if (entInfo->isNotTeamMember) {
mapGfxType = MAP_GFX_ENEMY;
}
else if (entInfo->isTeamLeader) {
gPlayerDotMapPosition.x = x;
gPlayerDotMapPosition.y = y;
if (gDungeon->unk181e8.inFloorMapMode) {
mapGfxType = MAP_GFX_PLAYER;
}
}
else {
mapGfxType = MAP_GFX_ALLY;
}
}
lookForMapObject = FALSE;
}
}
}
if (lookForMapObject && !blinded) {
Entity *entity = tile->object;
if (entity != NULL) {
s32 entType = GetEntityType(entity);
if (!tileKnown) {
mapGfxType = MAP_GFX_NOTHING;
if (entType == ENTITY_ITEM) {
if ((showItems || (tile->spawnOrVisibilityFlags & 2)) && terrainType != TERRAIN_TYPE_WALL) {
mapGfxType = MAP_GFX_ITEM;
}
}
lookForMapObject = FALSE;
}
else {
if (entType == ENTITY_TRAP) {
if (entity->isVisible || showHiddenTraps) {
Trap *trap = GetTrapData(entity);
mapGfxType = sTrapToMapGfxId[trap->id];
lookForMapObject = FALSE;
}
}
}
if (lookForMapObject) {
if (entType == ENTITY_ITEM) {
if ((showItems || (tile->spawnOrVisibilityFlags & 2)) && terrainType != TERRAIN_TYPE_WALL) {
mapGfxType = MAP_GFX_ITEM;
lookForMapObject = FALSE;
}
}
}
if (lookForMapObject) {
if (terrainType != TERRAIN_TYPE_NORMAL) {
mapGfxType = MAP_GFX_NOTHING;
lookForMapObject = FALSE;
}
}
}
else {
if (!tileKnown) {
if (var_24 && (tile->terrainType & TERRAIN_TYPE_STAIRS)) {
if (GetFloorType() == FLOOR_TYPE_NORMAL) {
mapGfxType = MAP_GFX_STAIRS;
}
else {
mapGfxType = MAP_GFX_SPECIAL_STAIRS;
}
lookForMapObject = FALSE;
}
}
else {
if ((tile->terrainType & TERRAIN_TYPE_STAIRS)) {
if (GetFloorType() == FLOOR_TYPE_NORMAL) {
mapGfxType = MAP_GFX_STAIRS;
}
else {
mapGfxType = MAP_GFX_SPECIAL_STAIRS;
}
lookForMapObject = FALSE;
}
}
}
}
if (!lookForMapObject) {
if (hallucinating) {
if (mapGfxType != MAP_GFX_NOTHING) {
mapGfxType = MAP_GFX_GREEN_DOT;
}
}
}
if (mapGfxType == MAP_GFX_NOTHING) {
if (!tileKnown) {
mapGfxType = 1;
}
else if (terrainType != TERRAIN_TYPE_NORMAL) {
mapGfxType = 1;
}
else {
s32 terrainLine = MAP_GFX_TERRAIN_LINE_UP | MAP_GFX_TERRAIN_LINE_RIGHT | MAP_GFX_TERRAIN_LINE_DOWN | MAP_GFX_TERRAIN_LINE_LEFT;
if (y < DUNGEON_MAX_SIZE_Y - 1) {
const Tile *adjacentTile = GetTile(x, y + 1);
if (GetTerrainType(adjacentTile) == TERRAIN_TYPE_NORMAL) {
terrainLine &= ~(MAP_GFX_TERRAIN_LINE_UP);
}
}
if (y >= 1) {
const Tile *adjacentTile = GetTile(x, y - 1);
if (GetTerrainType(adjacentTile) == TERRAIN_TYPE_NORMAL) {
terrainLine &= ~(MAP_GFX_TERRAIN_LINE_DOWN);
}
}
if (x < DUNGEON_MAX_SIZE_X - 1) {
const Tile *adjacentTile = GetTile(x + 1, y);
if (GetTerrainType(adjacentTile) == TERRAIN_TYPE_NORMAL) {
terrainLine &= ~(MAP_GFX_TERRAIN_LINE_RIGHT);
}
}
if (x >= 1) {
const Tile *adjacentTile = GetTile(x - 1, y);
if (GetTerrainType(adjacentTile) == TERRAIN_TYPE_NORMAL) {
terrainLine &= ~(MAP_GFX_TERRAIN_LINE_LEFT);
}
}
mapGfxType = (s16) terrainLine;
if (tile->spawnOrVisibilityFlags & VISIBILITY_FLAG_VISITED) {
mapGfxType = (s16) (mapGfxType + MAP_GFX_TERRAIN_TILES_VISITED);
}
else {
mapGfxType = (s16) (mapGfxType + MAP_GFX_TERRAIN_TILES_REVEALED);
}
}
}
// Not possible on GBA.
if (gGameOptionsRef->mapOption == TOP_MAP_AND_TEAM_NO_BOTTOM) {
mapGfxType = (s16) (mapGfxType + 128);
}
else if (DoesNotHaveShadedMap() == TRUE) {
mapGfxType = (s16) (mapGfxType + 64);
}
}
else {
mapGfxType = 1;
gPlayerDotMapPosition.x = 100;
}
xDiv2 = x / 2;
yMinus = (y - 2) + yAdd;
yDiv2 = (yMinus / 2);
r3 = x - (xDiv2 * 2);
r3 += (yMinus - (yDiv2 * 2)) * 2;
dst = dungeon->dungeonMap.perTile[yDiv2][xDiv2].arr;
{
struct DungeonMapGfx *ptr = ((struct DungeonMapGfx *)(&sDungeonMapGfxFile->data));
src = ptr->gfx->unk0[mapGfxType * 4 + r3];
}
dst[0] = (dst[0] & src[0]) | src[1];
dst[1] = (dst[1] & src[2]) | src[3];
dst[2] = (dst[2] & src[4]) | src[5];
dst[3] = (dst[3] & src[6]) | src[7];
dst[4] = (dst[4] & src[8]) | src[9];
dst[5] = (dst[5] & src[10]) | src[11];
dst[6] = (dst[6] & src[12]) | src[13];
dst[7] = (dst[7] & src[14]) | src[15];
if (!dungeon->dungeonMap.copyAllAtOnce && !dungeon->dungeonMap.tileScheduledForCopy[yDiv2][xDiv2]) {
s32 id;
dungeon->dungeonMap.tileScheduledForCopy[yDiv2][xDiv2] = TRUE;
id = dungeon->dungeonMap.scheduledVramCopiesCount;
if (id < MAX_SCHEDULED_DUNGEON_MAP_COPIES) {
dungeon->dungeonMap.vramCopies[id].vramPtr = sDungeonMapVramDst + ((xDiv2 + yDiv2 * DUNGEON_MAP_MAX_X) * sizeof(struct UnkDungeonGlobal_1822C_Sub));
dungeon->dungeonMap.vramCopies[id].mapArrayPtr = dst;
dungeon->dungeonMap.vramCopies[id].boolPtr = &dungeon->dungeonMap.tileScheduledForCopy[yDiv2][xDiv2];
dungeon->dungeonMap.scheduledVramCopiesCount++;
}
else {
dungeon->dungeonMap.copyAllAtOnce = TRUE;
}
}
}
void CopyDungeonMapToVram(void)
{
s32 i;
Dungeon *dungeon = gDungeon;
if (dungeon == NULL)
return;
if (!dungeon->dungeonMap.copyToVram)
return;
if (sub_800EC74())
return;
if (!dungeon->dungeonMap.copyAllAtOnce) {
for (i = 0; i < dungeon->dungeonMap.scheduledVramCopiesCount; i++) {
struct DungeonMapVramCopy *ptr = &dungeon->dungeonMap.vramCopies[i];
u32 *src = ptr->mapArrayPtr;
u32 *dst = ptr->vramPtr;
if (gUnknown_202EDD0 == 0 || gUnknown_202EDD0 == 3) {
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
}
*ptr->boolPtr = FALSE;
}
}
else {
void *dst, *src;
dungeon->dungeonMap.copyAllAtOnce = FALSE;
dst = sDungeonMapVramDst;
src = dungeon->dungeonMap.perTile[0][0].arr;
for (i = 0; i < DUNGEON_MAX_SIZE_X * 8; i += 8) {
if (gUnknown_202EDD0 == 0 || gUnknown_202EDD0 == 3) {
CpuCopy(dst, src, 0x100);
}
dst += 0x100;
src += 0x100;
}
dungeon->dungeonMap.resetTilesScheduledForCopy = TRUE;
}
dungeon->dungeonMap.scheduledVramCopiesCount = 0;
}
void ShowPlayerDotOnMap(void)
{
if (gDungeon->unk181e8.inFloorMapMode)
return;
if (!gDungeon->unk181e8.unk18219)
return;
if (gPlayerDotMapPosition.x >= 100)
return;
if ((++sPlayerDotFrames & 8) == 0) {
SpriteOAM sprite = {0};
SpriteSetAffine1(&sprite, 0);
SpriteSetAffine2(&sprite, 0);
SpriteSetObjMode(&sprite, 0);
SpriteSetMosaic(&sprite, 0);
SpriteSetBpp(&sprite, 0);
SpriteSetShape(&sprite, 0);
SpriteSetMatrixNum(&sprite, 0);
SpriteSetSize(&sprite, 0);
SpriteSetTileNum(&sprite, 0x215);
SpriteSetPriority(&sprite, 0);
SpriteSetPalNum(&sprite, 15);
SpriteSetUnk6_0(&sprite, 0);
SpriteSetUnk6_1(&sprite, 0);
// Nulled on GBA
if (gGameOptionsRef->mapOption == TOP_MAP_AND_TEAM_NO_BOTTOM) {
SpriteSetX(&sprite, (gPlayerDotMapPosition.x * 4) + 16);
SpriteSetY(&sprite, (gPlayerDotMapPosition.y + 1) * 4);
nullsub_11(&sprite,0x100,NULL,NULL);
}
else {
SpriteSetX(&sprite, (gPlayerDotMapPosition.x * 4) + 8);
SpriteSetY(&sprite, (gPlayerDotMapPosition.y) * 4);
AddSprite(&sprite,0x100,NULL,NULL);
}
}
}
void ResetMapPlayerDotFrames(void)
{
sPlayerDotFrames = 0;
}
void ShowWholeRevealedDungeonMap(void)
{
s32 x, y;
gDungeon->dungeonMap.copyAllAtOnce = TRUE;
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) {
for (x = 0; x < DUNGEON_MAX_SIZE_X; x++) {
ShowDungeonMapAtPos(x, y);
}
}
}
void UpdateBgTilemapForDungeonMap(bool8 a0)
{
s32 id, count1, count2;
s32 i, j;
u16 tilemapValue;
if (gGameOptionsRef->mapOption == TOP_MAP_AND_TEAM_NO_BOTTOM) {
count1 = 15;
count2 = 0;
}
else if (a0) {
count1 = 14;
count2 = 0;
}
else {
count1 = 16;
count2 = 3;
}
tilemapValue = TILEMAP_TILE_NUM(0xB8) | TILEMAP_PAL(14);
id = 1;
for (i = 0; i < count1; i++) {
u16 *ptr = &gBgTilemaps[0][id][1];
for (j = 0; j < 28; j++) {
*ptr++ = tilemapValue++;
}
id++;
}
for (i = 0; i < count2; i++) {
u16 *ptr = &gBgTilemaps[0][id][1];
for (j = 0; j < 28; j++) {
*ptr++ = TILEMAP_TILE_NUM(0) | TILEMAP_PAL(14);
}
id++;
}
}
// BUG: Overflowing into vramCopies. They forgot that the array size is max X/Y divided by two...
void TryResetDungeonMapTilesScheduledForCopy(void)
{
s32 x, y;
Dungeon *dungeon = gDungeon;
if (dungeon->dungeonMap.resetTilesScheduledForCopy) {
#ifdef BUGFIX
for (y = 0; y < DUNGEON_MAP_MAX_Y; y++) {
for (x = 0; x < DUNGEON_MAP_MAX_X; x++) {
dungeon->dungeonMap.tileScheduledForCopy[y][x] = FALSE;
}
}
#else
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) {
for (x = 0; x < DUNGEON_MAX_SIZE_X; x++) {
dungeon->dungeonMap.tileScheduledForCopy[y][x] = FALSE;
}
}
#endif // BUGFIX
dungeon->dungeonMap.resetTilesScheduledForCopy = FALSE;
}
}

View File

@ -37,7 +37,7 @@ EWRAM_DATA Tile gOutOfBoundsTileData = {0};
EWRAM_INIT const Tile *gCurTilesetOobTile = {NULL};
extern u8 sub_8043CE4(u32);
extern void sub_80402AC(s32, s32);
extern void ShowDungeonMapAtPos(s32, s32);
extern int sprintf(char *, const char *, ...);
const Tile *GetTile(s32 x, s32 y)
@ -442,7 +442,7 @@ void sub_8049BB0(s32 x, s32 y)
void sub_8049ED4(void)
{
bool32 hallucinating, unk1820F;
bool32 hallucinating, showInvisibleTrapsMonsters;
u16 *src;
const Tile *tile;
s32 r7;
@ -455,7 +455,7 @@ void sub_8049ED4(void)
Dungeon *dungeon = gDungeon;
hallucinating = dungeon->unk181e8.hallucinating;
unk1820F = dungeon->unk181e8.unk1820F;
showInvisibleTrapsMonsters = dungeon->unk181e8.showInvisibleTrapsMonsters;
x = dungeon->unk181e8.cameraPixelPos.x >> 3;
r10 = gUnknown_80F6A4A[30 + x];
var_48 = gUnknown_80F6C06[30 + x];
@ -484,7 +484,7 @@ void sub_8049ED4(void)
{
Entity *tileObject = tile->object;
if (tileObject != NULL) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || unk1820F)) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || showInvisibleTrapsMonsters)) {
u8 trapType = GetEntInfo(tileObject)->flags;
src = &dungeon->unk12A18[trapType][r7];
}
@ -503,7 +503,7 @@ void sub_8049ED4(void)
for (j = 0; j < 23; j++) {
y &= 0x1F;
gUnknown_202B038[3][y][x] = *src;
gBgTilemaps[3][y][x] = *src;
src += 3;
y++;
r8++;
@ -529,7 +529,7 @@ void sub_8049ED4(void)
{
Entity *tileObject = tile->object;
if (tileObject != NULL) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || unk1820F)) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || showInvisibleTrapsMonsters)) {
u8 trapType = GetEntInfo(tileObject)->flags;
src = &dungeon->unk12A18[trapType][r7];
}
@ -562,7 +562,7 @@ void sub_804A1F0(s32 a0, s32 a1)
{
const Tile *tile;
u16 *src;
bool32 hallucinating, unk1820F;
bool32 hallucinating, showInvisibleTrapsMonsters;
s32 xTemp, yTemp;
s32 i;
s32 r8;
@ -574,7 +574,7 @@ void sub_804A1F0(s32 a0, s32 a1)
Dungeon *dungeon = gDungeon;
hallucinating = dungeon->unk181e8.hallucinating;
unk1820F = dungeon->unk181e8.unk1820F;
showInvisibleTrapsMonsters = dungeon->unk181e8.showInvisibleTrapsMonsters;
xTemp = dungeon->unk181e8.cameraPixelPos.x + a0;
yTemp = dungeon->unk181e8.cameraPixelPos.y + a1;
yTemp >>= 3;
@ -599,7 +599,7 @@ void sub_804A1F0(s32 a0, s32 a1)
{
Entity *tileObject = tile->object;
if (tileObject != NULL) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || unk1820F)) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || showInvisibleTrapsMonsters)) {
u8 trapType = GetEntInfo(tileObject)->flags;
src = &dungeon->unk12A18[trapType][r6];
}
@ -618,7 +618,7 @@ void sub_804A1F0(s32 a0, s32 a1)
for (i = 0; i < 23; i++) {
x &= 0x1F;
y &= 0x1F;
gUnknown_202B038[3][y][x] = *src;
gBgTilemaps[3][y][x] = *src;
src += 3;
y++;
r8++;
@ -640,7 +640,7 @@ void sub_804A1F0(s32 a0, s32 a1)
{
Entity *tileObject = tile->object;
if (tileObject != NULL) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || unk1820F)) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || showInvisibleTrapsMonsters)) {
u8 trapType = GetEntInfo(tileObject)->flags;
src = &dungeon->unk12A18[trapType][r6];
}
@ -664,7 +664,7 @@ void sub_804A49C(s32 a0, s32 a1)
{
const Tile *tile;
u16 *src;
bool32 hallucinating, unk1820F;
bool32 hallucinating, showInvisibleTrapsMonsters;
s32 xTemp, yTemp;
s32 i;
s32 var_2C;
@ -676,7 +676,7 @@ void sub_804A49C(s32 a0, s32 a1)
Dungeon *dungeon = gDungeon;
hallucinating = dungeon->unk181e8.hallucinating;
unk1820F = dungeon->unk181e8.unk1820F;
showInvisibleTrapsMonsters = dungeon->unk181e8.showInvisibleTrapsMonsters;
xTemp = dungeon->unk181e8.cameraPixelPos.x + a0;
yTemp = dungeon->unk181e8.cameraPixelPos.y + a1;
x = xTemp >> 3;
@ -700,7 +700,7 @@ void sub_804A49C(s32 a0, s32 a1)
{
Entity *tileObject = tile->object;
if (tileObject != NULL) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || unk1820F)) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || showInvisibleTrapsMonsters)) {
u8 trapType = GetEntInfo(tileObject)->flags;
src = &dungeon->unk12A18[trapType][r6];
}
@ -719,7 +719,7 @@ void sub_804A49C(s32 a0, s32 a1)
for (i = 0; i < 31; i++) {
x &= 0x1F;
y &= 0x1F;
gUnknown_202B038[3][y][x] = *src;
gBgTilemaps[3][y][x] = *src;
src++;
x++;
r9++;
@ -741,7 +741,7 @@ void sub_804A49C(s32 a0, s32 a1)
{
Entity *tileObject = tile->object;
if (tileObject != NULL) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || unk1820F)) {
if (GetEntityType(tileObject) == ENTITY_TRAP && (tileObject->isVisible || showInvisibleTrapsMonsters)) {
u8 trapType = GetEntInfo(tileObject)->flags;
src = &dungeon->unk12A18[trapType][r6];
}
@ -833,7 +833,7 @@ void sub_804A728(DungeonPos *pos, s32 a1, u8 a2, u8 a3)
for (j = 0; j < 21; j++) {
x &= 0x1F;
y &= 0x1F;
gUnknown_202B038[2][y][x] = *src;
gBgTilemaps[2][y][x] = *src;
src += 3;
y++;
var_34++;
@ -893,7 +893,7 @@ void sub_804AA60(void)
{
for(j = 0; j < 0x20; j++)
{
gUnknown_202B038[2][i][j] = 0;
gBgTilemaps[2][i][j] = 0;
}
}
sub_80098F8(2);
@ -1023,7 +1023,7 @@ void sub_804AC20(DungeonPos *pos)
for (x = xMin; x <= xMax; x++) {
tile = GetTileMut(x,y);
tile->spawnOrVisibilityFlags |= 3;
sub_80402AC(x,y);
ShowDungeonMapAtPos(x,y);
}
}
}

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "dungeon_message.h"
#include "dungeon_map.h"
#include "dungeon.h"
#include "structs/dungeon_entity.h"
#include "code_803E46C.h"
@ -33,7 +34,6 @@ static bool8 sub_8052DC0(Entity *);
extern bool8 sub_8045888(Entity *pokemon);
extern void sub_805E804(void);
extern void sub_803EAF0(s32, s32);
extern void sub_8040238(void);
extern void sub_8083E28(void);
extern u32 sub_8014140(s32 a0, const void *a1);
extern void sub_8083D30(void);
@ -44,7 +44,6 @@ extern void sub_8083CE0(u8 param_1);
extern u32 gUnknown_202EDD0;
extern u8 gUnknown_203B40C;
extern u8 gUnknown_202EE01;
extern s32 gUnknown_202EDCC;
extern const u8 gUnknown_80F7AE8[];
@ -379,8 +378,8 @@ void DisplayDungeonMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const u8
if (a2) {
sub_805E804();
sub_8040238();
if (gUnknown_202EE01) {
LoadDungeonMapPalette();
if (gShowDungeonMap) {
sub_803EAF0(0, 0);
}
else {
@ -510,7 +509,7 @@ void DisplayDungeonDialogue(const struct DungeonDialogueStruct *dialogueInfo)
}
if (dialogueInfo->unk0 != 1 && dialogueInfo->unk0 != 3) {
sub_8040238();
LoadDungeonMapPalette();
sub_803EAF0(0, 0);
}
sub_803E708(8, 9);
@ -556,7 +555,7 @@ bool32 DisplayDungeonYesNoMessage(struct MonDialogueSpriteInfo *monSpriteInfo, c
CloseFile(monPortrait.faceFile);
}
sub_8040238();
LoadDungeonMapPalette();
sub_803EAF0(0, 0);
if (chosenMenuIndex == 1)
@ -599,7 +598,7 @@ s32 DisplayDungeonMenuMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const
CloseFile(monPortrait.faceFile);
}
sub_8040238();
LoadDungeonMapPalette();
sub_803EAF0(0, 0);
return chosenMenuIndex;
}
@ -736,7 +735,7 @@ void sub_8052FB8(const u8 *str)
{
s32 i;
for (i = 1; i < 30; i++) {
gUnknown_202B038[0][0][i] = 0;
gBgTilemaps[0][0][i] = 0;
}
}
@ -786,7 +785,7 @@ void sub_8052FB8(const u8 *str)
ShowWindows(NULL, TRUE, TRUE);
sub_803E46C(9);
sub_8040238();
LoadDungeonMapPalette();
for (j = 0; j < 8; j++) {
SetBGPaletteBufferColorArray(240 + j, &gFontPalette[j]);
}

View File

@ -15,7 +15,7 @@
extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE];
extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE];
extern DungeonPos gUnknown_203B410;
extern DungeonPos gPlayerDotMapPosition;
extern Entity *gLeaderPointer; // 203B450
#include "data/dungeon_serializer.h"
@ -450,11 +450,11 @@ static void WriteDungeonVisibility(DataSerializer *seri)
WriteU8(seri, gDungeon->unk181e8.priority);
WriteU8(seri, gDungeon->unk181e8.visibilityRange);
WriteBool8(seri, gDungeon->unk181e8.blinded);
WriteBool8(seri, gDungeon->unk181e8.unk1820B);
WriteBool8(seri, gDungeon->unk181e8.allTilesRevealed);
WriteBool8(seri, gDungeon->unk181e8.unk1820C);
WriteBool8(seri, gDungeon->unk181e8.unk1820D);
WriteBool8(seri, gDungeon->unk181e8.unk1820E);
WriteBool8(seri, gDungeon->unk181e8.unk1820F);
WriteBool8(seri, gDungeon->unk181e8.showAllFloorItems);
WriteBool8(seri, gDungeon->unk181e8.showInvisibleTrapsMonsters);
WriteBool8(seri, gDungeon->unk181e8.hallucinating);
WriteBool8(seri, gDungeon->unk181e8.unk18211);
WriteBool8(seri, gDungeon->unk181e8.unk18213);
@ -847,11 +847,11 @@ static void ReadDungeonVisibility(DataSerializer *seri)
gDungeon->unk181e8.priority = ReadU8(seri);
gDungeon->unk181e8.visibilityRange = ReadU8(seri);
gDungeon->unk181e8.blinded = ReadBool8(seri);
gDungeon->unk181e8.unk1820B = ReadBool8(seri);
gDungeon->unk181e8.allTilesRevealed = ReadBool8(seri);
gDungeon->unk181e8.unk1820C = ReadBool8(seri);
gDungeon->unk181e8.unk1820D = ReadBool8(seri);
gDungeon->unk181e8.unk1820E = ReadBool8(seri);
gDungeon->unk181e8.unk1820F = ReadBool8(seri);
gDungeon->unk181e8.showAllFloorItems = ReadBool8(seri);
gDungeon->unk181e8.showInvisibleTrapsMonsters = ReadBool8(seri);
gDungeon->unk181e8.hallucinating = ReadBool8(seri);
gDungeon->unk181e8.unk18211 = ReadBool8(seri);
gDungeon->unk181e8.unk18213 = ReadBool8(seri);
@ -1100,8 +1100,8 @@ static void ReadMonster(DataSerializer *seri, bool8 isTeamMember, s32 index)
gLeaderPointer = NULL;
if (monEntInfo->isTeamLeader) {
gUnknown_203B410.x = mon->pos.x;
gUnknown_203B410.y = mon->pos.y;
gPlayerDotMapPosition.x = mon->pos.x;
gPlayerDotMapPosition.y = mon->pos.y;
}
LoadIQSkills(mon);

View File

@ -418,3 +418,39 @@ void sub_8085B4C(struct_8085B80 a0[], s16 *a1[], Entity *a2[], s32 a3)
a0[i].unk8 = a1[i][2];
}
}
bool8 sub_8085B80(struct_8085B80 *a0)
{
s16 *unkCPtr;
int i;
bool8 ret = FALSE;
for (i = 0; i < gUnknown_202F3D8; i++) {
Entity *entity = a0[i].unk4;
EntityInfo *enInfo = GetEntInfo(entity);
unkCPtr = a0[i].unkC;
if (a0[i].unk0 != 0) {
ret = TRUE;
if (a0[i].unk8 == 0) {
unkCPtr = unkCPtr + 4;
if (unkCPtr[2] == 0) {
a0[i].unk0 = 0;
enInfo->action.direction = unkCPtr[0] & DIRECTION_MASK;
sub_806CDD4(entity, 7, unkCPtr[0]);
sub_80856C8(entity, unkCPtr[5], unkCPtr[6]);
continue;
}
a0[i].unk8 = unkCPtr[2];
a0[i].unkC = unkCPtr;
enInfo->action.direction = unkCPtr[0] & DIRECTION_MASK;
sub_806CDD4(entity, 0, (int)*unkCPtr);
}
a0[i].unk8--;
IncreaseEntityPixelPos(entity,
gAdjacentTileOffsets[*unkCPtr].x * unkCPtr[1] * 0x100,
gAdjacentTileOffsets[*unkCPtr].y * unkCPtr[1] * 0x100);
}
}
return ret;
}

View File

@ -153,8 +153,8 @@ void FriendAreasMap_UpdateBg(void)
x1 &= 0x1F;
y1 &= 0x1F;
gUnknown_202B038[2][y1][x1] = gFriendAreasMapPtr->unk2014[y2][x2];
gUnknown_202B038[3][y1][x1] = gFriendAreasMapPtr->unk14[y2][x2];
gBgTilemaps[2][y1][x1] = gFriendAreasMapPtr->unk2014[y2][x2];
gBgTilemaps[3][y1][x1] = gFriendAreasMapPtr->unk14[y2][x2];
x2++;
x1++;
}

View File

@ -140,7 +140,7 @@ extern void nullsub_84(Entity *);
extern void nullsub_85(Entity *);
extern void sub_803F580(u32);
extern void sub_8040A84(void);
extern void ShowWholeRevealedDungeonMap(void);
extern void sub_8041D9C(Entity *);
extern void sub_8041DB0(Entity *pokemon);
extern void sub_8041CA8(Entity *);
@ -713,7 +713,7 @@ void HandleScannerOrb(Entity* pokemon, Entity* target)
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FAEA0); // Item locations became evident
sub_803F580(0);
sub_8040A84();
ShowWholeRevealedDungeonMap();
EntityUpdateStatusSprites(target);
}
}
@ -738,7 +738,7 @@ void HandleStairsOrb(Entity* pokemon, Entity* target)
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FAEC8);
sub_803F580(0);
sub_8040A84();
ShowWholeRevealedDungeonMap();
EntityUpdateStatusSprites(target);
}
}
@ -758,7 +758,7 @@ void HandleRadarOrb(Entity* pokemon, Entity* target)
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FAFAC);
sub_803F580(0);
sub_8040A84();
ShowWholeRevealedDungeonMap();
EntityUpdateStatusSprites(target);
}
}

View File

@ -43,7 +43,7 @@ extern void sub_8068FE0(Entity *, u32, Entity *r2);
extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
extern void sub_807FC3C(DungeonPos *, u32, u32);
extern void sub_8042A64(DungeonPos *);
extern void sub_8040A84(void);
extern void ShowWholeRevealedDungeonMap(void);
extern void sub_80498A8(s32, s32);
extern void sub_8042A54(DungeonPos *);
extern void sub_8049BB0(s32, s32);
@ -954,7 +954,7 @@ bool8 TrapbustOrbAction(Entity * pokemon,Entity * target, Move *move, s32 param_
}
if (foundTrap) {
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FD1B0);
sub_8040A84();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
}
else {
@ -1106,7 +1106,7 @@ bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4)
else {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD0B8);
}
sub_8040A84();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
return filledInTile;
}

View File

@ -39,7 +39,7 @@ EWRAM_DATA static s32 sUnknown_202B024 = 0;
EWRAM_DATA static s32 sCharHeight[2] = {0};
EWRAM_DATA static u32 sTextShadowMask = 0; // Some text color info is stored; retrieve via "& 0xF"
EWRAM_DATA static u8 sDrawTextShadow = 0;
EWRAM_DATA ALIGNED(4) u16 gUnknown_202B038[4][32][32] = {0};
EWRAM_DATA ALIGNED(4) u16 gBgTilemaps[4][32][32] = {0};
IWRAM_DATA static s16 gUnknown_3000E94[161] = {0};
@ -190,12 +190,12 @@ void LoadCharmaps(void)
sCharacterSpacing = 0;
for (i = 0; i < 20; i++) {
gUnknown_202B038[0][i][0] = 0xf279;
gUnknown_202B038[1][i][0] = 0xf27a;
gBgTilemaps[0][i][0] = 0xf279;
gBgTilemaps[1][i][0] = 0xf27a;
for (j = 1; j < 32; j++) {
gUnknown_202B038[0][i][j] = 0;
gUnknown_202B038[1][i][j] = 0xf27a;
gBgTilemaps[0][i][j] = 0;
gBgTilemaps[1][i][j] = 0xf27a;
}
}
@ -297,7 +297,7 @@ static void SaveUnkTextStructAndXXX_8006438(const Windows *a0, bool8 a1, bool8 a
sUnknown_202AFC0.id[i] = a0->id[i];
if (a0->id[i].width) {
sub_8006554(gUnknown_2027370, (u32 *)VRAM, sUnknown_20274B4, &gUnknown_202B038[0][0][0], gUnknown_80B8804[i], &a0->id[i], a1, r9, a3, 0);
sub_8006554(gUnknown_2027370, (u32 *)VRAM, sUnknown_20274B4, &gBgTilemaps[0][0][0], gUnknown_80B8804[i], &a0->id[i], a1, r9, a3, 0);
sub_80089AC(&a0->id[i], a3);
r9 += a0->id[i].width * a0->id[i].unk10;
}
@ -1471,8 +1471,8 @@ void sub_8007334(s32 a0)
for (i = 0; i < textStructPtr->unk6; i++) {
s32 id = textStructPtr->unk0;
for (j = 0; j < textStructPtr->unk4; j++) {
gUnknown_202B038[0][r6][id] &= ~0x3ff;
gUnknown_202B038[0][r6][id] |= r5;
gBgTilemaps[0][r6][id] &= ~0x3ff;
gBgTilemaps[0][r6][id] |= r5;
id++;
r5++;
}
@ -1864,246 +1864,64 @@ UNUSED static void nullsub_158(void)
{
}
#ifdef NONMATCHING // https://decomp.me/scratch/AU1bH
static void sub_8007BA8(UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color)
void sub_8007BA8(struct UnkTextStruct1 *windows, u32 windowId, s32 x, s32 y, s32 a4, s32 color)
{
s32 iVar1; // r1
s32 iVar3;
s32 iVar9; // r8?
u32 *dst;
s32 i;
s32 xDiv8, yDiv8;
s32 j, k;
u32 *r4;
u32 r5;
u32 r6;
UnkTextStruct1 *ip;
s32 sp4;
s32 sp8;
u32 sp1C; // Used correctly
s32 yeah;
u32 *sp10; // r2?
ip = &a0[a1];
sp8 = y / 8;
if (sp8 >= ip->unk8)
struct UnkTextStruct1 *window = &windows[windowId];
yDiv8 = y / 8;
if (yDiv8 >= window->unk8)
return;
yeah = ip->unk4 * sp8;
dst = window->unk18 + (((yDiv8 * window->unk4) + x / 8) * 8);
dst += y - (yDiv8 * 8);
r4 = ip->unk18 + ((yeah + x / 8) * 8);
r4 += (sp8 * -8) + y;
for (i = 0; i < color; i++) {
u32 *loopDst = dst;
xDiv8 = x / 8;
for (sp4 = 0; sp4 < color; sp4++) {
sp10 = r4;
iVar1 = x / 8;
for (j = 0; j < a4; j += 8) {
if (xDiv8 < window->unk4) {
u32 andBits = 0xF0000000;
u32 orBits = 0xE0000000;
u32 bits = 0;
u32 var = *loopDst;
for (iVar9 = 0; iVar9 < a4; iVar9 += 8) {
if (iVar1 >= ip->unk4)
break;
for (k = 0; k < 8; k++) {
if (!(var & andBits))
bits |= orBits;
r6 = 0xF0000000;
r5 = 0xE0000000;
sp1C = 0;
andBits >>= 4;
orBits >>= 4;
}
for (iVar3 = 0; iVar3 < 8; iVar3++) {
if ((sp10[0] & r6) == 0)
sp1C |= r5;
*loopDst |= bits;
if (window->unk3C > loopDst)
window->unk3C = loopDst;
if (window->unk40 < loopDst)
window->unk40 = loopDst;
r6 >>= 4;
r5 >>= 4;
xDiv8++;
loopDst += 8;
}
else {
break;
}
sp10[0] |= sp1C;
if (ip->unk3C > sp10)
ip->unk3C = sp10;
if (ip->unk40 < sp10)
ip->unk40 = sp10;
sp10 += 8;
iVar1++;
}
y++;
r4++;
dst++;
if ((y % 8) == 0) {
r4 += ip->unk20;
sp8++;
if (sp8 >= ip->unk8)
dst += window->unk20;
yDiv8++;
if (yDiv8 >= window->unk8)
return;
}
sp4++;
}
}
#else
NAKED
static void sub_8007BA8(UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color)
{
asm_unified(
"push {r4-r7,lr}\n"
"\tmov r7, r10\n"
"\tmov r6, r9\n"
"\tmov r5, r8\n"
"\tpush {r5-r7}\n"
"\tsub sp, 0x20\n"
"\tstr r2, [sp]\n"
"\tlsls r2, r1, 3\n"
"\tadds r2, r1\n"
"\tlsls r2, 3\n"
"\tadds r0, r2\n"
"\tmov r12, r0\n"
"\tadds r0, r3, 0\n"
"\tcmp r3, 0\n"
"\tbge _08007BC8\n"
"\tadds r0, r3, 0x7\n"
"_08007BC8:\n"
"\tasrs r0, 3\n"
"\tstr r0, [sp, 0x8]\n"
"\tmov r1, r12\n"
"\tmovs r2, 0x8\n"
"\tldrsh r0, [r1, r2]\n"
"\tldr r4, [sp, 0x8]\n"
"\tcmp r4, r0\n"
"\tbge _08007CC4\n"
"\tmovs r7, 0x4\n"
"\tldrsh r0, [r1, r7]\n"
"\tadds r1, r4, 0\n"
"\tmuls r1, r0\n"
"\tldr r0, [sp]\n"
"\tcmp r0, 0\n"
"\tbge _08007BE8\n"
"\tadds r0, 0x7\n"
"_08007BE8:\n"
"\tasrs r0, 3\n"
"\tadds r0, r1, r0\n"
"\tlsls r0, 5\n"
"\tmov r2, r12\n"
"\tldr r1, [r2, 0x18]\n"
"\tadds r4, r1, r0\n"
"\tldr r7, [sp, 0x8]\n"
"\tlsls r0, r7, 3\n"
"\tsubs r0, r3, r0\n"
"\tlsls r0, 2\n"
"\tadds r4, r0\n"
"\tmovs r0, 0\n"
"\tstr r0, [sp, 0x4]\n"
"\tldr r1, [sp, 0x44]\n"
"\tcmp r0, r1\n"
"\tbge _08007CC4\n"
"_08007C08:\n"
"\tadds r2, r4, 0\n"
"\tldr r0, [sp]\n"
"\tcmp r0, 0\n"
"\tbge _08007C12\n"
"\tadds r0, 0x7\n"
"_08007C12:\n"
"\tasrs r1, r0, 3\n"
"\tmovs r7, 0\n"
"\tmov r8, r7\n"
"\tadds r3, 0x1\n"
"\tstr r3, [sp, 0xC]\n"
"\tadds r4, 0x4\n"
"\tstr r4, [sp, 0x14]\n"
"\tldr r0, [sp, 0x40]\n"
"\tcmp r8, r0\n"
"\tbge _08007C94\n"
"_08007C26:\n"
"\tmov r3, r12\n"
"\tmovs r4, 0x4\n"
"\tldrsh r0, [r3, r4]\n"
"\tcmp r1, r0\n"
"\tbge _08007C94\n"
"\tmovs r6, 0xF0\n"
"\tlsls r6, 24\n"
"\tmovs r5, 0xE0\n"
"\tlsls r5, 24\n"
"\tmovs r7, 0\n"
"\tstr r7, [sp, 0x1C]\n"
"\tldr r4, [r2]\n"
"\tadds r3, r4, 0\n"
"\tmov r0, r12\n"
"\tldr r0, [r0, 0x3C]\n"
"\tmov r9, r0\n"
"\tmov r7, r12\n"
"\tldr r7, [r7, 0x40]\n"
"\tmov r10, r7\n"
"\tadds r1, 0x1\n"
"\tstr r1, [sp, 0x10]\n"
"\tadds r0, r2, 0\n"
"\tadds r0, 0x20\n"
"\tstr r0, [sp, 0x18]\n"
"\tmovs r1, 0x8\n"
"\tadd r8, r1\n"
"\tmovs r1, 0x7\n"
"_08007C5C:\n"
"\tadds r0, r4, 0\n"
"\tands r0, r6\n"
"\tcmp r0, 0\n"
"\tbne _08007C6A\n"
"\tldr r7, [sp, 0x1C]\n"
"\torrs r7, r5\n"
"\tstr r7, [sp, 0x1C]\n"
"_08007C6A:\n"
"\tlsrs r6, 4\n"
"\tlsrs r5, 4\n"
"\tsubs r1, 0x1\n"
"\tcmp r1, 0\n"
"\tbge _08007C5C\n"
"\tldr r0, [sp, 0x1C]\n"
"\torrs r3, r0\n"
"\tstr r3, [r2]\n"
"\tcmp r9, r2\n"
"\tbls _08007C82\n"
"\tmov r1, r12\n"
"\tstr r2, [r1, 0x3C]\n"
"_08007C82:\n"
"\tcmp r10, r2\n"
"\tbcs _08007C8A\n"
"\tmov r3, r12\n"
"\tstr r2, [r3, 0x40]\n"
"_08007C8A:\n"
"\tldr r1, [sp, 0x10]\n"
"\tldr r2, [sp, 0x18]\n"
"\tldr r4, [sp, 0x40]\n"
"\tcmp r8, r4\n"
"\tblt _08007C26\n"
"_08007C94:\n"
"\tldr r3, [sp, 0xC]\n"
"\tldr r4, [sp, 0x14]\n"
"\tmovs r0, 0x7\n"
"\tands r0, r3\n"
"\tcmp r0, 0\n"
"\tbne _08007CB8\n"
"\tmov r7, r12\n"
"\tldr r0, [r7, 0x20]\n"
"\tlsls r0, 2\n"
"\tadds r4, r0\n"
"\tldr r0, [sp, 0x8]\n"
"\tadds r0, 0x1\n"
"\tstr r0, [sp, 0x8]\n"
"\tmovs r1, 0x8\n"
"\tldrsh r0, [r7, r1]\n"
"\tldr r2, [sp, 0x8]\n"
"\tcmp r2, r0\n"
"\tbge _08007CC4\n"
"_08007CB8:\n"
"\tldr r7, [sp, 0x4]\n"
"\tadds r7, 0x1\n"
"\tstr r7, [sp, 0x4]\n"
"\tldr r0, [sp, 0x44]\n"
"\tcmp r7, r0\n"
"\tblt _08007C08\n"
"_08007CC4:\n"
"\tadd sp, 0x20\n"
"\tpop {r3-r5}\n"
"\tmov r8, r3\n"
"\tmov r9, r4\n"
"\tmov r10, r5\n"
"\tpop {r4-r7}\n"
"\tpop {r0}\n"
"\tbx r0");
}
#endif // NONMATCHING
UNUSED static void sub_8007CD4(u32 a0, s32 a1, s32 a2, s32 a3, s32 a4)
{
@ -2114,171 +1932,69 @@ UNUSED static void nullsub_159(void)
{
}
NAKED // Very similar to sub_8007BA8
static void sub_8007D00(UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color)
// Very similar to sub_8007BA8. It clears bits instead of setting them.
void sub_8007D00(struct UnkTextStruct1 *windows, u32 windowId, s32 x, s32 y, s32 a4, s32 color)
{
asm_unified(
"push {r4-r7,lr}\n"
"\tmov r7, r10\n"
"\tmov r6, r9\n"
"\tmov r5, r8\n"
"\tpush {r5-r7}\n"
"\tsub sp, 0x20\n"
"\tstr r2, [sp]\n"
"\tlsls r2, r1, 3\n"
"\tadds r2, r1\n"
"\tlsls r2, 3\n"
"\tadds r0, r2\n"
"\tmov r12, r0\n"
"\tadds r0, r3, 0\n"
"\tcmp r3, 0\n"
"\tbge _08007D20\n"
"\tadds r0, r3, 0x7\n"
"_08007D20:\n"
"\tasrs r0, 3\n"
"\tstr r0, [sp, 0x8]\n"
"\tmov r1, r12\n"
"\tmovs r2, 0x8\n"
"\tldrsh r0, [r1, r2]\n"
"\tldr r4, [sp, 0x8]\n"
"\tcmp r4, r0\n"
"\tbge _08007E0E\n"
"\tmovs r5, 0x4\n"
"\tldrsh r0, [r1, r5]\n"
"\tadds r1, r4, 0\n"
"\tmuls r1, r0\n"
"\tldr r0, [sp]\n"
"\tcmp r0, 0\n"
"\tbge _08007D40\n"
"\tadds r0, 0x7\n"
"_08007D40:\n"
"\tasrs r0, 3\n"
"\tadds r0, r1, r0\n"
"\tlsls r0, 5\n"
"\tmov r2, r12\n"
"\tldr r1, [r2, 0x18]\n"
"\tadds r4, r1, r0\n"
"\tldr r5, [sp, 0x8]\n"
"\tlsls r0, r5, 3\n"
"\tsubs r0, r3, r0\n"
"\tlsls r0, 2\n"
"\tadds r4, r0\n"
"\tmovs r0, 0\n"
"\tb _08007E06\n"
"_08007D5A:\n"
"\tadds r2, r4, 0\n"
"\tldr r0, [sp]\n"
"\tcmp r0, 0\n"
"\tbge _08007D64\n"
"\tadds r0, 0x7\n"
"_08007D64:\n"
"\tasrs r1, r0, 3\n"
"\tmovs r5, 0\n"
"\tmov r8, r5\n"
"\tadds r3, 0x1\n"
"\tstr r3, [sp, 0xC]\n"
"\tadds r4, 0x4\n"
"\tstr r4, [sp, 0x14]\n"
"\tldr r0, [sp, 0x40]\n"
"\tcmp r8, r0\n"
"\tbge _08007DE0\n"
"_08007D78:\n"
"\tmov r3, r12\n"
"\tmovs r4, 0x4\n"
"\tldrsh r0, [r3, r4]\n"
"\tcmp r1, r0\n"
"\tbge _08007DE0\n"
"\tmovs r4, 0xF0\n"
"\tlsls r4, 24\n"
"\tmovs r6, 0xE0\n"
"\tlsls r6, 24\n"
"\tmovs r7, 0\n"
"\tldr r5, [r2]\n"
"\tstr r5, [sp, 0x1C]\n"
"\tadds r3, r5, 0\n"
"\tmov r0, r12\n"
"\tldr r0, [r0, 0x3C]\n"
"\tmov r9, r0\n"
"\tmov r5, r12\n"
"\tldr r5, [r5, 0x40]\n"
"\tmov r10, r5\n"
"\tadds r1, 0x1\n"
"\tstr r1, [sp, 0x10]\n"
"\tadds r0, r2, 0\n"
"\tadds r0, 0x20\n"
"\tstr r0, [sp, 0x18]\n"
"\tmovs r1, 0x8\n"
"\tadd r8, r1\n"
"\tmovs r1, 0x7\n"
"_08007DAE:\n"
"\tldr r0, [sp, 0x1C]\n"
"\tands r0, r4\n"
"\tcmp r0, r6\n"
"\tbne _08007DB8\n"
"\torrs r7, r4\n"
"_08007DB8:\n"
"\tlsrs r4, 4\n"
"\tlsrs r6, 4\n"
"\tsubs r1, 0x1\n"
"\tcmp r1, 0\n"
"\tbge _08007DAE\n"
"\tbics r3, r7\n"
"\tstr r3, [r2]\n"
"\tcmp r9, r2\n"
"\tbls _08007DCE\n"
"\tmov r3, r12\n"
"\tstr r2, [r3, 0x3C]\n"
"_08007DCE:\n"
"\tcmp r10, r2\n"
"\tbcs _08007DD6\n"
"\tmov r4, r12\n"
"\tstr r2, [r4, 0x40]\n"
"_08007DD6:\n"
"\tldr r1, [sp, 0x10]\n"
"\tldr r2, [sp, 0x18]\n"
"\tldr r5, [sp, 0x40]\n"
"\tcmp r8, r5\n"
"\tblt _08007D78\n"
"_08007DE0:\n"
"\tldr r3, [sp, 0xC]\n"
"\tldr r4, [sp, 0x14]\n"
"\tmovs r0, 0x7\n"
"\tands r0, r3\n"
"\tcmp r0, 0\n"
"\tbne _08007E02\n"
"\tmov r1, r12\n"
"\tldr r0, [r1, 0x20]\n"
"\tlsls r0, 2\n"
"\tadds r4, r0\n"
"\tldr r2, [sp, 0x8]\n"
"\tadds r2, 0x1\n"
"\tstr r2, [sp, 0x8]\n"
"\tmovs r5, 0x8\n"
"\tldrsh r0, [r1, r5]\n"
"\tcmp r2, r0\n"
"\tbge _08007E0E\n"
"_08007E02:\n"
"\tldr r0, [sp, 0x4]\n"
"\tadds r0, 0x1\n"
"_08007E06:\n"
"\tstr r0, [sp, 0x4]\n"
"\tldr r1, [sp, 0x44]\n"
"\tcmp r0, r1\n"
"\tblt _08007D5A\n"
"_08007E0E:\n"
"\tadd sp, 0x20\n"
"\tpop {r3-r5}\n"
"\tmov r8, r3\n"
"\tmov r9, r4\n"
"\tmov r10, r5\n"
"\tpop {r4-r7}\n"
"\tpop {r0}\n"
"\tbx r0");
u32 *dst;
s32 i;
s32 xDiv8, yDiv8;
s32 j, k;
struct UnkTextStruct1 *window = &windows[windowId];
yDiv8 = y / 8;
if (yDiv8 >= window->unk8)
return;
dst = window->unk18 + (((yDiv8 * window->unk4) + x / 8) * 8);
dst += y - (yDiv8 * 8);
for (i = 0; i < color; i++) {
u32 *loopDst = dst;
xDiv8 = x / 8;
for (j = 0; j < a4; j += 8) {
if (xDiv8 < window->unk4) {
u32 andBits = 0xF0000000;
u32 equalBits = 0xE0000000;
u32 bits = 0;
u32 var = *loopDst;
for (k = 0; k < 8; k++) {
if ((var & andBits) == equalBits)
bits |= andBits;
andBits >>= 4;
equalBits >>= 4;
}
*loopDst &= ~(bits);
if (window->unk3C > loopDst)
window->unk3C = loopDst;
if (window->unk40 < loopDst)
window->unk40 = loopDst;
xDiv8++;
loopDst += 8;
}
else {
break;
}
}
y++;
dst++;
if ((y % 8) == 0) {
dst += window->unk20;
yDiv8++;
if (yDiv8 >= window->unk8)
return;
}
}
}
void sub_8007E20(u32 a0, u32 a1, u32 a2, u32 a3, u32 a4, u32 *a5, u32 a6)
{
sub_8007E64(gUnknown_2027370, gUnknown_202B038[0], a0, a1, a2, a3, a4, a5, a6);
sub_8007E64(gUnknown_2027370, gBgTilemaps[0], a0, a1, a2, a3, a4, a5, a6);
}
UNUSED static void nullsub_160(void)
@ -2355,7 +2071,7 @@ static u32 FlipPixelsHorizontally(u32 a0)
UNUSED static void sub_8007FEC(u32 a0, u32 a1, u32 a2, u32 a3, u32 a4, u32 *a5, u32 a6)
{
sub_8008030(gUnknown_2027370, gUnknown_202B038[0], a0, a1, a2, a3, a4, a5, a6);
sub_8008030(gUnknown_2027370, gBgTilemaps[0], a0, a1, a2, a3, a4, a5, a6);
}
UNUSED static void nullsub_161(void)
@ -2459,7 +2175,7 @@ UNUSED static void sub_80081A4(s32 a0, s32 a3, s32 a4, s32 a7Id)
void DisplayMonPortraitSprite(s32 a0, const u8 *compressedData, s32 a2)
{
DisplayMonPortrait(gUnknown_2027370, gUnknown_202B038[0], a0, compressedData, a2);
DisplayMonPortrait(gUnknown_2027370, gBgTilemaps[0], a0, compressedData, a2);
}
UNUSED static void nullsub_162(void)
@ -2550,7 +2266,7 @@ static void DisplayMonPortraitFlipped(UnkTextStruct1 *a0, s32 a1, const u8 *comp
UNUSED static void sub_8008468(u32 a0, u32 a1, u32 a2, u32 a3, u32 a4, u32 a6)
{
sub_80084A4(gUnknown_2027370, gUnknown_202B038[0], a0, a1, a2, a3, a4, a6);
sub_80084A4(gUnknown_2027370, gBgTilemaps[0], a0, a1, a2, a3, a4, a6);
}
UNUSED static void nullsub_164(void)
@ -3083,14 +2799,14 @@ UNUSED static bool8 sub_8008DA8(void)
UNUSED static void sub_8008DAC(s32 a0, s32 a1, s32 a2)
{
gUnknown_202B038[0][a1][a0] = a2;
gBgTilemaps[0][a1][a0] = a2;
gUnknown_20274A5 = TRUE;
}
void sub_8008DC8(s32 a0, s32 a1, u16 a2, s32 a3)
{
gUnknown_202B038[0][a1][a0] = a2;
gUnknown_202B038[1][a1][a0] = a3;
gBgTilemaps[0][a1][a0] = a2;
gBgTilemaps[1][a1][a0] = a3;
gUnknown_20274A5 = TRUE;
}
@ -3106,7 +2822,7 @@ UNUSED static void sub_8008DF4(s32 a0, s32 a1, u8 *a2)
if (r1 >= 97 && r1 <= 122) {
r1 -= 32;
}
gUnknown_202B038[0][a1][a0] = 0xF000 | (r1 + 0x258);
gBgTilemaps[0][a1][a0] = 0xF000 | (r1 + 0x258);
a2++;
a0++;
}
@ -3128,7 +2844,7 @@ UNUSED static void sub_8008E58(s32 a0, s32 a1, u8 *a2, s32 a3)
if (r1 >= 97 && r1 <= 122) {
r1 -= 32;
}
gUnknown_202B038[0][a1][a0] = 0xF000 | (r1 + 0x258);
gBgTilemaps[0][a1][a0] = 0xF000 | (r1 + 0x258);
a2++;
a0++;
a3--;
@ -3432,14 +3148,14 @@ static void sub_8009388(void)
{
s32 i, j;
gUnknown_202B038[0][0][0] = 0xF279;
gUnknown_202B038[1][0][0] = 0xF27A;
gBgTilemaps[0][0][0] = 0xF279;
gBgTilemaps[1][0][0] = 0xF27A;
for (i = sUnknown_202B020; i < sUnknown_202B024; i++) {
gUnknown_202B038[0][i][0] = 0xF279;
gUnknown_202B038[1][i][0] = 0xF27A;
gBgTilemaps[0][i][0] = 0xF279;
gBgTilemaps[1][i][0] = 0xF27A;
for (j = 1; j < 32; j++) {
gUnknown_202B038[0][i][j] = 0;
gUnknown_202B038[1][i][j] = 0xF27A;
gBgTilemaps[0][i][j] = 0;
gBgTilemaps[1][i][j] = 0xF27A;
}
}
}
@ -3448,14 +3164,14 @@ void sub_8009408(s32 from, s32 to)
{
s32 i, j;
gUnknown_202B038[0][0][0] = 0xF279;
gUnknown_202B038[1][0][0] = 0xF27A;
gBgTilemaps[0][0][0] = 0xF279;
gBgTilemaps[1][0][0] = 0xF27A;
for (i = from; i < to; i++) {
gUnknown_202B038[0][i][0] = 0xF279;
gUnknown_202B038[1][i][0] = 0xF27A;
gBgTilemaps[0][i][0] = 0xF279;
gBgTilemaps[1][i][0] = 0xF27A;
for (j = 1; j < 32; j++) {
gUnknown_202B038[0][i][j] = 0;
gUnknown_202B038[1][i][j] = 0xF27A;
gBgTilemaps[0][i][j] = 0;
gBgTilemaps[1][i][j] = 0xF27A;
}
}
gUnknown_20274A5 = TRUE;
@ -3471,8 +3187,8 @@ UNUSED static void sub_8009488(s32 strArrId)
for (i = 0; i < strPtr->unk6; i++) {
id1 = strPtr->unk0;
for (j = 0; j < strPtr->unk4; j++) {
gUnknown_202B038[0][id0][id1] &= 0xFC00;
gUnknown_202B038[1][id0][id1] = 0xF27A;
gBgTilemaps[0][id0][id1] &= 0xFC00;
gBgTilemaps[1][id0][id1] = 0xF27A;
id1++;
}
id0++;
@ -3492,8 +3208,8 @@ void sub_8009524(s32 strArrId)
for (i = 0; i < strPtr->unk6 + 2; i++) {
s32 id1 = strPtr->unk0 - 1;
for (j = 0; j < strPtr->unk4 + 2; j++) {
gUnknown_202B038[0][id0][id1] &= 0xFC00;
gUnknown_202B038[1][id0][id1] = 0xF27A;
gBgTilemaps[0][id0][id1] &= 0xFC00;
gBgTilemaps[1][id0][id1] = 0xF27A;
id1++;
}
id0++;

View File

@ -84,7 +84,7 @@ const u8 gDungeonWaterType[76] = {
DUNGEON_WATER_TYPE_NONE,
};
extern void sub_80402AC(s32, s32);
extern void ShowDungeonMapAtPos(s32, s32);
extern void sub_8049BB0(s32, s32);
void sub_8042A14(DungeonPos *);
@ -136,7 +136,7 @@ bool8 sub_804AD34(DungeonPos *pos)
{
sub_80498A8(x + pos->x, y + pos->y);
sub_8049BB0(x + pos->x, y + pos->y);
sub_80402AC(x + pos->x, y + pos->y);
ShowDungeonMapAtPos(x + pos->x, y + pos->y);
}
}
}
@ -198,7 +198,7 @@ void sub_804AE84(DungeonPos *pos)
for(x = -1; x < 2; x++)
{
sub_80498A8(x + pos->x, y + pos->y);
sub_80402AC(x + pos->x, y + pos->y);
ShowDungeonMapAtPos(x + pos->x, y + pos->y);
}
}

View File

@ -58,7 +58,7 @@ extern u32 gUnknown_8106A50;
void sub_806A9B4(Entity *, u32);
void sub_80461C8(DungeonPos *, u32);
void sub_80402AC(s32, s32);
void ShowDungeonMapAtPos(s32, s32);
s16 sub_803D970(u32);
bool8 sub_806AA0C(s32, s32);
void sub_80421EC(DungeonPos *, u32);
@ -247,7 +247,7 @@ void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4)
if (HasHeldItem(target, ITEM_TRAP_SCARF)) {
text = *gUnknown_80FDB5C;
}
if ((flag == TRUE) || (gDungeon->unk181e8.unk1820F != 0)) {
if ((flag == TRUE) || (gDungeon->unk181e8.showInvisibleTrapsMonsters != 0)) {
if (rand < 0) text = *gUnknown_80FDB7C;
}
else if (rand < 0xf) {
@ -771,7 +771,7 @@ void HandlePokemonTrap(Entity *param_1,DungeonPos *pos)
counter++;
}
}
sub_80402AC(x,y);
ShowDungeonMapAtPos(x,y);
}
}
}

View File

@ -367,8 +367,8 @@ static void UpdateBg(void)
x1 &= 0x1F;
y1 &= 0x1F;
gUnknown_202B038[2][y1][x1] = sWorldMapPtr->unk3114[y2][x2];
gUnknown_202B038[3][y1][x1] = sWorldMapPtr->unk1114[y2][x2];
gBgTilemaps[2][y1][x1] = sWorldMapPtr->unk3114[y2][x2];
gBgTilemaps[3][y1][x1] = sWorldMapPtr->unk1114[y2][x2];
x2++;
x1++;
}

View File

@ -109,16 +109,7 @@ gUnknown_202EDE8: /* 202EDE8 (sub_803E250 - sub_803EDF0) */
gUnknown_202EDFC: /* 202EDFC (sub_803F27C - sub_803F878) */
.space 0x4
gUnknown_202EE00: /* 202EE00 (sub_8040150 - sub_805D8C8) */
.space 0x1
gUnknown_202EE01: /* 202EE01 (sub_8040124 - PrintFieldMessage) */
.space 0x1
gUnknown_202EE02: /* 202EE02 (sub_8040894 - sub_8040A78) */
.space 0x2
gUnknown_202EE04: /* 202EE04 (sub_8040130 - sub_80402AC) */
.space 0x4
gUnknown_202EE08: /* 202EE08 (sub_8040150 - sub_8040788) */
.space 0x4
.include "src/dungeon_map.o"
gUnknown_202EE0C: /* 202EE0C (sub_80694C0 - sub_806B8CC) */
.space 0x4