gBattleControllerExecFlags bits now identified via helper macros
Created "exposition" macros to describe operations performed on gBattleControllerExecFlags. Updated the battle engine internals to use them, to more clearly document how battle link communications actually work.
This commit is contained in:
@@ -64,6 +64,47 @@ enum {
|
||||
REQUEST_TOUGH_RIBBON_BATTLE,
|
||||
};
|
||||
|
||||
// Accessors for gBattleControllerExecFlags.
|
||||
//
|
||||
// These are provided for documentation purposes, to make the battle
|
||||
// controller internals and the link communication internals more
|
||||
// legible. Several of these have functions that you should call
|
||||
// (e.g. MarkBattlerForControllerExec) instead of using these macros
|
||||
// directly.
|
||||
|
||||
#define MARK_BATTLE_CONTROLLER_ACTIVE_ON_LOCAL(battlerId) \
|
||||
do { gBattleControllerExecFlags |= gBitTable[battlerId] } while (0)
|
||||
|
||||
#define MARK_BATTLE_CONTROLLER_IDLE_ON_LOCAL(battlerId) \
|
||||
do { gBattleControllerExecFlags &= ~gBitTable(battlerId) } while (0)
|
||||
|
||||
#define IS_BATTLE_CONTROLLER_ACTIVE_ON_LOCAL(battlerId) \
|
||||
(gBattleControllerExecFlags & gBitTable[battlerId])
|
||||
|
||||
#define MARK_BATTLE_CONTROLLER_MESSAGE_OUTBOUND_OVER_LINK(battlerId) \
|
||||
do { gBattleControllerExecFlags |= gBitTable[battlerId] << 28; } while (0)
|
||||
|
||||
#define MARK_BATTLE_CONTROLLER_MESSAGE_SYNCHRONIZED_OVER_LINK(battlerId) \
|
||||
do { gBattleControllerExecFlags &= ~((1 << 28) << (battlerId)); }
|
||||
|
||||
#define MARK_BATTLE_CONTROLLER_ACTIVE_FOR_PLAYER(battlerId, playerId) \
|
||||
do { gBattleControllerExecFlags |= gBitTable[battlerId] << ((playerId) << 2); } while (0)
|
||||
|
||||
#define MARK_BATTLE_CONTROLLER_IDLE_FOR_PLAYER(battlerId, playerId) \
|
||||
do { gBattleControllerExecFlags &= ~(gBitTable[battlerId] << ((playerId) * 4)); } while (0)
|
||||
|
||||
#define IS_BATTLE_CONTROLLER_ACTIVE_FOR_PLAYER(battlerId, playerId) \
|
||||
(gBattleControllerExecFlags & (gBitTable[battlerId] << ((playerId) * 4)))
|
||||
|
||||
#define IS_BATTLE_CONTROLLER_ACTIVE_OR_PENDING_SYNC_ANYWHERE(battlerId) \
|
||||
(gBattleControllerExecFlags & ( \
|
||||
(gBitTable[battlerId]) \
|
||||
| (0xF << 28) \
|
||||
| (gBitTable[battlerId] << 4) \
|
||||
| (gBitTable[battlerId] << 8) \
|
||||
| (gBitTable[battlerId] << 12) \
|
||||
)
|
||||
|
||||
// Special arguments for Battle Controller functions.
|
||||
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user