From dbc3690282bc9d1bf52c1e9b8fc632343b26ea33 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 4 Jan 2021 03:58:31 -0300 Subject: [PATCH] Tweaked preprocessor directives Changed #ifdef X_ITEMS_REWORK == FALSE to #ifndef ITEM_EXPANSION Changed #ifdef X_ITEMS_REWORK == TRUE to #ifdef ITEM_EXPANSION --- include/constants/battle_config.h | 1 - include/constants/item_effects.h | 6 +++--- src/battle_ai_switch_items.c | 4 ++-- src/party_menu.c | 2 +- src/pokemon.c | 8 ++++---- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 90a50a81c..2eaf5e0d3 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -123,7 +123,6 @@ // Item settings #define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn. #define B_BERRIES_INSTANT GEN_6 // In Gen4+, most berries activate on battle start/switch-in if applicable. In gen3, they only activate either at the move end or turn end. -#define X_ITEMS_REWORK FALSE // This flag changes the way in which X Items' effects are implemented in the code and relies on the item_expansion to work. #define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. This flag relies on X_ITEMS_REWORK, and by extension, the item_expansion. // Flag settings. diff --git a/include/constants/item_effects.h b/include/constants/item_effects.h index 8d97cdd7d..7ed183347 100644 --- a/include/constants/item_effects.h +++ b/include/constants/item_effects.h @@ -2,7 +2,7 @@ #define GUARD_CONSTANTS_ITEM_EFFECTS_H // field 0 masks -#if X_ITEMS_REWORK == FALSE +#ifndef ITEM_EXPANSION #define ITEM0_X_ATTACK 0x0F #endif #define ITEM0_DIRE_HIT 0x30 // Works the same way as the move Focus Energy. @@ -10,7 +10,7 @@ #define ITEM0_INFATUATION 0x80 // field 1 masks -#if X_ITEMS_REWORK == FALSE +#ifndef ITEM_EXPANSION #define ITEM1_X_SPEED 0x0F #define ITEM1_X_DEFEND 0xF0 @@ -20,7 +20,7 @@ #endif // alt field 1 masks -#if X_ITEMS_REWORK == TRUE +#ifdef ITEM_EXPANSION #define ITEM1_X_ATTACK 0x1 #define ITEM1_X_DEFEND 0x2 #define ITEM1_X_SPEED 0x4 diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index c106d7d9c..93020f600 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -773,7 +773,7 @@ static u8 GetAI_ItemType(u16 itemId, const u8 *itemEffect) return AI_ITEM_HEAL_HP; else if (itemEffect[3] & ITEM3_STATUS_ALL) return AI_ITEM_CURE_CONDITION; -#if X_ITEMS_REWORK == TRUE +#ifdef ITEM_EXPANSION else if ((itemEffect[0] & ITEM0_DIRE_HIT) || itemEffect[1]) #else else if (itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0) @@ -887,7 +887,7 @@ static bool8 ShouldUseItem(void) *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0; if (gDisableStructs[gActiveBattler].isFirstTurn == 0) break; - #if X_ITEMS_REWORK == FALSE + #ifndef ITEM_EXPANSION if (itemEffects[0] & ITEM0_X_ATTACK) *(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1; if (itemEffects[1] & ITEM1_X_DEFEND) diff --git a/src/party_menu.c b/src/party_menu.c index 49906566d..d9cec4b1c 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -5186,7 +5186,7 @@ u8 GetItemEffectType(u16 item) else itemEffect = gItemEffectTable[item - ITEM_POTION]; -#if X_ITEMS_REWORK == FALSE +#ifndef ITEM_EXPANSION if ((itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK)) || itemEffect[1] || itemEffect[2] || (itemEffect[3] & ITEM3_GUARD_SPEC)) #else if ((itemEffect[0] & ITEM0_DIRE_HIT) || itemEffect[1] || (itemEffect[3] & ITEM3_GUARD_SPEC)) diff --git a/src/pokemon.c b/src/pokemon.c index 901b8ab7a..87160e4d3 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2051,7 +2051,7 @@ static const u8 sGetMonDataEVConstants[] = // For stat-raising items static const u8 sStatsToRaise[] = { -#if X_ITEMS_REWORK == FALSE +#ifndef ITEM_EXPANSION STAT_ATK, STAT_ATK, STAT_SPEED, STAT_DEF, STAT_SPATK, STAT_ACC #else STAT_ATK, STAT_ATK, STAT_DEF, STAT_SPEED, STAT_SPATK, STAT_SPDEF, STAT_ACC @@ -4434,7 +4434,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov gBattleMons[gActiveBattler].status2 |= STATUS2_FOCUS_ENERGY; retVal = FALSE; } - #if X_ITEMS_REWORK == FALSE + #ifndef ITEM_EXPANSION if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK) && gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE) { @@ -4446,7 +4446,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov #endif break; // in-battle stat boosting effects - #if X_ITEMS_REWORK == FALSE + #ifndef ITEM_EXPANSION case 1: if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND) && gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE) @@ -5127,7 +5127,7 @@ u8 *UseStatIncreaseItem(u16 itemId) gPotentialItemEffectBattler = gBattlerInMenuId; -#if X_ITEMS_REWORK == FALSE +#ifndef ITEM_EXPANSION for (i = 0; i < 3; i++) { if (itemEffect[i] & (ITEM0_X_ATTACK | ITEM1_X_SPEED | ITEM2_X_SPATK))