Yay, it's all working now!

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@914 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-03-22 15:23:22 +00:00
parent bb2fd1c05d
commit ade32bfce0
6 changed files with 59 additions and 55 deletions

View file

@ -74,7 +74,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define stv_s 0 #define stv_s 0
#define stv_t 4 #define stv_t 4
#define stv_size 8 #define stv_size 8
#define stv_shift 4 #define stv_shift 3
// trivertx_t structure // trivertx_t structure

View file

@ -1670,7 +1670,6 @@ LNDLoop:
movl %esi,C(r_p0)+12 movl %esi,C(r_p0)+12
fdivrs float_1 fdivrs float_1
// r_p1[0] = index1->v[0]; // r_p1[0] = index1->v[0];
@ -1697,6 +1696,9 @@ LNDLoop:
movl %eax,C(r_p1)+8 movl %eax,C(r_p1)+8
movl %esi,C(r_p1)+12 movl %esi,C(r_p1)+12
// r_p2[0] = index2->v[0]; // r_p2[0] = index2->v[0];
// r_p2[1] = index2->v[1]; // r_p2[1] = index2->v[1];
// r_p2[4] = index2->v[4]; // r_p2[4] = index2->v[4];
@ -1720,7 +1722,8 @@ LNDLoop:
movl stv_t(%esi), %esi movl stv_t(%esi), %esi
movl %eax,C(r_p2)+8 movl %eax,C(r_p2)+8
movl %esi,C(r_p2)+12 movl %esi,C(r_p2)+12
fstps C(d_xdenom) fstps C(d_xdenom)
// D_PolysetSetEdgeTable (); // D_PolysetSetEdgeTable ();

View file

