Clean up defines lacking spaces

This commit is contained in:
Bassoonian 2024-08-15 19:34:56 +02:00
parent a3d5f54b75
commit c1ee43254e
24 changed files with 59 additions and 59 deletions

View file

@ -460,26 +460,26 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER
typeArg = gBattleMoves[move].type; \
}
#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
#define IS_TYPE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
#define IS_TYPE_PHYSICAL(moveType) (moveType < TYPE_MYSTERY)
#define IS_TYPE_SPECIAL(moveType) (moveType > TYPE_MYSTERY)
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0))
#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type))
#define IS_BATTLER_OF_TYPE(battlerId, type) ((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type))
#define SET_BATTLER_TYPE(battlerId, type) \
{ \
gBattleMons[battlerId].types[0] = type; \
gBattleMons[battlerId].types[1] = type; \
}
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
#define GET_STAT_BUFF_VALUE2(n)((n & 0xF0))
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
#define GET_STAT_BUFF_ID(n) ((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
#define GET_STAT_BUFF_VALUE2(n) ((n & 0xF0))
#define GET_STAT_BUFF_VALUE(n) (((n >> 4) & 7)) // 0x10, 0x20, 0x40
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
#define SET_STAT_BUFF_VALUE(n)((((n) << 4) & 0xF0))
#define SET_STAT_BUFF_VALUE(n) ((((n) << 4) & 0xF0))
#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7))
#define SET_STATCHANGER(statId, stage, goesDown) (gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7))
// NOTE: The members of this struct have hard-coded offsets
// in include/constants/battle_script_commands.h

View file

@ -23,9 +23,9 @@ struct MultiPartnerMenuPokemon
};
// defines for the u8 array gTypeEffectiveness
#define TYPE_EFFECT_ATK_TYPE(i)((gTypeEffectiveness[i + 0]))
#define TYPE_EFFECT_DEF_TYPE(i)((gTypeEffectiveness[i + 1]))
#define TYPE_EFFECT_MULTIPLIER(i)((gTypeEffectiveness[i + 2]))
#define TYPE_EFFECT_ATK_TYPE(i) ((gTypeEffectiveness[i + 0]))
#define TYPE_EFFECT_DEF_TYPE(i) ((gTypeEffectiveness[i + 1]))
#define TYPE_EFFECT_MULTIPLIER(i) ((gTypeEffectiveness[i + 2]))
// defines for the gTypeEffectiveness multipliers
#define TYPE_MUL_NO_EFFECT 0

View file

@ -33,9 +33,9 @@
#define ABILITYEFFECT_WATER_SPORT 254
#define ABILITYEFFECT_SWITCH_IN_WEATHER 255
#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0))
#define ABILITY_ON_FIELD(abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0))
#define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0))
#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId) (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0))
#define ABILITY_ON_FIELD(abilityId) (AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0))
#define ABILITY_ON_FIELD2(abilityId) (AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0))
// For the first argument of ItemBattleEffects, to deteremine which block of item effects to try
#define ITEMEFFECT_ON_SWITCH_IN 0

View file

@ -441,8 +441,8 @@
#define NUM_ROUTE_114_MAN_BERRIES (LAST_ROUTE_114_MAN_BERRY - FIRST_ROUTE_114_MAN_BERRY + 1)
#define NUM_ROUTE_114_MAN_BERRIES_SKIPPED (FIRST_ROUTE_114_MAN_BERRY - FIRST_BERRY_INDEX)
#define ITEM_TO_BERRY(itemId)(((itemId) - FIRST_BERRY_INDEX) + 1)
#define ITEM_TO_MAIL(itemId)((itemId) - FIRST_MAIL_INDEX)
#define ITEM_TO_BERRY(itemId) (((itemId) - FIRST_BERRY_INDEX) + 1)
#define ITEM_TO_MAIL(itemId) ((itemId) - FIRST_MAIL_INDEX)
#define MAIL_NONE 0xFF
#define NUM_TECHNICAL_MACHINES 50

