diff --git a/include/util.h b/include/util.h index 0c8843ab..abe2b62d 100644 --- a/include/util.h +++ b/include/util.h @@ -64,4 +64,6 @@ static inline s32 Max(s32 a, s32 b) b = temp; \ } +#define GET_FLAG(FLAG, BIT) ((bool8) (((FLAG) & (BIT)) ? TRUE : FALSE)) + #endif //PMDSKY_UTIL_H diff --git a/src/moves_3.c b/src/moves_3.c index 26f34467..42c4ea99 100644 --- a/src/moves_3.c +++ b/src/moves_3.c @@ -64,8 +64,6 @@ u8 *GetMoveMessageFromId(s32 move_id) return StringFromId((u16)(DUNGEON_MOVE_TABLES.moves->moves[move_id].message_string_idx + MESSAGE_ID)); } -#define GET_BIT(BYTE, N) ((u8)(BYTE & (1 << N) ? 1 : 0)) - s32 GetNbMoves(struct moves *moves) { s32 index; @@ -81,7 +79,7 @@ s32 GetNbMoves(struct moves *moves) // fake u8 flag = *(u8*)((u32)moves + (index * 6)); - if(GET_BIT(flag, 0)) + if(GET_FLAG(flag, MOVE_FLAG_EXISTS)) num_moves++; } diff --git a/src/overlay_31_02383478.c b/src/overlay_31_02383478.c index 35ceea32..f228f174 100644 --- a/src/overlay_31_02383478.c +++ b/src/overlay_31_02383478.c @@ -14,8 +14,6 @@ extern u8* strcpy(u8* dest, const u8* src); extern void sub_0200D894(struct item*); extern void ov10_022BD394(char*, s32, u32, u32); -#define GET_BIT(BYTE, N) ((u8)(BYTE & (1 << N) ? 1 : 0)) - char* ov31_02383478(char* arg1, s32 arg2, u32 arg3) { u32 a = 1; @@ -36,7 +34,7 @@ char* ov31_02383478(char* arg1, s32 arg2, u32 arg3) struct tile* tile = GetTile(x, y); struct item* item = GetItemInfo(tile->object); - if (GET_BIT(item->flags, 0)) { + if (GET_FLAG(item->flags, ITEM_FLAG_EXISTS)) { MaybeGetFormattedItemName(arg1, item, &OVERLAY31_UNKNOWN_STRUCT__NA_2389EF0, a, 1); OVERLAY31_UNKNOWN_POINTER__NA_238A26C->field_0x1277 = 0; } else { @@ -44,7 +42,7 @@ char* ov31_02383478(char* arg1, s32 arg2, u32 arg3) OVERLAY31_UNKNOWN_POINTER__NA_238A26C->field_0x1277 = 3; } } else { - if (GET_BIT(BAG_ITEMS_PTR_MIRROR->bag_items->bag_items[arg2].flags, 0) && + if (GET_FLAG(BAG_ITEMS_PTR_MIRROR->bag_items->bag_items[arg2].flags, ITEM_FLAG_EXISTS) && BAG_ITEMS_PTR_MIRROR->bag_items->bag_items[arg2].held_by) { u32 r1 = (BAG_ITEMS_PTR_MIRROR->bag_items->bag_items[arg2].held_by - 1); if (EntityIsValidOverlay31(DUNGEON_PTR[0]->monster_slots.party_members[r1]) == 0) {