game.c doc

This commit is contained in:
theo3 2022-01-04 18:39:32 -08:00
parent 52db70bb9d
commit 7036ec73af
49 changed files with 563 additions and 488 deletions

View File

@ -37,7 +37,7 @@ sub_08019698: @ 0x08019698
bl SetLocalFlagByBank
ldrh r0, [r4]
ldrh r1, [r4, #2]
bl sub_08052FD8
bl LoadCutsceneRoom
ldr r5, _0801972C @ =gRoomControls
ldrh r0, [r4, #6]
ldrh r1, [r5, #0xa]

View File

@ -6,8 +6,8 @@
.text
thumb_func_start sub_08053590
sub_08053590: @ 0x08053590
thumb_func_start CutsceneMain_Init
CutsceneMain_Init: @ 0x08053590
push {lr}
ldr r1, _080535A4 @ =gUnk_080FCBB4
ldr r0, _080535A8 @ =gMenu
@ -901,8 +901,8 @@ sub_08053C84: @ 0x08053C84
.align 2, 0
_08053C8C: .4byte gMenu
thumb_func_start sub_08053C90
sub_08053C90: @ 0x08053C90
thumb_func_start CutsceneMain_Exit
CutsceneMain_Exit: @ 0x08053C90
push {lr}
ldr r1, _08053CA4 @ =gUnk_080FCEF8
ldr r0, _08053CA8 @ =gMenu
@ -1294,8 +1294,8 @@ _08053FAA:
_08053FAC: .4byte gFadeControl
_08053FB0: .4byte gMenu
thumb_func_start sub_08053FB4
sub_08053FB4: @ 0x08053FB4
thumb_func_start CutsceneMain_Update
CutsceneMain_Update: @ 0x08053FB4
push {lr}
ldr r1, _08053FC8 @ =gUnk_080FD138
ldr r0, _08053FCC @ =gMenu

View File

@ -138,7 +138,7 @@ sub_08054974: @ 0x08054974
beq _080549BC
ldrb r0, [r6, #2]
ldrb r1, [r6, #3]
bl sub_08052FD8
bl LoadCutsceneRoom
b _080549CE
.align 2, 0
_080549B0: .4byte gUnk_080FE320

View File

@ -467,7 +467,7 @@ _0807835C:
bne _0807836A
b _080784AC
_0807836A:
bl sub_08052B24
bl CanDispEzloMessage
cmp r0, #0
beq _08078374
b _080784C4
@ -482,7 +482,7 @@ _08078376:
beq _08078384
b _080784AC
_08078384:
bl sub_08052B24
bl CanDispEzloMessage
cmp r0, #0
beq _0807838E
b _080784C4

View File

@ -3722,7 +3722,7 @@ _0807A468:
cmp r2, #0
beq _0807A4F2
_0807A46E:
bl CheckIsDungeon
bl AreaIsDungeon
cmp r0, #0
beq _0807A4B0
ldr r4, _0807A4AC @ =gPlayerEntity

View File

@ -1,6 +1,6 @@
.syntax unified
push {lr}
bl sub_08053500
bl InitBiggoronTimer
movs r0, #0xd
bl IsItemEquipped
adds r1, r0, #0

View File

@ -6,7 +6,7 @@
push {r5, r6, r7}
sub sp, #0x14
adds r4, r0, #0
bl CheckHasMap
bl AreaHasMap
cmp r0, #0
bne _0801DDB8
b _0801DEEA

View File

@ -631,9 +631,9 @@ CreateBird: @ 0x0809D700
push {r4, lr}
sub sp, #4
.ifdef EU
bl CheckIsOverworld @ TODO correct function?
bl AreaIsOverworld @ TODO correct function?
.else
bl sub_08052654
bl AreaAllowsWarp
.endif
cmp r0, #0
beq _0809D732

View File

@ -32,7 +32,7 @@ sub_0808AA1C: @ 0x0808AA1C
movs r4, #0
movs r6, #1
strb r6, [r5, #0xc]
bl CheckIsDungeon
bl AreaIsDungeon
cmp r0, #0
bne _0808AA36
adds r0, r5, #0

View File

@ -566,7 +566,7 @@ sub_080A4080: @ 0x080A4080
movs r0, #0xfd
lsls r0, r0, #1
movs r1, #0
bl sub_080ADA14
bl DrawDirect
movs r0, #0x94
strh r0, [r4, #2]
movs r0, #0x50
@ -577,7 +577,7 @@ sub_080A4080: @ 0x080A4080
ldr r7, _080A3954 @ =0x000001F9
adds r0, r7, #0
movs r1, #0
bl sub_080ADA14
bl DrawDirect
movs r0, #0xb8
strh r0, [r4]
movs r0, #0x94
@ -585,7 +585,7 @@ sub_080A4080: @ 0x080A4080
strh r0, [r4, #8]
adds r0, r7, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
ldr r0, _080A3958 @ =gMain
ldrh r0, [r0, #0xc]
lsrs r0, r0, #2
@ -618,7 +618,7 @@ _080A3920:
strh r0, [r4, #2]
adds r0, r7, #0
movs r1, #3
bl sub_080ADA14
bl DrawDirect
_080A3934:
cmp r5, #0
beq _080A3948
@ -628,7 +628,7 @@ _080A3934:
strh r0, [r4, #2]
adds r0, r7, #0
movs r1, #2
bl sub_080ADA14
bl DrawDirect
_080A3948:
pop {r4, r5, r6, r7, pc}
.align 2, 0
@ -659,7 +659,7 @@ _080A3960: .4byte 0x0000FFFF
strh r0, [r4, #8]
ldr r0, _080A413C @ =0x000001FB
movs r1, #0
bl sub_080ADA14
bl DrawDirect
movs r0, #0x94
strh r0, [r4, #2]
movs r0, #0x50
@ -671,7 +671,7 @@ _080A3960: .4byte 0x0000FFFF
lsls r7, r7, #1
adds r0, r7, #0
movs r1, #0
bl sub_080ADA14
bl DrawDirect
movs r0, #0xb8
strh r0, [r4]
movs r0, #0x94
@ -679,7 +679,7 @@ _080A3960: .4byte 0x0000FFFF
strh r0, [r4, #8]
adds r0, r7, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
ldr r0, _080A4140 @ =gMain
ldrh r0, [r0, #0xc]
lsrs r0, r0, #2
@ -712,7 +712,7 @@ _080A4108:
strh r0, [r4, #2]
adds r0, r7, #0
movs r1, #3
bl sub_080ADA14
bl DrawDirect
_080A411C:
cmp r5, #0
beq _080A4130
@ -722,7 +722,7 @@ _080A411C:
strh r0, [r4, #2]
adds r0, r7, #0
movs r1, #2
bl sub_080ADA14
bl DrawDirect
_080A4130:
pop {r4, r5, r6, r7, pc}
.align 2, 0
@ -1002,7 +1002,7 @@ _080A4362:
strh r0, [r1, #2]
movs r0, #0
movs r1, #5
bl sub_080ADA14
bl DrawDirect
ldr r0, _080A4394 @ =gOamCmd
strh r4, [r0]
strh r5, [r0, #2]
@ -1021,7 +1021,7 @@ _080A4372:
strh r1, [r0, #8]
movs r0, #0
movs r1, #3
bl sub_080ADA14
bl DrawDirect
pop {r4, r5, r6, r7, pc}
.align 2, 0
_080A4394: .4byte gOamCmd
@ -1826,7 +1826,7 @@ sub_080A4978: @ 0x080A4978
ldr r7, _080A4330 @ =0x000001FB
adds r0, r7, #0
movs r1, #0
bl sub_080ADA14
bl DrawDirect
ldr r0, _080A4334 @ =gSave
ldrb r0, [r0, #6]
movs r2, #0x88
@ -1860,7 +1860,7 @@ _080A41EC:
strh r0, [r5, #2]
adds r0, r7, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
ldr r0, _080A433C @ =gMain
ldrh r1, [r0, #0xc]
movs r0, #0x10
@ -1875,13 +1875,13 @@ _080A420A:
strh r0, [r5, #2]
adds r0, r7, #0
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
strh r6, [r5]
movs r0, #0x76
strh r0, [r5, #2]
adds r1, r4, #1
adds r0, r7, #0
bl sub_080ADA14
bl DrawDirect
_080A4226:
ldr r0, _080A433C @ =gMain
ldrh r1, [r0, #0xc]
@ -1911,7 +1911,7 @@ _080A4226:
strh r0, [r4, #2]
ldr r0, _080A4330 @ =0x000001FB
movs r1, #6
bl sub_080ADA14
bl DrawDirect
_080A4262:
ldrb r1, [r5, #0x1e]
movs r0, #0x1f
@ -1924,7 +1924,7 @@ _080A4262:
strh r0, [r4, #2]
ldr r0, _080A4330 @ =0x000001FB
movs r1, #7
bl sub_080ADA14
bl DrawDirect
_080A427C:
movs r0, #0x80
lsls r0, r0, #0x12
@ -1957,7 +1957,7 @@ _080A42A0:
strh r0, [r7, #8]
movs r0, #0
movs r1, #9
bl sub_080ADA14
bl DrawDirect
adds r0, r4, #0
movs r1, #0xa
bl __divsi3
@ -1988,7 +1988,7 @@ _080A42D0:
ldr r0, _080A4340 @ =0x000001F7
ldrb r1, [r4, #0x1c]
subs r1, #1
bl sub_080ADA14
bl DrawDirect
ldrb r1, [r4, #0x1c]
ldrb r0, [r4, #0x1d]
cmp r0, r1
@ -2046,7 +2046,7 @@ _080A4358EU: .4byte 0x06014000
lsls r7, r7, #1
adds r0, r7, #0
movs r1, #0
bl sub_080ADA14
bl DrawDirect
ldr r0, _080A4B20 @ =gSave
ldrb r0, [r0, #6]
movs r2, #0x88
@ -2080,7 +2080,7 @@ _080A49D6:
strh r0, [r5, #2]
adds r0, r7, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
ldr r0, _080A4B28 @ =gMain
ldrh r1, [r0, #0xc]
movs r0, #0x10
@ -2095,13 +2095,13 @@ _080A49F4:
strh r0, [r5, #2]
adds r0, r7, #0
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
strh r6, [r5]
movs r0, #0x76
strh r0, [r5, #2]
adds r1, r4, #1
adds r0, r7, #0
bl sub_080ADA14
bl DrawDirect
_080A4A10:
ldr r0, _080A4B28 @ =gMain
ldrh r1, [r0, #0xc]
@ -2132,7 +2132,7 @@ _080A4A10:
movs r0, #0xfe
lsls r0, r0, #1
movs r1, #6
bl sub_080ADA14
bl DrawDirect
_080A4A4E:
ldrb r1, [r5, #0x1e]
movs r0, #0x1f
@ -2146,7 +2146,7 @@ _080A4A4E:
movs r0, #0xfe
lsls r0, r0, #1
movs r1, #7
bl sub_080ADA14
bl DrawDirect
_080A4A6A:
movs r0, #0x80
lsls r0, r0, #0x12
@ -2179,7 +2179,7 @@ _080A4A8E:
strh r0, [r7, #8]
movs r0, #0
movs r1, #9
bl sub_080ADA14
bl DrawDirect
adds r0, r4, #0
movs r1, #0xa
bl __divsi3
@ -2211,7 +2211,7 @@ _080A4ABE:
lsls r0, r0, #1
ldrb r1, [r4, #0x1c]
subs r1, #1
bl sub_080ADA14
bl DrawDirect
ldrb r1, [r4, #0x1c]
ldrb r0, [r4, #0x1d]
cmp r0, r1
@ -2923,7 +2923,7 @@ sub_080A50A0: @ 0x080A50A0
adds r1, r0, #0
cmp r1, #0xf
bne _080A50B4
bl CheckHasMap
bl AreaHasMap
movs r1, #4
cmp r0, #0
beq _080A50B4
@ -3061,21 +3061,21 @@ _080A5182:
.endif
adds r0, r5, #0
movs r1, #0
bl sub_080ADA14
bl DrawDirect
ldr r0, [sp, #8]
strh r0, [r4]
ldr r0, [sp, #0xc]
strh r0, [r4, #2]
adds r0, r5, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
ldr r0, [sp, #0x10]
strh r0, [r4]
ldr r0, [sp, #0x14]
strh r0, [r4, #2]
adds r0, r5, #0
movs r1, #2
bl sub_080ADA14
bl DrawDirect
_080A51C6:
add sp, #0x18
pop {r4, r5, pc}
@ -3430,7 +3430,7 @@ _080A4C42:
ldr r0, [r0]
ldrb r1, [r0]
ldr r0, _080A4D4C @ =0x00000141
bl sub_080ADA14
bl DrawDirect
_080A4C68:
adds r6, #8
adds r5, #1
@ -3474,7 +3474,7 @@ _080A4CB2EU:
movs r6, #0xfd
lsls r6, r6, #1
adds r0, r6, #0
bl sub_080ADA14
bl DrawDirect
movs r0, #0x80
lsls r0, r0, #0x12
ldrb r0, [r0, #7]
@ -3495,7 +3495,7 @@ _080A4CCA:
strh r0, [r4, #8]
adds r0, r6, #0
movs r1, #0x22
bl sub_080ADA14
bl DrawDirect
ldr r7, _080A4D5C @ =gSave
adds r0, r7, #0
adds r0, #0xb4
@ -3513,7 +3513,7 @@ _080A4CCA:
strh r0, [r4, #2]
adds r0, r6, #0
movs r1, #3
bl sub_080ADA14
bl DrawDirect
_080A4D0E:
adds r0, r7, #0
adds r0, #0xb5
@ -3532,7 +3532,7 @@ _080A4D0E:
strh r0, [r2, #2]
adds r0, r6, #0
movs r1, #3
bl sub_080ADA14
bl DrawDirect
_080A4D36:
pop {r3, r4, r5}
mov r8, r3
@ -3653,7 +3653,7 @@ _080A542E:
ldrb r1, [r0]
movs r0, #0xa1
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
_080A5456:
adds r6, #8
adds r5, #1
@ -3696,7 +3696,7 @@ _080A547C:
_080A54A0:
ldr r6, _080A5544 @ =0x000001FB
adds r0, r6, #0
bl sub_080ADA14
bl DrawDirect
movs r0, #0x80
lsls r0, r0, #0x12
ldrb r0, [r0, #7]
@ -3717,7 +3717,7 @@ _080A54B6:
strh r0, [r4, #8]
adds r0, r6, #0
movs r1, #0x22
bl sub_080ADA14
bl DrawDirect
ldr r7, _080A5548 @ =gSave
adds r0, r7, #0
adds r0, #0xb4
@ -3735,7 +3735,7 @@ _080A54B6:
strh r0, [r4, #2]
adds r0, r6, #0
movs r1, #3
bl sub_080ADA14
bl DrawDirect
_080A54FA:
adds r0, r7, #0
adds r0, #0xb5
@ -3754,7 +3754,7 @@ _080A54FA:
strh r0, [r2, #2]
adds r0, r6, #0
movs r1, #3
bl sub_080ADA14
bl DrawDirect
_080A5522:
pop {r3, r4, r5}
mov r8, r3

View File

@ -425,7 +425,7 @@ _080A502E:
_080A505A:
movs r0, #0xfd
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
movs r3, #0
mov r8, r3
mov r7, sb
@ -501,7 +501,7 @@ _080A50EA:
ldrb r1, [r0]
ldr r0, _080A5194 @ =0x00000141
_080A50F6:
bl sub_080ADA14
bl DrawDirect
_080A50FA:
adds r7, #8
movs r0, #1
@ -529,7 +529,7 @@ _080A50FA:
strh r0, [r2, #2]
movs r0, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
_080A5132:
ldrb r0, [r4, #0x13]
cmp r0, #0x3f
@ -559,7 +559,7 @@ _080A5156:
strh r0, [r5, #8]
movs r0, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
adds r0, r4, #0
movs r1, #0xa
bl __divsi3
@ -630,7 +630,7 @@ _080A581A:
adds r1, #1
_080A5846:
ldr r0, _080A58A4 @ =0x000001FB
bl sub_080ADA14
bl DrawDirect
movs r3, #0
mov r8, r3
mov r7, sb
@ -708,7 +708,7 @@ _080A58D6:
movs r0, #0xa1
lsls r0, r0, #1
_080A58E4:
bl sub_080ADA14
bl DrawDirect
_080A58E8:
adds r7, #8
movs r0, #1
@ -736,7 +736,7 @@ _080A58E8:
strh r0, [r2, #2]
movs r0, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
_080A5920:
ldrb r0, [r4, #0x13]
cmp r0, #0x3f
@ -766,7 +766,7 @@ _080A5944:
strh r0, [r5, #8]
movs r0, #0
movs r1, #1
bl sub_080ADA14
bl DrawDirect
adds r0, r4, #0
movs r1, #0xa
bl __divsi3
@ -1316,7 +1316,7 @@ sub_080A5D1C: @ 0x080A5D1C
_080A5560:
movs r0, #0xfd
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
movs r0, #0x20
mov sb, r0
mov r1, sb
@ -1338,7 +1338,7 @@ _080A5560:
_080A558C:
movs r0, #0xfd
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
movs r0, #0x7e
strh r0, [r5, #2]
movs r0, #0x87
@ -1357,7 +1357,7 @@ _080A558C:
ldrb r4, [r0]
ldr r0, _080A56ACEU @ =0x00000143
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
_080A55BE:
bl HasDungeonCompass
cmp r0, #0
@ -1372,7 +1372,7 @@ _080A55BE:
ldrb r4, [r0]
ldr r0, _080A56ACEU @ =0x00000143
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
_080A55DE:
bl HasDungeonBigKey
cmp r0, #0
@ -1390,7 +1390,7 @@ _080A55DE:
ldrb r4, [r0]
ldr r0, _080A56ACEU @ =0x00000143
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
bl sub_080A5F24
cmp r0, #0
beq _080A563CEU
@ -1417,7 +1417,7 @@ _080A55DE:
_080A5634EU:
movs r0, #0xfd
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
_080A563CEU:
ldr r1, _080A569CEU @ =gOamCmd
movs r0, #0
@ -1437,7 +1437,7 @@ _080A5658:
movs r0, #0xfd
lsls r0, r0, #1
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
subs r4, #1
ldrh r0, [r6, #2]
adds r0, #0xc
@ -1516,7 +1516,7 @@ _080A56E8:
movs r0, #0xfd
lsls r0, r0, #1
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
adds r5, #3
ldrb r0, [r5]
cmp r0, #0
@ -1573,7 +1573,7 @@ _080A570E:
movs r1, #0x75
_080A5D70:
ldr r0, _080A5EB0 @ =0x000001FB
bl sub_080ADA14
bl DrawDirect
movs r0, #0x20
mov sb, r0
mov r1, sb
@ -1594,7 +1594,7 @@ _080A5D70:
movs r1, #0x78
_080A5D9A:
ldr r0, _080A5EB0 @ =0x000001FB
bl sub_080ADA14
bl DrawDirect
movs r0, #0x7e
strh r0, [r5, #2]
movs r0, #0x87
@ -1614,7 +1614,7 @@ _080A5D9A:
movs r0, #0xa2
lsls r0, r0, #1
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
_080A5DCC:
bl HasDungeonCompass
cmp r0, #0
@ -1630,7 +1630,7 @@ _080A5DCC:
movs r0, #0xa2
lsls r0, r0, #1
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
_080A5DEE:
bl HasDungeonBigKey
cmp r0, #0
@ -1647,7 +1647,7 @@ _080A5DEE:
ldr r1, [r1]
ldrb r4, [r1]
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
bl sub_080A5F24
cmp r0, #0
beq _080A5E48
@ -1673,7 +1673,7 @@ _080A5DEE:
movs r1, #0x7a
_080A5E42:
ldr r0, _080A5EB0 @ =0x000001FB
bl sub_080ADA14
bl DrawDirect
_080A5E48:
ldr r1, _080A5EA4 @ =gOamCmd
movs r0, #0
@ -1692,7 +1692,7 @@ _080A5E48:
_080A5E64:
ldr r0, _080A5EB0 @ =0x000001FB
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
subs r4, #1
ldrh r0, [r6, #2]
adds r0, #0xc
@ -1770,7 +1770,7 @@ _080A5EF0:
strh r0, [r7, #2]
ldr r0, _080A5F20 @ =0x000001FB
adds r1, r4, #0
bl sub_080ADA14
bl DrawDirect
adds r5, #3
ldrb r0, [r5]
cmp r0, #0
@ -2119,7 +2119,7 @@ sub_080A617C: @ 0x080A617C
_080A59AC:
ldr r5, _080A5A5C @ =0x000001FB
adds r0, r5, #0
bl sub_080ADA14
bl DrawDirect
ldrb r0, [r4, #3]
lsls r0, r0, #3
ldr r1, _080A5A60 @ =gUnk_08128D70
@ -2135,7 +2135,7 @@ _080A59AC:
strh r0, [r6, #2]
adds r0, r5, #0
movs r1, #0xb
bl sub_080ADA14
bl DrawDirect
movs r0, #0x30
strh r0, [r6]
movs r0, #0x6c
@ -2149,7 +2149,7 @@ _080A59AC:
strh r0, [r6, #8]
ldrb r1, [r4, #2]
adds r0, r5, #0
bl sub_080ADA14
bl DrawDirect
ldrb r0, [r4, #1]
lsls r0, r0, #0xc
orrs r0, r7
@ -2160,7 +2160,7 @@ _080A59AC:
strh r0, [r6, #2]
adds r0, r5, #0
movs r1, #0xc
bl sub_080ADA14
bl DrawDirect
_080A5A0E:
mov r0, r8
strh r0, [r6, #2]
@ -2185,7 +2185,7 @@ _080A5A18:
strh r6, [r7]
ldr r0, _080A5A5C @ =0x000001FB
movs r1, #0xa
bl sub_080ADA14
bl DrawDirect
_080A5A40:
adds r6, #0x1b
adds r5, #1
@ -2236,7 +2236,7 @@ _080A61B8:
movs r5, #0xfe
lsls r5, r5, #1
adds r0, r5, #0
bl sub_080ADA14
bl DrawDirect
ldrb r0, [r4, #3]
lsls r0, r0, #3
ldr r1, _080A626C @ =gUnk_08128D70
@ -2252,7 +2252,7 @@ _080A61B8:
strh r0, [r6, #2]
adds r0, r5, #0
movs r1, #0xb
bl sub_080ADA14
bl DrawDirect
movs r0, #0x30
strh r0, [r6]
movs r0, #0x6c
@ -2266,7 +2266,7 @@ _080A61B8:
strh r0, [r6, #8]
ldrb r1, [r4, #2]
adds r0, r5, #0
bl sub_080ADA14
bl DrawDirect
ldrb r0, [r4, #1]
lsls r0, r0, #0xc
orrs r0, r7
@ -2277,7 +2277,7 @@ _080A61B8:
strh r0, [r6, #2]
adds r0, r5, #0
movs r1, #0xc
bl sub_080ADA14
bl DrawDirect
_080A621C:
mov r0, r8
strh r0, [r6, #2]
@ -2303,7 +2303,7 @@ _080A6226:
movs r0, #0xfe
lsls r0, r0, #1
movs r1, #0xa
bl sub_080ADA14
bl DrawDirect
_080A6250:
adds r6, #0x1b
adds r5, #1
@ -2508,7 +2508,7 @@ _080A5B86:
_080A5BD8:
movs r0, #0xfd
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
_080A5BE0:
ldr r3, _080A5C18 @ =gChooseFileState
ldrb r0, [r3, #3]
@ -2532,7 +2532,7 @@ _080A5BE0:
adds r1, r2, r0
movs r0, #0xfd
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
bl sub_080A6498
pop {r4, r5, r6, pc}
.align 2, 0
@ -2597,7 +2597,7 @@ _080A6392:
movs r1, #0x5a
_080A63E4:
ldr r0, _080A6430 @ =0x000001FB
bl sub_080ADA14
bl DrawDirect
_080A63EA:
ldr r3, _080A6420 @ =gMenu
ldrb r0, [r3, #3]
@ -2620,7 +2620,7 @@ _080A63EA:
bics r0, r1
adds r1, r2, r0
ldr r0, _080A6430 @ =0x000001FB
bl sub_080ADA14
bl DrawDirect
bl sub_080A6498
pop {r4, r5, r6, pc}
.align 2, 0
@ -2667,7 +2667,7 @@ _080A5C52:
ldrb r1, [r4]
movs r0, #0xfd
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
_080A5C6E:
adds r6, #1
adds r4, #8
@ -2714,7 +2714,7 @@ _080A645E:
strh r0, [r7, #2]
ldrb r1, [r4]
ldr r0, _080A6494 @ =0x000001FB
bl sub_080ADA14
bl DrawDirect
_080A6478:
adds r6, #1
adds r4, #8
@ -2763,7 +2763,7 @@ _080A5CA4:
movs r0, #0xfd
lsls r0, r0, #1
adds r1, r5, #0
bl sub_080ADA14
bl DrawDirect
_080A5CC8EU:
adds r5, #3
adds r4, #1
@ -2810,7 +2810,7 @@ _080A64B0:
strh r0, [r6, #2]
ldr r0, _080A64F0 @ =0x000001FB
adds r1, r5, #0
bl sub_080ADA14
bl DrawDirect
_080A64D2:
adds r5, #3
adds r4, #1
@ -3096,7 +3096,7 @@ sub_080A66D0: @ 0x080A66D0
movs r0, #0xfd
lsls r0, r0, #1
movs r1, #0x71
bl sub_080ADA14
bl DrawDirect
_080A5F1A:
ldrb r0, [r5, #2]
ldrh r4, [r4, #0xa]
@ -3107,7 +3107,7 @@ _080A5F1A:
movs r0, #0xfd
lsls r0, r0, #1
movs r1, #0x72
bl sub_080ADA14
bl DrawDirect
_080A5F30:
ldrb r0, [r5, #7]
mov sl, r0
@ -3165,7 +3165,7 @@ _080A5F8A:
strh r0, [r7, #2]
ldrh r0, [r4, #2]
ldrb r1, [r4, #1]
bl sub_080ADA14
bl DrawDirect
_080A5FA6:
adds r4, #8
ldrh r0, [r4, #2]
@ -3219,7 +3219,7 @@ _080A5FAE:
strh r0, [r6, #2]
ldr r0, _080A6788 @ =0x000001FB
movs r1, #0x71
bl sub_080ADA14
bl DrawDirect
_080A6724:
ldrb r0, [r5, #2]
ldrh r4, [r4, #0xa]
@ -3229,7 +3229,7 @@ _080A6724:
strh r0, [r6, #2]
ldr r0, _080A6788 @ =0x000001FB
movs r1, #0x72
bl sub_080ADA14
bl DrawDirect
_080A6738:
ldrb r0, [r5, #7]
mov sl, r0
@ -3288,7 +3288,7 @@ _080A6796:
strh r0, [r7, #2]
ldrh r0, [r4, #2]
ldrb r1, [r4, #1]
bl sub_080ADA14
bl DrawDirect
_080A67B2:
adds r4, #8
ldrh r0, [r4, #2]
@ -4304,7 +4304,7 @@ sub_080A6E70: @ 0x080A6E70
_080A6698:
movs r0, #0xfd
lsls r0, r0, #1
bl sub_080ADA14
bl DrawDirect
movs r4, #0
ldr r5, _080A66D4 @ =gSave
_080A66A4EU:
@ -4321,7 +4321,7 @@ _080A66A4EU:
movs r0, #0xfd
lsls r0, r0, #1
movs r1, #0x5c
bl sub_080ADA14
bl DrawDirect
_080A66C4:
adds r4, #1
cmp r4, #7
@ -4358,7 +4358,7 @@ _080A66D4: .4byte gSave
movs r1, #0x5d
_080A6EA0:
ldr r0, _080A6ED8 @ =0x000001FB
bl sub_080ADA14
bl DrawDirect
movs r4, #0
ldr r5, _080A6EDC @ =gSave
_080A6EAA:
@ -4374,7 +4374,7 @@ _080A6EAA:
bl sub_080A6EE0
ldr r0, _080A6ED8 @ =0x000001FB
movs r1, #0x5c
bl sub_080ADA14
bl DrawDirect
_080A6EC8:
adds r4, #1
cmp r4, #7
@ -5041,7 +5041,7 @@ _080A73B4:
adds r4, r4, r1
str r0, [r4]
ldrb r0, [r5, #6]
bl sub_080527FC
bl RestoreGameTask
ldrb r1, [r5, #0xd]
rsbs r0, r1, #0
orrs r0, r1
@ -5134,7 +5134,7 @@ _080A7524: .4byte gMain
thumb_func_start Subtask_Update
Subtask_Update: @ 0x080A7528
push {lr}
ldr r1, _080A753C @ =gUnk_08129030
ldr r1, _080A753C @ =gSubtasks
ldr r0, _080A7540 @ =gUnk_02032EC0
ldrb r0, [r0, #2]
lsls r0, r0, #2
@ -5143,5 +5143,5 @@ Subtask_Update: @ 0x080A7528
bl _call_via_r0
pop {pc}
.align 2, 0
_080A753C: .4byte gUnk_08129030
_080A753C: .4byte gSubtasks
_080A7540: .4byte gUnk_02032EC0

View File

@ -68,7 +68,7 @@ _0801C20E:
strh r0, [r4, #8]
ldrh r0, [r2, #6]
ldrb r1, [r3, #0x10]
bl sub_080ADA14
bl DrawDirect
_0801C248:
adds r5, #1
cmp r5, #0x17
@ -1009,7 +1009,7 @@ sub_0801C99C: @ 0x0801C99C
ands r0, r1
cmp r0, #0
bne _0801C9B2
bl sub_08052724
bl AreaHasKeys
cmp r0, #0
bne _0801C9EC
_0801C9B2:

View File

@ -31141,7 +31141,7 @@
"size": 16
},
{
"path": "data_080FC8A4/gUnk_080FCA20.bin",
"path": "data_080FC8A4/sCutsceneData.bin",
"start": 1034784,
"size": 80
},

View File

@ -57,39 +57,3 @@ gUnk_080FC9C8:: @ 080FC9C8
.4byte sub_080517EC
.4byte sub_08051874
.4byte sub_080518E4
gUnk_080FC9D8:: @ 080FC9D8
.4byte GameTask_Transition
.4byte GameTask_Init
.4byte GameTask_Main
.4byte sub_08051D2C
gUnk_080FC9E8:: @ 080FC9E8
.4byte GameMain_InitRoom
.4byte GameMain_ChangeRoom
.4byte GameMain_Update
.4byte GameMain_ChangeArea
.4byte GameMain_MinishPortal
.4byte GameMain_BarrelUpdate
.4byte 00000000
.4byte GameMain_Subtask
gUnk_080FCA08:: @ 080FCA08
.4byte sub_08051E84
.4byte sub_08051F04
.4byte sub_08051F40
gUnk_080FCA14:: @ 080FCA14
.4byte sub_08053590
.4byte sub_08053FB4
.4byte sub_08053C90
gUnk_080FCA20:: @ 080FCA20
.incbin "data_080FC8A4/gUnk_080FCA20.bin"
gUnk_080FCA70:: @ 080FCA70
.4byte sub_080520D8
.4byte sub_0805212C
.4byte sub_080521A0
.4byte sub_080522F4
.4byte nullsub_107

View File

@ -142,13 +142,13 @@ gUnk_0812901C:: @ 0812901C
.4byte Subtask_FadeOut
.4byte Subtask_Die
gUnk_08129030:: @ 08129030
gSubtasks:: @ 08129030
.4byte Subtask_Exit
.4byte Subtask_PauseMenu
.4byte Subtask_Exit
.4byte Subtask_MapHint
.4byte Subtask_KinstoneMenu
.4byte Subtask_ChuchuCutscene
.4byte Subtask_AuxCutscene
.4byte Subtask_PortalCutscene
.4byte Subtask_FigurineMenu
.4byte Subtask_WorldEvent

View File

@ -1061,7 +1061,7 @@ Area_MinishRafters:: @ 080D4F20
.4byte Room_MinishRafters_Bakery
Area_EzloCutscene:: @ 080D4F30
.4byte Area_EzloCutscene_Main
.4byte Area_EzloAuxCutscene_Main
Area_WindTribeTower:: @ 080D4F34
.4byte Room_WindTribeTower_Entrance
@ -3516,10 +3516,10 @@ Room_GoronCave_Main:: @ 080D8EB0
.4byte sub_unk3_GoronCave_Main
.4byte sub_StateChange_GoronCave_Main
Entities_EzloCutscene_Main_0:: @ 080D8ED0
Entities_EzloAuxCutscene_Main_0:: @ 080D8ED0
entity_list_end
Entities_EzloCutscene_Main_1:: @ 080D8EE0
Entities_EzloAuxCutscene_Main_1:: @ 080D8EE0
object_raw subtype=0x4d, x=0x34, y=0x28, collision=1, paramA=0x3f
object_raw subtype=0x4d, x=0x28, y=0x48, collision=1, paramA=0xc
object_raw subtype=0x4d, x=0x80, y=0x24, collision=1, paramA=0x42
@ -3531,21 +3531,21 @@ Entities_EzloCutscene_Main_1:: @ 080D8EE0
object_raw subtype=0x4d, x=0xb8, y=0xd8, collision=1, paramA=0x41
entity_list_end
Enemies_EzloCutscene_Main:: @ 080D8F80
Enemies_EzloAuxCutscene_Main:: @ 080D8F80
entity_list_end
TileEntities_EzloCutscene_Main:: @ 080D8F90
TileEntities_EzloAuxCutscene_Main:: @ 080D8F90
tile_entity_list_end
Area_EzloCutscene_Main:: @ 080D8F98
.4byte Entities_EzloCutscene_Main_0
.4byte Entities_EzloCutscene_Main_1
.4byte Enemies_EzloCutscene_Main
.4byte TileEntities_EzloCutscene_Main
Area_EzloAuxCutscene_Main:: @ 080D8F98
.4byte Entities_EzloAuxCutscene_Main_0
.4byte Entities_EzloAuxCutscene_Main_1
.4byte Enemies_EzloAuxCutscene_Main
.4byte TileEntities_EzloAuxCutscene_Main
.4byte 0x00000000
.4byte 0x00000000
.4byte sub_unk3_EzloCutscene_Main
.4byte sub_StateChange_EzloCutscene_Main
.4byte sub_unk3_EzloAuxCutscene_Main
.4byte sub_StateChange_EzloAuxCutscene_Main
Entities_RoyalValley_Main_0:: @ 080D8FB8
manager subtype=0xf, paramA=0x7

View File

@ -43,8 +43,8 @@ typedef struct {
RoomResInfo roomResInfos[MAX_ROOMS];
RoomResInfo currentRoomInfo;
RoomResInfo* pCurrentRoomInfo;
u32 musicIndex;
u32 pMusicIndex;
u32 bgm;
u32 queued_bgm;
u8 filler5[0x20];
void* transitionManager;
void (*onEnter)();

View File

@ -100,7 +100,7 @@ extern void sub_0804ED18();
extern void sub_080AF2E4(void);
extern void sub_0804F578(void);
extern void sub_08059994(void);
extern void sub_080ADA14(u32, u32); // trampoline to sub_080B27F4
extern void DrawDirect(u32, u32); // trampoline to sub_080B27F4
extern void sub_0801E1B8(u32, u32);
extern void sub_080A3B74(void);
extern void sub_080A4054(void);

View File

@ -4,60 +4,50 @@
#include "global.h"
#include "area.h"
enum {
GAMETASK_TRANSITION,
GAMETASK_INIT,
GAMETASK_MAIN,
GAMETASK_EXIT,
};
enum {
GAMEMAIN_INITROOM,
GAMEMAIN_CHANGEROOM,
GAMEMAIN_UPDATE,
GAMEMAIN_CHANGEAREA,
GAMEMAIN_MINISHPORTAL,
GAMEMAIN_BARRELUPDATE,
GAMEMAIN_RESERVED,
GAMEMAIN_SUBTASK,
};
void ChangeLightLevel(s32);
void ChangeLightLevel(s32 level);
void SetPopupState(u32 type, u32 choice_idx);
bool32 CheckIsOverworld(void);
bool32 sub_08052638(u32 r0);
bool32 CheckAreaOverworld(u32 area);
bool32 AreaIsOverworld(void);
bool32 AreaIsDungeon(void);
bool32 AreaHasEnemies(void);
bool32 AreaHasNoEnemies(void);
bool32 AreaHasMap(void);
bool32 AreaHasKeys(void);
#ifndef EU
u32 sub_08052654(void);
#endif
u32 CheckIsDungeon(void);
u32 CheckIsInteriorWithEnemies(void);
u32 CheckIsInteriorNoEnemies(void);
u32 CheckHasMap(void);
// This function was introduced to allow warping from indoor areas (palace of winds).
u32 AreaAllowsWarp(void);
u32 ItemIsSword(u32 item);
void sub_080526F8(s32 a1);
u32 sub_08052724(void);
u32 HasDungeonMap(void);
u32 HasDungeonCompass(void);
u32 HasDungeonBigKey(void);
u32 HasDungeonSmallKey(void);
void sub_080527FC(u32 a1, u32 a2);
#ifndef EU
// related to a music bug?
void sub_08052878(void);
#endif
void RoomExitCallback(void);
void sub_080526F8(s32 a1);
bool32 HasDungeonMap(void);
bool32 HasDungeonCompass(void);
bool32 HasDungeonBigKey(void);
bool32 HasDungeonSmallKey(void);
bool32 ItemIsSword(u32 item);
bool32 ItemIsShield(u32 item);
u32 GetBottleContaining(u32 item);
void LoadGfxGroups(void);
void LoadCutsceneRoom(u32 room, u32 area);
void InitRoom(void);
void InitParachuteRoom(void);
u32 sub_08052B24(void);
void RegisterTransitionManager(void* mgr, void (*onEnter)(void), void (*onExit)(void));
void RoomExitCallback(void);
void RestoreGameTask(u32 a1);
bool32 CanDispEzloMessage(void);
void DisplayEzloMessage(void);
void sub_08052CA4(u32 area, u32 room, u32 x, u32 y);
void sub_08052CD0(u32 area, u32 room, u32 x, u32 y);
void InitRoom(void);
void SetWorldMapPos(u32 area, u32 room, u32 x, u32 y);
void SetDungeonMapPos(u32 area, u32 room, u32 x, u32 y);
/**
* @brief Get bank offset for area
@ -66,14 +56,59 @@ u32 GetFlagBankOffset(u32 idx);
RoomResInfo* GetCurrentRoomInfo(void);
void sub_08052EA0(void);
void sub_08052FD8(u32 room, u32 area);
void sub_08053250(void);
void LoadGfxGroups(void);
void sub_080533CC(void);
void sub_08053494(void);
void sub_080534AC(void);
void sub_08053500(void);
void InitBiggoronTimer(void);
u32 GetBottleContaining(u32);
enum {
GAMETASK_TRANSITION, /* transition from fileselect task */
GAMETASK_INIT,
GAMETASK_MAIN,
GAMETASK_EXIT, /* gameover task or reset */
};
enum {
GAMEMAIN_INITROOM,
GAMEMAIN_CHANGEROOM,
GAMEMAIN_UPDATE,
GAMEMAIN_CHANGEAREA,
GAMEMAIN_MINISHPORTAL, /* moments after viewing portal cutscene */
GAMEMAIN_BARRELUPDATE, /* barrel in deepwood shrine */
GAMEMAIN_RESERVED,
GAMEMAIN_SUBTASK,
};
/**
* @brief Subtasks override the game task for short periods
*/
enum {
SUBTASK_EXIT,
SUBTASK_PAUSEMENU,
SUBTASK_EXIT2,
SUBTASK_MAPHINT,
SUBTASK_KINSTONEMENU,
SUBTASK_AUXCUTSCENE, /* cutscene without presence of player */
SUBTASK_PORTALCUTSCENE, /* player "falling" down portal cutscene */
SUBTASK_FIGURINEMENU,
SUBTASK_WORLDEVENT,
SUBTASK_FASTTRAVEL,
SUBTASK_LOCALMAPHINT,
};
typedef void(Subtask)(void);
Subtask Subtask_Exit;
Subtask Subtask_PauseMenu;
Subtask Subtask_Exit;
Subtask Subtask_MapHint;
Subtask Subtask_KinstoneMenu;
Subtask Subtask_AuxCutscene;
Subtask Subtask_PortalCutscene;
Subtask Subtask_FigurineMenu;
Subtask Subtask_WorldEvent;
Subtask Subtask_FastTravel;
Subtask Subtask_LocalMapHint;
#endif // GAME_H

View File

@ -280,7 +280,7 @@ extern u16 gWalletSizes[];
extern PlayerState gPlayerState;
extern Entity gPlayerEntity;
u32 CheckPlayerActivity(void);
u32 CheckPlayerInactive(void);
void SetPlayerControl(PlayerControlMode mode);
void ResetPlayer(void);
void ResetPlayerVelocity(void);

View File

@ -51,7 +51,7 @@ typedef struct {
/*0x25C*/ u8 flags[0x200];
/*0x45C*/ u8 unk45C[0x10];
/*0x46C*/ u8 unk46C[0x20];
/*0x48C*/ u32 unk48C[7];
/*0x48C*/ u32 timers[7];
/*0x4A8*/ u32 demo_timer;
/*0x4AC*/ u8 filler4ac[0x8];
} SaveFile;

View File

@ -66,7 +66,7 @@ void sub_080ADA04(OAMCommand* cmd, void* dst) {
fn(cmd, dst);
}
void sub_080ADA14(u32 a1, u32 a2) {
void DrawDirect(u32 a1, u32 a2) {
void (*fn)(OAMCommand*, u32, u32) = gUnk_03006580;
fn(&gOamCmd, a1, a2);
}

View File

@ -94,7 +94,7 @@ u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
return bottleIndex;
}
u32 ItemIsSword(u32 item) {
bool32 ItemIsSword(u32 item) {
switch (item) {
case ITEM_SMITH_SWORD:
case ITEM_GREEN_SWORD:
@ -107,7 +107,7 @@ u32 ItemIsSword(u32 item) {
}
}
u32 ItemIsShield(u32 id) {
bool32 ItemIsShield(u32 id) {
switch (id) {
case 13:
case 14:
@ -117,7 +117,7 @@ u32 ItemIsShield(u32 id) {
}
}
u32 ItemIsBottle(u32 id) {
bool32 ItemIsBottle(u32 id) {
switch (id) {
case 28:
case 29:

View File

@ -148,7 +148,7 @@ void sub_080240B8(Entity* this) {
}
UpdateSpriteForCollisionLayer(this);
if (CheckIsDungeon())
if (AreaIsDungeon())
this->spriteOrientation.flipY = 1;
this->field_0x80.HALF.HI = Random() & 0x40;
@ -534,7 +534,7 @@ void sub_08024940(Entity* this) {
this->z.HALF.HI += 2;
}
if (this->type2 != 0 || CheckIsDungeon()) {
if (this->type2 != 0 || AreaIsDungeon()) {
if (!sub_08049FA0(this)) {
this->direction = sub_08049EE4(this);
sub_080249F4(this);

View File

@ -653,7 +653,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) {
parent->direction = -1;
this->actionDelay = 0;
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
return;
}
this->actionDelay = 1;

View File

@ -992,8 +992,8 @@ void sub_0804235C(Entity* this) {
void VaatiWrathType0PreAction(Entity* this) {
int temp;
if ((gRoomTransition.field_0x38 & 2) == 0) {
if (gSave.unk48C[3] != 0) {
gSave.unk48C[3]--;
if (gSave.timers[3] != 0) {
gSave.timers[3]--;
} else {
temp = gPlayerState.framestate_last;
if (temp < 2) {

View File

@ -458,7 +458,7 @@ void sub_0805E98C(void) {
}
}
void QueueEntityDeletion(void) {
void RecycleEntities(void) {
Entity* i;
LinkedList* list;

View File

@ -481,36 +481,36 @@ void sub_08050A64(u32 idx) {
gOamCmd.x = 0xA2;
gOamCmd.y = 0x36;
#ifdef EU
sub_080ADA14(0x144, 0x24);
DrawDirect(0x144, 0x24);
#else
sub_080ADA14(0x145, 0x24);
DrawDirect(0x145, 0x24);
#endif
}
if (GetInventoryValue(0x41)) {
gOamCmd.x = 0x96;
gOamCmd.y = 0x3D;
#ifdef EU
sub_080ADA14(0x144, 0x22);
DrawDirect(0x144, 0x22);
#else
sub_080ADA14(0x145, 0x22);
DrawDirect(0x145, 0x22);
#endif
}
if (GetInventoryValue(0x42)) {
gOamCmd.x = 0xAE;
gOamCmd.y = 0x3D;
#ifdef EU
sub_080ADA14(0x144, 0x23);
DrawDirect(0x144, 0x23);
#else
sub_080ADA14(0x145, 0x23);
DrawDirect(0x145, 0x23);
#endif
}
if (GetInventoryValue(0x43)) {
gOamCmd.x = 0xA2;
gOamCmd.y = 0x44;
#ifdef EU
sub_080ADA14(0x144, 0x21);
DrawDirect(0x144, 0x21);
#else
sub_080ADA14(0x145, 0x21);
DrawDirect(0x145, 0x21);
#endif
}
}

View File

@ -17,12 +17,52 @@
#include "game.h"
#include "item.h"
// Game task
typedef void(GameState)(void);
typedef void(GameMainState)(void);
static GameState GameTask_Transition;
static GameState GameTask_Init;
static GameState GameTask_Exit;
static GameState GameTask_Main;
static GameMainState GameMain_InitRoom;
static GameMainState GameMain_ChangeRoom;
static GameMainState GameMain_Update;
static GameMainState GameMain_ChangeArea;
GameMainState GameMain_MinishPortal;
static GameMainState GameMain_BarrelUpdate;
/*static GameMainState 00000000;*/
GameMainState GameMain_Subtask;
// Cutscene subtask
typedef void(AuxCutsceneState)(void);
typedef void(CutsceneMainState)(void);
static AuxCutsceneState AuxCutscene_Init;
static AuxCutsceneState AuxCutscene_Main;
static AuxCutsceneState AuxCutscene_Exit;
CutsceneMainState CutsceneMain_Init;
CutsceneMainState CutsceneMain_Update;
CutsceneMainState CutsceneMain_Exit;
// Game Over task
typedef void(GameOverState)(void);
static GameOverState GameOver_Init;
static GameOverState GameOver_FadeIn;
static GameOverState GameOver_TextMove;
static GameOverState GameOver_Update;
static GameOverState GameOver_Exit;
extern u8 gUpdateVisibleTiles;
extern u8 gUnk_080FCA84[];
extern u8 gUnk_080FCAC8[];
extern u16 gUnk_020178E0[];
extern u8 gUnk_02024090[];
extern u16 gUnk_080FCAD6[];
extern void** gAreaTilesets[];
extern void** gAreaRoomMaps[];
@ -31,15 +71,6 @@ extern void* gUnk_080B755C[];
extern void** gExitLists[];
extern void** gAreaTable[];
extern u8 gUnk_080FCAF8[];
extern u16 gUnk_020178E0[];
extern void (*gUnk_080FC9D8[])();
extern void (*gUnk_080FC9E8[])();
extern void (*gUnk_080FCA08[])();
extern void (*gUnk_080FCA14[])();
extern void (*gUnk_080FCA70[])(void);
void FinalizeSave(void);
void ClearArmosData(void);
void ClearRoomMemory(void);
@ -55,19 +86,16 @@ void UpdateDoorTransition(void);
u32 IsEnterPortal(void);
void UpdateCarriedObject(void);
void DrawUI();
u32 CheckPlayerActivity();
u32 CheckPlayerInactive();
void CollisionMain();
void sub_0805BB74();
void CreateZeldaFollower(void);
void LoadRoomGfx();
void QueueEntityDeletion();
void RecycleEntities();
void sub_0804AF90();
void CallRoomProp6();
void LoadRoomBgm();
void UpdateScroll();
void UpdateBgAnim();
void sub_08052010();
void sub_080520C4();
void CleanUpGFXSlots();
void sub_080ADE24();
void InitUI(u32);
@ -85,6 +113,8 @@ void sub_0807C740(void);
void SetBGDefaults(void);
void LoadItemGfx(void);
static void LoadRoomBgm();
static void sub_08052010(void);
static void ResetTmpFlags(void);
static void InitializeEntities(void);
static void CheckAreaDiscovery(void);
@ -97,11 +127,10 @@ static void sub_0805340C(void);
static void sub_08051D98(void);
static void sub_08051DCC(void);
static u32 CheckGameOver(void);
static u32 HandleRoomExit(void);
static void sub_080531F8(void);
static u32 CheckRoomExit(void);
static void UpdatePlayerRoomStatus(void);
static void sub_0805329C(void);
static void InitializePlayer(void);
/* static */ void sub_08051F04(void);
/* static */ void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4);
static void DrawGameOverText(void);
static u32 StairsAreValid();
@ -124,16 +153,6 @@ typedef struct {
} struct_08127F94;
extern struct_08127F94 gUnk_08127F94[];
typedef struct {
u8 _0;
u8 _1;
u8 _2;
u8 _3;
u16 _4;
u16 _6;
} struct_080FCA20;
extern struct_080FCA20 gUnk_080FCA20[];
typedef struct {
u16* dest;
void* gfx_dest;
@ -161,9 +180,26 @@ typedef struct {
extern void CreateDialogBox();
typedef struct {
u8 area;
u8 room;
u8 _2;
u8 _3;
u16 x;
u16 y;
} CutsceneData;
static const CutsceneData sCutsceneData[];
void GameTask(void) {
static GameState* const sStates[] = {
GameTask_Transition,
GameTask_Init,
GameTask_Main,
GameTask_Exit,
};
gRoomTransition.frameCount++;
gUnk_080FC9D8[gMain.state]();
sStates[gMain.state]();
#ifdef DEMO_USA
if (gSave.demo_timer != 0) {
if (--gSave.demo_timer == 0) {
@ -174,7 +210,7 @@ void GameTask(void) {
#endif
}
void GameTask_Transition(void) {
static void GameTask_Transition(void) {
// wait for file select to fade out
if (gFadeControl.active)
return;
@ -190,7 +226,7 @@ void GameTask_Transition(void) {
FinalizeSave();
// spawn in with saved status
MemCopy(&gSave.saved_status, &gRoomTransition.player_status, sizeof (gRoomTransition.player_status));
MemCopy(&gSave.saved_status, &gRoomTransition.player_status, sizeof(gRoomTransition.player_status));
gRoomTransition.type = TRANSITION_FADE_BLACK_SLOW;
ResetTmpFlags();
@ -198,7 +234,7 @@ void GameTask_Transition(void) {
gMain.substate = 0;
}
void GameTask_Init(void) {
static void GameTask_Init(void) {
DispReset(1);
gFadeControl.mask = 0xffffffff;
MemClear(&gOAMControls, 0xB74);
@ -216,13 +252,23 @@ void GameTask_Init(void) {
gMain.state = GAMETASK_MAIN;
}
void GameTask_Main(void) {
gUnk_080FC9E8[gMain.substate]();
static void GameTask_Main(void) {
static GameMainState* const sStates[] = {
GameMain_InitRoom,
GameMain_ChangeRoom,
GameMain_Update,
GameMain_ChangeArea,
GameMain_MinishPortal,
GameMain_BarrelUpdate,
0,
GameMain_Subtask,
};
sStates[gMain.substate]();
}
void GameMain_InitRoom(void) {
static void GameMain_InitRoom(void) {
SetInitializationPriority();
gScreen.lcd.displayControl = 0x1740;
gScreen.lcd.displayControl = DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP;
gMain.substate = GAMEMAIN_CHANGEROOM;
gRoomTransition.transitioningOut = 0;
gRoomTransition.field_0x4[0] = 0;
@ -236,7 +282,7 @@ void GameMain_InitRoom(void) {
#endif
}
void GameMain_ChangeRoom(void) {
static void GameMain_ChangeRoom(void) {
UpdateEntities();
if (!UpdateLightLevel())
UpdateScroll();
@ -254,9 +300,9 @@ void GameMain_ChangeRoom(void) {
return;
UpdateFakeScroll();
if (gArea.musicIndex != gArea.pMusicIndex) {
gArea.musicIndex = gArea.pMusicIndex;
SoundReq(gArea.pMusicIndex | SONG_PLAY_VOL_RESET);
if (gArea.bgm != gArea.queued_bgm) {
gArea.bgm = gArea.queued_bgm;
SoundReq(gArea.queued_bgm | SONG_PLAY_VOL_RESET);
}
DeleteSleepingEntities();
@ -298,13 +344,13 @@ void GameMain_ChangeRoom(void) {
}
}
void GameMain_Update(void) {
if (CheckPlayerActivity() || IsEnterPortal()) {
static void GameMain_Update(void) {
if (CheckPlayerInactive() || IsEnterPortal()) {
return;
}
sub_0805340C();
// leave early if player is entering a portal
// leave early if player is now entering a portal
if (gMain.substate != GAMEMAIN_UPDATE) {
return;
}
@ -325,7 +371,7 @@ void GameMain_Update(void) {
DrawOAMCmd();
UpdateCarriedObject();
DrawEntities();
HandleRoomExit();
CheckRoomExit();
UpdatePlayerMapCoords();
CheckGameOver();
sub_080185F8();
@ -346,8 +392,8 @@ void GameMain_Update(void) {
}
}
void GameMain_BarrelUpdate(void) {
if (CheckPlayerActivity())
static void GameMain_BarrelUpdate(void) {
if (CheckPlayerInactive())
return;
UpdateEntities();
@ -358,14 +404,14 @@ void GameMain_BarrelUpdate(void) {
DrawOAMCmd();
UpdateCarriedObject();
DrawEntities();
HandleRoomExit();
CheckRoomExit();
CheckGameOver();
CopyOAM();
if (!gFadeControl.active)
ResetSystemPriority();
}
void GameMain_ChangeArea(void) {
static void GameMain_ChangeArea(void) {
FlushSprites();
DrawOAMCmd();
DrawEntities();
@ -379,7 +425,7 @@ void GameMain_ChangeArea(void) {
}
}
void sub_08051D2C(void) {
static void GameTask_Exit(void) {
#ifdef DEMO_USA
if (!gFadeControl.active)
DoSoftReset();
@ -405,15 +451,15 @@ static void InitializeEntities(void) {
sub_0805329C();
UpdateScrollVram();
sub_0805BB74(0xffffffff);
sub_080531F8();
UpdatePlayerRoomStatus();
}
void sub_08051D98(void) {
static void sub_08051D98(void) {
sub_08052EA0();
gRoomVars.field_0x0 = 1;
// remove old entities, unless persistent
QueueEntityDeletion();
RecycleEntities();
sub_0804AF90();
CallRoomProp6();
@ -424,21 +470,21 @@ void sub_08051D98(void) {
SetPlayerControl(1);
}
void sub_08051DCC(void) {
static void sub_08051DCC(void) {
gRoomControls.area = gRoomTransition.player_status.area_next;
gRoomControls.room = gRoomTransition.player_status.room_next;
RoomExitCallback();
gRoomTransition.type = TRANSITION_3;
InitRoom();
sub_08052EA0();
QueueEntityDeletion();
RecycleEntities();
sub_0804AF90();
CallRoomProp6();
LoadRoomBgm();
}
void UpdateWindcrests() {
if (CheckIsOverworld()) {
static void UpdateWindcrests(void) {
if (AreaIsOverworld()) {
struct_08127F94* i;
u32 hi_x, hi_y;
s32 x, y;
@ -462,31 +508,43 @@ void UpdateWindcrests() {
}
}
void Subtask_ChuchuCutscene() {
gUnk_080FCA08[gMenu.menuType]();
void Subtask_AuxCutscene(void) {
static AuxCutsceneState* const sStates[] = {
AuxCutscene_Init,
AuxCutscene_Main,
AuxCutscene_Exit,
};
sStates[gMenu.menuType]();
}
void sub_08051E84() {
struct_080FCA20* p = &gUnk_080FCA20[gUnk_02032EC0.field_0x3];
gRoomControls.area = p->_0;
gRoomControls.room = p->_1;
static void AuxCutscene_Init(void) {
const CutsceneData* p = &sCutsceneData[gUnk_02032EC0.field_0x3];
gRoomControls.area = p->area;
gRoomControls.room = p->room;
LoadGfxGroups();
gArea.localFlagOffset = GetFlagBankOffset(gRoomControls.area);
SetCurrentRoomPropertyList(p->_0, p->_1);
sub_08052FD8(p->_0, p->_1);
gRoomControls.scroll_x = gRoomControls.origin_x + p->_4;
gRoomControls.scroll_y = gRoomControls.origin_y + p->_6;
SetCurrentRoomPropertyList(p->area, p->room);
LoadCutsceneRoom(p->area, p->room);
gRoomControls.scroll_x = gRoomControls.origin_x + p->x;
gRoomControls.scroll_y = gRoomControls.origin_y + p->y;
gMenu.field_0x0 = p->_2;
gMenu.field_0x3 = p->_3 & 0xf;
gMenu.field_0xc = (void*)p;
gMenu.menuType++;
gMenu.overlayType = 0;
gMenu.transitionTimer = 300;
sub_08051F04();
AuxCutscene_Main(); // init
}
void sub_08051F04(void) {
gUnk_080FCA14[gMenu.field_0x0]();
static void AuxCutscene_Main(void) {
static CutsceneMainState* const sStates[] = {
CutsceneMain_Init,
CutsceneMain_Update,
CutsceneMain_Exit,
};
sStates[gMenu.field_0x0]();
FlushSprites();
UpdateEntities();
DrawEntities();
@ -497,8 +555,21 @@ void sub_08051F04(void) {
UpdateScrollVram();
}
void sub_08051F40(u32 a1, u32 a2, u32 a3, u32 a4) {
u32 flag = gUnk_080FCA20[gUnk_02032EC0.field_0x3]._3;
static const CutsceneData sCutsceneData[] = {
{ AREA_MINISH_WOODS, 0, 0, 0, 336, 528 },
{ AREA_HYRULE_FIELD, 1, 1, 0, 472, 312 },
{ AREA_HYRULE_CASTLE, 2, 1, 1, 16, 16 },
{ AREA_SANCTUARY, 2, 1, 2, 0, 0 },
{ AREA_EZLO_CUTSCENE, 0, 1, 3, 0, 0 },
{ AREA_HOUSE_INTERIORS_2, 16, 1, 4, 0, 0 },
{ AREA_DARK_HYRULE_CASTLE_OUTSIDE, 0, 1, 5, 0, 40 },
{ AREA_FORTRESS_OF_WINDS, 28, 2, 0, 0, 0 },
{ AREA_FORTRESS_OF_WINDS, 29, 2, 1, 0, 0 },
{ AREA_DARK_HYRULE_CASTLE, 14, 2, 2, 16, 16 },
};
static void AuxCutscene_Exit(void) {
u32 flag = sCutsceneData[gUnk_02032EC0.field_0x3]._3;
if (flag & 0xF0) {
MenuFadeIn(2, flag >> 4);
} else {
@ -510,12 +581,12 @@ void sub_08051F40(u32 a1, u32 a2, u32 a3, u32 a4) {
void sub_08051F78(u32 a1, u32 a2, u32 a3, u32 a4) {
u32 idx = gUnk_02032EC0.field_0x3;
struct_080FCA20* p = &gUnk_080FCA20[idx];
sub_08051F9C(p->_0, p->_1, p->_4, p->_6);
const CutsceneData* p = &sCutsceneData[idx];
sub_08051F9C(p->area, p->room, p->x, p->y);
}
void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4) {
u32 tmp = gScreen.lcd.displayControl & 0x6000;
u32 tmp = gScreen.lcd.displayControl & (DISPCNT_WIN0_ON | DISPCNT_WIN1_ON);
sub_08052FF4(a1, a2);
gRoomControls.scroll_x = gRoomControls.origin_x + a3;
gRoomControls.scroll_y = gRoomControls.origin_y + a4;
@ -525,15 +596,15 @@ void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4) {
gScreen.lcd.displayControl |= tmp;
}
void sub_08051FF0() {
void sub_08051FF0(void) {
sub_0804B0B0(gMenu.field_0xc[0], gMenu.field_0xc[1]);
}
void sub_08052004() {
void sub_08052004(void) {
gMenu.menuType = 2;
}
void sub_08052010() {
static void sub_08052010(void) {
InitSoundPlayingInfo();
MessageInitialize();
DispReset(1);
@ -545,15 +616,19 @@ void sub_08052010() {
LoadGfxGroup(4);
MemClear((void*)0x06000000, 0x20);
MemClear(&gMenu, 0x30);
gScreen.lcd.displayControl |= 0x1000;
gScreen.bg1.control = 0x1C01;
gScreen.bg2.control = 0x1D05;
gScreen.lcd.displayControl |= DISPCNT_OBJ_ON;
gScreen.bg1.control = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(28) | BGCNT_CHARBASE(0);
gScreen.bg2.control = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(29) | BGCNT_CHARBASE(1);
gScreen.bg1.updated = 1;
gScreen.bg2.updated = 1;
}
void GameOverTask() {
gUnk_080FCA70[gMain.state]();
void GameOverTask(void) {
static GameOverState* const sStates[] = {
GameOver_Init, GameOver_FadeIn, GameOver_TextMove, GameOver_Update, GameOver_Exit,
};
sStates[gMain.state]();
if (gMain.state != 0) {
FlushSprites();
DrawGameOverText();
@ -561,12 +636,12 @@ void GameOverTask() {
}
}
void sub_080520C4(u32 idx) {
static void switch_state(u32 idx) {
gMain.state = idx;
sub_080A7114(0);
}
void sub_080520D8(void) {
static void GameOver_Init(void) {
if (gFadeControl.active)
return;
sub_08052010();
@ -577,10 +652,10 @@ void sub_080520D8(void) {
SoundReq(BGM_GAMEOVER);
sub_080500F4(4);
gFadeControl.mask = 0xFFFF0001;
sub_080520C4(1);
switch_state(1);
}
void sub_0805212C(void) {
static void GameOver_FadeIn(void) {
if (gFadeControl.active)
return;
@ -590,7 +665,7 @@ void sub_0805212C(void) {
} else {
gMenu.transitionTimer--;
if (gMenu.transitionTimer == 0) {
sub_080520C4(2);
switch_state(2);
#if defined(DEMO_USA) || defined(DEMO_JP)
SoundReq(SONG_VOL_FADE_OUT);
DoFade(7, 4);
@ -607,14 +682,13 @@ void sub_0805212C(void) {
}
}
static void GameOver_TextMove(void) {
#if defined(DEMO_USA) || defined(DEMO_JP)
void sub_080521A0(void) {
if (gFadeControl.active == 0) {
DoSoftReset();
}
}
#else
void sub_080521A0(void) {
s32 temp3;
u32 temp2;
@ -685,13 +759,13 @@ void sub_080521A0(void) {
default:
gScreen.lcd.displayControl &= ~DISPCNT_BG1_ON;
sub_08050384();
sub_080520C4(3);
switch_state(3);
return;
}
}
#endif
void sub_080522F4(void) {
static void GameOver_Update(void) {
switch (gMenu.menuType) {
case 0x0:
gMenu.transitionTimer = 0x1e;
@ -743,7 +817,9 @@ void sub_080522F4(void) {
}
}
void nullsub_107(void) {
// Unused, since task is set above
// if we got here, it would be a softlock
static void GameOver_Exit(void) {
}
static void DrawGameOverText(void) {
@ -760,9 +836,9 @@ static void DrawGameOverText(void) {
for (i = 0; i < 8; ++i) {
gOamCmd.x = sOffsets[i];
#ifdef EU
sub_080ADA14(0x1fc, i);
DrawDirect(0x1fc, i);
#else
sub_080ADA14(0x1fd, i);
DrawDirect(0x1fd, i);
#endif
}
}
@ -810,7 +886,7 @@ void SetPopupState(u32 type, u32 choice_idx) {
gScreen.bg1.updated = fakematch;
}
void InitializePlayer(void) {
static void InitializePlayer(void) {
static const u8 sPlayerSpawnStates[] = {
[PL_SPAWN_DEFAULT] = PLAYER_INIT,
[PL_SPAWN_MINISH] = PLAYER_MINISH,
@ -881,7 +957,7 @@ void InitializePlayer(void) {
RegisterPlayerHitbox();
}
bool32 CheckIsOverworld(void) {
bool32 AreaIsOverworld(void) {
#ifdef EU
return gArea.areaMetadata == 0x01;
#else
@ -889,33 +965,33 @@ bool32 CheckIsOverworld(void) {
#endif
}
bool32 sub_08052638(u32 r0) {
bool32 CheckAreaOverworld(u32 area) {
#if EU
return gAreaMetadata[r0].flags == 0x01;
return gAreaMetadata[area].flags == 0x01;
#else
return gAreaMetadata[r0].flags == 0x81;
return gAreaMetadata[area].flags == 0x81;
#endif
}
#ifndef EU
u32 sub_08052654(void) {
bool32 AreaAllowsWarp(void) {
return (gArea.areaMetadata >> 7) & 1;
}
#endif
u32 CheckIsDungeon(void) {
bool32 AreaIsDungeon(void) {
return (gArea.areaMetadata >> 2) & 1;
}
u32 CheckIsInteriorWithEnemies(void) {
bool32 AreaHasEnemies(void) {
return (gArea.areaMetadata >> 4) & 1;
}
u32 CheckIsInteriorNoEnemies(void) {
bool32 AreaHasNoEnemies(void) {
return (gArea.areaMetadata >> 6) & 1;
}
u32 CheckHasMap(void) {
bool32 AreaHasMap(void) {
return (gArea.areaMetadata >> 3) & 1;
}
@ -951,7 +1027,7 @@ void ModRupees(s32 delta) {
}
void sub_080526F8(s32 a1) {
if (sub_08052724()) {
if (AreaHasKeys()) {
u8* p = &gSave.unk45C[gArea.dungeon_idx];
if (*p + a1 < 0)
*p = 0;
@ -960,41 +1036,41 @@ void sub_080526F8(s32 a1) {
}
}
u32 sub_08052724(void) {
bool32 AreaHasKeys(void) {
return (gArea.areaMetadata >> 1) & 1;
}
u32 HasDungeonMap(void) {
bool32 HasDungeonMap(void) {
u32 tmp;
if (sub_08052724())
if (AreaHasKeys())
tmp = gSave.unk45C[gArea.dungeon_idx];
return tmp ? 1 : 0;
}
u32 HasDungeonCompass(void) {
bool32 HasDungeonCompass(void) {
u32 tmp;
if (sub_08052724())
if (AreaHasKeys())
tmp = gSave.unk46C[gArea.dungeon_idx] & 4;
return tmp ? 1 : 0;
}
u32 HasDungeonBigKey(void) {
if (!sub_08052724())
bool32 HasDungeonBigKey(void) {
if (!AreaHasKeys())
return 0;
return (gSave.unk46C[gArea.dungeon_idx] >> 1) & 1;
}
u32 HasDungeonSmallKey(void) {
bool32 HasDungeonSmallKey(void) {
u32 tmp;
if (!sub_08052724())
if (!AreaHasKeys())
return 0;
return gSave.unk46C[gArea.dungeon_idx] & 1;
}
void sub_080527FC(u32 a1, u32 a2) {
void RestoreGameTask(u32 a1) {
LoadGfxGroups();
#ifndef EU
CleanUpGFXSlots();
@ -1003,28 +1079,28 @@ void sub_080527FC(u32 a1, u32 a2) {
InitUI(1);
sub_0801AE44(a1);
MemCopy(gUnk_02024090, gPaletteBuffer, 1024);
gUsedPalettes = -1;
gUsedPalettes = 0xffffffff;
}
void LoadRoomBgm(void) {
gArea.pMusicIndex = gAreaMetadata[gRoomControls.area]._3;
static void LoadRoomBgm(void) {
gArea.queued_bgm = gAreaMetadata[gRoomControls.area]._3;
if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START)) {
gArea.pMusicIndex = BGM_FIGHT_THEME2;
gArea.queued_bgm = BGM_FIGHT_THEME2;
}
}
#ifndef EU
void sub_08052878(void) {
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_STOP_ALL);
}
static void sub_0805289C(void) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#endif
u32 CheckGameOver(void) {
static u32 CheckGameOver(void) {
if (gRoomTransition.field_0x4[1]) {
InitFade();
gMain.state = 3;
@ -1041,7 +1117,7 @@ void RoomExitCallback(void) {
gArea.onExit(gArea.transitionManager);
}
u32 HandleRoomExit(void) {
static u32 CheckRoomExit(void) {
if (gRoomTransition.transitioningOut && gSave.stats.health != 0 && gPlayerState.framestate != PL_STATE_DIE) {
if (StairsAreValid()) {
gRoomTransition.transitioningOut = 0;
@ -1147,7 +1223,7 @@ static void InitRoomTransition(void) {
}
}
u32 sub_08052B24(void) {
bool32 CanDispEzloMessage(void) {
s32 tmp = PL_STATE_WALK;
if (!(gInput.heldKeys & SELECT_BUTTON) || gPlayerState.controlMode != CONTROL_ENABLED || gUnk_02034490[0] ||
@ -1185,7 +1261,7 @@ void DisplayEzloMessage(void) {
}
#if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP)
void CreateManagerF(void) {
static void CreateManagerF(void) {
Entity* e = NULL;
if (gRoomTransition.player_status.field_0x24[13])
@ -1204,7 +1280,7 @@ void CreateManagerF(void) {
}
#endif
void sub_08052C3C(void) {
static void sub_08052C3C(void) {
if (gArea.field_0x18 == 0)
gArea.unk1A = gArea.field_0x18;
if (gArea.unk1A) {
@ -1213,25 +1289,25 @@ void sub_08052C3C(void) {
}
}
void UpdatePlayerMapCoords(void) {
if (!CheckIsInteriorNoEnemies()) {
if (CheckIsOverworld()) {
static void UpdatePlayerMapCoords(void) {
if (!AreaHasNoEnemies()) {
if (AreaIsOverworld()) {
gRoomTransition.player_status.overworld_map_x = gPlayerEntity.x.HALF_U.HI;
gRoomTransition.player_status.overworld_map_y = gPlayerEntity.y.HALF_U.HI;
} else if (CheckIsDungeon()) {
} else if (AreaIsDungeon()) {
gRoomTransition.player_status.dungeon_map_x = gPlayerEntity.x.HALF.HI;
gRoomTransition.player_status.dungeon_map_y = gPlayerEntity.y.HALF.HI;
}
}
}
void sub_08052CA4(u32 area, u32 room, u32 x, u32 y) {
void SetWorldMapPos(u32 area, u32 room, u32 x, u32 y) {
RoomHeader* hdr = gAreaRoomHeaders[area] + room;
gRoomTransition.player_status.overworld_map_x = hdr->map_x + x;
gRoomTransition.player_status.overworld_map_y = hdr->map_y + y;
}
void sub_08052CD0(u32 area, u32 room, u32 x, u32 y) {
void SetDungeonMapPos(u32 area, u32 room, u32 x, u32 y) {
RoomHeader* hdr = gAreaRoomHeaders[area] + room;
gRoomTransition.player_status.dungeon_map_x = hdr->map_x + x;
gRoomTransition.player_status.dungeon_map_y = hdr->map_y + y;
@ -1324,7 +1400,7 @@ static u32 sub_08052EF4(s32 idx) {
* @brief If enabled, this type of transition does not change the room
* and keeps all entities.
*/
void UpdateFakeScroll(void) {
static void UpdateFakeScroll(void) {
u32 x, y;
LinkedList* ll;
Entity* e;
@ -1365,7 +1441,7 @@ void UpdateFakeScroll(void) {
} while (++ll < gEntityLists + 9);
}
void sub_08052FD8(u32 area, u32 room) {
void LoadCutsceneRoom(u32 area, u32 room) {
sub_08052FF4(area, room);
gRoomControls.camera_target = NULL;
sub_0807C860();
@ -1440,7 +1516,7 @@ static u32 sub_08053144(void) {
return ret;
}
void CheckAreaDiscovery(void) {
static void CheckAreaDiscovery(void) {
if (!sub_08053144())
return;
@ -1465,12 +1541,12 @@ void CheckAreaDiscovery(void) {
WriteBit(gSave.areaVisitFlags, gArea.locationIndex);
}
void sub_080531F8(void) {
static void UpdatePlayerRoomStatus(void) {
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
if (sub_08053144()) {
MemCopy(&gRoomTransition.player_status, &gSave.saved_status, sizeof gRoomTransition.player_status);
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
gRoomTransition.player_status.dungeon_area = gRoomControls.area;
gRoomTransition.player_status.dungeon_room = gRoomControls.room;
gRoomTransition.player_status.dungeon_x = gPlayerEntity.x.HALF.HI;
@ -1490,7 +1566,7 @@ void sub_08053250(void) {
MemCopy(&gRoomTransition.player_status, &gSave.saved_status, sizeof gRoomTransition.player_status);
}
void sub_0805329C(void) {
static void sub_0805329C(void) {
if (sub_08053144()) {
switch (gRoomControls.area) {
case AREA_DEEPWOOD_SHRINE:
@ -1556,7 +1632,7 @@ void sub_080533CC(void) {
gUsedPalettes |= 8;
}
void sub_0805340C(void) {
static void sub_0805340C(void) {
static void (*const sHandlers[])(u32*) = {
sub_08053434, DummyHandler, sub_080534E4, DummyHandler, DummyHandler, DummyHandler, DummyHandler, DummyHandler,
};
@ -1564,7 +1640,7 @@ void sub_0805340C(void) {
u32* p;
u32 i;
p = gSave.unk48C;
p = gSave.timers;
for (i = 0; i < 8; i++, p++) {
(sHandlers[i])(p);
}
@ -1590,20 +1666,20 @@ static void sub_08053460(void) {
FLAG_BANK_10, LV6_KANE_2ND, FLAG_BANK_10, LV6_SOTO_ENDING,
0xFFFF };
gSave.unk48C[0] = 0;
gSave.timers[0] = 0;
if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_ZELDA_DISCURSE))
ClearGlobalFlag(ZELDA_CHASE);
ClearFlagArray(sClearFlags);
}
void sub_08053494(void) {
gSave.unk48C[0] = 10800;
gSave.timers[0] = 10800;
}
void sub_080534AC(void) {
if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START)) {
ClearLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START);
gSave.unk48C[0] = 0;
gSave.timers[0] = 0;
SoundReq(SONG_STOP_BGM);
}
}
@ -1615,11 +1691,11 @@ static void sub_080534E4(u32* a1) {
}
}
void sub_08053500(void) {
gSave.unk48C[2] = 36000;
void InitBiggoronTimer(void) {
gSave.timers[2] = 36000;
}
void ResetTmpFlags(void) {
static void ResetTmpFlags(void) {
static const u16 sClearFlags[] = { FLAG_BANK_2, BILL00_SHICHOU_00, FLAG_BANK_2, BILL0A_YADO_TAKARA_00,
FLAG_BANK_2, BILL0C_SCHOOLR_00, FLAG_BANK_1, MACHI00_00,
FLAG_BANK_1, MACHI00_02, FLAG_BANK_2, MHOUSE06_00,

View File

@ -60,21 +60,21 @@ void sub_080595E4(Manager10* this) {
void sub_08059608(Manager10* this) {
if (this->unk_23) {
if (!--this->unk_23) {
gArea.musicIndex = gArea.pMusicIndex;
SoundReq(gArea.musicIndex);
gArea.bgm = gArea.queued_bgm;
SoundReq(gArea.bgm);
}
return;
}
if (sub_0805986C()) {
if (gArea.pMusicIndex != 0x1E) {
gArea.pMusicIndex = 0x1E;
if (gArea.queued_bgm != 0x1E) {
gArea.queued_bgm = 0x1E;
this->unk_23 = 0x78;
SoundReq(0x800d0000);
}
return;
}
if (gArea.pMusicIndex != 0x37) {
gArea.pMusicIndex = 0x37;
if (gArea.queued_bgm != 0x37) {
gArea.queued_bgm = 0x37;
this->unk_23 = 0x78;
SoundReq(0x800d0000);
}
@ -210,6 +210,6 @@ void sub_08059960(const u16* unk1, const u16* unk2, u16* unk3, u8 unk4) {
void sub_08059994() {
if (sub_0805986C()) {
LoadPaletteGroup(0x5B);
gArea.pMusicIndex = 0x1E;
gArea.queued_bgm = 0x1E;
}
}

View File

@ -89,7 +89,7 @@ void sub_0805C050(u32 pos, u32 layer) {
SetTileType(0xb4, pos - 1, layer);
SetTileType(0xb7, pos + 1, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
Entity* object = CreateObject(ARCHWAY, 0xe, 0);
if (object != NULL) {
object->x.HALF.HI = ((pos & 0x3f) << 4) + 8 + gRoomControls.origin_x;
@ -97,7 +97,7 @@ void sub_0805C050(u32 pos, u32 layer) {
}
SetTileType(0xb5, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xb5, pos, 1);
} else {
SetTileType(0xb6, pos, 1);
@ -110,7 +110,7 @@ void sub_0805C050(u32 pos, u32 layer) {
} else {
Entity* object;
SetTileType(0xb5, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
object = CreateObject(ARCHWAY, sub_0805C608(), 6);
@ -133,7 +133,7 @@ void sub_0805C178(u32 pos, u32 layer) {
SetTileType(0xf7, pos + 0x41, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
object = CreateObject(ARCHWAY, 0xe, 1);
if (object != NULL) {
@ -142,7 +142,7 @@ void sub_0805C178(u32 pos, u32 layer) {
}
SetTileType(0xf2, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xf2, pos, 1);
} else {
SetTileType(0xf3, pos, 1);
@ -153,7 +153,7 @@ void sub_0805C178(u32 pos, u32 layer) {
SetTileType(0xfa, pos + 0x41, 2);
} else {
SetTileType(0xf2, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
object = CreateObject(ARCHWAY, sub_0805C608(), 7);
@ -175,7 +175,7 @@ void sub_0805C294(u32 pos, u32 layer) {
SetTileType(0xd6, pos + 0x40, layer);
SetTileType(0xd7, pos + 0x41, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
object = CreateObject(ARCHWAY, 0xe, 2);
if (object != NULL) {
object->x.HALF.HI = ((pos & 0x3f) << 4) + 8 + gRoomControls.origin_x;
@ -183,7 +183,7 @@ void sub_0805C294(u32 pos, u32 layer) {
}
SetTileType(0xd2, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xd2, pos, 1);
} else {
SetTileType(0xd3, pos, 1);
@ -194,7 +194,7 @@ void sub_0805C294(u32 pos, u32 layer) {
SetTileType(0xda, pos + 0x41, 2);
} else {
SetTileType(0xd2, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
object = CreateObject(ARCHWAY, sub_0805C608(), 8);
@ -216,7 +216,7 @@ void sub_0805C3B4(u32 pos, u32 layer) {
SetTileType(0xe3, pos + 0x3f, layer);
SetTileType(0xe7, pos + 0x40, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
object = CreateObject(ARCHWAY, 0xe, 3);
if (object != NULL) {
object->x.HALF.HI = ((pos & 0x3f) << 4) + -0x10 + gRoomControls.origin_x;
@ -224,7 +224,7 @@ void sub_0805C3B4(u32 pos, u32 layer) {
}
SetTileType(0xe5, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xe5, pos, 1);
} else {
SetTileType(0xe6, pos, 1);
@ -235,7 +235,7 @@ void sub_0805C3B4(u32 pos, u32 layer) {
SetTileType(0xea, pos + 0x3f, 2);
} else {
SetTileType(0xe5, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
@ -258,7 +258,7 @@ void sub_0805C4E0(u32 pos, u32 layer) {
SetTileType(0xc4, pos - 1, layer);
SetTileType(0xc7, pos + 1, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
object = CreateObject(ARCHWAY, 0xe, 0);
if (object != NULL) {
object->x.HALF.HI = ((pos & 0x3f) << 4) + 8 + gRoomControls.origin_x;
@ -266,7 +266,7 @@ void sub_0805C4E0(u32 pos, u32 layer) {
}
SetTileType(0xc5, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xc5, pos, 1);
} else {
SetTileType(0xc6, pos, 1);
@ -277,7 +277,7 @@ void sub_0805C4E0(u32 pos, u32 layer) {
SetTileType(0xca, pos - 0x3f, 2);
} else {
SetTileType(0xc5, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}

View File

@ -38,7 +38,7 @@ void sub_0805DE68(Manager* this) {
*(u8*)&gRoomTransition.field_0x3a = 0x20;
*((u8*)&gRoomTransition.field_0x3a + 1) = 0x20;
#if !defined(EU) && !defined(JP)
gSave.unk48C[3] = 0x1194;
gSave.timers[3] = 0x1194;
#endif
}
@ -119,7 +119,7 @@ void sub_0805E000(Manager* this) {
*(Entity**)this->unk_18 = enemy;
this->action = 1;
SetPlayerControl(3);
gArea.pMusicIndex = 0x80010000;
gArea.queued_bgm = 0x80010000;
DoFade(6, 4);
SoundReq(SFX_APPARATE);
}

View File

@ -48,7 +48,7 @@ void sub_0805E140(Manager39* this) {
this->manager.unk_0e = 0x78;
this->manager.unk_0f = 0x3c;
SetDefaultPriority((Entity*)this, PRIO_HIGHEST);
sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], CheckIsDungeon());
sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], AreaIsDungeon());
}
void sub_0805E18C(Manager39* this) {

View File

@ -52,8 +52,8 @@ void ManagerB_WaitForFlag(ManagerB* this) {
ManagerB_LoadFight(&this->manager);
if (!this->unk_35) {
tmp = gRoomVars.field_0x9 ? gRoomVars.field_0x9 : 0x33;
this->unk_20 = gArea.musicIndex;
gArea.musicIndex = tmp;
this->unk_20 = gArea.bgm;
gArea.bgm = tmp;
SoundReq(tmp);
}
sub_080186C0(0xB0F);
@ -69,8 +69,8 @@ void ManagerB_WaitForDone(ManagerB* this) {
// restore music (if it was set, which apparently is only possible if there's a flag the fight waited for)
if (this->unk_3c) {
if (!this->unk_35) {
gArea.musicIndex = this->unk_20;
SoundReq(gArea.musicIndex);
gArea.bgm = this->unk_20;
SoundReq(gArea.bgm);
sub_0801855C();
}
}

View File

@ -293,7 +293,7 @@ void sub_08058D34() {
gScreen.bg1.yOffset = tmp2;
gScreen.controls.layerFXControl = 0x3456;
gScreen.controls.alphaBlend = 0x909;
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
gUpdateVisibleTiles = 0;
if (CheckGlobalFlag(LV1TARU_OPEN)) {
LoadGfxGroup(0x4A);

View File

@ -14,7 +14,7 @@ extern u8 gMapDataTopSpecial[];
void sub_0806D138(u8* param_1, u8* param_2);
extern void sub_08053500(void);
extern void InitBiggoronTimer(void);
extern u32 gUnk_0200B650;
void sub_0806D110(void);
@ -302,7 +302,7 @@ ASM_FUNC("asm/non_matching/bigGoron/sub_0806D520.inc", void sub_0806D520(Entity*
NONMATCH("asm/non_matching/bigGoron/sub_0806D5D4.inc", void sub_0806D5D4(void)) {
u32 itemSlot;
sub_08053500();
InitBiggoronTimer();
itemSlot = IsItemEquipped(0xd);
if (itemSlot != 2) {
((u8*)&gSave.stats.itemOnA)[itemSlot] = 0;
@ -312,7 +312,7 @@ NONMATCH("asm/non_matching/bigGoron/sub_0806D5D4.inc", void sub_0806D5D4(void))
END_NONMATCH
void sub_0806D600(Entity* this, ScriptExecutionContext* context) {
context->condition = gSave.unk48C[2] == 0;
context->condition = gSave.timers[2] == 0;
}
void sub_0806D620(void) {

View File

@ -224,13 +224,13 @@ void sub_08060318(void) {
}
void sub_08060340(void) {
gSave.unk48C[1] = gSave.unk50;
gSave.timers[1] = gSave.unk50;
}
u32 sub_08060354(void) {
s32 iVar2;
iVar2 = gSave.unk50 - gSave.unk48C[1];
iVar2 = gSave.unk50 - gSave.timers[1];
if (CheckGlobalFlag(DRUG_1) == 0) {
if (4 < iVar2) {
return 0x8444;

View File

@ -8,7 +8,7 @@ void Archway(Entity* this) {
this->frameIndex = this->type2;
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
this->spritePriority.b0 = 1;
}
}

View File

@ -127,7 +127,7 @@ void sub_08083338(Entity* this) {
if (!CheckFlags(this->field_0x86.HWORD)) {
this->frameIndex |= 4;
sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD);
if (!CheckIsDungeon()) {
if (!AreaIsDungeon()) {
this->action = 5;
} else {
this->action = 8;

View File

@ -7,7 +7,7 @@ void MinishSizedArchway(Entity* this) {
this->frameIndex = this->type;
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
this->spritePriority.b0 = 1;
}
}

View File

@ -14,7 +14,7 @@ void sub_08090EC0(Entity* this) {
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
this->frameIndex = this->type2;
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
this->frameIndex += 4;
sub_080AE068(this);
LoadFixedGFX(this, 0x184);

View File

@ -45,7 +45,7 @@ void sub_0808B474(Entity* this) {
if (CheckFlags(this->field_0x86.HWORD)) {
sub_0808B830(this);
} else {
if (CheckIsDungeon() && sub_0807CAEC(this->type)) {
if (AreaIsDungeon() && sub_0807CAEC(this->type)) {
sub_0808B830(this);
}
}
@ -63,7 +63,7 @@ void sub_0808B474(Entity* this) {
void sub_0808B530(Entity* this) {
if (CheckFlags(this->field_0x86.HWORD)) {
sub_0808B830(this);
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
sub_0807CAC8(this->type);
}
this->action = 2;

View File

@ -320,7 +320,7 @@ extern u16 script_BedAtSimons;
extern Entity* gPlayerClones[];
extern ScriptExecutionContext gPlayerScriptExecutionContext;
NONMATCH("asm/non_matching/playerItemPacciCane/sub_080705AC.inc", u32 CheckPlayerActivity(void)) {
NONMATCH("asm/non_matching/playerItemPacciCane/sub_080705AC.inc", u32 CheckPlayerInactive(void)) {
if (!((gInput.newKeys & START_BUTTON) == 0 || gFadeControl.active || gUnk_02034490[0] ||
(gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.fillerD0[34] ||
gPlayerState.controlMode != 0 || gPriorityHandler.priority_timer != 0)) {
@ -1053,7 +1053,7 @@ static void PlayerUsePortal(Entity* this) {
if ((gInput.newKeys & (B_BUTTON | R_BUTTON)) == 0)
return;
if (CheckIsDungeon() || gArea.curPortalType == 3) {
if (AreaIsDungeon() || gArea.curPortalType == 3) {
this->subAction = 7;
this->actionDelay = 30;
DoFade(7, 16);
@ -2228,7 +2228,7 @@ static void sub_08072B5C(Entity* this) {
return;
}
if (!CheckIsOverworld()) {
if (!AreaIsOverworld()) {
sub_08004542(this);
}
this->subAction++;

View File

@ -147,7 +147,7 @@ void MandiblesProjectile_Action3(Entity* this) {
this->direction = uVar1 << 2;
this->animationState = uVar1 << 0x1a >> 0x1a;
this->hitbox = &gHitbox_0;
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
this->spriteOrientation.flipY = 1;
}
sub_080AA3E0(this, 0);

View File

@ -280,7 +280,7 @@ void LoadRoomTileEntities(TileEntity* list) {
LoadBombableWallTile(t);
break;
case MUSIC_SETTER:
gArea.pMusicIndex = t->_3;
gArea.queued_bgm = t->_3;
break;
case DARKNESS:
LoadDarknessTile(t);

View File

@ -517,7 +517,7 @@ void sub_StateChange_HouseInteriors1_SchoolWest(void) {
LoadRoomEntityList(&gUnk_080D7038);
}
if (gRoomVars.field_0x0 == 0) {
sub_08052CA4(2, 0, 0x2c8, 0xa8);
SetWorldMapPos(2, 0, 0x2c8, 0xa8);
}
}
@ -564,17 +564,17 @@ void sub_StateChange_HyruleCastle_0(void) {
#if defined(JP) || defined(DEMO_JP)
if (CheckGlobalFlag(CASTLE_BGM) || CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#elif defined(EU)
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#else
if (CheckGlobalFlag(CASTLE_BGM)) {
gArea.pMusicIndex = BGM_HYRULE_CASTLE_NOINTRO;
gArea.queued_bgm = BGM_HYRULE_CASTLE_NOINTRO;
} else if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#endif
}
@ -594,7 +594,7 @@ extern EntityData gUnk_080D73E0;
void sub_StateChange_HyruleCastle_1(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
} else {
if (!CheckGlobalFlag(LV2_CLEAR)) {
LoadRoomEntityList(&gUnk_080D73B0);
@ -604,7 +604,7 @@ void sub_StateChange_HyruleCastle_1(void) {
}
#ifndef EU
if (CheckGlobalFlag(CASTLE_BGM)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#endif
}
@ -622,16 +622,16 @@ extern EntityData gUnk_080D7618;
void sub_StateChange_HyruleCastle_2(void) {
#ifndef EU
if (CheckGlobalFlag(CASTLE_BGM)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#endif
if (CheckGlobalFlag(ENDING)) {
LoadRoomEntityList(&gUnk_080D7618);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
} else if (CheckGlobalFlag(TABIDACHI) == 0) {
LoadRoomEntityList(&gUnk_080D74C8);
gArea.pMusicIndex = BGM_HYRULE_CASTLE_NOINTRO;
gArea.queued_bgm = BGM_HYRULE_CASTLE_NOINTRO;
} else if (CheckGlobalFlag(LV1_CLEAR) == 0) {
LoadRoomEntityList(&gUnk_080D7588);
} else {
@ -669,7 +669,7 @@ void sub_StateChange_HyruleCastle_4(void) {
sub_080751E8(0, 6, &script_PlayerWakingUpInHyruleCastle);
#ifdef EU
SoundReq(0x80010000);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
#else
}
@ -683,9 +683,9 @@ void sub_StateChange_HyruleCastle_4(void) {
#endif
if (CheckGlobalFlag(CASTLE_BGM)) {
#if defined(JP) || defined(DEMO_JP)
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
#else
gArea.pMusicIndex = BGM_HYRULE_CASTLE_NOINTRO;
gArea.queued_bgm = BGM_HYRULE_CASTLE_NOINTRO;
#endif
}
#if !(defined(JP) || defined(DEMO_JP))
@ -1011,11 +1011,11 @@ void sub_0804BF38(u32 arg0, struct_0804BF38* arg1)
ASM_FUNC("asm/non_matching/sub_0804BF38.inc", void sub_0804BF38(Entity* this, ScriptExecutionContext* context))
#endif
u32 sub_unk3_EzloCutscene_Main() {
u32 sub_unk3_EzloAuxCutscene_Main() {
return 1;
}
void sub_StateChange_EzloCutscene_Main() {
void sub_StateChange_EzloAuxCutscene_Main() {
}
u32 sub_unk3_RoyalValley_Main() {
@ -2264,7 +2264,7 @@ void sub_StateChange_DeepwoodShrineBoss_Main(void) {
LoadRoomEntityList(&gUnk_additional_a_DeepwoodShrineBoss_Main);
} else {
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
}
@ -2462,7 +2462,7 @@ void sub_StateChange_CaveOfFlamesBoss_Main(void) {
LoadRoomEntityList(&gUnk_additional_a_CaveOfFlamesBoss_Main);
} else {
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
}
@ -2562,7 +2562,7 @@ void sub_StateChange_FortressOfWinds_Mazaal(void) {
SetPlayerControl(3);
}
}
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
}
@ -2791,7 +2791,7 @@ void sub_StateChange_TempleOfDroplets_BigOcto(void) {
LoadRoomEntityList(&gUnk_additional_a_TempleOfDroplets_BigOcto);
} else {
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
}
@ -3112,7 +3112,7 @@ void sub_StateChange_PalaceOfWinds_0(void) {
if (!GetInventoryValue(ITEM_WIND_ELEMENT)) {
SetPlayerControl(3);
LoadRoomEntityList(&gUnk_additional_8_PalaceOfWinds_0);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_STOP_BGM);
}
}
@ -3522,7 +3522,7 @@ u32 sub_unk3_Vaati2_Main() {
void sub_StateChange_Vaati2_Main(void) {
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
u32 sub_unk3_Vaati3_Main() {
@ -3584,7 +3584,7 @@ void sub_StateChange_DarkHyruleCastleOutside_ZeldaStatuePlatform(void) {
LoadRoomEntityList(&gUnk_080EADB8);
SetTileType(0x4072, 0x145, 1);
SetTileType(0x4072, 0x149, 1);
gArea.pMusicIndex = 0;
gArea.queued_bgm = 0;
}
}
@ -3629,14 +3629,14 @@ void sub_StateChange_DarkHyruleCastleOutside_Garden(void) {
if (!CheckLocalFlag(0x7f)) {
LoadRoomEntityList(&gUnk_080EAEC0);
SetLocalFlag(0x7f);
gArea.pMusicIndex = 0x11;
gArea.queued_bgm = 0x11;
} else {
LoadRoomEntityList(&gUnk_080EAF20);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
} else {
if (CheckLocalFlag(0x79)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
if (!CheckLocalFlag(1)) {
LoadRoomEntityList(&gUnk_080EAE60);
@ -3701,7 +3701,7 @@ u32 sub_unk3_DarkHyruleCastle_0(void) {
if (CheckGlobalFlag(ENDING)) {
gRoomVars.field_0x6c[0] = &gUnk_080EB604;
gRoomVars.field_0x6c[2] = 0;
gArea.musicIndex = gArea.pMusicIndex = BGM_BEAT_VAATI;
gArea.bgm = gArea.queued_bgm = BGM_BEAT_VAATI;
} else if (CheckLocalFlag(0x79)) {
gRoomVars.field_0x6c[0] = NULL;
if (!CheckLocalFlag(0x7a)) {
@ -3716,7 +3716,7 @@ u32 sub_unk3_DarkHyruleCastle_0(void) {
void sub_StateChange_DarkHyruleCastle_0(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
if (CheckLocalFlag(0x79)) {
@ -3731,7 +3731,7 @@ void sub_0804D9B0(void) {
sub_0807BB98(0x357, 1, 5, 1);
sub_0807BB98(0x55f, 1, 2, 1);
LoadRoomEntityList(&gUnk_080EB684);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
u32 sub_unk3_DarkHyruleCastle_1() {
@ -3975,7 +3975,7 @@ void sub_StateChange_DarkHyruleCastle_28(void) {
if (CheckLocalFlag(0x79)) {
sub_0807BB98(0x90, 1, 1, 5);
LoadRoomEntityList(&gUnk_080ECFCC);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
}
@ -4005,7 +4005,7 @@ u32 sub_unk3_DarkHyruleCastle_31(void) {
void sub_StateChange_DarkHyruleCastle_31(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
}
@ -4170,7 +4170,7 @@ void sub_StateChange_DarkHyruleCastle_53(void) {
if (CheckLocalFlag(0x79)) {
sub_0807BB98(3, 2, 5, 1);
LoadRoomEntityList(&gUnk_080EE314);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
}
@ -4194,7 +4194,7 @@ void sub_StateChange_DarkHyruleCastle_55(void) {
if (CheckLocalFlag(0x79)) {
sub_0807BB98(0x392, 2, 2, 5);
LoadRoomEntityList(&gUnk_080EE5DC);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
}
@ -4450,16 +4450,16 @@ void sub_StateChange_CastleGarden_Main(void) {
if (!CheckGlobalFlag(TABIDACHI)) {
LoadRoomEntityList(&gUnk_080F0650);
#ifdef EU
gArea.pMusicIndex = BGM_FESTIVAL_APPROACH;
gArea.queued_bgm = BGM_FESTIVAL_APPROACH;
#else
gArea.pMusicIndex = BGM_BEANSTALK;
gArea.queued_bgm = BGM_BEANSTALK;
SetGlobalFlag(CASTLE_BGM);
} else {
if (CheckGlobalFlag(CASTLE_BGM)) {
#if defined(JP) || defined(DEMO_JP)
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
#else
gArea.pMusicIndex = BGM_HYRULE_CASTLE_NOINTRO;
gArea.queued_bgm = BGM_HYRULE_CASTLE_NOINTRO;
#endif
}
#endif
@ -4743,7 +4743,7 @@ extern EntityData gUnk_080F2E2C;
void sub_StateChange_HouseInteriors2_LinksHouseEntrance(void) {
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if (!CheckGlobalFlag(START)) {
@ -4760,7 +4760,7 @@ extern EntityData gUnk_080F2EC4;
void sub_StateChange_HouseInteriors2_LinksHouseSmith(void) {
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if (!CheckGlobalFlag(START)) {
@ -4810,7 +4810,7 @@ void sub_StateChange_HouseInteriors2_LinksHouseBedroom(void) {
sub_080751E8(0, 6, &script_PlayerIntro);
}
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if ((gPlayerState.flags & PL_NO_CAP) == 0) {
@ -5074,7 +5074,7 @@ extern EntityData gUnk_080F4E10;
void sub_StateChange_MinishWoods_Main(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
if (!CheckGlobalFlag(EZERO_1ST)) {
LoadRoomEntityList(&gUnk_080F4D50);
@ -5145,7 +5145,7 @@ void sub_StateChange_SanctuaryEntrance_Main(void) {
}
void sub_0804ED18(void) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
u32 sub_unk3_Sanctuary_Hall() {
@ -5155,7 +5155,7 @@ u32 sub_unk3_Sanctuary_Hall() {
void sub_StateChange_Sanctuary_Hall(void) {
sub_080AF2E4();
if (CheckGlobalFlag(SEIIKI_BGM)) {
gArea.pMusicIndex = BGM_CASTLE_COLLAPSE;
gArea.queued_bgm = BGM_CASTLE_COLLAPSE;
}
}
@ -5207,7 +5207,7 @@ void sub_StateChange_Sanctuary_Main(void) {
LoadRoomEntityList(&gUnk_080F55B8);
}
if (CheckGlobalFlag(SEIIKI_BGM)) {
gArea.pMusicIndex = BGM_CASTLE_COLLAPSE;
gArea.queued_bgm = BGM_CASTLE_COLLAPSE;
}
}
@ -5222,7 +5222,7 @@ void sub_StateChange_Sanctuary_StainedGlass(void) {
LoadRoomEntityList(&gUnk_080F5660);
}
if (CheckGlobalFlag(SEIIKI_BGM)) {
gArea.pMusicIndex = BGM_CASTLE_COLLAPSE;
gArea.queued_bgm = BGM_CASTLE_COLLAPSE;
}
}
@ -5398,7 +5398,7 @@ void sub_StateChange_WindTribeTower_Entrance(void) {
SetTileType(0x4072, 0x4c7, 1);
SetTileType(0x4072, 0x507, 1);
}
sub_08052CA4(8, 0, 0x1e8, 0x158);
SetWorldMapPos(8, 0, 0x1e8, 0x158);
}
u32 sub_unk3_WindTribeTower_Floor2() {
@ -5451,7 +5451,7 @@ void sub_StateChange_WindTribeTowerRoof_Main(void) {
if (CheckGlobalFlag(LV5_CLEAR) && !CheckLocalFlagByBank(0x100, 5)) {
LoadRoomEntityList(&gUnk_080F66AC);
}
sub_08052CA4(8, 0, 0x1e8, 0x158);
SetWorldMapPos(8, 0, 0x1e8, 0x158);
#ifndef EU
gArea.areaMetadata |= 0x80;
#endif
@ -5562,7 +5562,7 @@ void sub_StateChange_HyruleField_LinksHouseExterior(void) {
ClearGlobalFlag(ZELDA_CHASE);
}
if (!CheckGlobalFlag(TABIDACHI)) {
gArea.pMusicIndex = BGM_FESTIVAL_APPROACH;
gArea.queued_bgm = BGM_FESTIVAL_APPROACH;
}
if ((gSave.windcrests & 0x40000000) == 0) {
LoadRoomEntityList(&gUnk_080F70D8);
@ -5703,9 +5703,9 @@ void sub_StateChange_HyruleField_OutsideCastle(void) {
}
if (!CheckGlobalFlag(TABIDACHI)) {
#ifdef EU
gArea.pMusicIndex = 0x10;
gArea.queued_bgm = 0x10;
#else
gArea.pMusicIndex = 0x13;
gArea.queued_bgm = 0x13;
#endif
}
}
@ -6479,7 +6479,7 @@ extern EntityData gUnk_080FACB8;
void sub_StateChange_MtCrenel_MountainTop(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
} else {
LoadRoomEntityList(&gUnk_080FACB8);
}

View File

@ -1458,7 +1458,7 @@ void ScriptCommand_PlaySound(Entity* entity, ScriptExecutionContext* context) {
void ScriptCommand_PlayBgm(Entity* entity, ScriptExecutionContext* context) {
if (context->scriptInstructionPointer[1] >= 100) {
SoundReq(gArea.musicIndex);
SoundReq(gArea.bgm);
} else {
SoundReq(context->scriptInstructionPointer[1]);
}

View File

@ -15,7 +15,7 @@ void sub_080808D8(void) {
}
void sub_080808E4(void) {
if (sub_08052638(gRoomTransition.player_status.area_next)) {
if (CheckAreaOverworld(gRoomTransition.player_status.area_next)) {
gRoomTransition.type = TRANSITION_DEFAULT;
} else {
gRoomTransition.type = TRANSITION_FADE_BLACK;

View File

@ -281,14 +281,14 @@ static void HandleTitlescreen(void) {
gOamCmd._8 = 0xE020;
gOamCmd.x = 120;
gOamCmd.y = 152;
sub_080ADA14(511, 1);
DrawDirect(511, 1);
#elif defined(EU)
gOamCmd._4 = 0;
gOamCmd._6 = 0;
gOamCmd._8 = 0xE020;
gOamCmd.x = 120;
gOamCmd.y = 152;
sub_080ADA14(510, 1);
DrawDirect(510, 1);
#else
UpdatePressStartIcon();
#endif
@ -296,9 +296,9 @@ static void HandleTitlescreen(void) {
gOamCmd._8 = 0xe000;
gOamCmd.y = 0x84;
#ifdef EU
sub_080ADA14(0x1fe, 0);
DrawDirect(0x1fe, 0);
#else
sub_080ADA14(0x1ff, 0);
DrawDirect(0x1ff, 0);
#endif
}
}
@ -318,7 +318,7 @@ static void UpdatePressStartIcon(void) {
gOamCmd._8 = 0xE020;
gOamCmd.x = 120;
gOamCmd.y = 152;
sub_080ADA14(511, 1);
DrawDirect(511, 1);
}
#endif