void F3DCBFD_Vtx(u32 w0, u32 w1)
{
-
s32 v0, n;
u32 address;
n = (w0 >> 12)&0xFF;
gSPFlushTriangles();
Vertex* vertex = (Vertex*)&RDRAM[address];
-
+ u32 v;
+
for (s32 i=0; i < n; i++)
{
- u32 v;
#ifdef __TRIBUFFER_OPT
- v = __indexmap_getnew(i, 1);
+ v = __indexmap_getnew(v0 + i, 1);
#else
- v = i;
+ v = v0 + i;
#endif
OGL.triangles.vertices[v].x = vertex->x;
if (config.enableLighting && gSP.geometryMode & G_LIGHTING)
{
- OGL.triangles.vertices[v].nx = ((s8*)RDRAM)[(normal_address + (i<<2) + (v0<<1) + 0)^3];
- OGL.triangles.vertices[v].ny = ((s8*)RDRAM)[(normal_address + (i<<2) + (v0<<1) + 1)^3];
+ OGL.triangles.vertices[v].nx = ((s8*)RDRAM)[(normal_address + (i<<1) + (v0<<1) + 0)^3];
+ OGL.triangles.vertices[v].ny = ((s8*)RDRAM)[(normal_address + (i<<1) + (v0<<1) + 1)^3];
OGL.triangles.vertices[v].nz = (s8)(vertex->flag&0xff);
}
gSPProcessVertex(v);
- if (config.enableLighting && gSP.geometryMode & G_LIGHTING)
+ u32 nonblack = 0;
+ nonblack += OGL.triangles.vertices[v].r;
+ nonblack += OGL.triangles.vertices[v].g;
+ nonblack += OGL.triangles.vertices[v].b;
+ if (config.enableLighting && (gSP.geometryMode & G_LIGHTING) && (nonblack != 0))
{
OGL.triangles.vertices[v].r = OGL.triangles.vertices[v].r * vertex->color.r * 0.0039215689f;
OGL.triangles.vertices[v].g = OGL.triangles.vertices[v].g * vertex->color.g * 0.0039215689f;
OGL.triangles.vertices[v].b = OGL.triangles.vertices[v].b * vertex->color.b * 0.0039215689f;
- OGL.triangles.vertices[v].a = OGL.triangles.vertices[v].a * vertex->color.a * 0.0039215689f;
+ OGL.triangles.vertices[v].a = vertex->color.a * 0.0039215689f;
}
else
{
switch (index)
{
case G_MW_NUMLIGHT:
- gSPNumLights(w1 / 48);
+ gSPNumLights(w1 / 48);
break;
case G_MW_CLIP:
break;
case G_MW_SEGMENT:
- gSPSegment(_SHIFTR(offset, 2, 4), w1);
+ gSPSegment(_SHIFTR(offset, 2, 4), w1 & 0x00FFFFFF);
break;
case G_MW_FOG:
case F3DCBFD_MV_LIGHT:
{
- u32 offset = _SHIFTR( w0, 8, 8 ) << 3;
- if (offset >= 48)
- {
- gSPLight( w1, (offset - 24) / 24);
- }
+ u32 offset = (w0 >> 5) & 0x3FFF;
+ u32 n = offset / 48;
+ if (n < 2) {
+ //LookAt
+ return;
+ }
+ n--;
+ gSPLight(w1, n);
break;
}
void F3DCBFD_Tri4(u32 w0, u32 w1)
{
gSP4Triangles( _SHIFTR(w0, 23, 5), _SHIFTR(w0, 18, 5), (_SHIFTR(w0, 15, 3 ) << 2) | _SHIFTR(w1, 30, 2),
- _SHIFTR(w0, 10, 5), _SHIFTR(w0, 5, 5), _SHIFTR(w1, 0, 5),
+ _SHIFTR(w0, 10, 5), _SHIFTR(w0, 5, 5), _SHIFTR(w0, 0, 5),
_SHIFTR(w1, 25, 5), _SHIFTR(w1, 20, 5), _SHIFTR(w1, 15, 5),
_SHIFTR(w1, 10, 5), _SHIFTR(w1, 5, 5), _SHIFTR(w1, 0, 5));
}
{F3DPD, FALSE, 0x1c4f7869, "Perfect Dark"},
{F3DEX, FALSE, 0x0ace4c3f, "Mario Kart"},
//{F3DEX, FALSE, 0xda51ccdb, "Rogue Squadron"},
- //{F3DCBFD, FALSE, 0x1b4ace88, "RSP Gfx ucode F3DEXBG.NoN fifo 2.08 Yoshitaka Yasumoto 1999 Nintendo."},
+ {F3DCBFD, FALSE, 0x1b4ace88, "RSP Gfx ucode F3DEXBG.NoN fifo 2.08 Yoshitaka Yasumoto 1999 Nintendo."},
};
u32 G_RDPHALF_1, G_RDPHALF_2, G_RDPHALF_CONT;