Bit shifts from hex to decimal

This commit is contained in:
GriffinR 2021-03-30 17:38:09 -04:00
parent d5d1caf965
commit 8c6e89e994
9 changed files with 24 additions and 24 deletions

View File

@ -4087,7 +4087,7 @@ static void HandleTurnActionSelectionState(void)
} }
break; break;
case STATE_WAIT_ACTION_CHOSEN: // Try to perform an action. case STATE_WAIT_ACTION_CHOSEN: // Try to perform an action.
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12))))
{ {
RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]); RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]);
gChosenActionByBattler[gActiveBattler] = gBattleBufferB[gActiveBattler][1]; gChosenActionByBattler[gActiveBattler] = gBattleBufferB[gActiveBattler][1];
@ -4266,7 +4266,7 @@ static void HandleTurnActionSelectionState(void)
} }
break; break;
case STATE_WAIT_ACTION_CASE_CHOSEN: case STATE_WAIT_ACTION_CASE_CHOSEN:
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12))))
{ {
switch (gChosenActionByBattler[gActiveBattler]) switch (gChosenActionByBattler[gActiveBattler])
{ {
@ -4375,7 +4375,7 @@ static void HandleTurnActionSelectionState(void)
break; break;
case STATE_WAIT_ACTION_CONFIRMED_STANDBY: case STATE_WAIT_ACTION_CONFIRMED_STANDBY:
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler])
| (0xF0000000) | (0xF << 28)
| (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 4)
| (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 8)
| (gBitTable[gActiveBattler] << 12)))) | (gBitTable[gActiveBattler] << 12))))
@ -4400,7 +4400,7 @@ static void HandleTurnActionSelectionState(void)
} }
break; break;
case STATE_WAIT_ACTION_CONFIRMED: case STATE_WAIT_ACTION_CONFIRMED:
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12))))
{ {
gBattleCommunication[ACTIONS_CONFIRMED_COUNT]++; gBattleCommunication[ACTIONS_CONFIRMED_COUNT]++;
} }
@ -4414,7 +4414,7 @@ static void HandleTurnActionSelectionState(void)
{ {
gBattlerAttacker = gActiveBattler; gBattlerAttacker = gActiveBattler;
gBattlescriptCurrInstr = gSelectionBattleScripts[gActiveBattler]; gBattlescriptCurrInstr = gSelectionBattleScripts[gActiveBattler];
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12))))
{ {
gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]]();
} }
@ -4422,7 +4422,7 @@ static void HandleTurnActionSelectionState(void)
} }
break; break;
case STATE_WAIT_SET_BEFORE_ACTION: case STATE_WAIT_SET_BEFORE_ACTION:
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12))))
{ {
gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN;
} }
@ -4446,7 +4446,7 @@ static void HandleTurnActionSelectionState(void)
{ {
gBattlerAttacker = gActiveBattler; gBattlerAttacker = gActiveBattler;
gBattlescriptCurrInstr = gSelectionBattleScripts[gActiveBattler]; gBattlescriptCurrInstr = gSelectionBattleScripts[gActiveBattler];
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12))))
{ {
gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]]();
} }

View File

@ -4855,7 +4855,7 @@ static void Cmd_openpartyscreen(void)
{ {
u8 flag40_0, flag40_1, flag40_2, flag40_3; u8 flag40_0, flag40_1, flag40_2, flag40_3;
hitmarkerFaintBits = gHitMarker >> 0x1C; hitmarkerFaintBits = gHitMarker >> 28;
if (gBitTable[0] & hitmarkerFaintBits) if (gBitTable[0] & hitmarkerFaintBits)
{ {
@ -4984,7 +4984,7 @@ static void Cmd_openpartyscreen(void)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ {
hitmarkerFaintBits = gHitMarker >> 0x1C; hitmarkerFaintBits = gHitMarker >> 28;
if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits) if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits)
{ {
gActiveBattler = 2; gActiveBattler = 2;
@ -5029,7 +5029,7 @@ static void Cmd_openpartyscreen(void)
gBattlescriptCurrInstr += 6; gBattlescriptCurrInstr += 6;
} }
hitmarkerFaintBits = gHitMarker >> 0x1C; hitmarkerFaintBits = gHitMarker >> 28;
gBattlerFainted = 0; gBattlerFainted = 0;
while (!(gBitTable[gBattlerFainted] & hitmarkerFaintBits) while (!(gBitTable[gBattlerFainted] & hitmarkerFaintBits)
@ -5229,7 +5229,7 @@ static void Cmd_switchineffects(void)
if (gBattlescriptCurrInstr[1] == 5) if (gBattlescriptCurrInstr[1] == 5)
{ {
u32 hitmarkerFaintBits = gHitMarker >> 0x1C; u32 hitmarkerFaintBits = gHitMarker >> 28;
gBattlerFainted++; gBattlerFainted++;
while (1) while (1)

View File

@ -801,7 +801,7 @@ void MarkAllBattlersForControllerExec(void) // unused
if (gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{ {
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
gBattleControllerExecFlags |= gBitTable[i] << 0x1C; gBattleControllerExecFlags |= gBitTable[i] << (32 - MAX_BATTLERS_COUNT);
} }
else else
{ {
@ -813,7 +813,7 @@ void MarkAllBattlersForControllerExec(void) // unused
void MarkBattlerForControllerExec(u8 battlerId) void MarkBattlerForControllerExec(u8 battlerId)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_LINK)
gBattleControllerExecFlags |= gBitTable[battlerId] << 0x1C; gBattleControllerExecFlags |= gBitTable[battlerId] << (32 - MAX_BATTLERS_COUNT);
else else
gBattleControllerExecFlags |= gBitTable[battlerId]; gBattleControllerExecFlags |= gBitTable[battlerId];
} }

View File

@ -804,8 +804,8 @@ void ConvertImageProcessingToGBA(struct ImageProcessingContext *context)
dest = dest_ + ((i * width + j) << 4) + (k << 1); dest = dest_ + ((i * width + j) << 4) + (k << 1);
src = src_ + ((((i << 3) + k) << 3) * width) + (j << 3); src = src_ + ((((i << 3) + k) << 3) * width) + (j << 3);
dest[0] = src[0] | (src[1] << 4) | (src[2] << 8) | (src[3] << 0xC); dest[0] = src[0] | (src[1] << 4) | (src[2] << 8) | (src[3] << 12);
dest[1] = src[4] | (src[5] << 4) | (src[6] << 8) | (src[7] << 0xC); dest[1] = src[4] | (src[5] << 4) | (src[6] << 8) | (src[7] << 12);
} }
} }
} }

View File

@ -130,7 +130,7 @@ void MoveSaveBlocks_ResetHeap(void)
gMain.vblankCallback = vblankCB; gMain.vblankCallback = vblankCB;
// create a new encryption key // create a new encryption key
encryptionKey = (Random() << 0x10) + (Random()); encryptionKey = (Random() << 16) + (Random());
ApplyNewEncryptionKeyToAllEncryptedData(encryptionKey); ApplyNewEncryptionKeyToAllEncryptedData(encryptionKey);
gSaveBlock2Ptr->encryptionKey = encryptionKey; gSaveBlock2Ptr->encryptionKey = encryptionKey;
} }

