mirror of
https://github.com/pret/pmd-sky.git
synced 2026-04-24 14:59:13 -05:00
Matched CanLayTrap
Match by DizzyEggg
This commit is contained in:
parent
08ee322d31
commit
342d5be6f1
|
|
@ -1094,46 +1094,3 @@ PrepareTrapperTrap: ; 0x022EDBD4
|
|||
_022EDC28: .word DUNGEON_PTR
|
||||
_022EDC2C: .word 0x00012AAA + PREPARE_TRAPPER_TRAP_OFFSET
|
||||
arm_func_end PrepareTrapperTrap
|
||||
|
||||
; https://decomp.me/scratch/EcuBP
|
||||
#ifndef NONMATCHING
|
||||
arm_func_start CanLayTrap
|
||||
CanLayTrap: ; 0x022EDC30
|
||||
stmdb sp!, {r3, lr}
|
||||
mov r1, r0
|
||||
ldrsh r0, [r1]
|
||||
ldrsh r1, [r1, #2]
|
||||
bl GetTileSafe
|
||||
ldrh r2, [r0]
|
||||
tst r2, #0x200
|
||||
movne r0, #0
|
||||
ldmneia sp!, {r3, pc}
|
||||
ldrb r1, [r0, #7]
|
||||
cmp r1, #0xff
|
||||
moveq r0, #0
|
||||
ldmeqia sp!, {r3, pc}
|
||||
tst r2, #8
|
||||
movne r0, #0
|
||||
ldmneia sp!, {r3, pc}
|
||||
tst r2, #0x20
|
||||
movne r0, #0
|
||||
ldmneia sp!, {r3, pc}
|
||||
ldrh r1, [r0]
|
||||
and r1, r1, #3
|
||||
cmp r1, #1
|
||||
movne r0, #0
|
||||
ldmneia sp!, {r3, pc}
|
||||
ldr r0, [r0, #0x10]
|
||||
cmp r0, #0
|
||||
beq _022EDCB4
|
||||
ldr r0, [r0]
|
||||
cmp r0, #2
|
||||
moveq r0, #1
|
||||
movne r0, #0
|
||||
and r0, r0, #0xff
|
||||
ldmia sp!, {r3, pc}
|
||||
_022EDCB4:
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end CanLayTrap
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ static inline struct monster *GetEntInfo(struct entity *ent)
|
|||
return ent->info;
|
||||
}
|
||||
|
||||
static inline u32 GetEntityType(struct entity *entity)
|
||||
{
|
||||
return entity->type;
|
||||
}
|
||||
|
||||
static inline bool8 ItemSticky(u8 flags)
|
||||
{
|
||||
// Double bang is needed to match for some reason.
|
||||
|
|
@ -24,6 +29,11 @@ static inline bool8 MoveExists(struct move *move)
|
|||
return move->flags0 & MOVE_FLAG_EXISTS ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static inline s32 GetTerrainType(const struct tile* tile)
|
||||
{
|
||||
return tile->terrain_flags & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
|
||||
}
|
||||
|
||||
#define ENTITY_POISONED(entity_info)((entity_info->burn_class_status.burn == STATUS_BURN_POISONED || entity_info->burn_class_status.burn == STATUS_BURN_BADLY_POISONED))
|
||||
|
||||
#endif // PMDSKY_DUNGEON_UTIL_STATIC_H
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
#include "trap.h"
|
||||
#include "dungeon.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_util_static.h"
|
||||
|
||||
// https://decomp.me/scratch/EcuBP
|
||||
#ifdef NONMATCHING
|
||||
bool8 CanLayTrap(struct position *pos)
|
||||
{
|
||||
struct tile *tile = GetTileSafe(pos->x, pos->y);
|
||||
|
|
@ -19,12 +18,11 @@ bool8 CanLayTrap(struct position *pos)
|
|||
if (tile->terrain_flags & TERRAIN_TYPE_SHOP)
|
||||
return FALSE;
|
||||
|
||||
if ((tile->terrain_flags & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) != TERRAIN_TYPE_NORMAL)
|
||||
if (GetTerrainType(tile) != TERRAIN_TYPE_NORMAL)
|
||||
return FALSE;
|
||||
|
||||
if (tile->object != NULL)
|
||||
return tile->object->type == ENTITY_TRAP;
|
||||
return GetEntityType(tile->object) == ENTITY_TRAP;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user