diff options
author | Cheng Hann Gan <chenghanngan.us@gmail.com> | 2021-12-12 15:52:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-12 12:52:06 -0800 |
commit | c53bdc35f8bdd401e90dfae263a3f5fc9182f86b (patch) | |
tree | 6111353227b153e4aa56422d91e4e79288ce7376 /include/dungeon_entity.h | |
parent | a34c9ab91b553fcb1f72b94eb912b94bea58885b (diff) |
Dungeon random/AI decomp + converted positions to structs (#83)
* Decomped RollPercentChance()
* Decomped DungeonRandomCapped()
* Decomped DungeonRandom()
* Decomped FindRockItemTargets()
-Added position struct.
Diffstat (limited to 'include/dungeon_entity.h')
-rw-r--r-- | include/dungeon_entity.h | 56 |
1 files changed, 20 insertions, 36 deletions
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; |