View File

@ -2036,8 +2036,8 @@ void sub_819A080(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 src
{ {
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++) for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
{ {
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B); pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 29) >> 27);
pixelsDst = (void*) dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + ((( loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 0x1d) >> 0x1B); pixelsDst = (void*) dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + ((( loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 29) >> 27);
if ((uintptr_t)pixelsDst & 0x1) if ((uintptr_t)pixelsDst & 0x1)
{ {

View File

@ -87,7 +87,7 @@ void CopyTrainerId(u8 *dst, u8 *src)
static void InitPlayerTrainerId(void) static void InitPlayerTrainerId(void)
{ {
u32 trainerId = (Random() << 0x10) | GetGeneratedTrainerIdLower(); u32 trainerId = (Random() << 16) | GetGeneratedTrainerIdLower();
SetTrainerId(trainerId, gSaveBlock2Ptr->playerTrainerId); SetTrainerId(trainerId, gSaveBlock2Ptr->playerTrainerId);
} }

View File

@ -760,8 +760,8 @@ static void sub_8135FCC(s32 pkblId)
{ {
if (GetPokeblockData(pokeblock, PBLOCK_SPICY + i) > 0) if (GetPokeblockData(pokeblock, PBLOCK_SPICY + i) > 0)
{ {
rectTilemapSrc[0] = (i << 0xC) + 0x17; rectTilemapSrc[0] = (i << 12) + 0x17;
rectTilemapSrc[1] = (i << 0xC) + 0x18; rectTilemapSrc[1] = (i << 12) + 0x18;
} }
else else
{ {

View File

@ -6605,12 +6605,12 @@ const u8 *GetTrainerPartnerName(void)
#define READ_PTR_FROM_TASK(taskId, dataId) \ #define READ_PTR_FROM_TASK(taskId, dataId) \
(void*)( \ (void*)( \
((u16)(gTasks[taskId].data[dataId]) | \ ((u16)(gTasks[taskId].data[dataId]) | \
((u16)(gTasks[taskId].data[dataId + 1]) << 0x10))) ((u16)(gTasks[taskId].data[dataId + 1]) << 16)))
#define STORE_PTR_IN_TASK(ptr, taskId, dataId) \ #define STORE_PTR_IN_TASK(ptr, taskId, dataId) \
{ \ { \
gTasks[taskId].data[dataId] = (u32)(ptr); \ gTasks[taskId].data[dataId] = (u32)(ptr); \
gTasks[taskId].data[dataId + 1] = (u32)(ptr) >> 0x10; \ gTasks[taskId].data[dataId + 1] = (u32)(ptr) >> 16; \
} }
static void Task_AnimateAfterDelay(u8 taskId) static void Task_AnimateAfterDelay(u8 taskId)
@ -6897,7 +6897,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1)
else else
{ {
for (i = 0; i < structPtr->field_0_0; i++) for (i = 0; i < structPtr->field_0_0; i++)
structPtr->byteArrays[i] = structPtr->bytes + (structPtr->field_3_0 * (i << 0xD)); structPtr->byteArrays[i] = structPtr->bytes + (structPtr->field_3_0 * (i << 13));
} }
structPtr->templates = AllocZeroed(sizeof(struct SpriteTemplate) * structPtr->field_0_0); structPtr->templates = AllocZeroed(sizeof(struct SpriteTemplate) * structPtr->field_0_0);