diff --git a/data/data_80F59C8_5.s b/data/data_80F59C8_5.s deleted file mode 100644 index d43ce6e93..000000000 --- a/data/data_80F59C8_5.s +++ /dev/null @@ -1,40 +0,0 @@ -#include "constants/status.h" -.section .rodata - -.align 2, 0 - -.string "pksdir0" -.align 2,0 - -.global gSpeedTurns -gSpeedTurns: @ 80F6860 -@ replacing .incbin "baserom.gba", 0xF6860, 0x104 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00 -.byte 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00 -.byte 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x14, 0x00 -.byte 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x17, 0x00, 0x18, 0x00, 0x00, 0x00 -.byte 0x19, 0x00, 0x1a, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1d, 0x00, 0x1e, 0x00, 0x00, 0x00 -.byte 0x1f, 0x00, 0x20, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x23, 0x00, 0x24, 0x00, 0x00, 0x00 -.byte 0x25, 0x00, 0x26, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x29, 0x00, 0x2a, 0x00, 0x2b, 0x00 -.byte 0x2c, 0x00, 0x2d, 0x00, 0x2e, 0x00, 0x2f, 0x00, 0x30, 0x00, 0x31, 0x00, 0x32, 0x00, 0x33, 0x00 -.byte 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x39, 0x00, 0x3a, 0x00, 0x3b, 0x00 -.byte 0x3c, 0x00, 0x3d, 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64 -.byte 0x69, 0x72, 0x30, 0x00 - -.global gUnknown_80F6964 -gUnknown_80F6964: @ 80F6964 -@ replacing .incbin "baserom.gba", 0xF6964, 0x18 -.byte 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00 -.byte 0x12, 0x00, 0x31, 0x00, 0x2c, 0x00, 0x12, 0x00 - -.global gUnknown_80F697C -gUnknown_80F697C: @ 80F697C -.byte 0x58, 0x00, 0x00, 0x00 -.string "pksdir0" -.align 2,0 diff --git a/data/data_80F59C8_7.s b/data/data_80F59C8_7.s index 3c200bc26..fd19b376b 100644 --- a/data/data_80F59C8_7.s +++ b/data/data_80F59C8_7.s @@ -5,5 +5,3 @@ .string "pksdir0" .align 2,0 .string "pksdir0" -.align 2,0 -.string "pksdir0" diff --git a/data/pksdir_0.s b/data/pksdir_0.s index e05d752ca..43dacf9e3 100644 --- a/data/pksdir_0.s +++ b/data/pksdir_0.s @@ -1,3 +1,4 @@ .section .rodata +.align 2 .string "pksdir0\0" diff --git a/data/pksdir_1.s b/data/pksdir_1.s new file mode 100644 index 000000000..43dacf9e3 --- /dev/null +++ b/data/pksdir_1.s @@ -0,0 +1,4 @@ +.section .rodata + +.align 2 +.string "pksdir0\0" diff --git a/include/constants/item.h b/include/constants/item.h index a8c1edc0a..59f426756 100644 --- a/include/constants/item.h +++ b/include/constants/item.h @@ -16,6 +16,7 @@ #define CATEGORY_HELD_ITEMS 4 #define CATEGORY_TMS_HMS 5 #define CATEGORY_POKE 6 +#define CATEGORY_7 7 #define CATEGORY_OTHER 8 #define CATEGORY_ORBS 9 #define CATEGORY_LINK_BOX 10 diff --git a/include/dungeon_engine.h b/include/dungeon_engine.h index 08c673b8d..4c1ec87dd 100644 --- a/include/dungeon_engine.h +++ b/include/dungeon_engine.h @@ -1,6 +1,10 @@ #ifndef GUARD_DUNGEON_ENGINE_H #define GUARD_DUNGEON_ENGINE_H +#include "structs/dungeon_entity.h" + +extern const s16 gSpeedTurns[MAX_SPEED_STAGE + 1][25]; + void RunFractionalTurn(bool8 param_1); #endif diff --git a/ld_script.txt b/ld_script.txt index ca29180f4..261259f2f 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -528,7 +528,7 @@ SECTIONS { src/personality_test1.o(.rodata); src/personality_test2.o(.rodata); src/code_803D0D8.o(.rodata); - src/dungeon_util.o(.rodata); + src/dungeon_pos_data.o(.rodata); data/data_80F4D44.o(.rodata); src/dungeon_config.o(.rodata); data/data_80F59C8_1.o(.rodata); @@ -541,9 +541,13 @@ SECTIONS { data/pksdir_0.o(.rodata); src/code_8041AD0.o(.rodata); src/run_dungeon.o(.rodata); - data/data_80F59C8_5.o(.rodata); + src/dungeon_engine.o(.rodata); + src/dungeon_action.o(.rodata); + data/pksdir_1.o(.rodata); + src/dungeon_util.o(.text); src/dungeon_items.o(.rodata); data/data_80F59C8_7.o(.rodata); + src/dungeon_ai_item_weight.o(.rodata); src/dungeon_map_access.o(.rodata); src/dungeon_generation.o(.rodata); src/dungeon_generation_fixed.o(.rodata); diff --git a/src/dungeon_action.c b/src/dungeon_action.c index 944fd688d..725006daa 100644 --- a/src/dungeon_action.c +++ b/src/dungeon_action.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "dungeon_action.h" #include "constants/dungeon_action.h" #include "dungeon_ai.h" @@ -16,29 +17,36 @@ #include "code_8044CC8.h" #include "dungeon_items.h" #include "dungeon_map_access.h" +#include "dungeon_engine.h" +#include "run_dungeon.h" -extern u8 gUnknown_80F697C[]; -extern s16 gSpeedTurns[2][0x19]; - -extern void sub_8043ED0(u32); -extern u8 GetFloorType(void); extern bool8 sub_8044B28(void); extern void sub_8086AC0(void); -extern void sub_8043ED0(u32); extern void UseAttack(u32); extern void TriggerWeatherAbilities(void); extern void sub_8071DA4(Entity *); extern void TickStatusHeal(Entity *); - extern unkStruct_202EE44 gDungeonSubMenu[10]; extern s32 gDungeonSubMenuItemsCount; -extern u16 gUnknown_80F6964[NUM_ITEM_CATEGORIES]; -extern u8 gUnknown_80F697C[]; extern bool8 sub_8045888(Entity *); -extern u8 GetFloorType(void); + +static const u16 gUnknown_80F6964[NUM_ITEM_CATEGORIES] = { + [CATEGORY_THROWN_LINE] = 0, + [CATEGORY_THROWN_ARC] = 0, + [CATEGORY_BERRIES_SEEDS_VITAMINS] = 13, + [CATEGORY_FOOD_GUMMIES] = 14, + [CATEGORY_HELD_ITEMS] = 0, + [CATEGORY_TMS_HMS] = 16, + [CATEGORY_POKE] = 0, + [CATEGORY_7] = 18, + [CATEGORY_OTHER] = 18, + [CATEGORY_ORBS] = 49, + [CATEGORY_LINK_BOX] = 44, + [CATEGORY_USED_TM] = 18, +}; UNUSED static const u8 *sub_8044BA8(u16 actionId, u8 id) { @@ -46,7 +54,7 @@ UNUSED static const u8 *sub_8044BA8(u16 actionId, u8 id) return gUnknown_80F91EC; } else { - if (!AreStringsDifferent(gUnknown_80F7C50[actionId].str, gUnknown_80F697C)) { + if (!AreStringsDifferent(gUnknown_80F7C50[actionId].str, "X")) { return gActions[GetItemActionType(id)].useText; } else { @@ -240,7 +248,7 @@ const u8 *GetDungeonSubMenuItemString(s32 param_1) return gUnknown_80F91EC; } else { - if (!AreStringsDifferent(gUnknown_80F7C50[actionId].str, gUnknown_80F697C)) { + if (!AreStringsDifferent(gUnknown_80F7C50[actionId].str, "X")) { return gActions[GetItemActionType(gDungeonSubMenu[param_1].unk2)].useText; } else { diff --git a/src/dungeon_ai_item_weight.c b/src/dungeon_ai_item_weight.c index dfe5c9f81..672fc1355 100644 --- a/src/dungeon_ai_item_weight.c +++ b/src/dungeon_ai_item_weight.c @@ -1,6 +1,6 @@ #include "global.h" +#include "globaldata.h" #include "dungeon_ai_item_weight.h" - #include "constants/status.h" #include "constants/targeting.h" #include "dungeon_ai_targeting.h" diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index 655d8b6d2..fcce8d72e 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "run_dungeon.h" #include "code_803E46C.h" #include "constants/dungeon.h" @@ -12,8 +13,6 @@ #include "constants/ability.h" #include "dungeon_pokemon_attributes.h" -extern s16 gSpeedTurns[2][25]; - extern bool8 sub_8044B28(void); extern void TrySpawnMonsterAndActivatePlusMinus(void); extern void sub_807E378(void); @@ -34,7 +33,13 @@ extern void sub_807EAA0(u32, u32); static void sub_8044454(void); static bool8 xxx_dungeon_80442D0(bool8); -// First file in overlay5 +const s16 gSpeedTurns[MAX_SPEED_STAGE + 1][25] = { + [0] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0}, + [1] = {0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 9, 0}, + [2] = {0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0}, + [3] = {0, 22, 23, 24, 0, 25, 26, 27, 0, 28, 29, 30, 0, 31, 32, 33, 0, 34, 35, 36, 0, 37, 38, 39, 0}, + [4] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64}, +}; void RunFractionalTurn(bool8 param_1) { diff --git a/src/dungeon_pos_data.c b/src/dungeon_pos_data.c new file mode 100644 index 000000000..914137d61 --- /dev/null +++ b/src/dungeon_pos_data.c @@ -0,0 +1,595 @@ +#include "global.h" +#include "structs/str_position.h" + +const DungeonPos gAdjacentTileOffsets[] = { + {0, 1}, + {1, 1}, + {1, 0}, + {1, -1}, + {0, -1}, + {-1, -1}, + {-1, 0}, + {-1, 1} +}; + +const DungeonPos gUnknown_80F4468[76] = { + {0, 0}, + {0, -1}, + {1, 0}, + {0, 1}, + {-1, 0}, + {-1, -1}, + {1, -1}, + {-1, 1}, + {1, 1}, + {-2, -2}, + {-1, -2}, + {0, -2}, + {1, -2}, + {2, -2}, + {-2, -1}, + {2, -1}, + {-2, 0}, + {2, 0}, + {-2, 1}, + {2, 1}, + {-2, 2}, + {-1, 2}, + {0, 2}, + {1, 2}, + {2, 2}, + {99, 99}, + {0, 0}, + {-1, 0}, + {0, -1}, + {0, 1}, + {1, 0}, + {-1, -1}, + {-1, 1}, + {-2, 0}, + {0, -2}, + {0, 2}, + {1, -1}, + {1, 1}, + {2, 0}, + {-1, -2}, + {-1, 2}, + {-2, -1}, + {-2, 1}, + {-3, 0}, + {0, -3}, + {0, 3}, + {1, -2}, + {1, 2}, + {2, -1}, + {2, 1}, + {3, 0}, + {-1, -3}, + {-1, 3}, + {-2, -2}, + {-2, 2}, + {-3, -1}, + {-3, 1}, + {1, -3}, + {1, 3}, + {2, -2}, + {2, 2}, + {3, -1}, + {3, 1}, + {-2, -3}, + {-2, 3}, + {-3, -2}, + {-3, 2}, + {2, -3}, + {2, 3}, + {3, -2}, + {3, 2}, + {-3, -3}, + {-3, 3}, + {3, -3}, + {3, 3}, + {99, 99}, +}; + +const DungeonPos gUnknown_80F4598[158] = { + {0, 0}, + {-1, 0}, + {1, 0}, + {0, 1}, + {0, -1}, + {-1, -1}, + {-1, 1}, + {-2, 0}, + {0, -2}, + {0, 2}, + {1, -1}, + {1, 1}, + {2, 0}, + {-1, -2}, + {-1, 2}, + {-2, -1}, + {-2, 1}, + {-3, 0}, + {0, -3}, + {0, 3}, + {1, -2}, + {1, 2}, + {2, -1}, + {2, 1}, + {3, 0}, + {-1, -3}, + {-1, 3}, + {-2, -2}, + {-2, 2}, + {-3, -1}, + {-3, 1}, + {1, -3}, + {1, 3}, + {2, -2}, + {2, 2}, + {3, -1}, + {3, 1}, + {-2, -3}, + {-2, 3}, + {-3, -2}, + {-3, 2}, + {2, -3}, + {2, 3}, + {3, -2}, + {3, 2}, + {-3, -3}, + {-3, 3}, + {3, -3}, + {3, 3}, + {-4, 0}, + {4, 0}, + {0, -4}, + {0, 4}, + {-4, 1}, + {4, 1}, + {-1, -4}, + {-1, 4}, + {-4, -1}, + {4, -1}, + {1, -4}, + {1, 4}, + {-4, 2}, + {4, 2}, + {-2, -4}, + {-2, 4}, + {-4, -2}, + {4, -2}, + {2, -4}, + {2, 4}, + {-4, 3}, + {4, 3}, + {-3, -4}, + {-3, 4}, + {-4, -3}, + {4, -3}, + {3, -4}, + {3, 4}, + {-4, 4}, + {4, 4}, + {-4, -4}, + {-4, 4}, + {-5, 0}, + {5, 0}, + {0, -5}, + {0, 5}, + {-5, -1}, + {5, -1}, + {-1, -5}, + {-1, 5}, + {-5, 1}, + {5, 1}, + {1, -5}, + {1, 5}, + {-5, -2}, + {5, -2}, + {-2, -5}, + {-2, 5}, + {-5, 2}, + {5, 2}, + {2, -5}, + {2, 5}, + {-5, -3}, + {5, -3}, + {-3, -5}, + {-3, 5}, + {-5, 3}, + {5, 3}, + {3, -5}, + {3, 5}, + {-5, -4}, + {5, -4}, + {-4, -5}, + {-4, 5}, + {-5, 4}, + {5, 4}, + {4, -5}, + {4, 5}, + {-5, -5}, + {5, -5}, + {-5, -5}, + {-5, 5}, + {99, 99}, + {0, -1}, + {1, 0}, + {0, 1}, + {-1, 0}, + {-1, -1}, + {1, -1}, + {-1, 1}, + {1, 1}, + {-2, -2}, + {-1, -2}, + {0, -2}, + {1, -2}, + {2, -2}, + {-2, -1}, + {2, -1}, + {-2, 0}, + {2, 0}, + {-2, 1}, + {2, 1}, + {-2, 2}, + {-1, 2}, + {0, 2}, + {1, 2}, + {2, 2}, + {0, 0}, + {99, 99}, + {0, 0}, + {0, -1}, + {1, 0}, + {0, 1}, + {-1, 0}, + {-1, -1}, + {1, -1}, + {-1, 1}, + {1, 1}, + {99, 99}, +}; + +static const DungeonPos gUnknown_80F4810[99] = { + {0, 1}, + {0, 2}, + {1, 2}, + {-1, 2}, + {0, 3}, + {1, 3}, + {-1, 3}, + {2, 3}, + {-2, 3}, + {0, 4}, + {1, 4}, + {-1, 4}, + {2, 4}, + {-2, 4}, + {3, 4}, + {-3, 4}, + {0, 5}, + {1, 5}, + {-1, 5}, + {2, 5}, + {-2, 5}, + {3, 5}, + {-3, 5}, + {4, 5}, + {-4, 5}, + {0, 6}, + {1, 6}, + {-1, 6}, + {2, 6}, + {-2, 6}, + {3, 6}, + {-3, 6}, + {4, 6}, + {-4, 6}, + {5, 6}, + {-5, 6}, + {0, 7}, + {1, 7}, + {-1, 7}, + {2, 7}, + {-2, 7}, + {3, 7}, + {-3, 7}, + {4, 7}, + {-4, 7}, + {5, 7}, + {-5, 7}, + {6, 7}, + {-6, 7}, + {0, 8}, + {1, 8}, + {-1, 8}, + {2, 8}, + {-2, 8}, + {3, 8}, + {-3, 8}, + {4, 8}, + {-4, 8}, + {5, 8}, + {-5, 8}, + {6, 8}, + {-6, 8}, + {7, 8}, + {-7, 8}, + {0, 9}, + {1, 9}, + {-1, 9}, + {2, 9}, + {-2, 9}, + {3, 9}, + {-3, 9}, + {4, 9}, + {-4, 9}, + {5, 9}, + {-5, 9}, + {6, 9}, + {-6, 9}, + {7, 9}, + {-7, 9}, + {8, 9}, + {-8, 9}, + {0, 10}, + {1, 10}, + {-1, 10}, + {2, 10}, + {-2, 10}, + {3, 10}, + {-3, 10}, + {4, 10}, + {-4, 10}, + {5, 10}, + {-5, 10}, + {6, 10}, + {-6, 10}, + {7, 10}, + {-7, 10}, + {8, 10}, + {-8, 10}, + {99, 99}, +}; + +static const DungeonPos gUnknown_80F499C[101] = { + {1, 0}, + {2, 0}, + {2, -1}, + {2, 1}, + {3, 0}, + {3, -1}, + {3, 1}, + {3, -2}, + {3, 2}, + {4, 0}, + {4, -1}, + {4, 1}, + {4, -2}, + {4, 2}, + {4, -3}, + {4, 3}, + {5, 0}, + {5, -1}, + {5, 1}, + {5, -2}, + {5, 2}, + {5, -3}, + {5, 3}, + {5, -4}, + {5, 4}, + {6, 0}, + {6, -1}, + {6, 1}, + {6, -2}, + {6, 2}, + {6, -3}, + {6, 3}, + {6, -4}, + {6, 4}, + {6, -5}, + {6, 5}, + {7, 0}, + {7, -1}, + {7, 1}, + {7, -2}, + {7, 2}, + {7, -3}, + {7, 3}, + {7, -4}, + {7, 4}, + {7, -5}, + {7, 5}, + {7, -6}, + {7, 6}, + {8, 0}, + {8, -1}, + {8, 1}, + {8, -2}, + {8, 2}, + {8, -3}, + {8, 3}, + {8, -4}, + {8, 4}, + {8, -5}, + {8, 5}, + {8, -6}, + {8, 6}, + {8, -7}, + {8, 7}, + {9, 0}, + {9, -1}, + {9, 1}, + {9, -2}, + {9, 2}, + {9, -3}, + {9, 3}, + {9, -4}, + {9, 4}, + {9, -5}, + {9, 5}, + {9, -6}, + {9, 6}, + {9, -7}, + {9, 7}, + {9, -8}, + {9, 8}, + {10, 0}, + {10, -1}, + {10, 1}, + {10, -2}, + {10, 2}, + {10, -3}, + {10, 3}, + {10, -4}, + {10, 4}, + {10, -5}, + {10, 5}, + {10, -6}, + {10, 6}, + {10, -7}, + {10, 7}, + {10, -8}, + {10, 8}, + {10, -9}, + {10, 9}, + {99, 99}, +}; + +static const DungeonPos gUnknown_80F4B30[101] = { + {1, 1}, + {2, 2}, + {2, 1}, + {1, 2}, + {3, 3}, + {3, 2}, + {2, 3}, + {3, 1}, + {1, 3}, + {4, 4}, + {4, 3}, + {3, 4}, + {4, 2}, + {2, 4}, + {4, 1}, + {1, 4}, + {5, 5}, + {5, 4}, + {4, 5}, + {5, 3}, + {3, 5}, + {5, 2}, + {2, 5}, + {5, 1}, + {1, 5}, + {6, 6}, + {6, 5}, + {5, 6}, + {6, 4}, + {4, 6}, + {6, 3}, + {3, 6}, + {6, 2}, + {2, 6}, + {6, 1}, + {1, 6}, + {7, 7}, + {7, 6}, + {6, 7}, + {7, 5}, + {5, 7}, + {7, 4}, + {4, 7}, + {7, 3}, + {3, 7}, + {7, 2}, + {2, 7}, + {7, 1}, + {1, 7}, + {8, 8}, + {8, 7}, + {7, 8}, + {8, 6}, + {6, 8}, + {8, 5}, + {5, 8}, + {8, 4}, + {4, 8}, + {8, 3}, + {3, 8}, + {8, 2}, + {2, 8}, + {8, 1}, + {1, 8}, + {9, 9}, + {9, 8}, + {8, 9}, + {9, 7}, + {7, 9}, + {9, 6}, + {6, 9}, + {9, 5}, + {5, 9}, + {9, 4}, + {4, 9}, + {9, 3}, + {3, 9}, + {9, 2}, + {2, 9}, + {9, 1}, + {1, 9}, + {10, 10}, + {10, 9}, + {9, 10}, + {10, 8}, + {8, 10}, + {10, 7}, + {7, 10}, + {10, 6}, + {6, 10}, + {10, 5}, + {5, 10}, + {10, 4}, + {4, 10}, + {10, 3}, + {3, 10}, + {10, 2}, + {2, 10}, + {10, 1}, + {1, 10}, + {99, 99}, +}; + +struct Struct80F4CC4 { + const DungeonPos *posArray; + s16 unk4; + s16 unk6; +}; + +const struct Struct80F4CC4 gUnknown_80F4CC4[] = { + {gUnknown_80F4810, 1, 1}, + {gUnknown_80F4B30, 1, 1}, + {gUnknown_80F499C, 1, 1}, + {gUnknown_80F4B30, 1, -1}, + {gUnknown_80F4810, -1, -1}, + {gUnknown_80F4B30, -1, -1}, + {gUnknown_80F499C, -1, -1}, + {gUnknown_80F4B30, -1, 1}, +}; + +const s32 gFaceDirectionIncrements[] = {0, 1, -1, 2, -2, 3, -3, 4, 0, -1, 1, -2, 2, -3, 3, 4}; + +const DungeonPos gUnknown_80F4D44[] = { + {0, 256}, + {256, 256}, + {256, 0}, + {256, -256}, + {0, -256}, + {-256, -256}, + {-256, 0}, + {-256, 256}, +}; + +const u8 gUnknown_80F4D64[] = {2, 6, 4, 0, 2, 0, 4, 6, 4, 0, 6, 2, 4, 2, 6, 0, 6, 2, 0, 4, 6, 4, 2, 0, 0, 4, 2, 6, 0, 6, 2, 4}; diff --git a/src/dungeon_util.c b/src/dungeon_util.c index 5464782d8..74c9a80ee 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -1,4 +1,5 @@ #include "global.h" +#include "globaldata.h" #include "dungeon_util.h" #include "structs/str_dungeon.h" #include "structs/str_traps.h" @@ -37,599 +38,6 @@ extern void sub_8045ACC(void); extern s32 GetMonsterApparentID(Entity *pokemon, s32 id); extern void sub_8045BF8(u8 *, Item *); -const DungeonPos gAdjacentTileOffsets[] = { - {0, 1}, - {1, 1}, - {1, 0}, - {1, -1}, - {0, -1}, - {-1, -1}, - {-1, 0}, - {-1, 1} -}; - -const DungeonPos gUnknown_80F4468[76] = { - {0, 0}, - {0, -1}, - {1, 0}, - {0, 1}, - {-1, 0}, - {-1, -1}, - {1, -1}, - {-1, 1}, - {1, 1}, - {-2, -2}, - {-1, -2}, - {0, -2}, - {1, -2}, - {2, -2}, - {-2, -1}, - {2, -1}, - {-2, 0}, - {2, 0}, - {-2, 1}, - {2, 1}, - {-2, 2}, - {-1, 2}, - {0, 2}, - {1, 2}, - {2, 2}, - {99, 99}, - {0, 0}, - {-1, 0}, - {0, -1}, - {0, 1}, - {1, 0}, - {-1, -1}, - {-1, 1}, - {-2, 0}, - {0, -2}, - {0, 2}, - {1, -1}, - {1, 1}, - {2, 0}, - {-1, -2}, - {-1, 2}, - {-2, -1}, - {-2, 1}, - {-3, 0}, - {0, -3}, - {0, 3}, - {1, -2}, - {1, 2}, - {2, -1}, - {2, 1}, - {3, 0}, - {-1, -3}, - {-1, 3}, - {-2, -2}, - {-2, 2}, - {-3, -1}, - {-3, 1}, - {1, -3}, - {1, 3}, - {2, -2}, - {2, 2}, - {3, -1}, - {3, 1}, - {-2, -3}, - {-2, 3}, - {-3, -2}, - {-3, 2}, - {2, -3}, - {2, 3}, - {3, -2}, - {3, 2}, - {-3, -3}, - {-3, 3}, - {3, -3}, - {3, 3}, - {99, 99}, -}; - -const DungeonPos gUnknown_80F4598[158] = { - {0, 0}, - {-1, 0}, - {1, 0}, - {0, 1}, - {0, -1}, - {-1, -1}, - {-1, 1}, - {-2, 0}, - {0, -2}, - {0, 2}, - {1, -1}, - {1, 1}, - {2, 0}, - {-1, -2}, - {-1, 2}, - {-2, -1}, - {-2, 1}, - {-3, 0}, - {0, -3}, - {0, 3}, - {1, -2}, - {1, 2}, - {2, -1}, - {2, 1}, - {3, 0}, - {-1, -3}, - {-1, 3}, - {-2, -2}, - {-2, 2}, - {-3, -1}, - {-3, 1}, - {1, -3}, - {1, 3}, - {2, -2}, - {2, 2}, - {3, -1}, - {3, 1}, - {-2, -3}, - {-2, 3}, - {-3, -2}, - {-3, 2}, - {2, -3}, - {2, 3}, - {3, -2}, - {3, 2}, - {-3, -3}, - {-3, 3}, - {3, -3}, - {3, 3}, - {-4, 0}, - {4, 0}, - {0, -4}, - {0, 4}, - {-4, 1}, - {4, 1}, - {-1, -4}, - {-1, 4}, - {-4, -1}, - {4, -1}, - {1, -4}, - {1, 4}, - {-4, 2}, - {4, 2}, - {-2, -4}, - {-2, 4}, - {-4, -2}, - {4, -2}, - {2, -4}, - {2, 4}, - {-4, 3}, - {4, 3}, - {-3, -4}, - {-3, 4}, - {-4, -3}, - {4, -3}, - {3, -4}, - {3, 4}, - {-4, 4}, - {4, 4}, - {-4, -4}, - {-4, 4}, - {-5, 0}, - {5, 0}, - {0, -5}, - {0, 5}, - {-5, -1}, - {5, -1}, - {-1, -5}, - {-1, 5}, - {-5, 1}, - {5, 1}, - {1, -5}, - {1, 5}, - {-5, -2}, - {5, -2}, - {-2, -5}, - {-2, 5}, - {-5, 2}, - {5, 2}, - {2, -5}, - {2, 5}, - {-5, -3}, - {5, -3}, - {-3, -5}, - {-3, 5}, - {-5, 3}, - {5, 3}, - {3, -5}, - {3, 5}, - {-5, -4}, - {5, -4}, - {-4, -5}, - {-4, 5}, - {-5, 4}, - {5, 4}, - {4, -5}, - {4, 5}, - {-5, -5}, - {5, -5}, - {-5, -5}, - {-5, 5}, - {99, 99}, - {0, -1}, - {1, 0}, - {0, 1}, - {-1, 0}, - {-1, -1}, - {1, -1}, - {-1, 1}, - {1, 1}, - {-2, -2}, - {-1, -2}, - {0, -2}, - {1, -2}, - {2, -2}, - {-2, -1}, - {2, -1}, - {-2, 0}, - {2, 0}, - {-2, 1}, - {2, 1}, - {-2, 2}, - {-1, 2}, - {0, 2}, - {1, 2}, - {2, 2}, - {0, 0}, - {99, 99}, - {0, 0}, - {0, -1}, - {1, 0}, - {0, 1}, - {-1, 0}, - {-1, -1}, - {1, -1}, - {-1, 1}, - {1, 1}, - {99, 99}, -}; - -static const DungeonPos gUnknown_80F4810[99] = { - {0, 1}, - {0, 2}, - {1, 2}, - {-1, 2}, - {0, 3}, - {1, 3}, - {-1, 3}, - {2, 3}, - {-2, 3}, - {0, 4}, - {1, 4}, - {-1, 4}, - {2, 4}, - {-2, 4}, - {3, 4}, - {-3, 4}, - {0, 5}, - {1, 5}, - {-1, 5}, - {2, 5}, - {-2, 5}, - {3, 5}, - {-3, 5}, - {4, 5}, - {-4, 5}, - {0, 6}, - {1, 6}, - {-1, 6}, - {2, 6}, - {-2, 6}, - {3, 6}, - {-3, 6}, - {4, 6}, - {-4, 6}, - {5, 6}, - {-5, 6}, - {0, 7}, - {1, 7}, - {-1, 7}, - {2, 7}, - {-2, 7}, - {3, 7}, - {-3, 7}, - {4, 7}, - {-4, 7}, - {5, 7}, - {-5, 7}, - {6, 7}, - {-6, 7}, - {0, 8}, - {1, 8}, - {-1, 8}, - {2, 8}, - {-2, 8}, - {3, 8}, - {-3, 8}, - {4, 8}, - {-4, 8}, - {5, 8}, - {-5, 8}, - {6, 8}, - {-6, 8}, - {7, 8}, - {-7, 8}, - {0, 9}, - {1, 9}, - {-1, 9}, - {2, 9}, - {-2, 9}, - {3, 9}, - {-3, 9}, - {4, 9}, - {-4, 9}, - {5, 9}, - {-5, 9}, - {6, 9}, - {-6, 9}, - {7, 9}, - {-7, 9}, - {8, 9}, - {-8, 9}, - {0, 10}, - {1, 10}, - {-1, 10}, - {2, 10}, - {-2, 10}, - {3, 10}, - {-3, 10}, - {4, 10}, - {-4, 10}, - {5, 10}, - {-5, 10}, - {6, 10}, - {-6, 10}, - {7, 10}, - {-7, 10}, - {8, 10}, - {-8, 10}, - {99, 99}, -}; - -static const DungeonPos gUnknown_80F499C[101] = { - {1, 0}, - {2, 0}, - {2, -1}, - {2, 1}, - {3, 0}, - {3, -1}, - {3, 1}, - {3, -2}, - {3, 2}, - {4, 0}, - {4, -1}, - {4, 1}, - {4, -2}, - {4, 2}, - {4, -3}, - {4, 3}, - {5, 0}, - {5, -1}, - {5, 1}, - {5, -2}, - {5, 2}, - {5, -3}, - {5, 3}, - {5, -4}, - {5, 4}, - {6, 0}, - {6, -1}, - {6, 1}, - {6, -2}, - {6, 2}, - {6, -3}, - {6, 3}, - {6, -4}, - {6, 4}, - {6, -5}, - {6, 5}, - {7, 0}, - {7, -1}, - {7, 1}, - {7, -2}, - {7, 2}, - {7, -3}, - {7, 3}, - {7, -4}, - {7, 4}, - {7, -5}, - {7, 5}, - {7, -6}, - {7, 6}, - {8, 0}, - {8, -1}, - {8, 1}, - {8, -2}, - {8, 2}, - {8, -3}, - {8, 3}, - {8, -4}, - {8, 4}, - {8, -5}, - {8, 5}, - {8, -6}, - {8, 6}, - {8, -7}, - {8, 7}, - {9, 0}, - {9, -1}, - {9, 1}, - {9, -2}, - {9, 2}, - {9, -3}, - {9, 3}, - {9, -4}, - {9, 4}, - {9, -5}, - {9, 5}, - {9, -6}, - {9, 6}, - {9, -7}, - {9, 7}, - {9, -8}, - {9, 8}, - {10, 0}, - {10, -1}, - {10, 1}, - {10, -2}, - {10, 2}, - {10, -3}, - {10, 3}, - {10, -4}, - {10, 4}, - {10, -5}, - {10, 5}, - {10, -6}, - {10, 6}, - {10, -7}, - {10, 7}, - {10, -8}, - {10, 8}, - {10, -9}, - {10, 9}, - {99, 99}, -}; - -static const DungeonPos gUnknown_80F4B30[101] = { - {1, 1}, - {2, 2}, - {2, 1}, - {1, 2}, - {3, 3}, - {3, 2}, - {2, 3}, - {3, 1}, - {1, 3}, - {4, 4}, - {4, 3}, - {3, 4}, - {4, 2}, - {2, 4}, - {4, 1}, - {1, 4}, - {5, 5}, - {5, 4}, - {4, 5}, - {5, 3}, - {3, 5}, - {5, 2}, - {2, 5}, - {5, 1}, - {1, 5}, - {6, 6}, - {6, 5}, - {5, 6}, - {6, 4}, - {4, 6}, - {6, 3}, - {3, 6}, - {6, 2}, - {2, 6}, - {6, 1}, - {1, 6}, - {7, 7}, - {7, 6}, - {6, 7}, - {7, 5}, - {5, 7}, - {7, 4}, - {4, 7}, - {7, 3}, - {3, 7}, - {7, 2}, - {2, 7}, - {7, 1}, - {1, 7}, - {8, 8}, - {8, 7}, - {7, 8}, - {8, 6}, - {6, 8}, - {8, 5}, - {5, 8}, - {8, 4}, - {4, 8}, - {8, 3}, - {3, 8}, - {8, 2}, - {2, 8}, - {8, 1}, - {1, 8}, - {9, 9}, - {9, 8}, - {8, 9}, - {9, 7}, - {7, 9}, - {9, 6}, - {6, 9}, - {9, 5}, - {5, 9}, - {9, 4}, - {4, 9}, - {9, 3}, - {3, 9}, - {9, 2}, - {2, 9}, - {9, 1}, - {1, 9}, - {10, 10}, - {10, 9}, - {9, 10}, - {10, 8}, - {8, 10}, - {10, 7}, - {7, 10}, - {10, 6}, - {6, 10}, - {10, 5}, - {5, 10}, - {10, 4}, - {4, 10}, - {10, 3}, - {3, 10}, - {10, 2}, - {2, 10}, - {10, 1}, - {1, 10}, - {99, 99}, -}; - -struct Struct80F4CC4 { - const DungeonPos *posArray; - s16 unk4; - s16 unk6; -}; - -const struct Struct80F4CC4 gUnknown_80F4CC4[] = { - {gUnknown_80F4810, 1, 1}, - {gUnknown_80F4B30, 1, 1}, - {gUnknown_80F499C, 1, 1}, - {gUnknown_80F4B30, 1, -1}, - {gUnknown_80F4810, -1, -1}, - {gUnknown_80F4B30, -1, -1}, - {gUnknown_80F499C, -1, -1}, - {gUnknown_80F4B30, -1, 1}, -}; - -const s32 gFaceDirectionIncrements[] = {0, 1, -1, 2, -2, 3, -3, 4, 0, -1, 1, -2, 2, -3, 3, 4}; - -const DungeonPos gUnknown_80F4D44[] = { - {0, 256}, - {256, 256}, - {256, 0}, - {256, -256}, - {0, -256}, - {-256, -256}, - {-256, 0}, - {-256, 256}, -}; - -const u8 gUnknown_80F4D64[] = {2, 6, 4, 0, 2, 0, 4, 6, 4, 0, 6, 2, 4, 2, 6, 0, 6, 2, 0, 4, 6, 4, 2, 0, 0, 4, 2, 6, 0, 6, 2, 4}; - bool8 EntityIsValid(Entity *entity) { if (!entity)