diff --git a/asm/overlay_29_022ECDE4.s b/asm/overlay_29_022ECDE4.s index 71f1e365..66b7d2eb 100644 --- a/asm/overlay_29_022ECDE4.s +++ b/asm/overlay_29_022ECDE4.s @@ -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 diff --git a/include/dungeon_util_static.h b/include/dungeon_util_static.h index f9fb34ba..0ae7c8b6 100644 --- a/include/dungeon_util_static.h +++ b/include/dungeon_util_static.h @@ -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 \ No newline at end of file diff --git a/src/dg.c b/src/dg.c index f99a7305..dc4a8adb 100644 --- a/src/dg.c +++ b/src/dg.c @@ -1,4 +1,5 @@ #include "dg.h" +#include "dungeon_util_static.h" // file starts at 0x022dea5c @@ -7,5 +8,5 @@ bool8 EntityIsValid__022E0354(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/dg_camera.c b/src/dg_camera.c index b3f9e5eb..d6c6ab3e 100644 --- a/src/dg_camera.c +++ b/src/dg_camera.c @@ -2,6 +2,7 @@ #include "dungeon.h" #include "dungeon_items.h" #include "dungeon_pokemon_attributes.h" +#include "dungeon_util_static.h" // file starts at 0x022e26b68 @@ -10,7 +11,7 @@ bool8 EntityIsValid__022E32E8(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } bool8 ItemIsActive__022E330C(struct entity *entity, enum item_id item_id) diff --git a/src/dg_effect.c b/src/dg_effect.c index d28b3140..f544bf4b 100644 --- a/src/dg_effect.c +++ b/src/dg_effect.c @@ -1,4 +1,5 @@ #include "dg_effect.h" +#include "dungeon_util_static.h" // file starts at 0x022e35e4 @@ -7,5 +8,5 @@ bool8 EntityIsValid__022E37B8(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/dg_object.c b/src/dg_object.c index 8b679d3c..a009bce3 100644 --- a/src/dg_object.c +++ b/src/dg_object.c @@ -1,4 +1,5 @@ #include "dg_object.h" +#include "dungeon_util_static.h" // file starts at 0x022e1608 @@ -10,7 +11,7 @@ bool8 EntityIsValid__022E1A1C(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } void UpdateEntityPixelPos(struct entity *entity, struct pixel_position *pixel_pos) diff --git a/src/dg_uty.c b/src/dg_uty.c index 3648277f..2ffff0c7 100644 --- a/src/dg_uty.c +++ b/src/dg_uty.c @@ -1,4 +1,5 @@ #include "dg_uty.h" +#include "dungeon_util_static.h" // file starts at 0x022e9020 @@ -7,5 +8,5 @@ bool8 EntityIsValid__022E95F4(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/dungeon_ai.c b/src/dungeon_ai.c index fcb5e950..1deeeeac 100644 --- a/src/dungeon_ai.c +++ b/src/dungeon_ai.c @@ -70,7 +70,7 @@ void RunMonsterAi(struct entity *monster, u32 unused) if (target == NULL) entity_is_valid = FALSE; else - entity_is_valid = target->type != ENTITY_NOTHING; + entity_is_valid = GetEntityType(target) != ENTITY_NOTHING; if (entity_is_valid && GetEntInfo(target)->curse_class_status.curse == STATUS_CURSE_DECOY && diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index 765b7e48..88e06c3a 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -76,7 +76,7 @@ u32 AiConsiderMove(struct ai_possible_move *ai_possible_move, struct entity *mon { struct entity *adjacent_monster = GetTile(monster->pos.x + DIRECTIONS_XY[i].x, monster->pos.y + DIRECTIONS_XY[i].y)->monster; if (adjacent_monster != NULL && - adjacent_monster->type == ENTITY_MONSTER && + GetEntityType(adjacent_monster) == ENTITY_MONSTER && (move_range == RANGE_FRONT_AND_SIDES || move_range == RANGE_NEARBY || CanAttackInDirection(monster, i))) @@ -102,7 +102,7 @@ u32 AiConsiderMove(struct ai_possible_move *ai_possible_move, struct entity *mon const struct tile *target_tile = GetTile(monster->pos.x + DIRECTIONS_XY[i].x, monster->pos.y + DIRECTIONS_XY[i].y); if (CanAttackInDirection(monster, i)) { - if (target_tile->monster != NULL && target_tile->monster->type == ENTITY_MONSTER) + if (target_tile->monster != NULL && GetEntityType(target_tile->monster) == ENTITY_MONSTER) { s32 prev_num_potential_targets = num_potential_targets; num_potential_targets = TryAddTargetToAiTargetList(num_potential_targets, move_target_and_range, monster, target_tile->monster, move, has_status_checker); @@ -111,7 +111,7 @@ u32 AiConsiderMove(struct ai_possible_move *ai_possible_move, struct entity *mon } target_tile = GetTile(monster->pos.x + DIRECTIONS_XY[i].x * 2, monster->pos.y + DIRECTIONS_XY[i].y * 2); - if (target_tile->monster != NULL && target_tile->monster->type == ENTITY_MONSTER) + if (target_tile->monster != NULL && GetEntityType(target_tile->monster) == ENTITY_MONSTER) num_potential_targets = TryAddTargetToAiTargetList(num_potential_targets, move_target_and_range, monster, target_tile->monster, move, has_status_checker); } } @@ -253,7 +253,7 @@ bool8 EntityIsValid__02319F8C(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } s32 TryAddTargetToAiTargetList(s32 current_num_targets, s32 move_ai_range, struct entity *user, struct entity *target, struct move *move, bool8 check_all_conditions) diff --git a/src/dungeon_ai_attack_1.c b/src/dungeon_ai_attack_1.c index 7b7a57c1..3c6eb66d 100644 --- a/src/dungeon_ai_attack_1.c +++ b/src/dungeon_ai_attack_1.c @@ -4,6 +4,7 @@ #include "dungeon_pokemon_attributes.h" #include "dungeon_pokemon_attributes_1.h" #include "dungeon_util.h" +#include "dungeon_util_static.h" #include "main_0208655C.h" #include "util.h" @@ -35,7 +36,7 @@ bool8 IsTargetInRange(struct entity *user, struct entity *target, s32 direction, break; const struct tile *map_tile = GetTile(current_pos_x, current_pos_y); - if (!(map_tile->terrain_flags & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY))) + if (GetTerrainType(map_tile) == TERRAIN_TYPE_WALL) return FALSE; if (map_tile->monster == target) diff --git a/src/dungeon_ai_item_weight.c b/src/dungeon_ai_item_weight.c index a1cd6cf2..8624060f 100644 --- a/src/dungeon_ai_item_weight.c +++ b/src/dungeon_ai_item_weight.c @@ -378,7 +378,7 @@ bool8 IsAdjacentToEnemy(struct entity *entity) struct tile *map_tile = GetTile(entity->pos.x + DIRECTIONS_XY[direction].x, entity->pos.y + DIRECTIONS_XY[direction].y); if (map_tile->monster != NULL) { - s32 no_pokemon = map_tile->monster->type == ENTITY_NOTHING; + s32 no_pokemon = GetEntityType(map_tile->monster) == ENTITY_NOTHING; if (no_pokemon != TRUE && GetTreatmentBetweenMonsters(entity, map_tile->monster, FALSE, TRUE) == TREATMENT_TREAT_AS_ENEMY) return TRUE; } diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index b01f0921..8f976330 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -30,7 +30,7 @@ bool8 EntityIsValid__0230E8F0(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } void AiDecideUseItem(struct entity *entity) @@ -119,7 +119,7 @@ void AiDecideUseItem(struct entity *entity) { // This seems unused. toolbox_index can never be 0. const struct tile *map_tile = GetTile(entity->pos.x, entity->pos.y); - if (map_tile->object != NULL && map_tile->object->type == ENTITY_ITEM) + if (map_tile->object != NULL && GetEntityType(map_tile->object) == ENTITY_ITEM) { item = GetItemInfo(map_tile->object); selected_toolbox_index = GROUND_ITEM_TOOLBOX_INDEX; diff --git a/src/dungeon_ai_items_1.c b/src/dungeon_ai_items_1.c index 0f0050b2..5fb890e6 100644 --- a/src/dungeon_ai_items_1.c +++ b/src/dungeon_ai_items_1.c @@ -106,7 +106,7 @@ bool8 EntityIsValid__0230F008(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } void GetPossibleAiArcItemTargets(struct entity *user, struct item *item, struct position positions[], bool8 always_add_position) diff --git a/src/dungeon_capabilities_4.c b/src/dungeon_capabilities_4.c index 5c19525a..94155dd5 100644 --- a/src/dungeon_capabilities_4.c +++ b/src/dungeon_capabilities_4.c @@ -35,7 +35,7 @@ bool8 CanMonsterMoveOrSwapWithAllyInDirection(struct entity *monster, s32 direct return FALSE; if (current_map_tile->monster != NULL && - current_map_tile->monster->type == ENTITY_MONSTER && + GetEntityType(current_map_tile->monster) == ENTITY_MONSTER && GetTreatmentBetweenMonsters(monster, current_map_tile->monster, TRUE, FALSE) == TREATMENT_TREAT_AS_ENEMY) return FALSE; @@ -81,7 +81,7 @@ bool8 CanAttackInDirection(struct entity *monster, s32 direction) if (current_map_tile->terrain_flags & TERRAIN_TYPE_IMPASSABLE_WALL) return FALSE; - if (current_map_tile->monster != NULL && current_map_tile->monster->type != ENTITY_MONSTER) + if (current_map_tile->monster != NULL && GetEntityType(current_map_tile->monster) != ENTITY_MONSTER) return FALSE; #ifdef JAPAN diff --git a/src/dungeon_logic_4.c b/src/dungeon_logic_4.c index 11347a73..7a0846af 100644 --- a/src/dungeon_logic_4.c +++ b/src/dungeon_logic_4.c @@ -7,7 +7,7 @@ bool8 HasLowHealth(struct entity *entity) if (!EntityIsValid__022F7364(entity)) return FALSE; - if (entity->type != ENTITY_MONSTER) + if (GetEntityType(entity) != ENTITY_MONSTER) return FALSE; struct monster *pokemon_info = GetEntInfo(entity); diff --git a/src/dungeon_map_access_1.c b/src/dungeon_map_access_1.c index 0ec4ba8b..85d52e0f 100644 --- a/src/dungeon_map_access_1.c +++ b/src/dungeon_map_access_1.c @@ -1,5 +1,6 @@ #include "dungeon_map_access_1.h" #include "dungeon.h" +#include "dungeon_util_static.h" #include "secondary_terrain_types.h" #include "tileset.h" @@ -10,12 +11,10 @@ bool8 IsTileGround(struct tile *tile) bool8 is_ground = FALSE; if (IsWaterTileset()) { - if (!(tile->terrain_flags & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY))) - { + if (GetTerrainType(tile) == TERRAIN_TYPE_WALL) is_ground = TRUE; - } } - else if ((tile->terrain_flags & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) != TERRAIN_TYPE_SECONDARY || + else if (GetTerrainType(tile) != TERRAIN_TYPE_SECONDARY || SECONDARY_TERRAIN_TYPES[DUNGEON_PTR[0]->gen_info.tileset_id] == SECONDARY_TERRAIN_LAVA) { is_ground = TRUE; diff --git a/src/dungeon_visibility.c b/src/dungeon_visibility.c index bd453fcf..967a7af1 100644 --- a/src/dungeon_visibility.c +++ b/src/dungeon_visibility.c @@ -16,9 +16,9 @@ bool8 CanSeeTarget(struct entity *user, struct entity *target) if (!target->is_visible) return FALSE; - if (target->type == ENTITY_MONSTER) + if (GetEntityType(target) == ENTITY_MONSTER) { - if (user->type == ENTITY_MONSTER) + if (GetEntityType(user) == ENTITY_MONSTER) { if (!CanSeeInvisibleMonsters(user) && GetEntInfo(target)->invisible_class_status.status == STATUS_INVISIBLE_INVISIBLE) return FALSE; diff --git a/src/move_checks.c b/src/move_checks.c index d8f2da90..679970e6 100644 --- a/src/move_checks.c +++ b/src/move_checks.c @@ -205,7 +205,7 @@ bool8 StatusCheckerCheck(struct entity *attacker, struct move *move) case MOVE_DIG: { struct tile *tile = GetTileAtEntity(attacker); - if (!IsTileGround(tile) || (tile->terrain_flags & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) != TERRAIN_TYPE_NORMAL) + if (!IsTileGround(tile) || GetTerrainType(tile) != TERRAIN_TYPE_NORMAL) return FALSE; break; } @@ -214,7 +214,7 @@ bool8 StatusCheckerCheck(struct entity *attacker, struct move *move) struct entity *object = GetTileAtEntity(attacker)->object; if (object == NULL) return FALSE; - if (object->type != ENTITY_TRAP) + if (GetEntityType(object) != ENTITY_TRAP) return FALSE; break; } @@ -468,5 +468,5 @@ bool8 EntityIsValid__02333FAC(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022EC608.c b/src/overlay_29_022EC608.c index 977b7e8f..e47b0fac 100644 --- a/src/overlay_29_022EC608.c +++ b/src/overlay_29_022EC608.c @@ -1,9 +1,10 @@ #include "overlay_29_022EC608.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__022EC608(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022ECDC0.c b/src/overlay_29_022ECDC0.c index f5e0ce3c..e71987df 100644 --- a/src/overlay_29_022ECDC0.c +++ b/src/overlay_29_022ECDC0.c @@ -1,9 +1,10 @@ #include "overlay_29_022ECDC0.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__022ECDC0(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022EE348.c b/src/overlay_29_022EE348.c index bc081cd4..526da01b 100644 --- a/src/overlay_29_022EE348.c +++ b/src/overlay_29_022EE348.c @@ -1,6 +1,7 @@ #include "overlay_29_022EE348.h" #include "dungeon_items.h" #include "dungeon_pokemon_attributes.h" +#include "dungeon_util_static.h" bool8 ItemIsActive__022EE318(struct entity *entity, enum item_id item_id) { @@ -15,5 +16,5 @@ bool8 EntityIsValid__022EE348(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022EF7A0.c b/src/overlay_29_022EF7A0.c index c5430a84..66f3cfa2 100644 --- a/src/overlay_29_022EF7A0.c +++ b/src/overlay_29_022EF7A0.c @@ -1,9 +1,10 @@ #include "overlay_29_022EF7A0.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__022EF7A0(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022F0590.c b/src/overlay_29_022F0590.c index 49ab607d..45e5a54d 100644 --- a/src/overlay_29_022F0590.c +++ b/src/overlay_29_022F0590.c @@ -1,9 +1,10 @@ #include "overlay_29_022F0590.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__022F0590(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022F528C.c b/src/overlay_29_022F528C.c index 43937d2f..8e99c72b 100644 --- a/src/overlay_29_022F528C.c +++ b/src/overlay_29_022F528C.c @@ -1,9 +1,10 @@ #include "overlay_29_022F528C.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__022F528C(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022F62A8.c b/src/overlay_29_022F62A8.c index c2429e95..2cff8989 100644 --- a/src/overlay_29_022F62A8.c +++ b/src/overlay_29_022F62A8.c @@ -1,9 +1,10 @@ #include "overlay_29_022F62A8.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__022F62A8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022F7364.c b/src/overlay_29_022F7364.c index e5f481b3..40c44ec3 100644 --- a/src/overlay_29_022F7364.c +++ b/src/overlay_29_022F7364.c @@ -1,5 +1,6 @@ #include "overlay_29_022F7364.h" #include "dungeon.h" +#include "dungeon_util_static.h" #include "util.h" #include "main_02051760.h" @@ -8,12 +9,12 @@ bool8 EntityIsValid__022F7364(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } extern struct dungeon *DUNGEON_PTR[]; s16 DungeonGetSpriteIndex(s16 monster_id) { - return DUNGEON_PTR[0]->sprite_indexes[monster_id]; + return DUNGEON_PTR[0]->sprite_indexes[monster_id]; } bool32 JoinedAtRangeCheck2Veneer(u8 joined_at) { diff --git a/src/overlay_29_022F9720.c b/src/overlay_29_022F9720.c index 804f2a9d..3160106e 100644 --- a/src/overlay_29_022F9720.c +++ b/src/overlay_29_022F9720.c @@ -1,9 +1,10 @@ #include "overlay_29_022F9720.h" +#include "dungeon_util_static.h" bool8 IsMonster__022F9720(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } diff --git a/src/overlay_29_022FC99C.c b/src/overlay_29_022FC99C.c index ad09e4ce..05bdf376 100644 --- a/src/overlay_29_022FC99C.c +++ b/src/overlay_29_022FC99C.c @@ -1,9 +1,10 @@ #include "overlay_29_022FC99C.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__022FC99C(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_022FED98.c b/src/overlay_29_022FED98.c index 37d76196..0a77f566 100644 --- a/src/overlay_29_022FED98.c +++ b/src/overlay_29_022FED98.c @@ -1,4 +1,5 @@ #include "overlay_29_022FED98.h" +#include "dungeon_util_static.h" #ifndef EUROPE bool8 EntityIsValid__022FED98(struct entity *entity) @@ -6,6 +7,6 @@ bool8 EntityIsValid__022FED98(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } #endif diff --git a/src/overlay_29_022FEEB8_eu.c b/src/overlay_29_022FEEB8_eu.c index df65ab30..a7cfaf11 100644 --- a/src/overlay_29_022FEEB8_eu.c +++ b/src/overlay_29_022FEEB8_eu.c @@ -1,4 +1,5 @@ #include "overlay_29_022FED98.h" +#include "dungeon_util_static.h" #ifdef EUROPE bool8 EntityIsValid__022FED98(struct entity *entity) @@ -6,6 +7,6 @@ bool8 EntityIsValid__022FED98(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } #endif diff --git a/src/overlay_29_023000E4.c b/src/overlay_29_023000E4.c index 129b4ec2..b163d6ec 100644 --- a/src/overlay_29_023000E4.c +++ b/src/overlay_29_023000E4.c @@ -1,11 +1,12 @@ #include "overlay_29_023000E4.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__023000E4(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } #ifndef JAPAN diff --git a/src/overlay_29_02301A60.c b/src/overlay_29_02301A60.c index f55b5ee9..cbfeea33 100644 --- a/src/overlay_29_02301A60.c +++ b/src/overlay_29_02301A60.c @@ -1,9 +1,10 @@ #include "overlay_29_02301A60.h" +#include "dungeon_util_static.h" bool8 IsMonster__02301A60(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } diff --git a/src/overlay_29_02302A38.c b/src/overlay_29_02302A38.c index 3b7a3c9c..925f4756 100644 --- a/src/overlay_29_02302A38.c +++ b/src/overlay_29_02302A38.c @@ -1,9 +1,10 @@ #include "overlay_29_02302A38.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02302A38(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_023047B8.c b/src/overlay_29_023047B8.c index 5fe4f853..ea79e79e 100644 --- a/src/overlay_29_023047B8.c +++ b/src/overlay_29_023047B8.c @@ -1,9 +1,10 @@ #include "overlay_29_023047B8.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__023047B8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0230558C.c b/src/overlay_29_0230558C.c index fdc4c655..b7e8d553 100644 --- a/src/overlay_29_0230558C.c +++ b/src/overlay_29_0230558C.c @@ -1,9 +1,10 @@ #include "overlay_29_0230558C.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0230558C(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02305C04.c b/src/overlay_29_02305C04.c index c3422262..5318d7e9 100644 --- a/src/overlay_29_02305C04.c +++ b/src/overlay_29_02305C04.c @@ -1,9 +1,10 @@ #include "overlay_29_02305C04.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02305C04(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02307EF8.c b/src/overlay_29_02307EF8.c index 4dd6d019..e8c482e9 100644 --- a/src/overlay_29_02307EF8.c +++ b/src/overlay_29_02307EF8.c @@ -1,13 +1,14 @@ #include "overlay_29_02307EF8.h" #include "dungeon_items.h" #include "dungeon_pokemon_attributes.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02307EF8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } bool8 ItemIsActive__02307F1C(struct entity *entity, enum item_id item_id) diff --git a/src/overlay_29_0230827C.c b/src/overlay_29_0230827C.c index d62e0c93..36eb19bd 100644 --- a/src/overlay_29_0230827C.c +++ b/src/overlay_29_0230827C.c @@ -1,9 +1,10 @@ #include "overlay_29_0230827C.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0230827C(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02308FBC.c b/src/overlay_29_02308FBC.c index 73e2cada..2c06a82c 100644 --- a/src/overlay_29_02308FBC.c +++ b/src/overlay_29_02308FBC.c @@ -1,9 +1,10 @@ #include "overlay_29_02308FBC.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02308FBC(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0230A994.c b/src/overlay_29_0230A994.c index 6bbebd12..3009fd2d 100644 --- a/src/overlay_29_0230A994.c +++ b/src/overlay_29_0230A994.c @@ -7,7 +7,7 @@ bool8 IsMonster__0230A994(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } bool8 ExclusiveItemEffectIsActive__0230A9B8(struct entity *entity, enum exclusive_item_effect_id effect_id) diff --git a/src/overlay_29_0230F980.c b/src/overlay_29_0230F980.c index ddece016..c1b3358a 100644 --- a/src/overlay_29_0230F980.c +++ b/src/overlay_29_0230F980.c @@ -1,9 +1,10 @@ #include "overlay_29_0230F980.h" +#include "dungeon_util_static.h" bool8 IsMonster__0230F980(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } diff --git a/src/overlay_29_02311010.c b/src/overlay_29_02311010.c index 5b870830..b7766ebd 100644 --- a/src/overlay_29_02311010.c +++ b/src/overlay_29_02311010.c @@ -9,7 +9,7 @@ bool8 EntityIsValid__02311010(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } bool8 ItemIsActive__02311034(struct entity *entity, enum item_id item_id) diff --git a/src/overlay_29_023118B4.c b/src/overlay_29_023118B4.c index f80abcaa..444cd560 100644 --- a/src/overlay_29_023118B4.c +++ b/src/overlay_29_023118B4.c @@ -1,9 +1,10 @@ #include "overlay_29_023118B4.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__023118B4(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02315118.c b/src/overlay_29_02315118.c index 385e447b..fb64ac0b 100644 --- a/src/overlay_29_02315118.c +++ b/src/overlay_29_02315118.c @@ -1,13 +1,14 @@ #include "overlay_29_02315118.h" #include "dungeon_items.h" #include "dungeon_pokemon_attributes.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02315118(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } bool8 ItemIsActive__0231513C(struct entity *entity, enum item_id item_id) diff --git a/src/overlay_29_02318AB0.c b/src/overlay_29_02318AB0.c index ce574d8e..2f71118a 100644 --- a/src/overlay_29_02318AB0.c +++ b/src/overlay_29_02318AB0.c @@ -1,9 +1,10 @@ #include "overlay_29_02318AB0.h" +#include "dungeon_util_static.h" bool8 IsMonster__02318AB0(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } diff --git a/src/overlay_29_02318D34.c b/src/overlay_29_02318D34.c index 223a47c3..376a36ae 100644 --- a/src/overlay_29_02318D34.c +++ b/src/overlay_29_02318D34.c @@ -1,9 +1,10 @@ #include "overlay_29_02318D34.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02318D34(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02318E4C.c b/src/overlay_29_02318E4C.c index c343295d..bc68ed89 100644 --- a/src/overlay_29_02318E4C.c +++ b/src/overlay_29_02318E4C.c @@ -1,9 +1,10 @@ #include "overlay_29_02318E4C.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02318E4C(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0231A9D4.c b/src/overlay_29_0231A9D4.c index 57a315b5..5011a5f3 100644 --- a/src/overlay_29_0231A9D4.c +++ b/src/overlay_29_0231A9D4.c @@ -1,9 +1,10 @@ #include "overlay_29_0231A9D4.h" +#include "dungeon_util_static.h" bool8 IsMonster__0231A9D4(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } diff --git a/src/overlay_29_0231B194.c b/src/overlay_29_0231B194.c index 4e8c3f95..c190b0bf 100644 --- a/src/overlay_29_0231B194.c +++ b/src/overlay_29_0231B194.c @@ -1,9 +1,10 @@ #include "overlay_29_0231B194.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0231B194(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0231B318.c b/src/overlay_29_0231B318.c index 8ccdddb4..546dea74 100644 --- a/src/overlay_29_0231B318.c +++ b/src/overlay_29_0231B318.c @@ -1,9 +1,10 @@ #include "overlay_29_0231B318.h" +#include "dungeon_util_static.h" bool8 IsMonster__0231B318(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } diff --git a/src/overlay_29_0231CBC8.c b/src/overlay_29_0231CBC8.c index fd368b0e..a3ffb4f6 100644 --- a/src/overlay_29_0231CBC8.c +++ b/src/overlay_29_0231CBC8.c @@ -1,9 +1,10 @@ #include "overlay_29_0231CBC8.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0231CBC8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0231EDD8.c b/src/overlay_29_0231EDD8.c index 06cfc1e2..a73ed0b8 100644 --- a/src/overlay_29_0231EDD8.c +++ b/src/overlay_29_0231EDD8.c @@ -1,9 +1,10 @@ #include "overlay_29_0231EDD8.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0231EDD8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0231F570.c b/src/overlay_29_0231F570.c index 6fb97d67..8a9d4c71 100644 --- a/src/overlay_29_0231F570.c +++ b/src/overlay_29_0231F570.c @@ -1,9 +1,10 @@ #include "overlay_29_0231F570.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0231F570(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0231FBFC.c b/src/overlay_29_0231FBFC.c index 7dfc2c76..07c069b3 100644 --- a/src/overlay_29_0231FBFC.c +++ b/src/overlay_29_0231FBFC.c @@ -1,9 +1,10 @@ #include "overlay_29_0231FBFC.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0231FBFC(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0232017C.c b/src/overlay_29_0232017C.c index 93fcdb77..ab6c10d0 100644 --- a/src/overlay_29_0232017C.c +++ b/src/overlay_29_0232017C.c @@ -1,9 +1,10 @@ #include "overlay_29_0232017C.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0232017C(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02320764.c b/src/overlay_29_02320764.c index b385826e..b7e16cff 100644 --- a/src/overlay_29_02320764.c +++ b/src/overlay_29_02320764.c @@ -1,9 +1,10 @@ #include "overlay_29_02320764.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02320764(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02321438.c b/src/overlay_29_02321438.c index f987930e..8492ea71 100644 --- a/src/overlay_29_02321438.c +++ b/src/overlay_29_02321438.c @@ -1,9 +1,10 @@ #include "overlay_29_02321438.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02321438(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02322DB8.c b/src/overlay_29_02322DB8.c index 6ee0da53..3c668291 100644 --- a/src/overlay_29_02322DB8.c +++ b/src/overlay_29_02322DB8.c @@ -1,9 +1,10 @@ #include "overlay_29_02322DB8.h" +#include "dungeon_util_static.h" bool8 IsMonster__02322DB8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } diff --git a/src/overlay_29_02325620.c b/src/overlay_29_02325620.c index c1b857ae..5e347403 100644 --- a/src/overlay_29_02325620.c +++ b/src/overlay_29_02325620.c @@ -1,9 +1,10 @@ #include "overlay_29_02325620.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02325620(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0232800C.c b/src/overlay_29_0232800C.c index 76ff6fd5..de916ec9 100644 --- a/src/overlay_29_0232800C.c +++ b/src/overlay_29_0232800C.c @@ -1,9 +1,10 @@ #include "overlay_29_0232800C.h" +#include "dungeon_util_static.h" bool8 EntityIsValidMoveEffects__0232800C(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0232A3D8.c b/src/overlay_29_0232A3D8.c index f0e6e020..904b4ec5 100644 --- a/src/overlay_29_0232A3D8.c +++ b/src/overlay_29_0232A3D8.c @@ -1,9 +1,10 @@ #include "overlay_29_0232A3D8.h" +#include "dungeon_util_static.h" bool8 EntityIsValidMoveEffects__0232A3D8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0232C500.c b/src/overlay_29_0232C500.c index c0ba2cf5..02de3cab 100644 --- a/src/overlay_29_0232C500.c +++ b/src/overlay_29_0232C500.c @@ -1,9 +1,10 @@ #include "overlay_29_0232C500.h" +#include "dungeon_util_static.h" bool8 EntityIsValidMoveEffects__0232C500(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0232E250.c b/src/overlay_29_0232E250.c index dd158e05..b6689aab 100644 --- a/src/overlay_29_0232E250.c +++ b/src/overlay_29_0232E250.c @@ -1,4 +1,5 @@ #include "overlay_29_0232E250.h" +#include "dungeon_util_static.h" extern s32 ATK_STAT_IDX; extern s32 SPATK_STAT_IDX; @@ -10,7 +11,7 @@ bool8 EntityIsValidMoveEffects__0232E250(struct entity *entity) if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } bool8 DoMoveDefendOrder(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id) diff --git a/src/overlay_29_0232E840.c b/src/overlay_29_0232E840.c index 9eef0ea9..a4842006 100644 --- a/src/overlay_29_0232E840.c +++ b/src/overlay_29_0232E840.c @@ -1,9 +1,10 @@ #include "overlay_29_0232E840.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0232E840(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_023350D8.c b/src/overlay_29_023350D8.c index 0f4e3229..cdd6e191 100644 --- a/src/overlay_29_023350D8.c +++ b/src/overlay_29_023350D8.c @@ -1,9 +1,10 @@ #include "overlay_29_023350D8.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__023350D8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02337CA8.c b/src/overlay_29_02337CA8.c index fa58baab..459a2cb1 100644 --- a/src/overlay_29_02337CA8.c +++ b/src/overlay_29_02337CA8.c @@ -1,9 +1,10 @@ #include "overlay_29_02337CA8.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02337CA8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02344AF8.c b/src/overlay_29_02344AF8.c index bbe44b92..4858d076 100644 --- a/src/overlay_29_02344AF8.c +++ b/src/overlay_29_02344AF8.c @@ -1,9 +1,10 @@ #include "overlay_29_02344AF8.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02344AF8(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02345698.c b/src/overlay_29_02345698.c index c337eb93..6bd34a7f 100644 --- a/src/overlay_29_02345698.c +++ b/src/overlay_29_02345698.c @@ -1,9 +1,10 @@ #include "overlay_29_02345698.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02345698(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_02347BA4.c b/src/overlay_29_02347BA4.c index b3e41197..0cd5b398 100644 --- a/src/overlay_29_02347BA4.c +++ b/src/overlay_29_02347BA4.c @@ -1,9 +1,10 @@ #include "overlay_29_02347BA4.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__02347BA4(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0234987C.c b/src/overlay_29_0234987C.c index b28fcfbc..6621fd5a 100644 --- a/src/overlay_29_0234987C.c +++ b/src/overlay_29_0234987C.c @@ -1,9 +1,10 @@ #include "overlay_29_0234987C.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0234987C(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0234D460.c b/src/overlay_29_0234D460.c index e8c97c86..22d02758 100644 --- a/src/overlay_29_0234D460.c +++ b/src/overlay_29_0234D460.c @@ -1,9 +1,10 @@ #include "overlay_29_0234D460.h" +#include "dungeon_util_static.h" bool8 IsMonster__0234D460(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type == ENTITY_MONSTER; + return GetEntityType(entity) == ENTITY_MONSTER; } diff --git a/src/overlay_29_0234DDD0.c b/src/overlay_29_0234DDD0.c index 7cbaee77..bb3cc2e0 100644 --- a/src/overlay_29_0234DDD0.c +++ b/src/overlay_29_0234DDD0.c @@ -1,9 +1,10 @@ #include "overlay_29_0234DDD0.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0234DDD0(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_29_0234EC14.c b/src/overlay_29_0234EC14.c index 10acc7ea..3918b1d1 100644 --- a/src/overlay_29_0234EC14.c +++ b/src/overlay_29_0234EC14.c @@ -1,9 +1,10 @@ #include "overlay_29_0234EC14.h" +#include "dungeon_util_static.h" bool8 EntityIsValid__0234EC14(struct entity *entity) { if (entity == NULL) return FALSE; - return entity->type != ENTITY_NOTHING; + return GetEntityType(entity) != ENTITY_NOTHING; } diff --git a/src/overlay_31_02382820.c b/src/overlay_31_02382820.c index 76471e74..f5d6209b 100644 --- a/src/overlay_31_02382820.c +++ b/src/overlay_31_02382820.c @@ -1,5 +1,6 @@ #include "overlay_31_02382820.h" #include "dungeon_ai_targeting.h" +#include "dungeon_util_static.h" #include "number_util.h" extern const u8 DUNGEON_MENU_SWITCH_STR1[];// = "[dungeon:0]"; @@ -114,7 +115,7 @@ void DrawDungeonMenuStatusWindow(struct Window* window) if (party_member == NULL) { is_valid_member = FALSE; } else { - is_valid_member = (party_member->type != ENTITY_NOTHING); + is_valid_member = GetEntityType(party_member) != ENTITY_NOTHING; } if (is_valid_member) { struct monster* member_info = party_member->info; diff --git a/src/trap.c b/src/trap.c index 087e2f7e..8abc4d52 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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