View file

@ -28,9 +28,9 @@ struct MonCoords
u8 y_offset;
};
#define MON_COORDS_SIZE(width, height)(DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8))
#define GET_MON_COORDS_WIDTH(size)((size >> 4) * 8)
#define GET_MON_COORDS_HEIGHT(size)((size & 0xF) * 8)
#define MON_COORDS_SIZE(width, height) (DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8))
#define GET_MON_COORDS_WIDTH(size) ((size >> 4) * 8)
#define GET_MON_COORDS_HEIGHT(size) ((size & 0xF) * 8)
struct TrainerMonNoItemDefaultMoves
{
@ -91,7 +91,7 @@ struct Trainer
/*0x24*/ union TrainerMonPtr party;
};
#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F))
#define TRAINER_ENCOUNTER_MUSIC(trainer) ((gTrainers[trainer].encounterMusic_gender & 0x7F))
extern const u16 gMinigameDigits_Pal[];
extern const u32 gMinigameDigits_Gfx[];

View file

@ -75,7 +75,7 @@
#define DISPLAY_TILE_HEIGHT (DISPLAY_HEIGHT / TILE_HEIGHT)
// Size of different tile formats in bytes
#define TILE_SIZE(bpp)((bpp) * TILE_WIDTH * TILE_HEIGHT / 8)
#define TILE_SIZE(bpp) ((bpp) * TILE_WIDTH * TILE_HEIGHT / 8)
#define TILE_SIZE_1BPP TILE_SIZE(1) // 8
#define TILE_SIZE_4BPP TILE_SIZE(4) // 32
#define TILE_SIZE_8BPP TILE_SIZE(8) // 64

View file

@ -89,7 +89,7 @@
// There are cases where GF does a&(n-1) where we would really like to have a%n, because
// if n is changed to a value that isn't a power of 2 then a&(n-1) is unlikely to work as
// intended, and a%n for powers of 2 isn't always optimized to use &.
#define MOD(a, n)(((n) & ((n)-1)) ? ((a) % (n)) : ((a) & ((n)-1)))
#define MOD(a, n) (((n) & ((n)-1)) ? ((a) % (n)) : ((a) & ((n)-1)))
// Extracts the upper 16 bits of a 32-bit number
#define HIHALF(n) (((n) & 0xFFFF0000) >> 16)
@ -130,7 +130,7 @@
f; \
})
#define DIV_ROUND_UP(val, roundBy)(((val) / (roundBy)) + (((val) % (roundBy)) ? 1 : 0))
#define DIV_ROUND_UP(val, roundBy) (((val) / (roundBy)) + (((val) % (roundBy)) ? 1 : 0))
#define ROUND_BITS_TO_BYTES(numBits) DIV_ROUND_UP(numBits, 8)

View file

@ -1,7 +1,7 @@
#ifndef GUARD_MAIL_H
#define GUARD_MAIL_H
#define IS_ITEM_MAIL(itemId)((itemId == ITEM_ORANGE_MAIL \
#define IS_ITEM_MAIL(itemId) ((itemId == ITEM_ORANGE_MAIL \
|| itemId == ITEM_HARBOR_MAIL \
|| itemId == ITEM_GLITTER_MAIL \
|| itemId == ITEM_MECH_MAIL \

View file