@ -1284,21 +1284,15 @@ void D_DrawSubdivC (void)
#ifdef PEXT_TRANS #ifdef PEXT_TRANS
if (r_pixbytes == 4) if (r_pixbytes == 4)
drawfnc = D_PolysetRecursiveTriangle32Trans; drawfnc = D_PolysetRecursiveTriangle32Trans;
else if (currententity->alpha != 1) else if (!(t_state & TT_ONE))
{ {
Set_TransLevelF(currententity->alpha); //fixme: this is being called by every poly!
if (t_state & TT_ZERO) if (t_state & TT_ZERO)
return; return;
if (t_state & TT_ONE) //it's solid anyway. if (t_state & TT_REVERSE)
drawfnc = D_PolysetRecursiveTriangle; drawfnc = D_PolysetRecursiveTriangleReverseTrans;
else else
{ drawfnc = D_PolysetRecursiveTriangleTrans;
if (t_state & TT_REVERSE)
drawfnc = D_PolysetRecursiveTriangleReverseTrans;
else
drawfnc = D_PolysetRecursiveTriangleTrans;
}
} }
else else
#endif #endif
@ -1328,7 +1322,7 @@ void D_DrawSubdiv32C (void)
{ {
mtriangle_t *ptri; mtriangle_t *ptri;
finalvert_t *pfv, *index0, *index1, *index2; finalvert_t *pfv, *index0, *index1, *index2;
mstvert_t *pst, *st0, *st1, *st2; mstvert_t *pst;
int i; int i;
int lnumtriangles; int lnumtriangles;
@ -1427,10 +1421,10 @@ void D_DrawNonSubdiv32C (void)
int i; int i;
int lnumtriangles; int lnumtriangles;
#if 1
mstvert_t *pst, *stv; mstvert_t *pst, *stv;
pst = r_affinetridesc.pstverts; pst = r_affinetridesc.pstverts;
#endif
pfv = r_affinetridesc.pfinalverts; pfv = r_affinetridesc.pfinalverts;
ptri = r_affinetridesc.ptriangles; ptri = r_affinetridesc.ptriangles;
lnumtriangles = r_affinetridesc.numtriangles; lnumtriangles = r_affinetridesc.numtriangles;

View file

@ -447,8 +447,6 @@ void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *p
{ {
int y, x; int y, x;
return; //the following code is actually 24 bit. :(
D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly
if (r_pixbytes == 1) if (r_pixbytes == 1)
{ {
@ -462,19 +460,19 @@ void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *p
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes) for (y=0 ; y<lines ; y++, dest += vid.conrowbytes)
{ {
v = (vid.conheight - lines + y)*inheight/vid.conheight; v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4; src = framedata + v*inwidth;
{ {
f = 0; f = 0;
fstep = (inwidth<<16)/vid.conwidth; fstep = (inwidth<<16)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4) for (x=0 ; x<vid.conwidth ; x+=4)
{ {
dest[x] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); dest[x] = FindPallete(palette[src[(f>>16)]*3], palette[src[(f>>16)]*3+1], palette[src[(f>>16)]*3+2]);
f += fstep; f += fstep;
dest[x+1] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); dest[x+1] = FindPallete(palette[src[(f>>16)]*3], palette[src[(f>>16)]*3+1], palette[src[(f>>16)]*3+2]);
f += fstep; f += fstep;
dest[x+2] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); dest[x+2] = FindPallete(palette[src[(f>>16)]*3], palette[src[(f>>16)]*3+1], palette[src[(f>>16)]*3+2]);
f += fstep; f += fstep;
dest[x+3] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); dest[x+3] = FindPallete(palette[src[(f>>16)]*3], palette[src[(f>>16)]*3+1], palette[src[(f>>16)]*3+2]);
f += fstep; f += fstep;
} }
} }
@ -482,6 +480,7 @@ void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *p
} }
else if (r_pixbytes == 2) else if (r_pixbytes == 2)
{ {
/* this still expects 32bit input
extern int redbits, redshift; extern int redbits, redshift;
extern int greenbits, greenshift; extern int greenbits, greenshift;
extern int bluebits, blueshift; extern int bluebits, blueshift;
@ -508,6 +507,7 @@ extern int bluebits, blueshift;
} }
} }
} }
*/
} }
else if (r_pixbytes == 4) else if (r_pixbytes == 4)
{ {
@ -521,15 +521,15 @@ extern int bluebits, blueshift;
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes*4) for (y=0 ; y<lines ; y++, dest += vid.conrowbytes*4)
{ {
v = (vid.conheight - lines + y)*inheight/vid.conheight; v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4; src = framedata + v*inwidth;
{ {
f = 0; f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth; fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth*4 ; x+=4) //sw 32 bit rendering is bgrx for (x=0 ; x<vid.conwidth*4 ; x+=4) //sw 32 bit rendering is bgrx
{ {
dest[x] = src[(f>>16)*4+2]; dest[x] = palette[src[(f>>16)]*3+2];
dest[x+1] = src[(f>>16)*4+1]; dest[x+1] = palette[src[(f>>16)]*3+1];
dest[x+2] = src[(f>>16)*4]; dest[x+2] = palette[src[(f>>16)]*3];
f += fstep; f += fstep;
} }
} }

View file

@ -32,8 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "d_local.h" // FIXME: shouldn't be needed (is needed for patch #include "d_local.h" // FIXME: shouldn't be needed (is needed for patch
// right now, but that should move) // right now, but that should move)
#undef id386
#define Q2RF_DEPTHHACK 16 // for view weapon Z crunching #define Q2RF_DEPTHHACK 16 // for view weapon Z crunching
#define LIGHT_MIN 5 // lowest light value we'll allow, to avoid the #define LIGHT_MIN 5 // lowest light value we'll allow, to avoid the
@ -137,7 +135,7 @@ qboolean R_AliasCheckBBox (void)
} }
// construct the base bounding box for this frame // construct the base bounding box for this frame
oframe = currententity->frame; oframe = currententity->oldframe;
// TODO: don't repeat this check when drawing? // TODO: don't repeat this check when drawing?
if ((oframe >= pmdl->numframes) || (oframe < 0)) if ((oframe >= pmdl->numframes) || (oframe < 0))
{ {
@ -299,6 +297,8 @@ R_AliasPreparePoints
General clipped case General clipped case
================ ================
*/ */
mstvert_t *stc;
mtriangle_t *tn;
void R_AliasPreparePoints (void) void R_AliasPreparePoints (void)
{ {
void (*drawfnc) (void); void (*drawfnc) (void);
@ -313,24 +313,17 @@ void R_AliasPreparePoints (void)
fv = pfinalverts; fv = pfinalverts;
av = pauxverts; av = pauxverts;
#if 0//id386 if (r_pixbytes == 4)
if (t_state & TT_ONE) //use the asm routines if we have it, and don't have alpha drawfnc = D_PolysetDraw32;
{ else if (r_pixbytes == 2)
if (r_pixbytes == 4) drawfnc = D_PolysetDraw16;
drawfnc = D_PolysetDraw32;
else if (r_pixbytes == 2)
drawfnc = D_PolysetDraw16;
else
drawfnc = D_PolysetDrawAsm;
}
else else
#endif
{ {
if (r_pixbytes == 4) #if id386
drawfnc = D_PolysetDraw32; if (t_state & TT_ONE)
else if (r_pixbytes == 2) drawfnc = D_PolysetDrawAsm;
drawfnc = D_PolysetDraw16;
else else
#endif
drawfnc = D_PolysetDrawC; drawfnc = D_PolysetDrawC;
} }
@ -354,7 +347,7 @@ void R_AliasPreparePoints (void)
} }
} }
pstverts = (mstvert_t *)((qbyte *)paliashdr + paliashdr->stverts); stc = pstverts = (mstvert_t *)((qbyte *)paliashdr + paliashdr->stverts);
// //
// clip and draw all triangles // clip and draw all triangles
// //
@ -373,8 +366,10 @@ void R_AliasPreparePoints (void)
if ( ! ( (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) & if ( ! ( (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) &
(ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) ) (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) )
{ // totally unclipped { // totally unclipped
extern int r_p0[6], r_p1[6], r_p2[6];
r_affinetridesc.pfinalverts = pfinalverts; r_affinetridesc.pfinalverts = pfinalverts;
r_affinetridesc.ptriangles = ptri; r_affinetridesc.ptriangles = ptri;
drawfnc (); drawfnc ();
} }
else else
@ -618,7 +613,7 @@ void R_AliasPrepareUnclippedPoints (void)
if (r_pixbytes == 4) if (r_pixbytes == 4)
D_PolysetDraw32 (); D_PolysetDraw32 ();
#if id386 #if id386
else if (currententity->alpha == 1) else if (t_state & TT_ONE)
D_PolysetDrawAsm (); D_PolysetDrawAsm ();
#endif #endif
else else

View file

@ -2499,12 +2499,24 @@ void R_ClipAndDrawPoly ( float alpha, int isturbulent, qboolean textured )
} }
else else
{ {
if (alpha < 0.5) if (isturbulent)
r_q2polydesc.drawspanlet = R_DrawSpanlet33Stipple; {
else if (alpha < 0.9) if (alpha < 0.5)
r_q2polydesc.drawspanlet = R_DrawSpanlet66Stipple; r_q2polydesc.drawspanlet = R_DrawSpanletTurbulentStipple33;
else if (alpha < 0.9)
r_q2polydesc.drawspanlet = R_DrawSpanletTurbulentStipple66;
else
r_q2polydesc.drawspanlet = R_8DrawSpanletAlphaTest;
}
else else
r_q2polydesc.drawspanlet = R_8DrawSpanletAlphaTest; {
if (alpha < 0.5)
r_q2polydesc.drawspanlet = R_DrawSpanlet33Stipple;
else if (alpha < 0.9)
r_q2polydesc.drawspanlet = R_DrawSpanlet66Stipple;
else
r_q2polydesc.drawspanlet = R_8DrawSpanletAlphaTest;
}
/* /*
if ( !textured ) if ( !textured )
{ {
@ -2711,14 +2723,14 @@ void SWR_DrawAlphaSurfaces( void )
if (s->texinfo->flags & SURF_TRANS66) if (s->texinfo->flags & SURF_TRANS66)
{ {
R_ClipAndDrawPoly( 0.66f, 0/*(s->texinfo->flags & (SURF_WARP|SURF_FLOWING))*/, true ); R_ClipAndDrawPoly( 0.66f, (s->texinfo->flags & (SURF_WARP|SURF_FLOWING)), true );
} }
else if (s->texinfo->flags & SURF_TRANS33) else if (s->texinfo->flags & SURF_TRANS33)
{ {
R_ClipAndDrawPoly( 0.33f, 0/*(s->texinfo->flags & (SURF_WARP|SURF_FLOWING))*/, true ); R_ClipAndDrawPoly( 0.33f, (s->texinfo->flags & (SURF_WARP|SURF_FLOWING)), true );
} }
else else
R_ClipAndDrawPoly( 1.f, 0/*(s->texinfo->flags & (SURF_WARP|SURF_FLOWING))*/, true ); R_ClipAndDrawPoly( 1.f, (s->texinfo->flags & (SURF_WARP|SURF_FLOWING)), true );
os = s; os = s;
s = s->nextalphasurface; s = s->nextalphasurface;