{
int32_t sr,sb,sg,src,sbc,sgc,c;
src=XCOL1(color);sbc=XCOL2(color);sgc=XCOL3(color);
- c=GETLE32(pdest)>>16;
+ c=HIWORD(GETLE32(pdest));
sr=(XCOL1(c))-src; if(sr&0x8000) sr=0;
sb=(XCOL2(c))-sbc; if(sb&0x8000) sb=0;
sg=(XCOL3(c))-sgc; if(sg&0x8000) sg=0;
{
uint32_t ma=GETLE32(pdest);
PUTLE32(pdest, (X32PSXCOL(r,g,b))|lSetMask);//0x80008000;
- if(ma&0x80000000) PUTLE32(pdest, (ma&0xFFFF0000)|(*pdest&0xFFFF));
- if(ma&0x00008000) PUTLE32(pdest, (ma&0xFFFF) |(*pdest&0xFFFF0000));
+ if(ma&0x80000000) PUTLE32(pdest, (ma&0xFFFF0000)|(GETLE32(pdest)&0xFFFF));
+ if(ma&0x00008000) PUTLE32(pdest, (ma&0xFFFF) |(GETLE32(pdest)&0xFFFF0000));
return;
}
PUTLE32(pdest, (X32PSXCOL(r,g,b))|lSetMask);//0x80008000;
{
static int iCheat=0;
col+=iCheat;
- if(iCheat==1) iCheat=0; else iCheat=1;
+ iCheat ^= 1;
}
{
uint32_t *DSTPtr;
unsigned short LineOffset;
- uint32_t lcol=lSetMask|(((uint32_t)(col))<<16)|col;
+ uint32_t lcol = lSetMask | ((uint32_t)col << 16) | col;
dx>>=1;
DSTPtr = (uint32_t *)(psxVuw + (1024*y0) + x0);
LineOffset = 512 - dx;
if(!bCheckMask && !DrawSemiTrans)
{
+ lcol = HOST2LE32(lcol);
for(i=0;i<dy;i++)
{
- for(j=0;j<dx;j++) { PUTLE32(DSTPtr, lcol); DSTPtr++; }
+ for(j=0;j<dx;j++) { *DSTPtr++ = lcol; }
DSTPtr += LineOffset;
}
}
{
uint32_t *DSTPtr;
unsigned short LineOffset;
- uint32_t lcol=(((int32_t)col)<<16)|col;
+ uint32_t lcol = HOST2LE32((((uint32_t)(col)) << 16) | col);
dx>>=1;
DSTPtr = (uint32_t *)(psxVuw + (1024*y0) + x0);
LineOffset = 512 - dx;
for(i=0;i<dy;i++)
{
- for(j=0;j<dx;j++) { PUTLE32(DSTPtr, lcol); DSTPtr++; }
+ for(j=0;j<dx;j++) { *DSTPtr++ = lcol; }
DSTPtr += LineOffset;
}
}
if(!bCheckMask && !DrawSemiTrans)
{
- color |=sSetMask;
+ lcolor = HOST2LE32(lcolor);
for (i=ymin;i<=ymax;i++)
{
xmin=left_x >> 16; if(drawX>xmin) xmin=drawX;
for(j=xmin;j<xmax;j+=2)
{
- PUTLE32(((uint32_t *)&psxVuw[(i<<10)+j]), lcolor);
+ *(uint32_t *)&psxVuw[(i<<10)+j] = lcolor;
}
- if(j==xmax) PUTLE16(&psxVuw[(i<<10)+j], color);
+ if(j==xmax) psxVuw[(i<<10)+j] = lcolor;
if(NextRow_F()) return;
}
if(!bCheckMask && !DrawSemiTrans)
{
- color |=sSetMask;
+ lcolor = HOST2LE32(lcolor);
for (i=ymin;i<=ymax;i++)
{
xmin=left_x >> 16; if(drawX>xmin) xmin=drawX;
for(j=xmin;j<xmax;j+=2)
{
- PUTLE32(((uint32_t *)&psxVuw[(i<<10)+j]), lcolor);
+ *(uint32_t *)&psxVuw[(i<<10)+j] = lcolor;
}
- if(j==xmax) PUTLE16(&psxVuw[(i<<10)+j], color);
+ if(j==xmax) psxVuw[(i<<10)+j] = lcolor;
if(NextRow_F4()) return;
}
sprtYa=(sprtY<<10);
clutP=(clutY0<<10)+clutX0;
for (sprCY=0;sprCY<sprtH;sprCY++)
+ {
for (sprCX=0;sprCX<sprtW;sprCX++)
{
tC= psxVub[((textY0+(sprCY*lYDir))<<11) + textX0 +(sprCX*lXDir)];
GetTextureTransColG_SPR(&psxVuw[sprA],GETLE16(&psxVuw[clutP+((tC>>4)&0xf)]));
GetTextureTransColG_SPR(&psxVuw[sprA+1],GETLE16(&psxVuw[clutP+(tC&0xf)]));
}
+ }
return;
case 1:
clutP>>=1;
for(sprCY=0;sprCY<sprtH;sprCY++)
+ {
for(sprCX=0;sprCX<sprtW;sprCX++)
{
tC = psxVub[((textY0+(sprCY*lYDir))<<11)+(GlobalTextAddrX<<1) + textX0 + (sprCX*lXDir)] & 0xff;
GetTextureTransColG_SPR(&psxVuw[((sprtY+sprCY)<<10)+sprtX + sprCX],psxVuw[clutP+tC]);
}
- return;
+ }
+ return;
case 2:
for (sprCY=0;sprCY<sprtH;sprCY++)
+ {
for (sprCX=0;sprCX<sprtW;sprCX++)
{
GetTextureTransColG_SPR(&psxVuw[((sprtY+sprCY)<<10)+sprtX+sprCX],
GETLE16(&psxVuw[((textY0+(sprCY*lYDir))<<10)+GlobalTextAddrX + textX0 +(sprCX*lXDir)]));
}
- return;
+ }
+ return;
}
}
{
short x0, y0, x1, y1, xt, yt;
int32_t rgbt;
- double m, dy, dx;
+ int dy, dx;
if (lx0 > drawW && lx1 > drawW) return;
if (ly0 > drawH && ly1 > drawH) return;
dy = y1 - y0;
}
- m = dy / dx;
-
- if (m >= 0)
+ if ((dx >= 0 && dy >= 0) || (dx < 0 && dy < 0))
{
- if (m > 1)
+ if (abs(dy) > abs(dx))
Line_S_SE_Shade(x0, y0, x1, y1, rgb0, rgb1);
else
Line_E_SE_Shade(x0, y0, x1, y1, rgb0, rgb1);
}
else
- if (m < -1)
+ if (abs(dy) > abs(dx))
Line_N_NE_Shade(x0, y0, x1, y1, rgb0, rgb1);
else
Line_E_NE_Shade(x0, y0, x1, y1, rgb0, rgb1);
static void DrawSoftwareLineFlat(int32_t rgb)
{
short x0, y0, x1, y1, xt, yt;
- double m, dy, dx;
+ int dy, dx;
unsigned short colour = 0;
if (lx0 > drawW && lx1 > drawW) return;
dy = y1 - y0;
}
- m = dy/dx;
-
- if (m >= 0)
+ if ((dx >= 0 && dy >= 0) || (dx < 0 && dy < 0))
{
- if (m > 1)
+ if (abs(dy) > abs(dx))
Line_S_SE_Flat(x0, y0, x1, y1, colour);
else
Line_E_SE_Flat(x0, y0, x1, y1, colour);
}
else
- if (m < -1)
+ if (abs(dy) > abs(dx))
Line_N_NE_Flat(x0, y0, x1, y1, colour);
else
Line_E_NE_Flat(x0, y0, x1, y1, colour);