diff --git a/include/code_80A26CC.h b/include/code_80A26CC.h index 89951026e..6f0dcae56 100644 --- a/include/code_80A26CC.h +++ b/include/code_80A26CC.h @@ -26,7 +26,7 @@ s16 sub_80A26B8(s16); s16 sub_80A26CC(s16); u8 sub_80A270C(s16 index); u8 sub_80A2728(s16 index); -u8 sub_80A2740(s16 index); +u8 ScriptDungeonIdToDungeonId(s16 index); s16 sub_80A2750(s16); bool8 sub_80A27CC(s16); bool8 sub_80A2824(u8 index); diff --git a/include/constants/script_dungeon_id.h b/include/constants/script_dungeon_id.h new file mode 100644 index 000000000..fee30ea0b --- /dev/null +++ b/include/constants/script_dungeon_id.h @@ -0,0 +1,92 @@ +#ifndef GUARD_CONSTANTS_SCRIPT_DUNGEON_ID_H +#define GUARD_CONSTANTS_SCRIPT_DUNGEON_ID_H + +enum ScriptDungeonId +{ + SCRIPT_DUNGEON_TINY_WOODS, + SCRIPT_DUNGEON_THUNDERWAVE_CAVE, + SCRIPT_DUNGEON_MT_STEEL, + SCRIPT_DUNGEON_3, + SCRIPT_DUNGEON_SINISTER_WOODS, + SCRIPT_DUNGEON_5, + SCRIPT_DUNGEON_SILENT_CHASM, + SCRIPT_DUNGEON_MT_THUNDER, + SCRIPT_DUNGEON_MT_THUNDER_PEAK, + SCRIPT_DUNGEON_GREAT_CANYON, + SCRIPT_DUNGEON_LAPIS_CAVE, + SCRIPT_DUNGEON_MT_BLAZE, + SCRIPT_DUNGEON_MT_BLAZE_PEAK, + SCRIPT_DUNGEON_FROSTY_FOREST, + SCRIPT_DUNGEON_FROSTY_GROTTO, + SCRIPT_DUNGEON_MT_FREEZE, + SCRIPT_DUNGEON_MT_FREEZE_PEAK, + SCRIPT_DUNGEON_MAGMA_CAVERN, + SCRIPT_DUNGEON_MAGMA_CAVERN_PIT, + SCRIPT_DUNGEON_SKY_TOWER, + SCRIPT_DUNGEON_SKY_TOWER_SUMMIT, + SCRIPT_DUNGEON_21, + SCRIPT_DUNGEON_UPROAR_FOREST, + SCRIPT_DUNGEON_HOWLING_FOREST, + SCRIPT_DUNGEON_STORMY_SEA, + SCRIPT_DUNGEON_SILVER_TRENCH, + SCRIPT_DUNGEON_METEOR_CAVE, + SCRIPT_DUNGEON_GREAT_CANYON_2, + SCRIPT_DUNGEON_FIERY_FIELD, + SCRIPT_DUNGEON_LIGHTNING_FIELD, + SCRIPT_DUNGEON_NORTHWIND_FIELD, + SCRIPT_DUNGEON_MT_FARAWAY, + SCRIPT_DUNGEON_WESTERN_CAVE, + SCRIPT_DUNGEON_NORTHERN_RANGE, + SCRIPT_DUNGEON_PITFALL_VALLEY, + SCRIPT_DUNGEON_BURIED_RELIC, + SCRIPT_DUNGEON_WISH_CAVE, + SCRIPT_DUNGEON_MT_FREEZE_2, + SCRIPT_DUNGEON_MT_FREEZE_PEAK_2, + SCRIPT_DUNGEON_MURKY_CAVE, + SCRIPT_DUNGEON_DESERT_REGION, + SCRIPT_DUNGEON_SOUTHERN_CAVERN, + SCRIPT_DUNGEON_WYVERN_HILL, + SCRIPT_DUNGEON_SOLAR_CAVE, + SCRIPT_DUNGEON_DARKNIGHT_RELIC, + SCRIPT_DUNGEON_GRAND_SEA, + SCRIPT_DUNGEON_WATERFALL_POND, + SCRIPT_DUNGEON_UNKNOWN_RELIC, + SCRIPT_DUNGEON_JOYOUS_TOWER, + SCRIPT_DUNGEON_FAR_OFF_SEA, + SCRIPT_DUNGEON_PURITY_FOREST, + SCRIPT_DUNGEON_ODDITY_CAVE, + SCRIPT_DUNGEON_REMAINS_ISLAND, + SCRIPT_DUNGEON_MARVELOUS_SEA, + SCRIPT_DUNGEON_FANTASY_STRAIT, + SCRIPT_DUNGEON_NORMAL_MAZE_2, + SCRIPT_DUNGEON_FIRE_MAZE, + SCRIPT_DUNGEON_WATER_MAZE, + SCRIPT_DUNGEON_GRASS_MAZE, + SCRIPT_DUNGEON_ELECTRIC_MAZE, + SCRIPT_DUNGEON_ICE_MAZE, + SCRIPT_DUNGEON_FIGHTING_MAZE, + SCRIPT_DUNGEON_GROUND_MAZE, + SCRIPT_DUNGEON_FLYING_MAZE, + SCRIPT_DUNGEON_PSYCHIC_MAZE, + SCRIPT_DUNGEON_POISON_MAZE_2, + SCRIPT_DUNGEON_BUG_MAZE, + SCRIPT_DUNGEON_ROCK_MAZE, + SCRIPT_DUNGEON_GHOST_MAZE, + SCRIPT_DUNGEON_DRAGON_MAZE, + SCRIPT_DUNGEON_DARK_MAZE, + SCRIPT_DUNGEON_STEEL_MAZE, + SCRIPT_DUNGEON_TEAM_SHIFTY, + SCRIPT_DUNGEON_TEAM_CONSTRICTOR, + SCRIPT_DUNGEON_TEAM_HYDRO, + SCRIPT_DUNGEON_TEAM_RUMBLEROCK, + SCRIPT_DUNGEON_RESCUE_TEAM_2, + SCRIPT_DUNGEON_RESCUE_TEAM_MAZE, + SCRIPT_DUNGEON_ROCK_PATH, + SCRIPT_DUNGEON_SNOW_PATH, + SCRIPT_DUNGEON_80, + SCRIPT_DUNGEON_81, + SCRIPT_DUNGEON_82, + SCRIPT_DUNGEON_COUNT, +}; + +#endif // GUARD_CONSTANTS_SCRIPT_DUNGEON_ID_H diff --git a/include/data_script.h b/include/data_script.h index ea038482d..dbcabb0d8 100644 --- a/include/data_script.h +++ b/include/data_script.h @@ -1,7 +1,7 @@ #include "constants/event_flag.h" #include "constants/item.h" #include "constants/ground_map.h" -#include "constants/dungeon.h" +#include "constants/script_dungeon_id.h" #include "portrait_placement.h" #include "structs/str_ground_script.h" #define LPARRAY(x) (ARRAY_COUNT(x)), x @@ -10,7 +10,7 @@ #define CPOS_CURRENT 0x4 // 01..07: complex map/dungeon selection/check commands -#define NEXT_DUNGEON(u, d) { 0x02, 0, u, d, 0, NULL } // Seems to be a general command for setting up which dungeon to enter next. First argument is unknown. +#define NEXT_DUNGEON(u, d) { 0x02, 0, u, d, 0, NULL } // Seems to be a general command for setting up which dungeon to enter next. First argument is unknown. The second argument is script dungeon id(not the one in dungeon/constants.h). There's a different ordering and a table with the proper dungeon id. #define SELECT_MAP(m) { 0x08, 0, 0, m, 0, NULL } #define SELECT_GROUND(m) { 0x09, 0, 0, m, 0, NULL } diff --git a/src/code_80A26CC.c b/src/code_80A26CC.c index 9b624221b..660e4dbd3 100644 --- a/src/code_80A26CC.c +++ b/src/code_80A26CC.c @@ -3,1082 +3,1084 @@ #include "code_80972F4.h" #include "code_80A26CC.h" #include "event_flag.h" +#include "constants/dungeon.h" +#include "constants/script_dungeon_id.h" -static const DungeonInfo gUnknown_81168A8[] = { - [0] = { +static const DungeonInfo gUnknown_81168A8[SCRIPT_DUNGEON_COUNT] = { + [SCRIPT_DUNGEON_TINY_WOODS] = { .unk0 = 178, .unk2 = 178, .unk4 = 178, .unk6 = -1, .unk8 = -1, .unkA = 359, - .dungeonIndex = 0, + .dungeonIndex = DUNGEON_TINY_WOODS, .unkD = 0, .unkE = 0, .unk10 = 1, .unk11 = 1, }, - [1] = { + [SCRIPT_DUNGEON_THUNDERWAVE_CAVE] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = 127, .unk8 = 129, .unkA = 360, - .dungeonIndex = 1, + .dungeonIndex = DUNGEON_THUNDERWAVE_CAVE, .unkD = 0, .unkE = 1, .unk10 = 1, .unk11 = 1, }, - [2] = { + [SCRIPT_DUNGEON_MT_STEEL] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = 136, .unk8 = 138, .unkA = 361, - .dungeonIndex = 2, + .dungeonIndex = DUNGEON_MT_STEEL, .unkD = 0, .unkE = 2, .unk10 = 1, .unk11 = 1, }, - [3] = { + [SCRIPT_DUNGEON_3] = { .unk0 = -1, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 361, - .dungeonIndex = 2, + .dungeonIndex = DUNGEON_MT_STEEL, .unkD = 0, .unkE = 2, .unk10 = 1, .unk11 = 0, }, - [4] = { + [SCRIPT_DUNGEON_SINISTER_WOODS] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = 148, .unk8 = 150, .unkA = 362, - .dungeonIndex = 3, + .dungeonIndex = DUNGEON_SINISTER_WOODS, .unkD = 0, .unkE = 3, .unk10 = 1, .unk11 = 1, }, - [5] = { + [SCRIPT_DUNGEON_5] = { .unk0 = -1, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 362, - .dungeonIndex = 3, + .dungeonIndex = DUNGEON_SINISTER_WOODS, .unkD = 0, .unkE = 3, .unk10 = 1, .unk11 = 0, }, - [6] = { + [SCRIPT_DUNGEON_SILENT_CHASM] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = 155, .unk8 = 157, .unkA = 363, - .dungeonIndex = 4, + .dungeonIndex = DUNGEON_SILENT_CHASM, .unkD = 0, .unkE = 4, .unk10 = 1, .unk11 = 1, }, - [7] = { + [SCRIPT_DUNGEON_MT_THUNDER] = { .unk0 = 9, .unk2 = 189, .unk4 = 12, .unk6 = 162, .unk8 = 164, .unkA = 364, - .dungeonIndex = 5, + .dungeonIndex = DUNGEON_MT_THUNDER, .unkD = 0, .unkE = 5, .unk10 = 1, .unk11 = 1, }, - [8] = { + [SCRIPT_DUNGEON_MT_THUNDER_PEAK] = { .unk0 = -1, .unk2 = 12, .unk4 = 189, .unk6 = -1, .unk8 = -1, .unkA = 364, - .dungeonIndex = 6, + .dungeonIndex = DUNGEON_MT_THUNDER_PEAK, .unkD = 0, .unkE = 5, .unk10 = 1, .unk11 = 1, }, - [9] = { + [SCRIPT_DUNGEON_GREAT_CANYON] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = 170, .unk8 = 172, .unkA = 365, - .dungeonIndex = 7, + .dungeonIndex = DUNGEON_GREAT_CANYON, .unkD = 0, .unkE = 6, .unk10 = 1, .unk11 = 1, }, - [10] = { + [SCRIPT_DUNGEON_LAPIS_CAVE] = { .unk0 = 193, .unk2 = 194, .unk4 = 193, .unk6 = -1, .unk8 = -1, .unkA = 366, - .dungeonIndex = 8, + .dungeonIndex = DUNGEON_LAPIS_CAVE, .unkD = 0, .unkE = 7, .unk10 = 1, .unk11 = 1, }, - [11] = { + [SCRIPT_DUNGEON_MT_BLAZE] = { .unk0 = 195, .unk2 = 196, .unk4 = 195, .unk6 = -1, .unk8 = -1, .unkA = 367, - .dungeonIndex = 9, + .dungeonIndex = DUNGEON_MT_BLAZE, .unkD = 0, .unkE = 8, .unk10 = 1, .unk11 = 1, }, - [12] = { + [SCRIPT_DUNGEON_MT_BLAZE_PEAK] = { .unk0 = -1, .unk2 = -1, .unk4 = 196, .unk6 = -1, .unk8 = -1, .unkA = 367, - .dungeonIndex = 10, + .dungeonIndex = DUNGEON_MT_BLAZE_PEAK, .unkD = 0, .unkE = 8, .unk10 = 1, .unk11 = 1, }, - [13] = { + [SCRIPT_DUNGEON_FROSTY_FOREST] = { .unk0 = 198, .unk2 = 199, .unk4 = 198, .unk6 = -1, .unk8 = -1, .unkA = 368, - .dungeonIndex = 11, + .dungeonIndex = DUNGEON_FROSTY_FOREST, .unkD = 0, .unkE = 9, .unk10 = 1, .unk11 = 1, }, - [14] = { + [SCRIPT_DUNGEON_FROSTY_GROTTO] = { .unk0 = -1, .unk2 = -1, .unk4 = 199, .unk6 = -1, .unk8 = -1, .unkA = 368, - .dungeonIndex = 12, + .dungeonIndex = DUNGEON_FROSTY_GROTTO, .unkD = 0, .unkE = 9, .unk10 = 1, .unk11 = 1, }, - [15] = { + [SCRIPT_DUNGEON_MT_FREEZE] = { .unk0 = 201, .unk2 = 202, .unk4 = 201, .unk6 = -1, .unk8 = -1, .unkA = 369, - .dungeonIndex = 13, + .dungeonIndex = DUNGEON_MT_FREEZE, .unkD = 0, .unkE = 10, .unk10 = 1, .unk11 = 1, }, - [16] = { + [SCRIPT_DUNGEON_MT_FREEZE_PEAK] = { .unk0 = -1, .unk2 = -1, .unk4 = 202, .unk6 = -1, .unk8 = -1, .unkA = 369, - .dungeonIndex = 14, + .dungeonIndex = DUNGEON_MT_FREEZE_PEAK, .unkD = 0, .unkE = 10, .unk10 = 1, .unk11 = 1, }, - [17] = { + [SCRIPT_DUNGEON_MAGMA_CAVERN] = { .unk0 = 9, .unk2 = 205, .unk4 = 12, .unk6 = 222, .unk8 = 224, .unkA = 370, - .dungeonIndex = 15, + .dungeonIndex = DUNGEON_MAGMA_CAVERN, .unkD = 0, .unkE = 11, .unk10 = 1, .unk11 = 1, }, - [18] = { + [SCRIPT_DUNGEON_MAGMA_CAVERN_PIT] = { .unk0 = -1, .unk2 = -1, .unk4 = 205, .unk6 = -1, .unk8 = -1, .unkA = 370, - .dungeonIndex = 16, + .dungeonIndex = DUNGEON_MAGMA_CAVERN_PIT, .unkD = 0, .unkE = 11, .unk10 = 1, .unk11 = 1, }, - [19] = { + [SCRIPT_DUNGEON_SKY_TOWER] = { .unk0 = 9, .unk2 = 208, .unk4 = 12, .unk6 = 230, .unk8 = 232, .unkA = 371, - .dungeonIndex = 17, + .dungeonIndex = DUNGEON_SKY_TOWER, .unkD = 0, .unkE = 12, .unk10 = 1, .unk11 = 1, }, - [20] = { + [SCRIPT_DUNGEON_SKY_TOWER_SUMMIT] = { .unk0 = -1, .unk2 = -1, .unk4 = 208, .unk6 = -1, .unk8 = -1, .unkA = 371, - .dungeonIndex = 18, + .dungeonIndex = DUNGEON_SKY_TOWER_SUMMIT, .unkD = 0, .unkE = 12, .unk10 = 1, .unk11 = 1, }, - [21] = { + [SCRIPT_DUNGEON_21] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 372, - .dungeonIndex = 0, + .dungeonIndex = DUNGEON_TINY_WOODS, .unkD = 0, .unkE = 13, .unk10 = 1, .unk11 = 0, }, - [22] = { + [SCRIPT_DUNGEON_UPROAR_FOREST] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 373, - .dungeonIndex = 42, + .dungeonIndex = DUNGEON_UPROAR_FOREST, .unkD = 0, .unkE = 14, .unk10 = 1, .unk11 = 1, }, - [23] = { + [SCRIPT_DUNGEON_HOWLING_FOREST] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 374, - .dungeonIndex = 53, + .dungeonIndex = DUNGEON_HOWLING_FOREST, .unkD = 0, .unkE = 15, .unk10 = 1, .unk11 = 1, }, - [24] = { + [SCRIPT_DUNGEON_STORMY_SEA] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 375, - .dungeonIndex = 19, + .dungeonIndex = DUNGEON_STORMY_SEA, .unkD = 0, .unkE = 16, .unk10 = 1, .unk11 = 1, }, - [25] = { + [SCRIPT_DUNGEON_SILVER_TRENCH] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 376, - .dungeonIndex = 20, + .dungeonIndex = DUNGEON_SILVER_TRENCH, .unkD = 0, .unkE = 17, .unk10 = 1, .unk11 = 1, }, - [26] = { + [SCRIPT_DUNGEON_METEOR_CAVE] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 377, - .dungeonIndex = 21, + .dungeonIndex = DUNGEON_METEOR_CAVE, .unkD = 0, .unkE = 18, .unk10 = 1, .unk11 = 1, }, - [27] = { + [SCRIPT_DUNGEON_GREAT_CANYON_2] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 378, - .dungeonIndex = 7, + .dungeonIndex = DUNGEON_GREAT_CANYON, .unkD = 0, .unkE = 19, .unk10 = 1, .unk11 = 1, }, - [28] = { + [SCRIPT_DUNGEON_FIERY_FIELD] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 379, - .dungeonIndex = 34, + .dungeonIndex = DUNGEON_FIERY_FIELD, .unkD = 0, .unkE = 20, .unk10 = 1, .unk11 = 1, }, - [29] = { + [SCRIPT_DUNGEON_LIGHTNING_FIELD] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 380, - .dungeonIndex = 37, + .dungeonIndex = DUNGEON_LIGHTNING_FIELD, .unkD = 0, .unkE = 21, .unk10 = 1, .unk11 = 1, }, - [30] = { + [SCRIPT_DUNGEON_NORTHWIND_FIELD] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 381, - .dungeonIndex = 35, + .dungeonIndex = DUNGEON_NORTHWIND_FIELD, .unkD = 0, .unkE = 22, .unk10 = 1, .unk11 = 1, }, - [31] = { + [SCRIPT_DUNGEON_MT_FARAWAY] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 382, - .dungeonIndex = 60, + .dungeonIndex = DUNGEON_MT_FARAWAY, .unkD = 0, .unkE = 23, .unk10 = 1, .unk11 = 1, }, - [32] = { + [SCRIPT_DUNGEON_WESTERN_CAVE] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 383, - .dungeonIndex = 23, + .dungeonIndex = DUNGEON_WESTERN_CAVE, .unkD = 0, .unkE = 24, .unk10 = 1, .unk11 = 1, }, - [33] = { + [SCRIPT_DUNGEON_NORTHERN_RANGE] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 384, - .dungeonIndex = 29, + .dungeonIndex = DUNGEON_NORTHERN_RANGE, .unkD = 0, .unkE = 25, .unk10 = 1, .unk11 = 1, }, - [34] = { + [SCRIPT_DUNGEON_PITFALL_VALLEY] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 385, - .dungeonIndex = 28, + .dungeonIndex = DUNGEON_PITFALL_VALLEY, .unkD = 0, .unkE = 26, .unk10 = 1, .unk11 = 1, }, - [35] = { + [SCRIPT_DUNGEON_BURIED_RELIC] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 386, - .dungeonIndex = 27, + .dungeonIndex = DUNGEON_BURIED_RELIC, .unkD = 0, .unkE = 27, .unk10 = 1, .unk11 = 1, }, - [36] = { + [SCRIPT_DUNGEON_WISH_CAVE] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 387, - .dungeonIndex = 26, + .dungeonIndex = DUNGEON_WISH_CAVE, .unkD = 0, .unkE = 28, .unk10 = 1, .unk11 = 1, }, - [37] = { + [SCRIPT_DUNGEON_MT_FREEZE_2] = { .unk0 = 201, .unk2 = 202, .unk4 = 201, .unk6 = 346, .unk8 = 346, .unkA = 388, - .dungeonIndex = 13, + .dungeonIndex = DUNGEON_MT_FREEZE, .unkD = 0, .unkE = 29, .unk10 = 1, .unk11 = 1, }, - [38] = { + [SCRIPT_DUNGEON_MT_FREEZE_PEAK_2] = { .unk0 = -1, .unk2 = -1, .unk4 = 202, .unk6 = -1, .unk8 = -1, .unkA = 388, - .dungeonIndex = 22, + .dungeonIndex = DUNGEON_MT_FREEZE_PEAK_2, .unkD = 0, .unkE = 29, .unk10 = 1, .unk11 = 1, }, - [39] = { + [SCRIPT_DUNGEON_MURKY_CAVE] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = 350, .unk8 = 350, .unkA = 389, - .dungeonIndex = 40, + .dungeonIndex = DUNGEON_MURKY_CAVE, .unkD = 0, .unkE = 30, .unk10 = 1, .unk11 = 1, }, - [40] = { + [SCRIPT_DUNGEON_DESERT_REGION] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 31, + .dungeonIndex = DUNGEON_DESERT_REGION, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [41] = { + [SCRIPT_DUNGEON_SOUTHERN_CAVERN] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 32, + .dungeonIndex = DUNGEON_SOUTHERN_CAVERN, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [42] = { + [SCRIPT_DUNGEON_WYVERN_HILL] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 33, + .dungeonIndex = DUNGEON_WYVERN_HILL, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [43] = { + [SCRIPT_DUNGEON_SOLAR_CAVE] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 36, + .dungeonIndex = DUNGEON_SOLAR_CAVE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [44] = { + [SCRIPT_DUNGEON_DARKNIGHT_RELIC] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 38, + .dungeonIndex = DUNGEON_DARKNIGHT_RELIC, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [45] = { + [SCRIPT_DUNGEON_GRAND_SEA] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 41, + .dungeonIndex = DUNGEON_GRAND_SEA, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [46] = { + [SCRIPT_DUNGEON_WATERFALL_POND] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 56, + .dungeonIndex = DUNGEON_WATERFALL_POND, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [47] = { + [SCRIPT_DUNGEON_UNKNOWN_RELIC] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 57, + .dungeonIndex = DUNGEON_UNKNOWN_RELIC, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [48] = { + [SCRIPT_DUNGEON_JOYOUS_TOWER] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 58, + .dungeonIndex = DUNGEON_JOYOUS_TOWER, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [49] = { + [SCRIPT_DUNGEON_FAR_OFF_SEA] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 59, + .dungeonIndex = DUNGEON_FAR_OFF_SEA, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [50] = { + [SCRIPT_DUNGEON_PURITY_FOREST] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 390, - .dungeonIndex = 62, + .dungeonIndex = DUNGEON_PURITY_FOREST, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [51] = { + [SCRIPT_DUNGEON_ODDITY_CAVE] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 391, - .dungeonIndex = 43, + .dungeonIndex = DUNGEON_ODDITY_CAVE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [52] = { + [SCRIPT_DUNGEON_REMAINS_ISLAND] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 392, - .dungeonIndex = 44, + .dungeonIndex = DUNGEON_REMAINS_ISLAND, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [53] = { + [SCRIPT_DUNGEON_MARVELOUS_SEA] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 393, - .dungeonIndex = 45, + .dungeonIndex = DUNGEON_MARVELOUS_SEA, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [54] = { + [SCRIPT_DUNGEON_FANTASY_STRAIT] = { .unk0 = 9, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 394, - .dungeonIndex = 46, + .dungeonIndex = DUNGEON_FANTASY_STRAIT, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [55] = { + [SCRIPT_DUNGEON_NORMAL_MAZE_2] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 75, + .dungeonIndex = DUNGEON_NORMAL_MAZE_2, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [56] = { + [SCRIPT_DUNGEON_FIRE_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 76, + .dungeonIndex = DUNGEON_FIRE_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [57] = { + [SCRIPT_DUNGEON_WATER_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 77, + .dungeonIndex = DUNGEON_WATER_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [58] = { + [SCRIPT_DUNGEON_GRASS_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 78, + .dungeonIndex = DUNGEON_GRASS_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [59] = { + [SCRIPT_DUNGEON_ELECTRIC_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 79, + .dungeonIndex = DUNGEON_ELECTRIC_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [60] = { + [SCRIPT_DUNGEON_ICE_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 80, + .dungeonIndex = DUNGEON_ICE_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [61] = { + [SCRIPT_DUNGEON_FIGHTING_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 81, + .dungeonIndex = DUNGEON_FIGHTING_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [62] = { + [SCRIPT_DUNGEON_GROUND_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 82, + .dungeonIndex = DUNGEON_GROUND_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [63] = { + [SCRIPT_DUNGEON_FLYING_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 83, + .dungeonIndex = DUNGEON_FLYING_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [64] = { + [SCRIPT_DUNGEON_PSYCHIC_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 84, + .dungeonIndex = DUNGEON_PSYCHIC_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [65] = { + [SCRIPT_DUNGEON_POISON_MAZE_2] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 85, + .dungeonIndex = DUNGEON_POISON_MAZE_2, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [66] = { + [SCRIPT_DUNGEON_BUG_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 86, + .dungeonIndex = DUNGEON_BUG_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [67] = { + [SCRIPT_DUNGEON_ROCK_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 87, + .dungeonIndex = DUNGEON_ROCK_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [68] = { + [SCRIPT_DUNGEON_GHOST_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 88, + .dungeonIndex = DUNGEON_GHOST_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [69] = { + [SCRIPT_DUNGEON_DRAGON_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 89, + .dungeonIndex = DUNGEON_DRAGON_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [70] = { + [SCRIPT_DUNGEON_DARK_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 90, + .dungeonIndex = DUNGEON_DARK_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [71] = { + [SCRIPT_DUNGEON_STEEL_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 91, + .dungeonIndex = DUNGEON_STEEL_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [72] = { + [SCRIPT_DUNGEON_TEAM_SHIFTY] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 92, + .dungeonIndex = DUNGEON_TEAM_SHIFTY, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [73] = { + [SCRIPT_DUNGEON_TEAM_CONSTRICTOR] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 93, + .dungeonIndex = DUNGEON_TEAM_CONSTRICTOR, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [74] = { + [SCRIPT_DUNGEON_TEAM_HYDRO] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 94, + .dungeonIndex = DUNGEON_TEAM_HYDRO, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [75] = { + [SCRIPT_DUNGEON_TEAM_RUMBLEROCK] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 95, + .dungeonIndex = DUNGEON_TEAM_RUMBLEROCK, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [76] = { + [SCRIPT_DUNGEON_RESCUE_TEAM_2] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 96, + .dungeonIndex = DUNGEON_RESCUE_TEAM_2, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [77] = { + [SCRIPT_DUNGEON_RESCUE_TEAM_MAZE] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 97, + .dungeonIndex = DUNGEON_RESCUE_TEAM_MAZE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [78] = { + [SCRIPT_DUNGEON_ROCK_PATH] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 398, - .dungeonIndex = 47, + .dungeonIndex = DUNGEON_ROCK_PATH, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [79] = { + [SCRIPT_DUNGEON_SNOW_PATH] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 399, - .dungeonIndex = 48, + .dungeonIndex = DUNGEON_SNOW_PATH, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 1, }, - [80] = { + [SCRIPT_DUNGEON_80] = { .unk0 = -1, .unk2 = 5, .unk4 = 5, .unk6 = -1, .unk8 = -1, .unkA = 395, - .dungeonIndex = 63, + .dungeonIndex = DUNGEON_OUT_ON_RESCUE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 0, }, - [81] = { + [SCRIPT_DUNGEON_81] = { .unk0 = -1, .unk2 = 12, .unk4 = 12, .unk6 = -1, .unk8 = -1, .unkA = 396, - .dungeonIndex = 63, + .dungeonIndex = DUNGEON_OUT_ON_RESCUE, .unkD = 0, .unkE = -1, .unk10 = 1, .unk11 = 0, }, - [82] = { + [SCRIPT_DUNGEON_82] = { .unk0 = -1, .unk2 = -1, .unk4 = -1, .unk6 = -1, .unk8 = -1, .unkA = 397, - .dungeonIndex = 63, + .dungeonIndex = DUNGEON_OUT_ON_RESCUE, .unkD = 0, .unkE = -1, .unk10 = 1, @@ -1096,10 +1098,52 @@ static const s16 gUnknown_8116F24[] = { }; static const s16 gUnknown_8116F9A[] = { - 0, 1, 2, 4, 6, 7, 9, 10, 11, 13, 15, 17, 19, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54 + [0] = 0, + [1] = 1, + [2] = 2, + [3] = 4, + [4] = 6, + [5] = 7, + [6] = 9, + [7] = 10, + [8] = 11, + [9] = 13, + [10] = 15, + [11] = 17, + [12] = 19, + [13] = 21, + [14] = 22, + [15] = 23, + [16] = 24, + [17] = 25, + [18] = 26, + [19] = 27, + [20] = 28, + [21] = 29, + [22] = 30, + [23] = 31, + [24] = 32, + [25] = 33, + [26] = 34, + [27] = 35, + [28] = 36, + [29] = 37, + [30] = 39, + [31] = 40, + [32] = 41, + [33] = 42, + [34] = 43, + [35] = 44, + [36] = 45, + [37] = 46, + [38] = 47, + [39] = 48, + [40] = 49, + [41] = 50, + [42] = 51, + [43] = 52, + [44] = 53, + [45] = 54, }; const DungeonInfo *GetDungeonInfo_80A2608(s32 _index) @@ -1110,9 +1154,7 @@ const DungeonInfo *GetDungeonInfo_80A2608(s32 _index) const DungeonInfo *sub_80A2620(s16 index) { - u32 temp; - temp = sub_80A26B8(index); - return &gUnknown_81168A8[temp]; + return &gUnknown_81168A8[sub_80A26B8(index)]; } UNUSED static s16 sub_80A2644(u32 index) @@ -1195,15 +1237,11 @@ u8 sub_80A2728(s16 index) return temp->dungeonIndex; } -u8 sub_80A2740(s16 index) +u8 ScriptDungeonIdToDungeonId(s16 scriptDungeonId_) { - const DungeonInfo *temp; - s32 index_s32; - - index_s32 = index; - - temp = GetDungeonInfo_80A2608(index_s32); - return temp->dungeonIndex; + s32 scriptDungeonId = scriptDungeonId_; + const DungeonInfo *data = GetDungeonInfo_80A2608(scriptDungeonId); + return data->dungeonIndex; } s16 sub_80A2750(s16 r0) diff --git a/src/data/ground/ground_data_d01p01_station.h b/src/data/ground/ground_data_d01p01_station.h index 0f9bfefa5..07e1ba81f 100644 --- a/src/data/ground/ground_data_d01p01_station.h +++ b/src/data/ground/ground_data_d01p01_station.h @@ -64,7 +64,7 @@ static const struct ScriptCommand s_gs178_g1_s0_station_sref_script[] = { /* 0x8 { 0x3b, 0x39, 0x0004, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, BGM_FADEOUT(30), - NEXT_DUNGEON(30, DUNGEON_TINY_WOODS), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_TINY_WOODS), RET, }; @@ -369,7 +369,7 @@ static const struct ScriptCommand s_gs178_g2_s0_station_sref_script[] = { /* 0x8 { 0x22, 0x01, 0x003c, 0x00000000, 0x00000000, NULL }, { 0x3b, 0x39, 0x0004, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(30, DUNGEON_TINY_WOODS), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_TINY_WOODS), RET, }; diff --git a/src/data/ground/ground_data_d02p01_station.h b/src/data/ground/ground_data_d02p01_station.h index 486892989..ccc82d33c 100644 --- a/src/data/ground/ground_data_d02p01_station.h +++ b/src/data/ground/ground_data_d02p01_station.h @@ -26,7 +26,7 @@ static const struct ScriptCommand s_gs180_g1_s0_station_sref_script[] = { /* 0x8 BGM_SWITCH(14), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(0, DUNGEON_THUNDERWAVE_CAVE), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_THUNDERWAVE_CAVE), RET, }; @@ -140,7 +140,7 @@ static const struct ScriptCommand s_gs180_g2_s0_station_sref_script[] = { /* 0x8 BGM_SWITCH(14), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(0, DUNGEON_THUNDERWAVE_CAVE), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_THUNDERWAVE_CAVE), RET, }; diff --git a/src/data/ground/ground_data_d04p01_station.h b/src/data/ground/ground_data_d04p01_station.h index 576f7b6c4..3818f94c2 100644 --- a/src/data/ground/ground_data_d04p01_station.h +++ b/src/data/ground/ground_data_d04p01_station.h @@ -10,7 +10,7 @@ static const struct ScriptCommand s_gs184_g0_s0_station_sref_script[] = { /* 0x82342f4 */ DEBUGINFO, - SELECT_MAP(184), + SELECT_MAP(MAP_SINISTER_WOODS_ENTRY), BGM_STOP, JUMP_SCRIPT(COMMON_ENTER), }; @@ -19,12 +19,12 @@ static const struct ScriptRef s_gs184_g0_s0_station_sref = { 404, 1, NULL /* ENT static const struct ScriptCommand s_gs184_g1_s0_station_sref_script[] = { /* 0x823436c */ DEBUGINFO, - SELECT_MAP(184), + SELECT_MAP(MAP_SINISTER_WOODS_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(15), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(30, 0x00000004), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_SINISTER_WOODS), RET, }; @@ -76,12 +76,12 @@ static const struct ScriptCommand s_gs184_g1_s0_lives1_dlg0[] = { /* 0x8234714 * static const struct ScriptCommand s_gs184_g2_s0_station_sref_script[] = { /* 0x82347a4 */ DEBUGINFO, - SELECT_MAP(184), + SELECT_MAP(MAP_SINISTER_WOODS_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(15), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(30, 0x00000004), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_SINISTER_WOODS), RET, }; diff --git a/src/data/ground/ground_data_d05p01_station.h b/src/data/ground/ground_data_d05p01_station.h index 3de6651b2..eb65677c1 100644 --- a/src/data/ground/ground_data_d05p01_station.h +++ b/src/data/ground/ground_data_d05p01_station.h @@ -11,7 +11,7 @@ static const struct ScriptCommand s_gs186_g0_s0_station_sref_script[] = { /* 0x8235a04 */ DEBUGINFO, - SELECT_MAP(186), + SELECT_MAP(MAP_SILENT_CHASM_ENTRY), BGM_STOP, JUMP_SCRIPT(COMMON_ENTER), }; @@ -20,13 +20,13 @@ static const struct ScriptRef s_gs186_g0_s0_station_sref = { 404, 1, NULL /* ENT static const struct ScriptCommand s_gs186_g1_s0_station_sref_script[] = { /* 0x8235a7c */ DEBUGINFO, - SELECT_MAP(186), + SELECT_MAP(MAP_SILENT_CHASM_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(113), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, { 0x23, 0x01, 0x0001, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(0, 0x00000006), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_SILENT_CHASM), RET, }; diff --git a/src/data/ground/ground_data_d06p01_station.h b/src/data/ground/ground_data_d06p01_station.h index 6ff2cfdf2..858fd4736 100644 --- a/src/data/ground/ground_data_d06p01_station.h +++ b/src/data/ground/ground_data_d06p01_station.h @@ -11,7 +11,7 @@ static const struct ScriptCommand s_gs188_g0_s0_station_sref_script[] = { /* 0x8239178 */ DEBUGINFO, - SELECT_MAP(188), + SELECT_MAP(MAP_MT_THUNDER_ENTRY), BGM_STOP, JUMP_SCRIPT(COMMON_ENTER), }; @@ -20,13 +20,13 @@ static const struct ScriptRef s_gs188_g0_s0_station_sref = { 404, 1, NULL /* ENT static const struct ScriptCommand s_gs188_g1_s0_station_sref_script[] = { /* 0x82391f0 */ DEBUGINFO, - SELECT_MAP(188), + SELECT_MAP(MAP_MT_THUNDER_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(111), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, { 0x23, 0x01, 0x0001, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(0, 0x00000007), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_MT_THUNDER), RET, }; @@ -114,13 +114,13 @@ static const struct ScriptCommand s_gs188_g1_s0_lives1_dlg0[] = { /* 0x8239824 * static const struct ScriptCommand s_gs188_g2_s0_station_sref_script[] = { /* 0x8239954 */ DEBUGINFO, - SELECT_MAP(188), + SELECT_MAP(MAP_MT_THUNDER_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(111), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, { 0x23, 0x01, 0x0001, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(0, 0x00000007), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_MT_THUNDER), RET, }; diff --git a/src/data/ground/ground_data_d06p02_station.h b/src/data/ground/ground_data_d06p02_station.h index 9f5ad61e8..5e0028ba0 100644 --- a/src/data/ground/ground_data_d06p02_station.h +++ b/src/data/ground/ground_data_d06p02_station.h @@ -52,7 +52,7 @@ static const struct ScriptCommand s_gs189_g0_s0_evt0_sref_script[] = { /* 0x823a LABEL(0), /* = 0x00 */ TEXTBOX_CLEAR, BGM_FADEOUT(60), - NEXT_DUNGEON(30, 0x00000008), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_MT_THUNDER_PEAK), COND_EQUAL(-1, /* to label */ 1), HALT, }; diff --git a/src/data/ground/ground_data_d07p01_station.h b/src/data/ground/ground_data_d07p01_station.h index 21f397fc5..f3fc975e1 100644 --- a/src/data/ground/ground_data_d07p01_station.h +++ b/src/data/ground/ground_data_d07p01_station.h @@ -13,7 +13,7 @@ static const struct ScriptCommand s_gs191_g0_s0_station_sref_script[] = { /* 0x823d7dc */ DEBUGINFO, - SELECT_MAP(191), + SELECT_MAP(MAP_GREAT_CANYON_ENTRY), BGM_STOP, JUMP_SCRIPT(COMMON_ENTER), }; @@ -22,12 +22,12 @@ static const struct ScriptRef s_gs191_g0_s0_station_sref = { 404, 1, NULL /* ENT static const struct ScriptCommand s_gs191_g1_s0_station_sref_script[] = { /* 0x823d854 */ DEBUGINFO, - SELECT_MAP(191), + SELECT_MAP(MAP_GREAT_CANYON_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(20), { 0x22, 0x01, 0x003c, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(0, 0x00000009), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_GREAT_CANYON), RET, }; @@ -89,12 +89,12 @@ static const struct ScriptCommand s_gs191_g1_s0_lives1_dlg0[] = { /* 0x823dc10 * static const struct ScriptCommand s_gs191_g2_s0_station_sref_script[] = { /* 0x823dd20 */ DEBUGINFO, - SELECT_MAP(191), + SELECT_MAP(MAP_GREAT_CANYON_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(20), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(0, 0x00000009), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_GREAT_CANYON), RET, }; diff --git a/src/data/ground/ground_data_d08p01_station.h b/src/data/ground/ground_data_d08p01_station.h index 636a11ea0..6e8a84dcc 100644 --- a/src/data/ground/ground_data_d08p01_station.h +++ b/src/data/ground/ground_data_d08p01_station.h @@ -14,7 +14,7 @@ static const struct ScriptCommand s_gs193_g0_s0_station_sref_script[] = { /* 0x8 JUMPIF_SCENARIOCHECK(5, /* to label */ 0), EXECUTE_STATION(12, 0, 0), LABEL(0), /* = 0x00 */ - SELECT_MAP(193), + SELECT_MAP(MAP_LAPIS_CAVE_ENTRY), CJUMP_SCENARIO_0(SCENARIO_MAIN), COND(JUDGE_EQ, 11, /* to label */ 1), JUMP_LABEL(2), @@ -124,13 +124,13 @@ static const struct ScriptCommand s_gs193_g0_s5_obj1_dlg2[] = { /* 0x8243080 */ static const struct ScriptCommand s_gs193_g1_s0_station_sref_script[] = { /* 0x82430a0 */ DEBUGINFO, - SELECT_MAP(193), + SELECT_MAP(MAP_LAPIS_CAVE_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(24), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, { 0x23, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(0, 0x0000000a), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_LAPIS_CAVE), RET, }; @@ -233,7 +233,7 @@ static const struct ScriptCommand s_gs193_g1_s0_lives1_dlg0[] = { /* 0x824389c * static const struct ScriptCommand s_gs193_g2_s0_station_sref_script[] = { /* 0x8243a1c */ DEBUGINFO, - SELECT_MAP(193), + SELECT_MAP(MAP_LAPIS_CAVE_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(102), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, @@ -434,7 +434,7 @@ static const struct ScriptCommand s_gs193_g3_s1_lives1_dlg0[] = { /* 0x8244648 * static const struct ScriptCommand s_gs193_g4_s0_station_sref_script[] = { /* 0x8244768 */ DEBUGINFO, - SELECT_MAP(193), + SELECT_MAP(MAP_LAPIS_CAVE_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(102), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, @@ -501,7 +501,7 @@ static const struct ScriptCommand s_gs193_g4_s0_lives1_dlg0[] = { /* 0x8244bb4 * static const struct ScriptCommand s_gs193_g5_s0_station_sref_script[] = { /* 0x8244c94 */ DEBUGINFO, - SELECT_MAP(193), + SELECT_MAP(MAP_LAPIS_CAVE_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(102), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, diff --git a/src/data/ground/ground_data_d09p02_station.h b/src/data/ground/ground_data_d09p02_station.h index f617f2845..c742715ce 100644 --- a/src/data/ground/ground_data_d09p02_station.h +++ b/src/data/ground/ground_data_d09p02_station.h @@ -57,7 +57,7 @@ static const struct ScriptCommand s_gs196_g0_s0_evt0_sref_script[] = { /* 0x8248 LABEL(0), /* = 0x00 */ TEXTBOX_CLEAR, BGM_FADEOUT(60), - NEXT_DUNGEON(30, 0x0000000c), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_MT_BLAZE_PEAK), COND_EQUAL(-1, /* to label */ 1), HALT, }; diff --git a/src/data/ground/ground_data_d10p02_station.h b/src/data/ground/ground_data_d10p02_station.h index 7f9cced67..388c7c356 100644 --- a/src/data/ground/ground_data_d10p02_station.h +++ b/src/data/ground/ground_data_d10p02_station.h @@ -57,7 +57,7 @@ static const struct ScriptCommand s_gs199_g0_s0_evt0_sref_script[] = { /* 0x824e LABEL(0), /* = 0x00 */ TEXTBOX_CLEAR, BGM_FADEOUT(60), - NEXT_DUNGEON(30, 0x0000000e), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_FROSTY_GROTTO), COND_EQUAL(-1, /* to label */ 1), HALT, }; diff --git a/src/data/ground/ground_data_d11p02_station.h b/src/data/ground/ground_data_d11p02_station.h index 2dcf1e074..db603efd7 100644 --- a/src/data/ground/ground_data_d11p02_station.h +++ b/src/data/ground/ground_data_d11p02_station.h @@ -60,11 +60,11 @@ static const struct ScriptCommand s_gs202_g0_s0_evt0_sref_script[] = { /* 0x8255 TEXTBOX_CLEAR, BGM_FADEOUT(60), JUMPIF_ARRAY(RESCUE_SCENARIO_JOB_LIST, 29, /* to label */ 2), - NEXT_DUNGEON(30, 0x00000010), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_MT_FREEZE_PEAK), COND_EQUAL(-1, /* to label */ 1), HALT, LABEL(2), /* = 0x02 */ - NEXT_DUNGEON(30, 0x00000026), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_MT_FREEZE_PEAK_2), COND_EQUAL(-1, /* to label */ 1), HALT, }; diff --git a/src/data/ground/ground_data_d12p01_station.h b/src/data/ground/ground_data_d12p01_station.h index dc0f3fd14..57af47c26 100644 --- a/src/data/ground/ground_data_d12p01_station.h +++ b/src/data/ground/ground_data_d12p01_station.h @@ -12,7 +12,7 @@ static const struct ScriptCommand s_gs204_g0_s0_station_sref_script[] = { /* 0x825ce34 */ DEBUGINFO, - SELECT_MAP(204), + SELECT_MAP(MAP_MAGMA_CAVERN_ENTRY), CJUMP_SCENARIO_0(SCENARIO_MAIN), COND(JUDGE_EQ, 15, /* to label */ 0), JUMP_LABEL(1), @@ -86,12 +86,12 @@ static const struct ScriptCommand s_gs204_g0_s4_lives1_dlg0[] = { /* 0x825d16c * static const struct ScriptCommand s_gs204_g1_s0_station_sref_script[] = { /* 0x825d19c */ DEBUGINFO, - SELECT_MAP(204), + SELECT_MAP(MAP_MAGMA_CAVERN_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(108), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(30, 0x00000011), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_MAGMA_CAVERN), RET, }; @@ -154,12 +154,12 @@ static const struct ScriptCommand s_gs204_g1_s0_lives1_dlg0[] = { /* 0x825d6dc * static const struct ScriptCommand s_gs204_g2_s0_station_sref_script[] = { /* 0x825d78c */ DEBUGINFO, - SELECT_MAP(204), + SELECT_MAP(MAP_MAGMA_CAVERN_ENTRY), SELECT_ENTITIES(-1, 0), BGM_SWITCH(108), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(30, 0x00000011), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_MAGMA_CAVERN), RET, }; diff --git a/src/data/ground/ground_data_d12p02_station.h b/src/data/ground/ground_data_d12p02_station.h index ad352fdfc..36bc9ddb8 100644 --- a/src/data/ground/ground_data_d12p02_station.h +++ b/src/data/ground/ground_data_d12p02_station.h @@ -52,7 +52,7 @@ static const struct ScriptCommand s_gs205_g0_s0_evt0_sref_script[] = { /* 0x825d LABEL(0), /* = 0x00 */ TEXTBOX_CLEAR, BGM_FADEOUT(60), - NEXT_DUNGEON(30, 0x00000012), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_MAGMA_CAVERN_PIT), COND_EQUAL(-1, /* to label */ 1), HALT, }; diff --git a/src/data/ground/ground_data_d13p01_station.h b/src/data/ground/ground_data_d13p01_station.h index c4164673d..2d0825f64 100644 --- a/src/data/ground/ground_data_d13p01_station.h +++ b/src/data/ground/ground_data_d13p01_station.h @@ -9,7 +9,7 @@ static const struct ScriptCommand s_gs207_g0_s0_station_sref_script[] = { /* 0x825ff68 */ DEBUGINFO, - SELECT_MAP(207), + SELECT_MAP(MAP_SKY_TOWER_ENTRY), BGM_STOP, JUMP_SCRIPT(COMMON_ENTER), }; @@ -20,7 +20,7 @@ static const struct ScriptCommand s_gs207_g1_s0_station_sref_script[] = { /* 0x8 DEBUGINFO, BGM_FADEOUT(30), WAIT(60), - SELECT_MAP(207), + SELECT_MAP(MAP_SKY_TOWER_ENTRY), SELECT_ENTITIES(-1, -1), BGM_SWITCH(22), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, @@ -164,12 +164,12 @@ static const struct ScriptCommand s_gs207_g1_s0_lives2_dlg0[] = { /* 0x8260738 * static const struct ScriptCommand s_gs207_g2_s0_station_sref_script[] = { /* 0x82608a8 */ DEBUGINFO, - SELECT_MAP(207), + SELECT_MAP(MAP_SKY_TOWER_ENTRY), SELECT_ENTITIES(-1, -1), BGM_SWITCH(22), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(30, 0x00000013), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_SKY_TOWER), RET, }; @@ -230,12 +230,12 @@ static const struct ScriptCommand s_gs207_g2_s0_lives2_dlg0[] = { /* 0x8260c3c * static const struct ScriptCommand s_gs207_g3_s0_station_sref_script[] = { /* 0x8260cac */ DEBUGINFO, - SELECT_MAP(207), + SELECT_MAP(MAP_SKY_TOWER_ENTRY), SELECT_ENTITIES(-1, -1), BGM_SWITCH(22), { 0x22, 0x01, 0x001e, 0x00000000, 0x00000000, NULL }, { 0xe3, 0x00, 0x0003, 0x00000000, 0x00000000, NULL }, - NEXT_DUNGEON(30, 0x00000013), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_SKY_TOWER), RET, }; diff --git a/src/data/ground/ground_data_d13p02_station.h b/src/data/ground/ground_data_d13p02_station.h index ff4c08c71..32fa487cb 100644 --- a/src/data/ground/ground_data_d13p02_station.h +++ b/src/data/ground/ground_data_d13p02_station.h @@ -52,7 +52,7 @@ static const struct ScriptCommand s_gs208_g0_s0_evt0_sref_script[] = { /* 0x8261 LABEL(0), /* = 0x00 */ TEXTBOX_CLEAR, BGM_FADEOUT(60), - NEXT_DUNGEON(30, 0x00000014), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_SKY_TOWER_SUMMIT), COND_EQUAL(-1, /* to label */ 1), HALT, }; diff --git a/src/data/ground/ground_event_data.h b/src/data/ground/ground_event_data.h index 8615a67b8..61b2e221e 100644 --- a/src/data/ground/ground_event_data.h +++ b/src/data/ground/ground_event_data.h @@ -1995,7 +1995,7 @@ static const struct ScriptCommand s_script_EVENT_M01E02B_L004B[] = { /* 0x81256f static const struct ScriptCommand s_script_EVENT_M01E02B_L005[] = { /* 0x8125730 */ DEBUGINFO, EXECUTE_SUBSTATION(182, 1, 0), - NEXT_DUNGEON(0, 0x00000002), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_MT_STEEL), RET, }; @@ -2008,7 +2008,7 @@ static const struct ScriptCommand s_script_EVENT_M01E02B_L006[] = { /* 0x8125770 static const struct ScriptCommand s_script_EVENT_M01E02B_L007[] = { /* 0x81257a0 */ DEBUGINFO, EXECUTE_SUBSTATION(182, 2, 0), - NEXT_DUNGEON(0, 0x00000002), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_MT_STEEL), RET, }; @@ -2168,7 +2168,7 @@ static const struct ScriptCommand s_script_EVENT_M01E04A_L004[] = { /* 0x8125de0 static const struct ScriptCommand s_script_EVENT_M01E04A_L005[] = { /* 0x8125e20 */ DEBUGINFO, - NEXT_DUNGEON(30, 0x00000006), + NEXT_DUNGEON(30, SCRIPT_DUNGEON_SILENT_CHASM), RET, }; @@ -3842,7 +3842,7 @@ static const struct ScriptCommand s_script_EVENT_S09E01A_L004[] = { /* 0x812a2f4 static const struct ScriptCommand s_script_EVENT_S09E01A_L004B[] = { /* 0x812a344 */ DEBUGINFO, EXECUTE_SUBSTATION(201, 6, 0), - NEXT_DUNGEON(0, 0x00000025), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_MT_FREEZE_2), RET, }; @@ -3876,7 +3876,7 @@ static const struct ScriptCommand s_script_EVENT_S09E01B_L001[] = { /* 0x812a454 static const struct ScriptCommand s_script_EVENT_S09E01B_L001B[] = { /* 0x812a4a4 */ DEBUGINFO, EXECUTE_SUBSTATION(221, 1, 0), - NEXT_DUNGEON(0, 0x00000027), + NEXT_DUNGEON(0, SCRIPT_DUNGEON_MURKY_CAVE), RET, }; @@ -4026,7 +4026,7 @@ static const struct ScriptCommand s_script_GETOUT_M01E02B[] = { /* 0x812ab34 */ JUMPIF_EQUAL(START_MODE, 10, /* to label */ 3), JUMP_SCRIPT(EVENT_M01E02B_L006), LABEL(6), /* = 0x06 */ - NEXT_DUNGEON(-1, 3), + NEXT_DUNGEON(-1, SCRIPT_DUNGEON_3), HALT, LABEL(1), /* = 0x01 */ JUMPIF_EQUAL(SCENARIO_MAIN, 4, /* to label */ 7), @@ -4050,7 +4050,7 @@ static const struct ScriptCommand s_script_GETOUT_M01E02B[] = { /* 0x812ab34 */ LABEL(11), /* = 0x0b */ JUMP_SCRIPT(GETOUT_R00E01A), LABEL(12), /* = 0x0c */ - NEXT_DUNGEON(-1, 3), + NEXT_DUNGEON(-1, SCRIPT_DUNGEON_3), HALT, LABEL(3), /* = 0x03 */ JUMP_SCRIPT(EVENT_DIVIDE), @@ -4074,7 +4074,7 @@ static const struct ScriptCommand s_script_GETOUT_M01E03A[] = { /* 0x812ae04 */ JUMPIF_EQUAL(START_MODE, 10, /* to label */ 3), JUMP_SCRIPT(EVENT_M01E03A_L009), LABEL(6), /* = 0x06 */ - NEXT_DUNGEON(-1, 5), + NEXT_DUNGEON(-1, SCRIPT_DUNGEON_5), HALT, LABEL(1), /* = 0x01 */ JUMPIF_EQUAL(SCENARIO_MAIN, 5, /* to label */ 7), @@ -4098,7 +4098,7 @@ static const struct ScriptCommand s_script_GETOUT_M01E03A[] = { /* 0x812ae04 */ LABEL(11), /* = 0x0b */ JUMP_SCRIPT(GETOUT_R00E01A), LABEL(12), /* = 0x0c */ - NEXT_DUNGEON(-1, 5), + NEXT_DUNGEON(-1, SCRIPT_DUNGEON_5), HALT, LABEL(3), /* = 0x03 */ JUMP_SCRIPT(EVENT_DIVIDE), diff --git a/src/ground_script.c b/src/ground_script.c index 1aac2dc9d..2c76cbf26 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -1918,7 +1918,7 @@ s32 ExecuteScriptCommand(Action *action) break; } case 10: { - u8 a = sub_80A2740((s16)curCmd.arg1); + u8 a = ScriptDungeonIdToDungeonId((s16)curCmd.arg1); s32 o = 0; switch ((s16)curCmd.arg1) { case 0: o = 1; break; @@ -3146,7 +3146,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3) } return 0; case 0xB: - return (CountJobsinDungeon(sub_80A2740(GetScriptVarValue(0, DUNGEON_ENTER_INDEX))) > 0); + return (CountJobsinDungeon(ScriptDungeonIdToDungeonId(GetScriptVarValue(0, DUNGEON_ENTER_INDEX))) > 0); case 0xC: { u8 sp_104; diff --git a/src/main_loops.c b/src/main_loops.c index d2fcdd9e7..096dc2214 100644 --- a/src/main_loops.c +++ b/src/main_loops.c @@ -618,23 +618,23 @@ static u32 RunGameMode_Async(u32 a0) else if (mode == MODE_DUNGEON_FROM_WORLD_MAP) { s32 i; - s32 dungId = (s16) GetScriptVarValue(NULL, DUNGEON_SELECT); - u8 r6 = sub_80A2740(dungId); + s32 scriptDungeonId = (s16) GetScriptVarValue(NULL, DUNGEON_SELECT); + u8 dungeonId = ScriptDungeonIdToDungeonId(scriptDungeonId); for (i = 0; i < WORLD_MAP_UNK_6D_COUNT; i++) { worldMapSetup.info.unk6D[i] = sub_80A28F0(i); } - if (r6 == 99) { + if (dungeonId == DUNGEON_INVALID) { mode = MODE_GROUND; continue; } worldMapSetup.info.startLocation.id = DUNGEON_OUT_ON_RESCUE; - sub_80011CC(&worldMapSetup.info.unk4, r6); + sub_80011CC(&worldMapSetup.info.unk4, dungeonId); worldMapSetup.info.unk6C = worldMapSetup.info.unk4.unk5; - switch ((s16) sub_80A2750(dungId)) { + switch ((s16) sub_80A2750(scriptDungeonId)) { case 1: - if (sub_80990EC(&dungeonSetup.info, dungId)) { + if (sub_80990EC(&dungeonSetup.info, scriptDungeonId)) { worldMapSetup.info.unk4.unkC = dungeonSetup.info.sub0.unkC; worldMapSetup.info.mon = dungeonSetup.info.mon; } @@ -656,7 +656,7 @@ static u32 RunGameMode_Async(u32 a0) mode = MODE_GROUND; continue; } - SetScriptVarValue(NULL, DUNGEON_ENTER, dungId); + SetScriptVarValue(NULL, DUNGEON_ENTER, scriptDungeonId); sUnknown_203B03C = 2; sub_800A8F8(4); r5 = xxx_script_related_8001334(5); @@ -1025,7 +1025,7 @@ static u8 sub_8001170(void) u8 dungeonID = NUM_DUNGEONS + 1; if (sub_80992E0(&local_10, &auStack_e)) - dungeonID = sub_80A2740(local_10); + dungeonID = ScriptDungeonIdToDungeonId(local_10); else if (!sub_8099328(&dungeonID) && !sub_8099360(&dungeonID) && sub_8099394(&auStack_b)) dungeonID = DUNGEON_OUT_ON_RESCUE; diff --git a/src/makuhita_dojo1.c b/src/makuhita_dojo1.c index e61e09b41..1ec6f9f84 100644 --- a/src/makuhita_dojo1.c +++ b/src/makuhita_dojo1.c @@ -193,7 +193,7 @@ static void MakuhitaDojo_UpdateDialogue(void) break; case 5: sMakuhitaDojoWork1->fallbackState = 13; - dLoc.id = sub_80A2740(sMakuhitaDojoWork1->unk10); + dLoc.id = ScriptDungeonIdToDungeonId(sMakuhitaDojoWork1->unk10); dLoc.floor = 1; PrintYellowDungeonNametoBuffer(gFormatBuffer_Monsters[0], &dLoc); CreateDialogueBoxAndPortrait(gCommonMakuhita[sMakuhitaDojoWork1->dlgMode][MAKUHITA_DLG_4], 0, sMakuhitaDojoWork1->monPortraitPtr, 0x10D); diff --git a/src/makuhita_dojo2.c b/src/makuhita_dojo2.c index 2701e285c..a986cc304 100644 --- a/src/makuhita_dojo2.c +++ b/src/makuhita_dojo2.c @@ -127,7 +127,7 @@ static void MakuhitaDojo_DrawCourseList(void) for (i = 0; i < sMakuhitaDojoWork2->s30.m.input.currPageEntries; i++) { iVar6 = sMakuhitaDojoWork2->unk0[sMakuhitaDojoWork2->s30.m.input.currPage * sMakuhitaDojoWork2->s30.m.input.entriesPerPage + i]; - dungeonIndex = sub_80A2740(iVar6); + dungeonIndex = ScriptDungeonIdToDungeonId(iVar6); mazeIndex = sub_80A2668(iVar6); diff --git a/src/unk_ds_only_feature.c b/src/unk_ds_only_feature.c index 3f400b690..082444d8e 100644 --- a/src/unk_ds_only_feature.c +++ b/src/unk_ds_only_feature.c @@ -9,6 +9,7 @@ #include "code_80A26CC.h" #include "constants/ground_map.h" #include "constants/friend_area.h" +#include "constants/dungeon.h" // This file effectively does nothing on GBA. If I were to guess I'd say it's bottom/top screen related. @@ -25,7 +26,7 @@ struct unkStruct_3001B68 s16 mapId; s16 groundPlaceId; u8 friendAreaId; - u8 unk19; + u8 dungeonId; u32 unk1C; u8 unk20; }; @@ -58,7 +59,7 @@ void sub_809C5C4(void) sUnknown_3001B68->mapId = -1; sUnknown_3001B68->groundPlaceId = GROUND_PLACE_DIRECTION; sUnknown_3001B68->friendAreaId = 0; - sUnknown_3001B68->unk19 = 0x3f; + sUnknown_3001B68->dungeonId = DUNGEON_OUT_ON_RESCUE; sUnknown_3001B68->unk1C = 0; sUnknown_3001B68->unk20 = 0; nullsub_107(); @@ -164,8 +165,8 @@ void sub_809C760(void) void sub_809C770(s16 mapId_, s16 groundPlaceId_) { u8 friendAreaId; - u8 uVar3; - s32 iVar5; + u8 dungeonId; + s32 scriptDungeonId; u32 uVar6; s32 mapId = mapId_; s32 groundPlaceId = groundPlaceId_; @@ -178,7 +179,7 @@ void sub_809C770(s16 mapId_, s16 groundPlaceId_) sub_809C6EC(); } friendAreaId = sUnknown_3001B68->friendAreaId; - uVar3 = sUnknown_3001B68->unk19; + dungeonId = sUnknown_3001B68->dungeonId; switch (groundPlaceId) { case GROUND_PLACE_FRIEND_AREAS: friendAreaId = MapIdToFriendAreaId(mapId); @@ -226,52 +227,52 @@ void sub_809C770(s16 mapId_, s16 groundPlaceId_) default: switch((s16)(groundPlaceId)) { case GROUND_PLACE_TINY_WOODS: - iVar5 = 0; + scriptDungeonId = 0; break; case GROUND_PLACE_MT_THUNDER: case GROUND_PLACE_MT_THUNDER_MID: - iVar5 = 7; + scriptDungeonId = 7; break; case GROUND_PLACE_GREAT_CANYON: case GROUND_PLACE_HILL_OF_THE_ANCIENTS: - iVar5 = 9; + scriptDungeonId = 9; break; case GROUND_PLACE_LAPIS_CAVE: - iVar5 = 10; + scriptDungeonId = 10; break; case GROUND_PLACE_MT_BLAZE: case GROUND_PLACE_MT_BLAZE_MID: - iVar5 = 0xb; + scriptDungeonId = 0xb; break; case GROUND_PLACE_FROSTY_FOREST: case GROUND_PLACE_FROSTY_CLEARING: - iVar5 = 0xd; + scriptDungeonId = 0xd; break; case GROUND_PLACE_MT_FREEZE: case GROUND_PLACE_MT_FREEZE_MID: - iVar5 = 0xf; + scriptDungeonId = 0xf; break; case GROUND_PLACE_MAGMA_CAVERN: case GROUND_PLACE_MAGMA_CAVERN_MID: - iVar5 = 0x11; + scriptDungeonId = 0x11; break; case GROUND_PLACE_SKY_TOWER: case GROUND_PLACE_SKY_TOWER_MID: - iVar5 = 0x13; + scriptDungeonId = 0x13; break; case GROUND_PLACE_WESTERN_CAVE: - iVar5 = 0x20; + scriptDungeonId = 0x20; break; case GROUND_PLACE_DUNGEON: default: - iVar5 = (s16)GetScriptVarValue(NULL,DUNGEON_ENTER); + scriptDungeonId = (s16)GetScriptVarValue(NULL,DUNGEON_ENTER); break; } - if (iVar5 == -1) { + if (scriptDungeonId == -1) { return; } - uVar3 = sub_80A2740(iVar5); + dungeonId = ScriptDungeonIdToDungeonId(scriptDungeonId); uVar6 = 2; break; } @@ -294,7 +295,7 @@ void sub_809C770(s16 mapId_, s16 groundPlaceId_) } } else if (uVar6 == 2 && - (uVar3 != sUnknown_3001B68->unk19 || (sUnknown_3001B68->groundPlaceId != groundPlaceId))) + (dungeonId != sUnknown_3001B68->dungeonId || (sUnknown_3001B68->groundPlaceId != groundPlaceId))) { sUnknown_3001B68->unkC = 1; sUnknown_3001B68->unk20 = 1; @@ -306,7 +307,7 @@ void sub_809C770(s16 mapId_, s16 groundPlaceId_) sUnknown_3001B68->mapId = mapId; sUnknown_3001B68->groundPlaceId = groundPlaceId; sUnknown_3001B68->friendAreaId = friendAreaId; - sUnknown_3001B68->unk19 = uVar3; + sUnknown_3001B68->dungeonId = dungeonId; if (sUnknown_3001B68->unk8 != 4) { sUnknown_3001B68->unkC = 0; sUnknown_3001B68->unk20 = 0;