diff options
author | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2022-02-21 15:40:12 -0500 |
---|---|---|
committer | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2022-02-21 15:40:12 -0500 |
commit | 33d2d6175067e75cd222b8f05234221ec2d2b82b (patch) | |
tree | 2f0c77cc29752a06797c3630daafde232ae14c0d /src | |
parent | 07795b6ff619c30426ad279ef840842ef3dea2ac (diff) |
Decomped CanLayTrap()
Diffstat (limited to 'src')
-rw-r--r-- | src/status_checker.c | 3 | ||||
-rw-r--r-- | src/trap.c | 27 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/status_checker.c b/src/status_checker.c index 667f0cb..07d6c7f 100644 --- a/src/status_checker.c +++ b/src/status_checker.c @@ -14,6 +14,7 @@ #include "number_util.h" #include "status_checks_1.h" #include "tile_types.h" +#include "trap.h" #include "weather.h" // Array indices correspond to the current dungeon tileset. @@ -96,8 +97,6 @@ const u8 gDungeonCamouflageTypes[76] = { TYPE_ROCK }; -extern bool8 CanLayTrap(struct Position*); - bool8 CanUseOnSelfWithStatusChecker(struct DungeonEntity *pokemon, struct PokemonMove *move) { struct DungeonEntityData *pokemonData = pokemon->entityData; diff --git a/src/trap.c b/src/trap.c new file mode 100644 index 0000000..e054706 --- /dev/null +++ b/src/trap.c @@ -0,0 +1,27 @@ +#include "global.h" +#include "trap.h" + +#include "dungeon_map_access.h" +#include "dungeon_util.h" +#include "map.h" + +bool8 CanLayTrap(struct Position *pos) +{ + struct MapTile *tile = GetMapTile_2(pos->x, pos->y); + if (tile->tileType & TILE_TYPE_STAIRS || + tile->roomIndex == CORRIDOR_ROOM_INDEX || + tile->tileType & TILE_TYPE_ROOM_EXIT) + { + return FALSE; + } + if (tile->tileType & TILE_TYPE_SHOP) + { + return FALSE; + } + if ((tile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID)) != TILE_TYPE_FLOOR || + (tile->mapObject != NULL && GetEntityType(tile->mapObject) != ENTITY_TRAP)) + { + return FALSE; + } + return TRUE; +} |