add 3d layer h-scrolling
This commit is contained in:
parent
71a93841c9
commit
7ba70e0b9d
|
@ -53,6 +53,7 @@
|
|||
- Add MMU->GPU signal for when vram mappings change, which allows it to assume textures are unchanged unless vram has changed [zeromus]
|
||||
- Move lighting model to software instead of using opengl for more precision [zeromus]
|
||||
- Fix a bug in texture transformation mode 1 [zeromus]
|
||||
- Add 3d layer h-scrolling [zeromus]
|
||||
Mac OS X port:
|
||||
- Fixed: Filenames and paths with unicode characters now work. [Jeff]
|
||||
- Fixed: Load state from file button works again. [Jeff]
|
||||
|
|
|
@ -746,7 +746,7 @@ INLINE void renderline_textBG(const GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG,
|
|||
u16 yoff;
|
||||
u16 x = 0;
|
||||
u16 xfin;
|
||||
u16 palette_size;
|
||||
u16 palette_size_shift;
|
||||
u16 mosaic = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0);
|
||||
|
||||
s8 line_dir = 1;
|
||||
|
@ -897,10 +897,10 @@ INLINE void renderline_textBG(const GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG,
|
|||
return;
|
||||
}
|
||||
|
||||
palette_size=0; // color: no extended palette
|
||||
palette_size_shift=0; // color: no extended palette
|
||||
if(dispCnt->ExBGxPalette_Enable) // color: extended palette
|
||||
{
|
||||
palette_size=0x100;
|
||||
palette_size_shift=8;
|
||||
pal = ARM9Mem.ExtPal[gpu->core][gpu->BGExtPalSlot[num]];
|
||||
if(!pal) return;
|
||||
}
|
||||
|
@ -926,9 +926,10 @@ INLINE void renderline_textBG(const GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG,
|
|||
}
|
||||
for(; x < xfin; )
|
||||
{
|
||||
color = T1ReadWord(pal, ((*line) + (tileentry.bits.Palette*palette_size)) << 1);
|
||||
if (*line)
|
||||
color = T1ReadWord(pal, ((*line) + (tileentry.bits.Palette<<palette_size_shift)) << 1);
|
||||
if (*line)
|
||||
gpu->setFinalColorBck(gpu,0,num,dst,color,x,Y);
|
||||
|
||||
dst += 2; x++; xoff++;
|
||||
|
||||
line += line_dir;
|
||||
|
@ -2166,7 +2167,15 @@ static INLINE void GPU_ligne_layer(NDS_Screen * screen, u16 l)
|
|||
{
|
||||
if (i16 == 0 && dispCnt->BG0_3D)
|
||||
{
|
||||
gpu3D->NDS_3D_GetLine (l, (u16*)dst);
|
||||
//determine the 3d range to grab
|
||||
BGxOFS * bgofs = &gpu->dispx_st->dispx_BGxOFS[i16];
|
||||
s16 hofs = (s16)T1ReadWord((u8 *)&bgofs->BGxHOFS, 0);
|
||||
int start, end, ofs;
|
||||
if(hofs==0) { start = 0; end = 255; ofs = 0; }
|
||||
else if(hofs<0) { start = -hofs; end=255; ofs=0; }
|
||||
else { start = 0; end=255-hofs; ofs=hofs; }
|
||||
|
||||
gpu3D->NDS_3D_GetLine (l, start, end, (u16*)dst+ofs);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1230,9 +1230,7 @@ static void GetLineCaptured(int line, u16* dst)
|
|||
}
|
||||
|
||||
|
||||
//NHerve mod3 - Fixed blending with 2D backgrounds (New Super Mario Bros looks better)
|
||||
//zeromus post-mod3: fix even better
|
||||
static void GetLine (int line, u16* dst)
|
||||
static void GetLine(int line, int start, int end_inclusive, u16* dst)
|
||||
{
|
||||
assert(line<192 && line>=0);
|
||||
|
||||
|
@ -1254,14 +1252,14 @@ static void GetLine (int line, u16* dst)
|
|||
//this alpha compositing blending logic isnt thought through very much
|
||||
//someone needs to think about what bitdepth it should take place at and how to do it efficiently
|
||||
|
||||
for(int i = 0; i < 256; i++)
|
||||
for(int i = start, j=0; i <= end_inclusive; ++i, ++j)
|
||||
{
|
||||
u32 stencil = screenStencil[i];
|
||||
|
||||
//you would use this if you wanted to use the stencil buffer to make decisions here
|
||||
if(!stencil) continue;
|
||||
|
||||
u16 oldcolor = dst[i];
|
||||
u16 oldcolor = dst[j];
|
||||
|
||||
int t=i<<2;
|
||||
u32 dstpixel;
|
||||
|
@ -1296,7 +1294,7 @@ static void GetLine (int line, u16* dst)
|
|||
newpix = mix[newpix][oldpix];
|
||||
dstpixel |= (newpix<<10);
|
||||
|
||||
dst[i] = dstpixel;
|
||||
dst[j] = dstpixel;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
static void NDS_nullFunc1 (void){}
|
||||
static char NDS_nullFunc2 (void){ return 1; }
|
||||
static void NDS_nullFunc3 (int,unsigned short*) {}
|
||||
static void NDS_nullFunc4 (int,int,int,unsigned short*) {}
|
||||
|
||||
GPU3DInterface gpu3DNull = {
|
||||
NDS_nullFunc2, //NDS_3D_Init
|
||||
|
@ -30,7 +31,7 @@ GPU3DInterface gpu3DNull = {
|
|||
NDS_nullFunc1, //NDS_3D_Close
|
||||
NDS_nullFunc1, //NDS_3D_Render
|
||||
NDS_nullFunc1, //NDS_3D_VramReconfigureSignal
|
||||
NDS_nullFunc3, //NDS_3D_GetLine
|
||||
NDS_nullFunc4, //NDS_3D_GetLine
|
||||
NDS_nullFunc3 //NDS_3D_GetLineCaptured
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef struct Render3DInterface
|
|||
void (CALL_CONVENTION* NDS_3D_VramReconfigureSignal) ();
|
||||
|
||||
//Retrieves a line of color buffer data
|
||||
void (CALL_CONVENTION* NDS_3D_GetLine) (int line, unsigned short* dst);
|
||||
void (CALL_CONVENTION* NDS_3D_GetLine) (int line, int start, int end_inclusive, unsigned short* dst);
|
||||
|
||||
//Retrieves a line of color buffer data for capture
|
||||
void (CALL_CONVENTION* NDS_3D_GetLineCaptured) (int line, unsigned short* dst);
|
||||
|
|
Loading…
Reference in New Issue