#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) },
};