@ -44,7 +44,7 @@ enum {
// The number of extra sparkles shown on a Pokémon's condition screen.
// All Pokémon start with 1, so the max here is MAX_CONDITION_SPARKLES - 1
#define GET_NUM_CONDITION_SPARKLES(sheen)((sheen) != MAX_SHEEN) ? (sheen) / ((u32)MAX_SHEEN / (MAX_CONDITION_SPARKLES - 1) + 1) : MAX_CONDITION_SPARKLES - 1;
#define GET_NUM_CONDITION_SPARKLES(sheen) ((sheen) != MAX_SHEEN) ? (sheen) / ((u32)MAX_SHEEN / (MAX_CONDITION_SPARKLES - 1) + 1) : MAX_CONDITION_SPARKLES - 1;
#define CONDITION_GRAPH_TOP_Y 56
#define CONDITION_GRAPH_BOTTOM_Y 121

View file

@ -13,8 +13,8 @@ u16 Random2(void);
// The number 1103515245 comes from the example implementation of rand and srand
// in the ISO C standard.
#define ISO_RANDOMIZE1(val)(1103515245 * (val) + 24691)
#define ISO_RANDOMIZE2(val)(1103515245 * (val) + 12345)
#define ISO_RANDOMIZE1(val) (1103515245 * (val) + 24691)
#define ISO_RANDOMIZE2(val) (1103515245 * (val) + 12345)
//Sets the initial seed value of the pseudorandom number generator
void SeedRng(u16 seed);

View file

@ -859,7 +859,7 @@ static u8 GetTrainerBattleTransition(void)
return sBattleTransitionTable_Trainer[transitionType][1];
}
#define RANDOM_TRANSITION(table)(table[Random() % ARRAY_COUNT(table)])
#define RANDOM_TRANSITION(table) (table[Random() % ARRAY_COUNT(table)])
u8 GetSpecialBattleTransition(s32 id)
{
u16 var;

View file

@ -171,7 +171,7 @@ static const u8 sDecorTilemap_3x2_X[] = {
0x06, 0x07, 0x06, 0x07, 0x06, 0x07
};
#define DECORSIZE(width, height)((width) * (height) * 4)
#define DECORSIZE(width, height) ((width) * (height) * 4)
static const struct {
const u8 *tiles;

View file

@ -1,10 +1,10 @@
#define SQUARE(n)((n) * (n))
#define CUBE(n)((n) * (n) * (n))
#define SQUARE(n) ((n) * (n))
#define CUBE(n) ((n) * (n) * (n))
#define EXP_SLOW(n)((5 * CUBE(n)) / 4) // (5 * (n)^3) / 4
#define EXP_FAST(n)((4 * CUBE(n)) / 5) // (4 * (n)^3) / 5
#define EXP_MEDIUM_FAST(n)(CUBE(n)) // (n)^3
#define EXP_MEDIUM_SLOW(n)((6 * CUBE(n)) / 5 - (15 * SQUARE(n)) + (100 * n) - 140) // (6 * (n)^3) / 5 - (15 * (n)^2) + (100 * n) - 140
#define EXP_SLOW(n) ((5 * CUBE(n)) / 4) // (5 * (n)^3) / 4
#define EXP_FAST(n) ((4 * CUBE(n)) / 5) // (4 * (n)^3) / 5
#define EXP_MEDIUM_FAST(n) (CUBE(n)) // (n)^3
#define EXP_MEDIUM_SLOW(n) ((6 * CUBE(n)) / 5 - (15 * SQUARE(n)) + (100 * n) - 140) // (6 * (n)^3) / 5 - (15 * (n)^2) + (100 * n) - 140
#define EXP_ERRATIC(n) \
(n <= 50) ? ((100 - n) * CUBE(n) / 50) \
:(n <= 68) ? ((150 - n) * CUBE(n) / 100) \

View file

@ -633,10 +633,10 @@ static const struct WindowTemplate sWindowTemplate_BButtonCancel = {
// Minimum and maximum number of players for a link group
// A minimum of 0 means the min and max are equal
#define LINK_GROUP_CAPACITY(min, max)(((min) << 12) | ((max) << 8))
#define GROUP_MAX(capacity)(capacity & 0x0F)
#define GROUP_MIN(capacity)(capacity >> 4)
#define GROUP_MIN2(capacity)(capacity & 0xF0) // Unnecessary to have both, but needed to match
#define LINK_GROUP_CAPACITY(min, max) (((min) << 12) | ((max) << 8))
#define GROUP_MAX(capacity) (capacity & 0x0F)
#define GROUP_MIN(capacity) (capacity >> 4)
#define GROUP_MIN2(capacity) (capacity & 0xF0) // Unnecessary to have both, but needed to match
static const u32 sLinkGroupToActivityAndCapacity[NUM_LINK_GROUP_TYPES] = {
[LINK_GROUP_SINGLE_BATTLE] = ACTIVITY_BATTLE_SINGLE | LINK_GROUP_CAPACITY(0, 2),

View file

@ -3957,14 +3957,14 @@ bool8 InPokemonCenter(void)
#define FANCLUB_BITFIELD (gSaveBlock1Ptr->vars[VAR_FANCLUB_FAN_COUNTER - VARS_START])
#define FANCLUB_COUNTER 0x007F
#define GET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD >> (flag) & 1)
#define SET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD |= 1 << (flag))
#define FLIP_TRAINER_FAN_CLUB_FLAG(flag)(FANCLUB_BITFIELD ^= 1 << (flag))
#define GET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD >> (flag) & 1)
#define SET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD |= 1 << (flag))
#define FLIP_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD ^= 1 << (flag))
#define GET_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD & FANCLUB_COUNTER)
#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & ~FANCLUB_COUNTER) | (count))
#define INCR_TRAINER_FAN_CLUB_COUNTER(count)(FANCLUB_BITFIELD += (count))
#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~FANCLUB_COUNTER)
#define GET_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD & FANCLUB_COUNTER)
#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & ~FANCLUB_COUNTER) | (count))
#define INCR_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD += (count))
#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~FANCLUB_COUNTER)
void ResetFanClub(void)
{

View file

@ -48,7 +48,7 @@ static const struct MapConnection *GetIncomingConnection(u8 direction, int x, in
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, const struct MapConnection *connection);
static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax, int offset);
#define GetBorderBlockAt(x, y)({ \
#define GetBorderBlockAt(x, y) ({ \
u16 block; \
int i; \
const u16 *border = gMapHeader.mapLayout->border; /* Unused, they read it again below */ \

View file

@ -1241,7 +1241,7 @@ static void ShowHideZoomingArea(bool8 show, bool8 zoomedIn)
static void UpdateAreaHighlight(u8 cursorArea, u8 previousCursorArea)
{
#define NON_HIGHLIGHT_AREA(area)((area) == CURSOR_AREA_NOTHING || (area) > CURSOR_AREA_CANCEL)
#define NON_HIGHLIGHT_AREA(area) ((area) == CURSOR_AREA_NOTHING || (area) > CURSOR_AREA_CANCEL)
// If moving off highlightable area, unhighlight it
switch (previousCursorArea)

View file

@ -138,7 +138,7 @@ static const u8 sAvailSlots[] = {
[4] = AVAIL_SLOT4
};
#define BLOCK_MASK(bitNum)((1 << (bitNum)) - 1)
#define BLOCK_MASK(bitNum) ((1 << (bitNum)) - 1)
static const u32 sAllBlocksReceived[] = {
BLOCK_MASK(0),
BLOCK_MASK(1),

View file

@ -317,7 +317,7 @@ void MailboxMenu_Free(void)
// filled with the graph color.
//---------------------------------------
#define SHIFT_RIGHT_ADJUSTED(n, s)(((n) >> (s)) + (((n) >> ((s) - 1)) & 1))
#define SHIFT_RIGHT_ADJUSTED(n, s) (((n) >> (s)) + (((n) >> ((s) - 1)) & 1))
void ConditionGraph_Init(struct ConditionGraph *graph)
{

View file

@ -108,7 +108,7 @@ enum {
// the lower 8 bits are a timer to the next state.
// When the timer is incremented above 255, it increments
// the vine state and the timer is reset.
#define VINE_STATE_TIMER(vineState)(((vineState) << 8) | 0xFF)
#define VINE_STATE_TIMER(vineState) (((vineState) << 8) | 0xFF)
enum {
MONSTATE_NORMAL, // Pokémon is either on the ground or in the middle of a jump

View file

@ -1080,7 +1080,7 @@ enum {
RIBBONGFX_GIFT_3,
};
#define TO_PAL_OFFSET(palNum)((palNum) - PALTAG_RIBBON_ICONS_1)
#define TO_PAL_OFFSET(palNum) ((palNum) - PALTAG_RIBBON_ICONS_1)
struct
{

View file

@ -189,7 +189,7 @@ static const u16 sTerraOrMarineCaveMapSecIds[ABNORMAL_WEATHER_LOCATIONS] =
[ABNORMAL_WEATHER_ROUTE_129_EAST - 1] = MAPSEC_ROUTE_129
};
#define MARINE_CAVE_COORD(location)(ABNORMAL_WEATHER_##location - MARINE_CAVE_LOCATIONS_START)
#define MARINE_CAVE_COORD(location) (ABNORMAL_WEATHER_##location - MARINE_CAVE_LOCATIONS_START)
static const struct UCoords16 sMarineCaveLocationCoords[MARINE_CAVE_LOCATIONS] =
{

View file

@ -70,13 +70,13 @@
// Get the id of the col/row from the selection ID
// e.g. GET_ROW(SQU_PURPLE_SKITTY) is ROW_PURPLE
#define GET_COL(selectionId)((selectionId) % (NUM_BOARD_POKES + 1))
#define GET_ROW(selectionId)((selectionId) / (NUM_BOARD_POKES + 1) * (NUM_BOARD_POKES + 1))
#define GET_COL(selectionId) ((selectionId) % (NUM_BOARD_POKES + 1))
#define GET_ROW(selectionId) ((selectionId) / (NUM_BOARD_POKES + 1) * (NUM_BOARD_POKES + 1))
// Get the col/row index from the selection ID
// e.g. GET_ROW_IDX(SQU_PURPLE_SKITTY) is 2 (purple being the 3rd row)
#define GET_COL_IDX(selectionId)(selectionId - 1)
#define GET_ROW_IDX(selectionId)(selectionId / 5 - 1)
#define GET_COL_IDX(selectionId) (selectionId - 1)
#define GET_ROW_IDX(selectionId) (selectionId / 5 - 1)
// Flags for the above selections, used to set which spaces have been hit or bet on
#define F_WYNAUT_COL (1 << COL_WYNAUT)
@ -149,7 +149,7 @@
// 2 different Roulette tables with 2 different rates (normal vs service day special)
// & 1 gets which table, >> 7 gets if ROULETTE_SPECIAL_RATE is set
#define GET_MIN_BET_ID(var)(((var) & 1) + (((var) >> 7) * 2))
#define GET_MIN_BET_ID(var) (((var) & 1) + (((var) >> 7) * 2))
// Having Shroomish or Taillow in the party can make rolls more consistent in length
// It also increases the likelihood that, if they appear to unstick a ball, they'll move it to a slot the player bet on

View file

@ -14,7 +14,7 @@
// Each parent player can lead a group of up to MAX_RFU_PLAYERS (including themselves).
// Multiply the leader's id by MAX_RFU_PLAYERS and add the member's id (0 if the leader) to
// get the sprite index of that player.
#define UR_PLAYER_SPRITE_ID(leaderId, memberId)(MAX_RFU_PLAYERS * leaderId + memberId)
#define UR_PLAYER_SPRITE_ID(leaderId, memberId) (MAX_RFU_PLAYERS * leaderId + memberId)
static EWRAM_DATA struct UnionRoomObject * sUnionObjWork = NULL;
static EWRAM_DATA u32 sUnionObjRefreshTimer = 0;