Rewritten the incorrectly implemented setFinalBGColorSpecialIncreaseWnd and setFinalBGColorSpecialDecreaseWnd functions. This fixes the part 1 of the glitch #2488334 (SPP puzzle glitch).

This commit is contained in:
luigi__ 2009-02-01 00:24:03 +00:00
parent 3bb392c413
commit d66fd4ab85
1 changed files with 35 additions and 33 deletions

View File

@ -431,9 +431,9 @@ u16 GPU::blend(u16 colA, u16 colB)
void GPU_setMasterBrightness (GPU *gpu, u16 val)
{
if(!nds.isInVblank()) {
if(!nds.isInVblank()) {
PROGINFO("Changing master brightness outside of vblank\n");
}
}
gpu->MasterBrightFactor = (val & 0x1F);
gpu->MasterBrightMode = (val>>14);
}
@ -777,20 +777,21 @@ static void setFinalBGColorSpecialIncreaseWnd (GPU *gpu, u8 *dst, u16 color, u8
gpu->renderline_checkWindows(x, windowDraw, windowEffect);
if (((gpu->BLDCNT >> gpu->currBgNum)&1) && windowEffect) // the bg to draw has a special color effect
if(windowDraw)
{
if (gpu->BLDY_EVY != 0x0)
{ // dont slow down if there is nothing to do
}
T2WriteWord(dst, 0, color) ;
gpu->bgPixels[x] = gpu->currBgNum;
}
else
{
if ((windowEffect && (gpu->BLDCNT & (0x100 << gpu->currBgNum))) || windowDraw)
if((gpu->BLDCNT & (1 << gpu->currBgNum)) && windowEffect)
{
T2WriteWord(dst, 0, color);
if (gpu->BLDY_EVY != 0x0)
{
color = fadeInColors[gpu->BLDY_EVY][color&0x7FFF];
}
T2WriteWord(dst, 0, (color | 0x8000));
gpu->bgPixels[x] = gpu->currBgNum;
}
else
{
T2WriteWord(dst, 0, (color | 0x8000));
gpu->bgPixels[x] = gpu->currBgNum;
}
}
@ -802,20 +803,21 @@ static void setFinalBGColorSpecialDecreaseWnd (GPU *gpu, u8 *dst, u16 color, u8
gpu->renderline_checkWindows(x, windowDraw, windowEffect);
if (((gpu->BLDCNT >> gpu->currBgNum)&1) && windowEffect) // the bg to draw has a special color effect
if(windowDraw)
{
if (gpu->BLDY_EVY != 0x0)
{ // dont slow down if there is nothing to do
color = (fadeOutColors[gpu->BLDY_EVY][color&0x7FFF] | 0x8000);
}
T2WriteWord(dst, 0, color) ;
gpu->bgPixels[x] = gpu->currBgNum;
}
else
{
if ((windowEffect && (gpu->BLDCNT & (0x100 << gpu->currBgNum))) || windowDraw)
if((gpu->BLDCNT & (1 << gpu->currBgNum)) && windowEffect)
{
T2WriteWord(dst, 0, color);
if (gpu->BLDY_EVY != 0x0)
{
color = fadeOutColors[gpu->BLDY_EVY][color&0x7FFF];
}
T2WriteWord(dst, 0, (color | 0x8000));
gpu->bgPixels[x] = gpu->currBgNum;
}
else
{
T2WriteWord(dst, 0, (color | 0x8000));
gpu->bgPixels[x] = gpu->currBgNum;
}
}
@ -1423,15 +1425,15 @@ static void setFinal3DColorSpecialDecreaseWnd(GPU *gpu, u32 passing, u8 *dst, u1
//overhead was ridiculous and terrible
FORCEINLINE void GPU::__setFinalColorBck(u8 *dst, u16 color, u8 x, bool opaque)
{
//I commented out this line to make a point.
//indeed, since x is a u8 we cannot pass in anything >=256
//but in fact, someone is going to try. specifically, that is the map viewer debug tools
//which try to render the enter BG. in cases where that is large, it could be up to 1024 wide.
//I think it survives this truncation to 8bits.
//I commented out this line to make a point.
//indeed, since x is a u8 we cannot pass in anything >=256
//but in fact, someone is going to try. specifically, that is the map viewer debug tools
//which try to render the enter BG. in cases where that is large, it could be up to 1024 wide.
//I think it survives this truncation to 8bits.
//assert(x<256);
int x_int;
int x_int;
//due to this early out, we will get incorrect behavior in cases where
//we enable mosaic in the middle of a frame. this is deemed unlikely.
if(!curr_mosaic_enabled) {