mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-24 09:44:17 -05:00
Decomped CanLayTrap()
This commit is contained in:
6648
asm/code_807E5AC.s
6648
asm/code_807E5AC.s
File diff suppressed because it is too large
Load Diff
6609
asm/code_807FCD4.s
Normal file
6609
asm/code_807FCD4.s
Normal file
File diff suppressed because it is too large
Load Diff
9
include/trap.h
Normal file
9
include/trap.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef GUARD_TRAP_H
|
||||
#define GUARD_TRAP_H
|
||||
|
||||
#include "position.h"
|
||||
|
||||
// 0x4AF74
|
||||
bool8 CanLayTrap(struct Position *pos);
|
||||
|
||||
#endif
|
||||
@@ -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);
|
||||
|
||||
@@ -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
27
src/trap.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user