Decomped CanLayTrap()

This commit is contained in:
AnonymousRandomPerson
2022-02-21 15:40:12 -05:00
parent 07795b6ff6
commit 33d2d61750
6 changed files with 6648 additions and 6650 deletions

File diff suppressed because it is too large Load Diff

6609
asm/code_807FCD4.s Normal file

File diff suppressed because it is too large Load Diff

9
include/trap.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef GUARD_TRAP_H
#define GUARD_TRAP_H
#include "position.h"
// 0x4AF74
bool8 CanLayTrap(struct Position *pos);
#endif

View File

@@ -242,6 +242,8 @@ SECTIONS {
asm/code_807CD9C.o(.text);
src/weather.o(.text);
asm/code_807E5AC.o(.text);
src/trap.o(.text);
asm/code_807FCD4.o(.text);
src/dungeon_range.o(.text);
asm/code_808333C.o(.text);
src/dungeon_random.o(.text);

View File

@@ -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;

27
src/trap.c Normal file
View File

@@ -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;
}