diff --git a/src/battle_main.c b/src/battle_main.c index 3507ff765..9bb2268a6 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4087,7 +4087,7 @@ static void HandleTurnActionSelectionState(void) } break; 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]); gChosenActionByBattler[gActiveBattler] = gBattleBufferB[gActiveBattler][1]; @@ -4266,7 +4266,7 @@ static void HandleTurnActionSelectionState(void) } break; 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]) { @@ -4375,7 +4375,7 @@ static void HandleTurnActionSelectionState(void) break; case STATE_WAIT_ACTION_CONFIRMED_STANDBY: if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) - | (0xF0000000) + | (0xF << 28) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 12)))) @@ -4400,7 +4400,7 @@ static void HandleTurnActionSelectionState(void) } break; 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]++; } @@ -4414,7 +4414,7 @@ static void HandleTurnActionSelectionState(void) { gBattlerAttacker = 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]](); } @@ -4422,7 +4422,7 @@ static void HandleTurnActionSelectionState(void) } break; 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; } @@ -4446,7 +4446,7 @@ static void HandleTurnActionSelectionState(void) { gBattlerAttacker = 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]](); } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 96c849cbc..84f8efaa8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4855,7 +4855,7 @@ static void Cmd_openpartyscreen(void) { u8 flag40_0, flag40_1, flag40_2, flag40_3; - hitmarkerFaintBits = gHitMarker >> 0x1C; + hitmarkerFaintBits = gHitMarker >> 28; if (gBitTable[0] & hitmarkerFaintBits) { @@ -4984,7 +4984,7 @@ static void Cmd_openpartyscreen(void) { if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - hitmarkerFaintBits = gHitMarker >> 0x1C; + hitmarkerFaintBits = gHitMarker >> 28; if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits) { gActiveBattler = 2; @@ -5029,7 +5029,7 @@ static void Cmd_openpartyscreen(void) gBattlescriptCurrInstr += 6; } - hitmarkerFaintBits = gHitMarker >> 0x1C; + hitmarkerFaintBits = gHitMarker >> 28; gBattlerFainted = 0; while (!(gBitTable[gBattlerFainted] & hitmarkerFaintBits) @@ -5229,7 +5229,7 @@ static void Cmd_switchineffects(void) if (gBattlescriptCurrInstr[1] == 5) { - u32 hitmarkerFaintBits = gHitMarker >> 0x1C; + u32 hitmarkerFaintBits = gHitMarker >> 28; gBattlerFainted++; while (1) diff --git a/src/battle_util.c b/src/battle_util.c index 6e1202bd1..c0d897707 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -801,7 +801,7 @@ void MarkAllBattlersForControllerExec(void) // unused if (gBattleTypeFlags & BATTLE_TYPE_LINK) { for (i = 0; i < gBattlersCount; i++) - gBattleControllerExecFlags |= gBitTable[i] << 0x1C; + gBattleControllerExecFlags |= gBitTable[i] << (32 - MAX_BATTLERS_COUNT); } else { @@ -813,7 +813,7 @@ void MarkAllBattlersForControllerExec(void) // unused void MarkBattlerForControllerExec(u8 battlerId) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) - gBattleControllerExecFlags |= gBitTable[battlerId] << 0x1C; + gBattleControllerExecFlags |= gBitTable[battlerId] << (32 - MAX_BATTLERS_COUNT); else gBattleControllerExecFlags |= gBitTable[battlerId]; } diff --git a/src/image_processing_effects.c b/src/image_processing_effects.c index 4a56871a4..fa6867f2c 100644 --- a/src/image_processing_effects.c +++ b/src/image_processing_effects.c @@ -804,8 +804,8 @@ void ConvertImageProcessingToGBA(struct ImageProcessingContext *context) dest = dest_ + ((i * width + j) << 4) + (k << 1); src = src_ + ((((i << 3) + k) << 3) * width) + (j << 3); - dest[0] = src[0] | (src[1] << 4) | (src[2] << 8) | (src[3] << 0xC); - dest[1] = src[4] | (src[5] << 4) | (src[6] << 8) | (src[7] << 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] << 12); } } } diff --git a/src/load_save.c b/src/load_save.c index 8459cd96b..eec8f91ae 100644 --- a/src/load_save.c +++ b/src/load_save.c @@ -130,7 +130,7 @@ void MoveSaveBlocks_ResetHeap(void) gMain.vblankCallback = vblankCB; // create a new encryption key - encryptionKey = (Random() << 0x10) + (Random()); + encryptionKey = (Random() << 16) + (Random()); ApplyNewEncryptionKeyToAllEncryptedData(encryptionKey); gSaveBlock2Ptr->encryptionKey = encryptionKey; } diff --git a/src/menu.c b/src/menu.c index 86e5caac2..9957f7203 100644 --- a/src/menu.c +++ b/src/menu.c @@ -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++) { - pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B); - pixelsDst = (void*) dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + ((( loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 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 << 29) >> 27); if ((uintptr_t)pixelsDst & 0x1) { diff --git a/src/new_game.c b/src/new_game.c index c43c6ae9f..05d86aa8c 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -87,7 +87,7 @@ void CopyTrainerId(u8 *dst, u8 *src) static void InitPlayerTrainerId(void) { - u32 trainerId = (Random() << 0x10) | GetGeneratedTrainerIdLower(); + u32 trainerId = (Random() << 16) | GetGeneratedTrainerIdLower(); SetTrainerId(trainerId, gSaveBlock2Ptr->playerTrainerId); } diff --git a/src/pokeblock.c b/src/pokeblock.c index ee546deda..3513e7dd2 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -760,8 +760,8 @@ static void sub_8135FCC(s32 pkblId) { if (GetPokeblockData(pokeblock, PBLOCK_SPICY + i) > 0) { - rectTilemapSrc[0] = (i << 0xC) + 0x17; - rectTilemapSrc[1] = (i << 0xC) + 0x18; + rectTilemapSrc[0] = (i << 12) + 0x17; + rectTilemapSrc[1] = (i << 12) + 0x18; } else { diff --git a/src/pokemon.c b/src/pokemon.c index 5b683584b..e28fba1b4 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6605,12 +6605,12 @@ const u8 *GetTrainerPartnerName(void) #define READ_PTR_FROM_TASK(taskId, dataId) \ (void*)( \ ((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) \ { \ 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) @@ -6897,7 +6897,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1) else { 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);