Fix Bldalpha args

This commit is contained in:
DizzyEggg 2018-12-26 14:03:48 +01:00
parent 7e4db39da5
commit 6761a049da
8 changed files with 41 additions and 41 deletions

View File

@ -1753,7 +1753,7 @@ static void sub_8073E08(u8 taskId)
if (--gTasks[taskId].tData15 < 0)
return;
SetGpuReg(REG_OFFSET_BLDALPHA, (gTasks[taskId].data[15]) | ((16 - gTasks[taskId].data[15]) << 8));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[15], 16 - gTasks[taskId].data[15]));
}
if (gTasks[taskId].tData15 == 0)
gTasks[taskId].func = sub_8073E64;
@ -1806,7 +1806,7 @@ static void sub_8073F98(u8 taskId)
if (--gTasks[taskId].tData15 >= 0)
{
SetGpuReg(REG_OFFSET_BLDALPHA, (gTasks[taskId].tData15) | ((16 - gTasks[taskId].tData15) << 8));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[15], 16 - gTasks[taskId].data[15]));
}
else if (gTasks[taskId].tData15 == -1)
{

View File

@ -2220,7 +2220,7 @@ static void sub_8177050(struct Sprite *sprite)
else
{
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x10);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0));
sprite->oam.objMode = 1;
sprite->data[3] = 16;
sprite->data[0] += 1;

View File

@ -1480,7 +1480,7 @@ static void InitMovingBackgroundTask(bool8 isLink)
if (!isLink)
{
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG2);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x808);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 8));
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG2_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP);
SetBgAttribute(innerBgId, BG_ATTR_PRIORITY, 2);
@ -1492,7 +1492,7 @@ static void InitMovingBackgroundTask(bool8 isLink)
else
{
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x808);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 8));
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP);
}

View File

@ -356,7 +356,7 @@ static bool8 InitHallOfFameScreen(void)
break;
case 2:
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x710);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 7));
SetGpuReg(REG_OFFSET_BLDY, 0);
sub_8174FAC();
sHofGfxPtr->state = 0;
@ -818,7 +818,7 @@ void CB2_DoHallOfFamePC(void)
u8 taskId, i;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x710);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 7));
SetGpuReg(REG_OFFSET_BLDY, 0);
taskId = CreateTask(Task_HofPC_CopySaveData, 0);

View File

@ -89,7 +89,7 @@ struct MailGraphics
struct MailRead
{
/*0x0000*/ u8 strbuf[8][64];
/*0*/ u8 strbuf[8][64];
/*0x0200*/ u8 playerName[12];
/*0x020C*/ MainCallback callback;
/*0x0210*/ MainCallback callback2;
@ -170,29 +170,29 @@ static const u16 sUnknown_0859F2B0[][2] = {
static const struct MailGraphics sUnknown_0859F2B8[] = {
{
gMailPalette_Orange, gMailTiles_Orange, gMailTilemap_Orange, 0x02c0, 0x0000, 0x294a, 0x6739
gMailPalette_Orange, gMailTiles_Orange, gMailTilemap_Orange, 0x02c0, 0, 0x294a, 0x6739
}, {
gMailPalette_Harbor, gMailTiles_Harbor, gMailTilemap_Harbor, 0x02e0, 0x0000, 0x7fff, 0x4631
gMailPalette_Harbor, gMailTiles_Harbor, gMailTilemap_Harbor, 0x02e0, 0, 0x7fff, 0x4631
}, {
gMailPalette_Glitter, gMailTiles_Glitter, gMailTilemap_Glitter, 0x0400, 0x0000, 0x294a, 0x6739
gMailPalette_Glitter, gMailTiles_Glitter, gMailTilemap_Glitter, 0x0400, 0, 0x294a, 0x6739
}, {
gMailPalette_Mech, gMailTiles_Mech, gMailTilemap_Mech, 0x01e0, 0x0000, 0x7fff, 0x4631
gMailPalette_Mech, gMailTiles_Mech, gMailTilemap_Mech, 0x01e0, 0, 0x7fff, 0x4631
}, {
gMailPalette_Wood, gMailTiles_Wood, gMailTilemap_Wood, 0x02e0, 0x0000, 0x7fff, 0x4631
gMailPalette_Wood, gMailTiles_Wood, gMailTilemap_Wood, 0x02e0, 0, 0x7fff, 0x4631
}, {
gMailPalette_Wave, gMailTiles_Wave, gMailTilemap_Wave, 0x0300, 0x0000, 0x294a, 0x6739
gMailPalette_Wave, gMailTiles_Wave, gMailTilemap_Wave, 0x0300, 0, 0x294a, 0x6739
}, {
gMailPalette_Bead, gMailTiles_Bead, gMailTilemap_Bead, 0x0140, 0x0000, 0x7fff, 0x4631
gMailPalette_Bead, gMailTiles_Bead, gMailTilemap_Bead, 0x0140, 0, 0x7fff, 0x4631
}, {
gMailPalette_Shadow, gMailTiles_Shadow, gMailTilemap_Shadow, 0x0300, 0x0000, 0x7fff, 0x4631
gMailPalette_Shadow, gMailTiles_Shadow, gMailTilemap_Shadow, 0x0300, 0, 0x7fff, 0x4631
}, {
gMailPalette_Tropic, gMailTiles_Tropic, gMailTilemap_Tropic, 0x0220, 0x0000, 0x294a, 0x6739
gMailPalette_Tropic, gMailTiles_Tropic, gMailTilemap_Tropic, 0x0220, 0, 0x294a, 0x6739
}, {
gMailPalette_Dream, gMailTiles_Dream, gMailTilemap_Dream, 0x0340, 0x0000, 0x294a, 0x6739
gMailPalette_Dream, gMailTiles_Dream, gMailTilemap_Dream, 0x0340, 0, 0x294a, 0x6739
}, {
gMailPalette_Fab, gMailTiles_Fab, gMailTilemap_Fab, 0x02a0, 0x0000, 0x294a, 0x6739
gMailPalette_Fab, gMailTiles_Fab, gMailTilemap_Fab, 0x02a0, 0, 0x294a, 0x6739
}, {
gMailPalette_Retro, gMailTiles_Retro, gMailTilemap_Retro, 0x0520, 0x0000, 0x294a, 0x6739
gMailPalette_Retro, gMailTiles_Retro, gMailTilemap_Retro, 0x0520, 0, 0x294a, 0x6739
}
};
@ -306,7 +306,7 @@ static bool8 MailReadBuildGraphics(void)
case 0:
SetVBlankCallback(NULL);
ScanlineEffect_Stop();
SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
break;
case 1:
CpuFill16(0, (void *)OAM, OAM_SIZE);
@ -323,16 +323,16 @@ static bool8 MailReadBuildGraphics(void)
case 5:
FreeAllSpritePalettes();
reset_temp_tile_data_buffers();
SetGpuReg(REG_OFFSET_BG0HOFS, 0x0000);
SetGpuReg(REG_OFFSET_BG0VOFS, 0x0000);
SetGpuReg(REG_OFFSET_BG1HOFS, 0x0000);
SetGpuReg(REG_OFFSET_BG1VOFS, 0x0000);
SetGpuReg(REG_OFFSET_BG2VOFS, 0x0000);
SetGpuReg(REG_OFFSET_BG2HOFS, 0x0000);
SetGpuReg(REG_OFFSET_BG3HOFS, 0x0000);
SetGpuReg(REG_OFFSET_BG3VOFS, 0x0000);
SetGpuReg(REG_OFFSET_BLDCNT, 0x0000);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x0000);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG3HOFS, 0);
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
break;
case 6:
ResetBgsAndClearDma3BusyFlags(0);

