Extract area metadata

This commit is contained in:
octorock 2022-12-11 15:39:22 +01:00
parent 1d741c182d
commit 64322c65de
18 changed files with 243 additions and 1546 deletions

View File

@ -1,59 +0,0 @@
.syntax unified
push {r4, lr}
bl CheckHeaderValid
cmp r0, #0
bne _080560F8
movs r0, #0x80
lsls r0, r0, #0x12
bl ReadSaveHeader
adds r1, r0, #0
movs r0, #1
rsbs r0, r0, #0
cmp r1, r0
blt _080560E4
cmp r1, #0
ble _080560E4
cmp r1, #1
bne _080560E4
bl CheckHeaderValid
cmp r0, #0
bne _080560F8
_080560E4:
ldr r0, _08056128 @ =sDefaultSettings
movs r4, #0x80
lsls r4, r4, #0x12
adds r1, r4, #0
movs r2, #0x10
bl MemCopy
adds r0, r4, #0
bl WriteSaveHeader
_080560F8:
ldr r2, _0805612C @ =gUnk_02000010
ldr r1, [r2]
ldr r0, _08056130 @ =0x4D435A33
eors r1, r0
rsbs r0, r1, #0
orrs r0, r1
lsrs r0, r0, #0x1f
ldrb r1, [r2, #4]
cmp r1, #0
beq _08056112
cmp r1, #0xc1
beq _08056112
movs r0, #1
_08056112:
cmp r0, #0
beq _08056124
ldr r4, _0805612C @ =gUnk_02000010
adds r0, r4, #0
movs r1, #0x20
bl MemClear
ldr r0, _08056130 @ =0x4D435A33
str r0, [r4]
_08056124:
pop {r4, pc}
.align 2, 0
_08056128: .4byte sDefaultSettings
_0805612C: .4byte gUnk_02000010
_08056130: .4byte 0x4D435A33
.syntax divided

View File

@ -1,14 +0,0 @@
.syntax unified
lsrs r2, r1, #3
adds r3, r0, r2
movs r2, #7
ands r1, r2
movs r2, #1
lsls r2, r1
ldrb r0, [r3]
adds r1, r0, #0
bics r1, r2
strb r1, [r3]
ands r0, r2
bx lr
.syntax divided

View File

@ -1,14 +0,0 @@
.syntax unified
lsrs r2, r1, #3
adds r3, r0, r2
movs r2, #7
ands r1, r2
movs r2, #1
lsls r2, r1
ldrb r0, [r3]
adds r1, r0, #0
orrs r1, r2
strb r1, [r3]
ands r0, r2
bx lr
.syntax divided

View File

@ -1,201 +0,0 @@
.syntax unified
push {r4, r5, r6, r7, lr}
adds r6, r0, #0
adds r5, r1, #0
adds r7, r2, #0
adds r0, r7, #0
movs r1, #1
bl sub_080B1B44
adds r4, r0, #0
adds r0, r7, #0
movs r1, #1
bl GetTileIndex
adds r3, r0, #0
movs r0, #0x80
lsls r0, r0, #7
ands r0, r3
cmp r0, #0
bne _0809012C
adds r3, r5, #0
ldr r1, _080900D0 @ =0xFFFFBFDC
adds r0, r3, r1
cmp r0, #0xb
bhi _0809011A
lsls r0, r0, #2
ldr r1, _080900D4 @ =_080900D8
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_080900D0: .4byte 0xFFFFBFDC
_080900D4: .4byte _080900D8
_080900D8: @ jump table
.4byte _08090114 @ case 0
.4byte _08090108 @ case 1
.4byte _0809011A @ case 2
.4byte _0809011A @ case 3
.4byte _0809011A @ case 4
.4byte _0809011A @ case 5
.4byte _0809011A @ case 6
.4byte _0809011A @ case 7
.4byte _08090114 @ case 8
.4byte _0809010E @ case 9
.4byte _08090114 @ case 10
.4byte _0809010E @ case 11
_08090108:
cmp r4, #5
bne _0809011A
b _08090118
_0809010E:
cmp r4, #5
bne _0809011A
b _08090118
_08090114:
cmp r4, #0xa
bne _0809011A
_08090118:
ldr r3, _08090128 @ =0x00004022
_0809011A:
adds r0, r3, #0
adds r1, r7, #0
movs r2, #1
bl SetTile
b _08090242
.align 2, 0
_08090128: .4byte 0x00004022
_0809012C:
ldr r1, _08090140 @ =0xFFFFBFDE
adds r0, r3, r1
cmp r0, #0xd
bls _08090136
b _08090242
_08090136:
lsls r0, r0, #2
ldr r1, _08090144 @ =_08090148
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_08090140: .4byte 0xFFFFBFDE
_08090144: .4byte _08090148
_08090148: @ jump table
.4byte _08090242 @ case 0
.4byte _08090242 @ case 1
.4byte _080901EC @ case 2
.4byte _08090180 @ case 3
.4byte _08090242 @ case 4
.4byte _08090242 @ case 5
.4byte _08090242 @ case 6
.4byte _08090242 @ case 7
.4byte _08090242 @ case 8
.4byte _08090242 @ case 9
.4byte _08090210 @ case 10
.4byte _080901B4 @ case 11
.4byte _08090210 @ case 12
.4byte _080901B4 @ case 13
_08090180:
ldr r0, _080901A8 @ =0x00004024
cmp r5, r0
bne _08090194
ldr r3, _080901AC @ =0x00004022
adds r2, r6, #0
adds r2, #0x83
ldrb r1, [r2]
movs r0, #0x10
orrs r0, r1
strb r0, [r2]
_08090194:
ldr r0, _080901B0 @ =0x0000402C
cmp r5, r0
bne _08090238
ldr r3, _080901AC @ =0x00004022
adds r2, r6, #0
adds r2, #0x83
ldrb r1, [r2]
movs r0, #0x10
b _08090234
.align 2, 0
_080901A8: .4byte 0x00004024
_080901AC: .4byte 0x00004022
_080901B0: .4byte 0x0000402C
_080901B4:
ldr r0, _080901DC @ =0x0000402C
cmp r5, r0
bne _080901C8
ldr r3, _080901E0 @ =0x0000402B
adds r2, r6, #0
adds r2, #0x83
ldrb r1, [r2]
movs r0, #0x10
orrs r0, r1
strb r0, [r2]
_080901C8:
ldr r0, _080901E4 @ =0x00004024
cmp r5, r0
bne _08090238
ldr r3, _080901E8 @ =0x00004022
adds r2, r6, #0
adds r2, #0x83
ldrb r1, [r2]
movs r0, #0x10
b _08090234
.align 2, 0
_080901DC: .4byte 0x0000402C
_080901E0: .4byte 0x0000402B
_080901E4: .4byte 0x00004024
_080901E8: .4byte 0x00004022
_080901EC:
ldr r0, _08090204 @ =0x00004025
cmp r5, r0
bne _08090200
ldr r3, _08090208 @ =0x00004022
adds r2, r6, #0
adds r2, #0x83
ldrb r1, [r2]
movs r0, #0x20
orrs r0, r1
strb r0, [r2]
_08090200:
ldr r0, _0809020C @ =0x0000402D
b _08090226
.align 2, 0
_08090204: .4byte 0x00004025
_08090208: .4byte 0x00004022
_0809020C: .4byte 0x0000402D
_08090210:
ldr r0, _08090244 @ =0x0000402D
cmp r5, r0
bne _08090224
ldr r3, _08090248 @ =0x0000402B
adds r2, r6, #0
adds r2, #0x83
ldrb r1, [r2]
movs r0, #0x20
orrs r0, r1
strb r0, [r2]
_08090224:
ldr r0, _0809024C @ =0x00004025
_08090226:
cmp r5, r0
bne _08090238
ldr r3, _08090250 @ =0x00004022
adds r2, r6, #0
adds r2, #0x83
ldrb r1, [r2]
movs r0, #0x20
_08090234:
orrs r0, r1
strb r0, [r2]
_08090238:
adds r0, r3, #0
adds r1, r7, #0
movs r2, #1
bl SetTile
_08090242:
pop {r4, r5, r6, r7, pc}
.align 2, 0
_08090244: .4byte 0x0000402D
_08090248: .4byte 0x0000402B
_0809024C: .4byte 0x00004025
_08090250: .4byte 0x00004022
.syntax divided

File diff suppressed because it is too large Load Diff

View File

@ -36,17 +36,3 @@ gUnk_08127D10:: @ 08127D10
.4byte StaffrollTask_State1MenuType7
@ End of staffroll
@ game.c
gAreaMetadata:: @ 08127D30
.ifdef EU
@ TODO only small differences
.incbin "data_08127280/gAreaMetadata_EU.bin"
.else
.incbin "data_08127280/gAreaMetadata_1_USA-JP-DEMO_USA-DEMO_JP.bin"
.endif
@ game.c, subtask2.c
gUnk_08127F94:: @ 08127F94
.incbin "data_08127280/gUnk_08127F94.bin"

View File

@ -83,7 +83,7 @@ typedef struct {
u8 flag_bank;
u8 queueBgm;
} AreaHeader;
extern AreaHeader gAreaMetadata[];
extern const AreaHeader gAreaMetadata[];
typedef enum {
AR_IS_OVERWORLD = 0x1,

View File

@ -290,14 +290,15 @@ typedef enum {
} EGameMainState;
typedef struct {
u8 _0;
u8 _1;
u8 _2;
u8 _3;
u8 _4;
u16 _6;
} struct_08127F94;
extern struct_08127F94 gUnk_08127F94[];
u8 minX;
u8 minY;
u8 maxX;
u8 maxY;
u8 windcrestId; /**< Id to set in gSave.windcrests when the user entered a room in the boundaries specified above.*/
//u8 pad;
u16 textIndex; /**< The text to show for this area.*/
} OverworldLocation;
extern const OverworldLocation gOverworldLocations[];
typedef struct {
const Font* font;

View File

@ -207,8 +207,8 @@ typedef struct {
u16 offsetY; /**< Scroll offset Y from the room origin. */
u16 x; /**< X position of the actual event. */
u16 y; /**< Y position of the actual event. */
u16 _c; // see sub_080A6A80, related to _0 and _2 of gUnk_08127F94
u16 _e; // see sub_080A6A80, related to _1 and _3 of gUnk_08127F94
u16 _c; // see GetOverworldLocation, related to _0 and _2 of gOverworldLocations
u16 _e; // see GetOverworldLocation, related to _1 and _3 of gOverworldLocations
u8 condition; // TODO some sort of flag determining what type the bank&flag are? see sub_0801E8D4
u8 bank; /**< @see LocalBanks */
u16 flag;

View File

@ -44,7 +44,7 @@ typedef struct {
/*0x009*/ u8 field_0x9[0x17];
/*0x020*/ u16 field_0x20;
/*0x022*/ u8 field_0x22[0x1e];
/*0x040*/ u32 windcrests; /**< Windcrest flags. */
/*0x040*/ u32 windcrests; /**< Windcrest flags. bits 0 - 0x10: Visited area of the overworld. Above 0x18: windcrest activated. */
/*0x044*/ u8 filler44[0xC];
/*0x050*/ u32 unk50;
/*0x054*/ u8 filler54[0x8];

View File

@ -89,11 +89,11 @@ void sub_080A4DB8(u32);
void sub_080A6290(void);
void sub_080A66D0();
void sub_080A67C4(u32);
void sub_080A6FB4(u32, u32);
void ShowAreaName(u32 id, u32 type);
void sub_080A698C(u32 param_1, u32 param_2, u32 param_3, u32 param_4);
u32 sub_080A6F40();
s32 sub_080A69E0();
struct_08127F94* sub_080A6A80(u32 param_1, u32 param_2);
const OverworldLocation* GetOverworldLocation(u32 x, u32 y);
void sub_080A6498(void);
void sub_080A71F4(const ScreenTransitionData* exitTransition);
void sub_080A6F6C(u32 textIndexOrPtr);

188
src/data/areaMetadata.c Normal file
View File

@ -0,0 +1,188 @@
#include "flags.h"
#include "game.h"
#include "message.h"
#include "sound.h"
#ifdef EU
#define OVERWORLD_FLAGS AR_IS_OVERWORLD
#else
#define OVERWORLD_FLAGS AR_IS_OVERWORLD | AR_ALLOWS_WARP
#endif
const AreaHeader gAreaMetadata[] = {
{ OVERWORLD_FLAGS, 18, LOCAL_BANK_1, BGM_MINISH_WOODS },
{ 0, 20, LOCAL_BANK_2, BGM_MINISH_VILLAGE },
{ OVERWORLD_FLAGS, 10, LOCAL_BANK_1, BGM_HYRULE_TOWN },
{ OVERWORLD_FLAGS, 0, LOCAL_BANK_1, BGM_HYRULE_FIELD },
{ OVERWORLD_FLAGS, 3, LOCAL_BANK_1, BGM_CASTOR_WILDS },
{ OVERWORLD_FLAGS, 4, LOCAL_BANK_1, BGM_WIND_RUINS },
{ OVERWORLD_FLAGS, 1, LOCAL_BANK_1, BGM_MT_CRENEL },
{ OVERWORLD_FLAGS, 8, LOCAL_BANK_1, BGM_HYRULE_CASTLE },
{ OVERWORLD_FLAGS, 16, LOCAL_BANK_1, BGM_CLOUD_TOPS },
{ OVERWORLD_FLAGS, 5, LOCAL_BANK_1, BGM_ROYAL_VALLEY },
{ OVERWORLD_FLAGS, 13, LOCAL_BANK_1, BGM_HYRULE_FIELD },
{ OVERWORLD_FLAGS, 17, LOCAL_BANK_1, BGM_HYRULE_FIELD },
{ AR_IS_MOLE_CAVE, 0, LOCAL_BANK_3, BGM_DIGGING_CAVE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_3, BGM_CLOUD_TOPS },
{ 0, 0, 0, 0 },
{ AR_IS_MOLE_CAVE, 0, LOCAL_BANK_3, BGM_DIGGING_CAVE },
{ 0, 21, LOCAL_BANK_2, BGM_MINISH_VILLAGE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_3, BGM_HYRULE_FIELD },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_3, BGM_HYRULE_FIELD },
{ AR_IS_MOLE_CAVE, 0, LOCAL_BANK_3, BGM_DIGGING_CAVE },
{ AR_IS_MOLE_CAVE, 0, LOCAL_BANK_3, BGM_DIGGING_CAVE },
{ OVERWORLD_FLAGS, 10, LOCAL_BANK_1, BGM_PICORI_FESTIVAL },
{ AR_IS_MOLE_CAVE, 0, LOCAL_BANK_3, BGM_DIGGING_CAVE },
{ AR_IS_MOLE_CAVE, 0, LOCAL_BANK_3, BGM_DIGGING_CAVE },
{ AR_HAS_KEYS | AR_IS_MOLE_CAVE, 26, LOCAL_BANK_3, BGM_FORTRESS_OF_WINDS },
{ AR_IS_MOLE_CAVE, 0, LOCAL_BANK_3, BGM_DIGGING_CAVE },
{ OVERWORLD_FLAGS, 12, LOCAL_BANK_1, BGM_HYRULE_FIELD },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_ENEMIES, 0, LOCAL_BANK_4, BGM_HOUSE },
{ AR_HAS_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_2, BGM_FAIRY_FOUNTAIN },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_3, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_3, BGM_HOUSE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_2, BGM_ELEMENT_THEME },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_4, BGM_DUNGEON },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_2, BGM_HOUSE },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_IS_DUNGEON, 0, LOCAL_BANK_3, BGM_DUNGEON },
{ AR_IS_DUNGEON, 0, LOCAL_BANK_3, BGM_DUNGEON },
{ AR_IS_DUNGEON, 0, LOCAL_BANK_3, BGM_SECRET_CASTLE_ENTRANCE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_G, BGM_SECRET_CASTLE_ENTRANCE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_G, BGM_SECRET_CASTLE_ENTRANCE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_G, BGM_SECRET_CASTLE_ENTRANCE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_G, BGM_SECRET_CASTLE_ENTRANCE },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 24, LOCAL_BANK_5, BGM_DEEPWOOD_SHRINE },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 24, LOCAL_BANK_5, BGM_DEEPWOOD_SHRINE },
{ 0, 0, LOCAL_BANK_5, BGM_MINISH_WOODS },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_5, BGM_DEEPWOOD_SHRINE },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 25, LOCAL_BANK_6, BGM_CAVE_OF_FLAMES },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 25, LOCAL_BANK_6, BGM_CAVE_OF_FLAMES },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 25, LOCAL_BANK_6, BGM_CAVE_OF_FLAMES },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 26, LOCAL_BANK_7, BGM_FORTRESS_OF_WINDS },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP | AR_HAS_NO_ENEMIES, 26, LOCAL_BANK_7, BGM_FORTRESS_OF_WINDS },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP | AR_HAS_NO_ENEMIES, 26, LOCAL_BANK_7, BGM_BOSS_THEME },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 26, LOCAL_BANK_7, BGM_FORTRESS_OF_WINDS },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 27, LOCAL_BANK_8, BGM_TEMPLE_OF_DROPLETS },
{ 0, 0, 0, 0 },
{ AR_IS_DUNGEON, 0, LOCAL_BANK_3, BGM_DUNGEON },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 27, LOCAL_BANK_8, BGM_TEMPLE_OF_DROPLETS },
{ AR_HAS_KEYS | AR_IS_DUNGEON, 30, LOCAL_BANK_3, BGM_ROYAL_CRYPT },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_KEYS | AR_IS_DUNGEON, 30, LOCAL_BANK_3, BGM_ROYAL_CRYPT },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 28, LOCAL_BANK_9, BGM_PALACE_OF_WINDS },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP | AR_HAS_NO_ENEMIES, 28, LOCAL_BANK_9, BGM_BOSS_THEME },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 28, LOCAL_BANK_9, BGM_PALACE_OF_WINDS },
{ AR_HAS_NO_ENEMIES, 19, LOCAL_BANK_3, BGM_ELEMENTAL_SANCTUARY },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_3, BGM_ELEMENTAL_SANCTUARY },
{ AR_HAS_NO_ENEMIES, 22, LOCAL_BANK_1, BGM_HYRULE_CASTLE },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_1, BGM_HYRULE_CASTLE },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ AR_HAS_NO_ENEMIES, 0, LOCAL_BANK_3, BGM_HYRULE_CASTLE },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 29, LOCAL_BANK_10, BGM_DARK_HYRULE_CASTLE },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP | AR_HAS_NO_ENEMIES, 29, LOCAL_BANK_10, BGM_DARK_HYRULE_CASTLE },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP | AR_HAS_NO_ENEMIES, 29, LOCAL_BANK_10, BGM_VAATI_WRATH },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP | AR_HAS_NO_ENEMIES, 29, LOCAL_BANK_10, BGM_VAATI_WRATH },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP | AR_HAS_NO_ENEMIES, 29, LOCAL_BANK_10, BGM_VAATI_TRANSFIGURED },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP | AR_HAS_NO_ENEMIES, 29, LOCAL_BANK_10, BGM_DARK_HYRULE_CASTLE },
{ 0, 0, 0, 0 },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 29, LOCAL_BANK_3, BGM_DARK_HYRULE_CASTLE },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 0, LOCAL_BANK_12, BGM_ROYAL_CRYPT },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 0, LOCAL_BANK_12, BGM_ROYAL_CRYPT },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 0, LOCAL_BANK_12, BGM_ROYAL_CRYPT },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 0, LOCAL_BANK_12, BGM_ROYAL_CRYPT },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 0, LOCAL_BANK_12, BGM_ROYAL_CRYPT },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 0, LOCAL_BANK_12, BGM_ROYAL_CRYPT },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 0, LOCAL_BANK_12, BGM_ROYAL_CRYPT },
{ AR_HAS_KEYS | AR_IS_DUNGEON | AR_HAS_MAP, 0, LOCAL_BANK_12, BGM_ROYAL_CRYPT },
{ 0, 0, 0, 0 },
};
const OverworldLocation gOverworldLocations[] = {
{ 0, 0, 62, 74, 0, TEXT_INDEX(TEXT_WINDCRESTS, 0x0b) },
{ 0, 75, 62, 104, 1, TEXT_INDEX(TEXT_WINDCRESTS, 0x0c) },
{ 0, 105, 62, 164, 2, TEXT_INDEX(TEXT_WINDCRESTS, 0x0d) },
{ 0, 165, 62, 197, 3, TEXT_INDEX(TEXT_WINDCRESTS, 0x0e) },
{ 63, 0, 92, 74, 4, TEXT_INDEX(TEXT_WINDCRESTS, 0x0f) },
{ 63, 75, 92, 134, 5, TEXT_INDEX(TEXT_WINDCRESTS, 0x10) },
{ 63, 135, 92, 197, 6, TEXT_INDEX(TEXT_WINDCRESTS, 0x11) },
{ 93, 0, 155, 44, 7, TEXT_INDEX(TEXT_WINDCRESTS, 0x12) },
{ 93, 45, 155, 94, 8, TEXT_INDEX(TEXT_WINDCRESTS, 0x13) },
{ 93, 95, 155, 154, 9, TEXT_INDEX(TEXT_WINDCRESTS, 0x14) },
{ 93, 155, 155, 197, 10, TEXT_INDEX(TEXT_WINDCRESTS, 0x15) },
{ 156, 0, 185, 74, 11, TEXT_INDEX(TEXT_WINDCRESTS, 0x17) },
{ 156, 75, 200, 134, 12, TEXT_INDEX(TEXT_WINDCRESTS, 0x18) },
{ 156, 135, 185, 197, 13, TEXT_INDEX(TEXT_WINDCRESTS, 0x19) },
{ 186, 0, 248, 62, 14, TEXT_INDEX(TEXT_WINDCRESTS, 0x1a) },
{ 186, 63, 248, 134, 15, TEXT_INDEX(TEXT_WINDCRESTS, 0x1b) },
{ 186, 135, 248, 197, 16, TEXT_INDEX(TEXT_WINDCRESTS, 0x1c) },
{ 255, 255, 255, 255, 99, TEXT_INDEX(TEXT_WINDCRESTS, 0x0b) },
};

