diff options
author | Seth Barberee <seth.barberee@gmail.com> | 2021-12-19 16:38:51 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-19 16:38:51 -0600 |
commit | 8e1c66d8bd01807285b05d8333f36cd2d70e062c (patch) | |
tree | bb1bf94d56b770eca66780948ff9e05401967ed1 /include | |
parent | 087405b9d975b447ef7b17afd1e73e449cc7881b (diff) | |
parent | 0369264407563b64d60c885f8bf79322b6f663c8 (diff) |
Merge pull request #85 from AnonymousRandomPerson/master
More AI decomp
Diffstat (limited to 'include')
-rw-r--r-- | include/constants/status.h | 4 | ||||
-rw-r--r-- | include/constants/targeting.h | 12 | ||||
-rw-r--r-- | include/dungeon_ai_1.h | 9 | ||||
-rw-r--r-- | include/dungeon_ai_items.h | 2 | ||||
-rw-r--r-- | include/dungeon_entity.h | 19 | ||||
-rw-r--r-- | include/dungeon_global_data.h | 17 | ||||
-rw-r--r-- | include/dungeon_map_access.h | 9 | ||||
-rw-r--r-- | include/dungeon_pokemon_attributes_1.h | 2 | ||||
-rw-r--r-- | include/dungeon_pokemon_sprites.h | 2 | ||||
-rw-r--r-- | include/dungeon_range.h | 9 | ||||
-rw-r--r-- | include/dungeon_util.h | 2 | ||||
-rw-r--r-- | include/dungeon_visibility.h | 9 | ||||
-rw-r--r-- | include/map.h | 23 | ||||
-rw-r--r-- | include/position.h | 16 |
14 files changed, 98 insertions, 37 deletions
diff --git a/include/constants/status.h b/include/constants/status.h index 19b860b..cf911c0 100644 --- a/include/constants/status.h +++ b/include/constants/status.h @@ -94,10 +94,6 @@ #define MUZZLED_STATUS_NONE 0 #define MUZZLED_STATUS_MUZZLED 1 -#define TARGETING_DECOY_NONE 0 -#define TARGETING_DECOY_TEAM 1 -#define TARGETING_DECOY_WILD 2 - #define STATUS_SPRITE_SLEEPLESS (1 << 0) #define STATUS_SPRITE_BURNED (1 << 1) #define STATUS_SPRITE_POISONED (1 << 2) diff --git a/include/constants/targeting.h b/include/constants/targeting.h new file mode 100644 index 0000000..6140716 --- /dev/null +++ b/include/constants/targeting.h @@ -0,0 +1,12 @@ +#ifndef GUARD_CONSTANTS_TARGETING_H +#define GUARD_CONSTANTS_TARGETING_H + +#define TARGETING_DECOY_NONE 0 +#define TARGETING_DECOY_TEAM 1 +#define TARGETING_DECOY_WILD 2 + +#define TARGET_CAPABILITY_CANNOT_ATTACK 0 +#define TARGET_CAPABILITY_CAN_TARGET 1 +#define TARGET_CAPABILITY_CAN_ATTACK_NOT_TARGET 2 + +#endif diff --git a/include/dungeon_ai_1.h b/include/dungeon_ai_1.h new file mode 100644 index 0000000..dace65a --- /dev/null +++ b/include/dungeon_ai_1.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_AI_1_H +#define GUARD_DUNGEON_AI_1_H + +#include "dungeon_entity.h" + +// 0x71598 +u8 CanTarget(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified); + +#endif diff --git a/include/dungeon_ai_items.h b/include/dungeon_ai_items.h index f4effd2..676200a 100644 --- a/include/dungeon_ai_items.h +++ b/include/dungeon_ai_items.h @@ -2,7 +2,7 @@ #define GUARD_DUNGEON_AI_ITEMS_H #include "dungeon_entity.h" -#include "map.h" +#include "position.h" // 0x73658 void DecideUseItem(struct DungeonEntity *pokemon); diff --git a/include/dungeon_entity.h b/include/dungeon_entity.h index b894a2f..f4e836c 100644 --- a/include/dungeon_entity.h +++ b/include/dungeon_entity.h @@ -3,7 +3,7 @@ #include "constants/move.h" #include "item.h" -#include "map.h" +#include "position.h" struct DungeonActionContainer { @@ -272,10 +272,10 @@ struct DungeonEntity enum EntityType { - ENTITY_NONE = 0, - ENTITY_POKEMON = 1, - ENTITY_TRAP = 2, - ENTITY_ITEM = 3 + ENTITY_NONE, + ENTITY_POKEMON, + ENTITY_TRAP, + ENTITY_ITEM }; enum MovementFlag @@ -287,10 +287,11 @@ enum MovementFlag enum ShopkeeperMode { - SHOPKEEPER_FRIENDLY = 1, + SHOPKEEPER_NONE, + SHOPKEEPER_FRIENDLY, // These two modes trigger if an explosion damages the shopkeeper. The shopkeeper attacks the side that damaged it. - SHOPKEEPER_AGGRESSIVE_TO_WILD = 2, - SHOPKEEPER_AGGRESSIVE_TO_PLAYER = 3 + SHOPKEEPER_AGGRESSIVE_TO_WILD, + SHOPKEEPER_AGGRESSIVE_TO_PLAYER }; enum MovementAction @@ -308,7 +309,7 @@ enum ClientType { CLIENT_TYPE_NONE = 0, CLIENT_TYPE_CLIENT = 1, // Used for mission clients that need rescuing. - CLIENT_TYPE_DONT_MOVE = 3 // Used for Diglett in the Skarmory boss fight. + CLIENT_TYPE_DONT_MOVE = 4 // Used for Diglett in the Skarmory boss fight. }; enum VisualFlag diff --git a/include/dungeon_global_data.h b/include/dungeon_global_data.h index 1d0a971..948603e 100644 --- a/include/dungeon_global_data.h +++ b/include/dungeon_global_data.h @@ -5,12 +5,15 @@ #include "dungeon_entity.h" #include "global.h" #include "map.h" +#include "position.h" -#define DUNGEON_MAX_SIZE_X 55 -#define DUNGEON_MAX_SIZE_Y 31 +#define DUNGEON_MAX_SIZE_X 56 +#define DUNGEON_MAX_SIZE_Y 32 #define DUNGEON_MAX_WILD_POKEMON 16 #define DUNGEON_MAX_POKEMON MAX_TEAM_MEMBERS + DUNGEON_MAX_WILD_POKEMON +extern struct DungeonGlobalData *gDungeonGlobalData; + struct DungeonGlobalData { u8 unk0; @@ -51,8 +54,8 @@ struct DungeonGlobalData u8 fill3A10[0x3A14 - 0x3A10]; /* 0x3A14 */ s16 bossBattleIndex; u8 fill3A16[0x3A18 - 0x3A16]; - /* 0x3A18 */ struct MapTile mapTiles[DUNGEON_MAX_SIZE_X * DUNGEON_MAX_SIZE_Y]; - u8 fill54BC[0xE23C - 0xD9F0]; + /* 0x3A18 */ struct MapTile mapTiles[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; + u8 fillE218[0xE23C - 0xE218]; s16 unkE23C; s16 unkE23E; u8 fillE240[0xE264 - 0xE240]; @@ -68,8 +71,10 @@ struct DungeonGlobalData /* 0xE277 */ u8 mudSportTurnsLeft; /* 0xE278 */ u8 waterSportTurnsLeft; u8 fillE279[0xE8C0 - 0xE279]; - /* 0xE8C0 */ u32 mapEntityPointers[DUNGEON_MAX_SIZE_X * DUNGEON_MAX_SIZE_Y]; - u8 fill10364[0x10844 - 0x10364]; + /* 0xE8C0 */ struct MapTile* mapEntityPointers[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; + u8 fill104C0[0x104C4 - 0x104C0]; + /* 0x104C4 */ struct MapRoom roomData[MAX_ROOM_COUNT]; + u8 fill10764[0x10844 - 0x10764]; /* 0x10844 */ u16 numRoomExits[MAX_ROOM_COUNT]; u8 fill10874[0x10884 - 0x10874]; /* 0x10884 */ struct Position roomExits[MAX_ROOM_COUNT][32]; // Arrays of room exits for each room. diff --git a/include/dungeon_map_access.h b/include/dungeon_map_access.h new file mode 100644 index 0000000..5e4e3da --- /dev/null +++ b/include/dungeon_map_access.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_MAP_ACCESS_H +#define GUARD_DUNGEON_MAP_ACCESS_H + +#include "map.h" + +// 0x4954C +struct MapTile* GetMapTileAtPosition(s32 x, s32 y); + +#endif diff --git a/include/dungeon_pokemon_attributes_1.h b/include/dungeon_pokemon_attributes_1.h index 0c8037b..ccf68e5 100644 --- a/include/dungeon_pokemon_attributes_1.h +++ b/include/dungeon_pokemon_attributes_1.h @@ -3,6 +3,8 @@ #include "dungeon_entity.h" +// 0x71884 +bool8 CanSeeInvisible(struct DungeonEntity *pokemon); // 0x718AC bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic); // 0x718D8 diff --git a/include/dungeon_pokemon_sprites.h b/include/dungeon_pokemon_sprites.h index 50595ea..fe934e2 100644 --- a/include/dungeon_pokemon_sprites.h +++ b/include/dungeon_pokemon_sprites.h @@ -1,7 +1,7 @@ #ifndef GUARD_DUNGEON_POKEMON_SPRITES_H #define GUARD_DUNGEON_POKEMON_SPRITES_H -#include "map.h" +#include "position.h" struct DungeonPokemonStatusSprite { diff --git a/include/dungeon_range.h b/include/dungeon_range.h new file mode 100644 index 0000000..3d76011 --- /dev/null +++ b/include/dungeon_range.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_RANGE_H +#define GUARD_DUNGEON_RANGE_H + +#include "position.h" + +// 0x83294 +bool8 InSameRoom_2(struct Position *pos1, struct Position *pos2); + +#endif diff --git a/include/dungeon_util.h b/include/dungeon_util.h index ca62184..82d44ba 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -11,6 +11,6 @@ u32 GetEntityType(struct DungeonEntity *entity); struct DungeonEntityData *GetTrapData(struct DungeonEntity *entity); // 0x45108 struct ItemSlot *GetItemData(struct DungeonEntity *entity); -struct MapTile *sub_8045128(struct DungeonEntity *entity); +struct MapTile *GetMapEntityForDungeonEntity(struct DungeonEntity *entity); #endif diff --git a/include/dungeon_visibility.h b/include/dungeon_visibility.h new file mode 100644 index 0000000..f94926e --- /dev/null +++ b/include/dungeon_visibility.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_VISIBILITY_H +#define GUARD_DUNGEON_VISIBILITY_H + +#include "dungeon_entity.h" + +// 0x45990 +bool8 CanSee(struct DungeonEntity *entity, struct DungeonEntity *targetEntity); + +#endif diff --git a/include/map.h b/include/map.h index 7863b46..2989c6c 100644 --- a/include/map.h +++ b/include/map.h @@ -2,8 +2,10 @@ #define GUARD_MAP_H #include "dungeon_entity.h" +#include "position.h" #define MAX_ROOM_COUNT 24 // Empirical max, not sure if the code supports any more. +#define CORRIDOR_ROOM_INDEX 0xFF struct MapTile { @@ -25,25 +27,16 @@ 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 */ struct Position start; - /* 0x6 */ struct Position end; - u8 fillA[0x1C - 0xA]; + // These are not aligned properly to use the Position struct. + /* 0x2 */ s16 startX; + /* 0x4 */ s16 startY; + /* 0x6 */ s16 endX; + /* 0x8 */ s16 endY; + u8 fillA[0x1A - 0xA]; }; enum TileType diff --git a/include/position.h b/include/position.h new file mode 100644 index 0000000..3a24df4 --- /dev/null +++ b/include/position.h @@ -0,0 +1,16 @@ +#ifndef GUARD_POSITION_H +#define GUARD_POSITION_H + +struct Position +{ + s16 x; + s16 y; +}; + +struct Position32 +{ + s32 x; + s32 y; +}; + +#endif |