From 137d9801c01d0c631ffd72f90f76e984a177844e Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 17 Oct 2020 01:25:54 -0300 Subject: [PATCH] Key Items configuration in file. --- include/constants/item_config.h | 20 ++++++++++++++++++++ include/item.h | 1 + src/data/items.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 include/constants/item_config.h diff --git a/include/constants/item_config.h b/include/constants/item_config.h new file mode 100644 index 000000000..bffe5740e --- /dev/null +++ b/include/constants/item_config.h @@ -0,0 +1,20 @@ +#ifndef GUARD_CONSTANTS_ITEM_CONFIG_H +#define GUARD_CONSTANTS_ITEM_CONFIG_H + +// Used by other branches to communicate with each other. +#define ITEM_EXPANSION + +#ifndef GEN_3 +#define GEN_3 0 +#define GEN_4 1 +#define GEN_5 2 +#define GEN_6 3 +#define GEN_7 4 +#define GEN_8 5 +#endif + +// Item config +#define P_KEY_FOSSILS GEN_7 // In Gen4+, all Gen 3 fossils became regular items. +#define P_KEY_ESCAPE_ROPE GEN_7 // In Gen8, Escape Rope became a Key Item. + +#endif // GUARD_CONSTANTS_ITEM_CONFIG_H diff --git a/include/item.h b/include/item.h index 87ff57bc7..909078943 100644 --- a/include/item.h +++ b/include/item.h @@ -2,6 +2,7 @@ #define GUARD_ITEM_H #include "constants/item.h" +#include "constants/item_config.h" typedef void (*ItemUseFunc)(u8); diff --git a/src/data/items.h b/src/data/items.h index 3f5ffac21..ee7865898 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -1283,7 +1283,13 @@ const struct Item gItems[] = .itemId = ITEM_ESCAPE_ROPE, .price = 550, .description = sEscapeRopeDesc, + #if P_KEY_ESCAPE_ROPE >= GEN_8 + .importance = 1, + .pocket = POCKET_KEY_ITEMS, + #else + .importance = 0, .pocket = POCKET_ITEMS, + #endif .type = 2, .fieldUseFunc = ItemUseOutOfBattle_EscapeRope, .secondaryId = 0, @@ -4813,8 +4819,13 @@ const struct Item gItems[] = .itemId = ITEM_OLD_AMBER, .price = 0, .description = sOldAmberDesc, + #if P_KEY_FOSSILS >= GEN_4 .importance = 1, .pocket = POCKET_KEY_ITEMS, + #else + .importance = 0, + .pocket = POCKET_ITEMS, + #endif .type = 4, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .secondaryId = 0, @@ -4878,8 +4889,13 @@ const struct Item gItems[] = .itemId = ITEM_HELIX_FOSSIL, .price = 0, .description = sHelixFossilDesc, + #if P_KEY_FOSSILS >= GEN_4 + .importance = 1, + .pocket = POCKET_KEY_ITEMS, + #else .importance = 0, .pocket = POCKET_ITEMS, + #endif .type = 4, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .secondaryId = 0, @@ -4891,8 +4907,13 @@ const struct Item gItems[] = .itemId = ITEM_DOME_FOSSIL, .price = 0, .description = sDomeFossilDesc, + #if P_KEY_FOSSILS >= GEN_4 + .importance = 1, + .pocket = POCKET_KEY_ITEMS, + #else .importance = 0, .pocket = POCKET_ITEMS, + #endif .type = 4, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .secondaryId = 0, @@ -4904,8 +4925,13 @@ const struct Item gItems[] = .itemId = ITEM_ROOT_FOSSIL, .price = 0, .description = sRootFossilDesc, + #if P_KEY_FOSSILS >= GEN_4 + .importance = 1, + .pocket = POCKET_KEY_ITEMS, + #else .importance = 0, .pocket = POCKET_ITEMS, + #endif .type = 4, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .secondaryId = 0, @@ -4917,8 +4943,13 @@ const struct Item gItems[] = .itemId = ITEM_CLAW_FOSSIL, .price = 0, .description = sClawFossilDesc, + #if P_KEY_FOSSILS >= GEN_4 + .importance = 1, + .pocket = POCKET_KEY_ITEMS, + #else .importance = 0, .pocket = POCKET_ITEMS, + #endif .type = 4, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .secondaryId = 0,