View File

@ -384,7 +384,7 @@ static void sub_08051DCC(void) {
static void UpdateWindcrests(void) {
if (AreaIsOverworld()) {
struct_08127F94* i;
const OverworldLocation* location;
u32 hi_x, hi_y;
s32 x, y;
@ -398,9 +398,9 @@ static void UpdateWindcrests(void) {
y += 0xf;
hi_y = y >> 4;
for (i = gUnk_08127F94; i->_0 != 0xFF; i++) {
if (i->_0 <= hi_x && i->_2 >= hi_x && i->_1 <= hi_y && i->_3 >= hi_y) {
gSave.windcrests |= 1 << i->_4;
for (location = gOverworldLocations; location->minX != 0xFF; location++) {
if (location->minX <= hi_x && location->maxX >= hi_x && location->minY <= hi_y && location->maxY >= hi_y) {
gSave.windcrests |= 1 << location->windcrestId;
break;
}
}

View File

@ -519,7 +519,7 @@ void SetDungeonMapPos(u32 area, u32 room, u32 x, u32 y) {
}
void InitRoom(void) {
AreaHeader* a_hdr = NULL;
const AreaHeader* a_hdr = NULL;
MemClear(&gArea, sizeof gArea);
a_hdr = &gAreaMetadata[gRoomControls.area];
@ -535,7 +535,7 @@ void InitRoom(void) {
}
u32 GetFlagBankOffset(u32 idx) {
AreaHeader* a_hdr = &gAreaMetadata[idx];
const AreaHeader* a_hdr = &gAreaMetadata[idx];
return gLocalFlagBanks[a_hdr->flag_bank];
}
@ -595,7 +595,7 @@ void sub_08052EA0(void) {
}
u32 sub_08052EF4(s32 idx) {
AreaHeader* a_hdr = NULL;
const AreaHeader* a_hdr = NULL;
u32 i = idx < 0 ? gRoomControls.area : idx;
a_hdr = &gAreaMetadata[i];
return gLocalFlagBanks[a_hdr->flag_bank];

View File

@ -56,14 +56,13 @@ void Subtask_PauseMenu(void) {
}
}
struct_08127F94* sub_080A6A80(u32, u32);
extern u8 gUnk_02034492[];
void sub_0801E8D4(void);
s32 sub_080A50A0(s32);
void PauseMenu_Variant0(void) {
struct_08127F94* ptr;
const OverworldLocation* location;
int r0, r1;
sub_0801E8D4();
@ -73,9 +72,9 @@ void PauseMenu_Variant0(void) {
gUnk_02034492[r1] = 0;
r1++;
} while (r1 <= 0xd);
ptr = sub_080A6A80((u16)gRoomTransition.player_status.overworld_map_x,
location = GetOverworldLocation((u16)gRoomTransition.player_status.overworld_map_x,
(u16)gRoomTransition.player_status.overworld_map_y);
gPauseMenuOptions.unk2[4] = ptr->_4;
gPauseMenuOptions.unk2[4] = location->windcrestId;
gPauseMenuOptions.unk2[5] = sub_0801DB94();
if (IsItemEquipped(ITEM_LANTERN_ON) != EQUIP_SLOT_NONE) {
r1 = 0x10;
@ -583,7 +582,6 @@ extern KeyButtonLayout gUnk_08128D60;
void DrawDungeonMapActually();
void sub_080A5CFC(u32, void*, u32);
void sub_080A6FB4(u32, u32);
void DrawDungeonFeatures(u32, void*, u32);
extern void DrawDungeonMap(u32 floor, struct_02019EE0* data, u32 size);
extern void LoadDungeonMap(void);
@ -1082,7 +1080,7 @@ void sub_080A5C44(u32 param_1, u32 param_2, u32 param_3) {
gMenu.field_0xc = gUnk_08128D38;
sub_080A5CFC(gMenu.field_0x3, &gMenu, param_3);
LoadGfxGroup(0x81);
sub_080A6FB4(gArea.dungeon_idx, 1);
ShowAreaName(gArea.dungeon_idx, 1);
SetMenuType(1);
ptr = &gUnk_08128D43[(u32)gArea.dungeon_idx * 2];
gScreen.bg1.xOffset += ptr[0];
@ -1455,7 +1453,7 @@ void sub_080A62E0(void) {
gMenu.field_0x3 = windcrest;
SoundReq(SFX_TEXTBOX_CHOICE);
}
sub_080A6FB4(gMenu.field_0x3, 0);
ShowAreaName(gMenu.field_0x3, 0);
}
void sub_080A6378(void) {

View File

@ -75,7 +75,7 @@ void sub_080A667C(void) {
}
gMenu.field_0xa = uVar2;
sub_080A6FB4(gMenu.field_0x3, 0);
ShowAreaName(gMenu.field_0x3, 0);
}
void sub_080A66D0(void) {
@ -217,7 +217,7 @@ void sub_080A698C(u32 param_1, u32 param_2, u32 param_3, u32 param_4) {
int iVar1;
iVar1 = sub_080A69E0(param_1, param_2);
if (0 < iVar1) {
if (iVar1 > 0) {
((struct_sub_080A698C*)&gMapDataBottomSpecial)[gGenericMenu.unk2d].unk0 = param_4 >> 8;
((struct_sub_080A698C*)&gMapDataBottomSpecial)[gGenericMenu.unk2d].unk1 = param_4;
((struct_sub_080A698C*)&gMapDataBottomSpecial)[gGenericMenu.unk2d].unk2 = param_3;
@ -228,17 +228,17 @@ void sub_080A698C(u32 param_1, u32 param_2, u32 param_3, u32 param_4) {
}
s32 sub_080A69E0(u32 param_1, u32 param_2) {
const struct_08127F94* pbVar1;
const OverworldLocation* location;
int iVar3;
if ((param_1 | param_2) == 0)
return -1;
pbVar1 = sub_080A6A80(param_1, param_2);
if (pbVar1 == NULL)
location = GetOverworldLocation(param_1, param_2);
if (location == NULL)
return -1;
if (gMenu.field_0x3 != pbVar1->_4)
if (gMenu.field_0x3 != location->windcrestId)
return -1;
switch (gMenu.field_0x3) {
@ -257,19 +257,19 @@ s32 sub_080A69E0(u32 param_1, u32 param_2) {
break;
}
param_1 = (s32)((param_1 - pbVar1->_0 * 0x10) * 100) / 0x23a;
param_2 = (s32)((param_2 - pbVar1->_1 * 0x10) * 100) / 0x23a;
param_1 = (s32)((param_1 - location->minX * 0x10) * 100) / 0x23a;
param_2 = (s32)((param_2 - location->minY * 0x10) * 100) / 0x23a;
return (param_2 << 0x10) | param_1;
}
struct_08127F94* sub_080A6A80(u32 param_1, u32 param_2) {
struct_08127F94* pbVar1;
param_1 >>= 4;
param_2 >>= 4;
const OverworldLocation* GetOverworldLocation(u32 x, u32 y) {
const OverworldLocation* location;
x >>= 4;
y >>= 4;
for (pbVar1 = gUnk_08127F94; pbVar1->_0 != 0xff; pbVar1++) {
if (pbVar1->_0 <= param_1 && pbVar1->_2 >= param_1 && pbVar1->_1 <= param_2 && pbVar1->_3 >= param_2) {
return pbVar1;
for (location = gOverworldLocations; location->minX != 0xff; location++) {
if (location->minX <= x && location->maxX >= x && location->minY <= y && location->maxY >= y) {
return location;
}
}
return NULL;

View File

@ -62,7 +62,13 @@ void sub_080A6F6C(u32 textIndexOrPtr) {
gScreen.bg0.yOffset = 2;
}
void sub_080A6FB4(u32 param_1, u32 param_2) {
/*
Show area name in a textbox.
param_2: 0: visited overworld area name
2: overworld area name
1: dungeon name
*/
void ShowAreaName(u32 id, u32 type) {
extern u16 gUnk_08128FF0[];
extern Font gUnk_08128FD8;
extern Font gUnk_08128FC0;
@ -70,16 +76,16 @@ void sub_080A6FB4(u32 param_1, u32 param_2) {
Font* font;
textIndexOrPtr = 0;
switch (param_2) {
switch (type) {
case 0:
if ((gSave.windcrests & (1 << param_1)) == 0)
if ((gSave.windcrests & (1 << id)) == 0)
break;
case 2:
textIndexOrPtr = gUnk_08127F94[param_1]._6;
textIndexOrPtr = gOverworldLocations[id].textIndex;
font = &gUnk_08128FC0;
break;
case 1:
textIndexOrPtr = gUnk_08128FF0[param_1];
textIndexOrPtr = gUnk_08128FF0[id];
font = &gUnk_08128FD8;
break;
}

View File

@ -41,11 +41,11 @@ void sub_080A6B04(void) {
bVar1 = ptr->unk7;
uVar3 = ptr2->_c;
uVar4 = ptr2->_e;
uVar2 = sub_080A6A80(uVar3, uVar4)->_4;
uVar2 = GetOverworldLocation(uVar3, uVar4)->windcrestId;
gMenu.field_0x3 = uVar2;
gGenericMenu.unk2b = 1;
sub_080A67C4(uVar2);
sub_080A6FB4(uVar2, 2);
ShowAreaName(uVar2, 2);
SetColor(0, 0x475f);
SetColor(0x5f, 0x475f);
MemFill16(0x5001, &gBG3Buffer, sizeof(gBG3Buffer));