diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/dungeon_ai_items.h | 5 | ||||
-rw-r--r-- | include/dungeon_entity.h | 56 | ||||
-rw-r--r-- | include/dungeon_global_data.h | 2 | ||||
-rw-r--r-- | include/dungeon_random.h | 9 | ||||
-rw-r--r-- | include/dungeon_random_1.h | 7 | ||||
-rw-r--r-- | include/map.h | 24 |
6 files changed, 55 insertions, 48 deletions
diff --git a/include/dungeon_ai_items.h b/include/dungeon_ai_items.h index b9e7625..f4effd2 100644 --- a/include/dungeon_ai_items.h +++ b/include/dungeon_ai_items.h @@ -2,10 +2,13 @@ #define GUARD_DUNGEON_AI_ITEMS_H #include "dungeon_entity.h" +#include "map.h" // 0x73658 void DecideUseItem(struct DungeonEntity *pokemon); // 0x739DC -void FindStraightThrowableTargets(struct DungeonEntity* pokemon, s32 thrownAIFlag, struct ItemSlot* item, bool8 ignoreRollChance); +void FindStraightThrowableTargets(struct DungeonEntity *pokemon, s32 thrownAIFlag, struct ItemSlot *item, bool8 ignoreRollChance); +// 0x73AA0 +void FindRockItemTargets(struct DungeonEntity *pokemon, struct ItemSlot *item, struct Position potentialTargets[], bool8 ignoreRollChance); #endif diff --git a/include/dungeon_entity.h b/include/dungeon_entity.h index ef18c67..25291e4 100644 --- a/include/dungeon_entity.h +++ b/include/dungeon_entity.h @@ -1,8 +1,9 @@ #ifndef GUARD_DUNGEON_ENTITY_H #define GUARD_DUNGEON_ENTITY_H -#include "item.h" #include "constants/move.h" +#include "item.h" +#include "map.h" struct DungeonActionContainer { @@ -13,8 +14,7 @@ struct DungeonActionContainer /* 0x4 */ u8 actionUseIndex; u8 fill5[0x8 - 0x5]; // Position of the Pokémon the last time it threw an item. - /* 0x8 */ s16 lastItemThrowPositionX; - /* 0xA */ s16 lastItemThrowPositionY; + /* 0x8 */ struct Position lastItemThrowPosition; u8 unkC; }; @@ -68,21 +68,17 @@ struct DungeonEntityData /* 0x44 */ struct DungeonActionContainer action; u8 fill55[0x58 - 0x55]; // Position of the target that the Pokémon wants throw an item at. - /* 0x58 */ s16 *itemTargetPosition; + /* 0x58 */ struct Position itemTargetPosition; /* 0x5C */ u8 type1; /* 0x5D */ u8 type2; /* 0x5E */ u8 ability1; /* 0x5F */ u8 ability2; /* 0x60 */ struct ItemSlot heldItem; u8 fill64[0x68 - 0x64]; - /* 0x68 */ s16 previousPosition1X; - /* 0x6A */ s16 previousPosition1Y; - /* 0x6C */ s16 previousPosition2X; - /* 0x6E */ s16 previousPosition2Y; - /* 0x70 */ s16 previousPosition3X; - /* 0x72 */ s16 previousPosition3Y; - /* 0x74 */ s16 previousPosition4X; - /* 0x76 */ s16 previousPosition4Y; + /* 0x68 */ struct Position previousPosition1; + /* 0x6C */ struct Position previousPosition2; + /* 0x70 */ struct Position previousPosition3; + /* 0x74 */ struct Position previousPosition4; /* 0x78 */ u8 movementAction; /* 0x79 */ bool8 notAdjacentToTarget; /* 0x7A */ bool8 hasTarget; @@ -91,8 +87,7 @@ struct DungeonEntityData u8 fill7E[0x80 - 0x7E]; /* 0x80 */ u32 targetPokemon; u8 fill84[0x88 - 0x84]; - /* 0x88 */ s16 targetMovePositionX; - /* 0x8A */ s16 targetMovePositionY; + /* 0x88 */ struct Position targetMovePosition; // Bitwise flags corresponding to selected IQ skills. /* 0x8C */ u8 IQSkillsSelected[4]; // IQ skills selected in the IQ skills menu. /* 0x90 */ u8 IQSkillsEnabled[4]; @@ -200,22 +195,17 @@ struct DungeonEntityData u8 unk15E; u8 unk15F; u8 fill160[0x16C - 0x160]; - /* 0x16C */ s16 targetPositionX; - /* 0x16E */ s16 targetPositionY; - /* 0x170 */ s16 posPixelX; - /* 0x172 */ s16 posPixelY; + /* 0x16C */ struct Position targetPosition; + /* 0x170 */ struct Position posPixel; u32 unk174; u8 fill178[0x184 - 0x178]; // Previous value of targetPosition for movement, 1 and 2 moves ago. - /* 0x184 */ s16 previousTargetMovePosition1X; - /* 0x186 */ s16 previousTargetMovePosition1Y; - /* 0x188 */ s32 previousTargetMovePosition2X; - /* 0x18C */ s32 previousTargetMovePosition2Y; + /* 0x184 */ struct Position previousTargetMovePosition1; + /* 0x188 */ struct Position32 previousTargetMovePosition2; /* 0x190 */ u8 lastMoveDirection; // The last direction that the Pokémon moved in. u8 fill191[0x194 - 0x191]; // Number of tiles that the Pokémon moved last, multiplied by 0x100. - /* 0x194 */ s32 lastMoveIncrementX; - /* 0x198 */ s32 lastMoveIncrementY; + /* 0x194 */ struct Position32 lastMoveIncrement; /* 0x19C */ u8 walkAnimationCounter; // Set when the Pokémon starts moving, and counts down until the Pokémon's walk animation stops. u8 fill19D[0x1F4 - 0x19D]; /* 0x1F4 */ u8 numMoveTiles; // Number of tiles to move in a turn. Can be greater than 1 if the user's movement speed is boosted. @@ -232,16 +222,12 @@ struct DungeonEntityData struct DungeonEntity { /* 0x0 */ u32 entityType; - /* 0x4 */ s16 posWorldX; - /* 0x6 */ s16 posWorldY; - /* 0x8 */ s16 prevPosWorldX; - /* 0xA */ s16 prevPosWorldY; + /* 0x4 */ struct Position posWorld; + /* 0x8 */ struct Position prevPosWorld; // The center of the entity acccording to pixel-space coordinates, using the same origin as posWorld. // X = (posWorld * 24 + 16) * 256, while Y = (posWorld * 24 + 12) * 256. - /* 0xC */ s32 posPixelX; - /* 0x10 */ s32 posPixelY; - /* 0x14 */ s32 prevPosPixelX; - /* 0x18 */ s32 prevPosPixelY; + /* 0xC */ struct Position32 posPixel; + /* 0x14 */ struct Position32 prevPosPixel; u8 fill1C[0x20 - 0x1C]; /* 0x20 */ bool8 visible; // Turned off when a Pokémon faints. u8 fill21[0x25 - 0x21]; @@ -259,11 +245,9 @@ struct DungeonEntity /* 0x2C */ u16 spriteAnimationIndex; /* 0x2E */ u16 spriteAnimationCounter2; // The position of the sprite within the tile. The animation may change the position slightly. - /* 0x30 */ u16 spritePosX; - /* 0x32 */ u16 spritePosY; + /* 0x30 */ struct Position spritePos; // Offset of the sprite from its position at the start of the animation. Changes alongside spritePos. - /* 0x34 */ s16 spritePosOffsetX; - /* 0x36 */ s16 spritePosOffsetY; + /* 0x34 */ struct Position spritePosOffset; u8 fill38[0x48 - 0x38]; // The sprite index to display, among the Pokémon's possible sprites. /* 0x48 */ u16 spriteIndexForEntity; diff --git a/include/dungeon_global_data.h b/include/dungeon_global_data.h index 254a195..5cb0c8a 100644 --- a/include/dungeon_global_data.h +++ b/include/dungeon_global_data.h @@ -72,7 +72,7 @@ struct DungeonGlobalData u8 fill10364[0x10844 - 0x10364]; /* 0x10844 */ u16 numRoomExits[MAX_ROOM_COUNT]; u8 fill10874[0x10884 - 0x10874]; - /* 0x10884 */ struct RoomExit roomExits[MAX_ROOM_COUNT][32]; // Arrays of room exits for each room. + /* 0x10884 */ struct Position roomExits[MAX_ROOM_COUNT][32]; // Arrays of room exits for each room. u8 fill11444[0x1356C - 0x11484]; u8 unk1356C; u8 fill1356D[0x1357C - 0x1356D]; diff --git a/include/dungeon_random.h b/include/dungeon_random.h new file mode 100644 index 0000000..5679720 --- /dev/null +++ b/include/dungeon_random.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_RANDOM_H +#define GUARD_DUNGEON_RANDOM_H + +// 0x840E8 +s32 DungeonRandom(void); +// 0x84100 +s32 DungeonRandomCapped(s32 cap); + +#endif diff --git a/include/dungeon_random_1.h b/include/dungeon_random_1.h new file mode 100644 index 0000000..bfc2ecd --- /dev/null +++ b/include/dungeon_random_1.h @@ -0,0 +1,7 @@ +#ifndef GUARD_DUNGEON_RANDOM_1_H +#define GUARD_DUNGEON_RANDOM_1_H + +// 0x84144 +bool8 RollPercentChance(s32 percentChance); + +#endif diff --git a/include/map.h b/include/map.h index 38fe68a..7863b46 100644 --- a/include/map.h +++ b/include/map.h @@ -25,23 +25,27 @@ struct MapTile /* 0x14 */ struct DungeonEntity *mapObject; // Item or trap on the tile. }; +struct Position +{ + s16 x; + s16 y; +}; + +struct Position32 +{ + s32 x; + s32 y; +}; + struct MapRoom { u8 fill0[0x2 - 0x0]; // All coordinates are inclusive. - /* 0x2 */ s16 startX; - /* 0x4 */ s16 startY; - /* 0x6 */ s16 endX; - /* 0x8 */ s16 endY; + /* 0x2 */ struct Position start; + /* 0x6 */ struct Position end; u8 fillA[0x1C - 0xA]; }; -struct RoomExit -{ - s16 x; - s16 y; -}; - enum TileType { TILE_TYPE_FLOOR = 1 << 0, |