View File

@ -1708,7 +1708,7 @@ static void sub_81D752C(u8 taskId)
if (data[0] != 16)
{
data[0]++;
SetGpuReg(REG_OFFSET_BLDALPHA, (data[0] << 8) | (16 - data[0]));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - data[0], data[0]));
}
}
@ -1954,7 +1954,7 @@ static void Task_RayTakesFlightAnim(u8 taskId)
sub_81D7E10();
sub_81D7E9C();
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_OBJ | BLDCNT_TGT2_BG1 | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x808);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 8));
BlendPalettes(-1, 0x10, 0);
SetVBlankCallback(VBlankCB_RayquazaScene);
CreateTask(sub_81D81A4, 0);
@ -2153,7 +2153,7 @@ static void Task_RayDescendsAnim(u8 taskId)
sub_81D82B0();
sub_81D8358();
SetGpuRegBits(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x1000);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
BlendPalettes(-1, 0x10, 0);
SetVBlankCallback(VBlankCB_RayquazaScene);
sRayScene->field_2008 = 0;
@ -2509,7 +2509,7 @@ static void Task_RayChasesAwayAnim(u8 taskId)
sub_81D68C8();
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, 0xE09);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(9, 14));
BlendPalettes(-1, 0x10, 0);
SetVBlankCallback(VBlankCB_RayquazaScene);
data[0] = 0;

View File

@ -616,7 +616,7 @@ static void Task_TitleScreenPhase1(u8 taskId)
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, 0);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_OBJ | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x10);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0));
SetGpuReg(REG_OFFSET_BLDY, 0);
// Create left side of version banner
@ -653,7 +653,7 @@ static void Task_TitleScreenPhase2(u8 taskId)
{
gTasks[taskId].tSkipToNext = TRUE;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BD);
SetGpuReg(REG_OFFSET_BLDALPHA, 0xF06);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(6, 15));
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1
| DISPCNT_OBJ_1D_MAP

View File

@ -338,7 +338,7 @@ static bool8 sub_81DAACC(struct Task *task)
{
sub_81DA700();
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x1000);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0x500, 2);
@ -368,11 +368,11 @@ static bool8 sub_81DAB4C(struct Task *task)
}
else
{
u16 var;
u16 blnd;
task->data[2]++;
var = task->data[2];
SetGpuReg(REG_OFFSET_BLDALPHA, (var) | ((16 - var) << 8));
blnd = task->data[2];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(blnd, 16 - blnd));
}
return FALSE;