Merge pull request #2025 from Bassoonian/cleandefinespaces

Clean up defines lacking spaces
This commit is contained in:
Martin Griffin
2024-08-21 19:04:12 +01:00
committed by GitHub
24 changed files with 59 additions and 59 deletions

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;