Merge pull request #1391 from GriffinRichards/objvram

Add some uses of OBJ_VRAM/VRAM_SIZE
This commit is contained in:
GriffinR 2021-03-31 00:36:20 -04:00 committed by GitHub
commit 5d7c438efc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 30 additions and 30 deletions

View file

@ -1126,7 +1126,7 @@ void DrawBattleEntryBackground(void)
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
LZDecompressVram(gUnknown_08D778F0, (void*)(BG_CHAR_ADDR(1)));
LZDecompressVram(gVsLettersGfx, (void*)(VRAM + 0x10000));
LZDecompressVram(gVsLettersGfx, (void*)OBJ_VRAM0);
LoadCompressedPalette(gUnknown_08D77AE4, 0x60, 0x20);
SetBgAttribute(1, BG_ATTR_SCREENSIZE, 1);
SetGpuReg(REG_OFFSET_BG1CNT, 0x5C04);

View file

@ -1935,7 +1935,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon)
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
{
TextIntoHealthboxObject((void*)(VRAM + 0x10040 + spriteTileNum), windowTileData, 6);
TextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x40 + spriteTileNum), windowTileData, 6);
ptr = (void*)(OBJ_VRAM0);
if (!IsDoubleBattle())
ptr += spriteTileNum + 0x800;
@ -1945,7 +1945,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon)
}
else
{
TextIntoHealthboxObject((void*)(VRAM + 0x10020 + spriteTileNum), windowTileData, 7);
TextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x20 + spriteTileNum), windowTileData, 7);
}
RemoveWindowOnHealthbox(windowId);

View file

@ -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]]();
}

View file

@ -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)

View file

@ -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];
}

View file

@ -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);
}
}
}

View file

@ -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;
}

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++)
{
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)
{

View file

@ -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);
}

View file

@ -2060,7 +2060,7 @@ static void sub_80867D8(void)
ScanlineEffect_Stop();
DmaClear16(3, PLTT + 2, PLTT_SIZE - 2);
DmaFillLarge16(3, 0, (void *)(VRAM + 0x0), 0x18000, 0x1000);
DmaFillLarge16(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000);
ResetOamRange(0, 128);
LoadOam();
}

View file

@ -1272,7 +1272,7 @@ void LoadBallGfx(u8 ballId)
break;
default:
var = GetSpriteTileStartByTag(gBallSpriteSheets[ballId].tag);
LZDecompressVram(gOpenPokeballGfx, (void *)(VRAM + 0x10100 + var * 32));
LZDecompressVram(gOpenPokeballGfx, (void *)(OBJ_VRAM0 + 0x100 + var * 32));
break;
}
}

View file

@ -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
{

View file

@ -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);

View file

@ -702,7 +702,7 @@ static void LoadLeftHeaderGfxForSubMenu(u32 menuGfxId)
size = GetDecompressedDataSize(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data);
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], (IndexOfSpritePaletteTag(2) * 16) + 0x100, 0x20);
LZ77UnCompWram(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data, &gDecompressionBuffer[0x1000]);
RequestDma3Copy(&gDecompressionBuffer[0x1000], (void *)VRAM + 0x10800 + (GetSpriteTileStartByTag(2) * 32), size, 1);
RequestDma3Copy(&gDecompressionBuffer[0x1000], (void *)OBJ_VRAM0 + 0x800 + (GetSpriteTileStartByTag(2) * 32), size, 1);
}
void ShowLeftHeaderGfx(u32 menuGfxId, bool32 isMain, bool32 isOnRightSide)