From ade32bfce0156c6e0bc701ad661bd9fd8b8ef510 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 22 Mar 2005 15:23:22 +0000 Subject: [PATCH] Yay, it's all working now! git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@914 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/sw/d_ifacea.h | 2 +- engine/sw/d_polysa.s | 7 +++++-- engine/sw/d_polyse.c | 20 +++++++------------- engine/sw/d_trans.c | 22 +++++++++++----------- engine/sw/r_alias.c | 35 +++++++++++++++-------------------- engine/sw/r_draw.c | 28 ++++++++++++++++++++-------- 6 files changed, 59 insertions(+), 55 deletions(-) diff --git a/engine/sw/d_ifacea.h b/engine/sw/d_ifacea.h index 25bb36a4e..a6e8a1e85 100644 --- a/engine/sw/d_ifacea.h +++ b/engine/sw/d_ifacea.h @@ -74,7 +74,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define stv_s 0 #define stv_t 4 #define stv_size 8 -#define stv_shift 4 +#define stv_shift 3 // trivertx_t structure diff --git a/engine/sw/d_polysa.s b/engine/sw/d_polysa.s index a678a820a..36401499e 100644 --- a/engine/sw/d_polysa.s +++ b/engine/sw/d_polysa.s @@ -1670,7 +1670,6 @@ LNDLoop: movl %esi,C(r_p0)+12 - fdivrs float_1 // r_p1[0] = index1->v[0]; @@ -1697,6 +1696,9 @@ LNDLoop: movl %eax,C(r_p1)+8 movl %esi,C(r_p1)+12 + + + // r_p2[0] = index2->v[0]; // r_p2[1] = index2->v[1]; // r_p2[4] = index2->v[4]; @@ -1720,7 +1722,8 @@ LNDLoop: movl stv_t(%esi), %esi movl %eax,C(r_p2)+8 movl %esi,C(r_p2)+12 - + + fstps C(d_xdenom) // D_PolysetSetEdgeTable (); diff --git a/engine/sw/d_polyse.c b/engine/sw/d_polyse.c index a451437e8..a99ab176b 100644 --- a/engine/sw/d_polyse.c +++ b/engine/sw/d_polyse.c @@ -1284,21 +1284,15 @@ void D_DrawSubdivC (void) #ifdef PEXT_TRANS if (r_pixbytes == 4) 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) return; - if (t_state & TT_ONE) //it's solid anyway. - drawfnc = D_PolysetRecursiveTriangle; + if (t_state & TT_REVERSE) + drawfnc = D_PolysetRecursiveTriangleReverseTrans; else - { - if (t_state & TT_REVERSE) - drawfnc = D_PolysetRecursiveTriangleReverseTrans; - else - drawfnc = D_PolysetRecursiveTriangleTrans; - } + drawfnc = D_PolysetRecursiveTriangleTrans; } else #endif @@ -1328,7 +1322,7 @@ void D_DrawSubdiv32C (void) { mtriangle_t *ptri; finalvert_t *pfv, *index0, *index1, *index2; - mstvert_t *pst, *st0, *st1, *st2; + mstvert_t *pst; int i; int lnumtriangles; @@ -1427,10 +1421,10 @@ void D_DrawNonSubdiv32C (void) int i; int lnumtriangles; -#if 1 + mstvert_t *pst, *stv; pst = r_affinetridesc.pstverts; -#endif + pfv = r_affinetridesc.pfinalverts; ptri = r_affinetridesc.ptriangles; lnumtriangles = r_affinetridesc.numtriangles; diff --git a/engine/sw/d_trans.c b/engine/sw/d_trans.c index b318fa41e..aaec0c379 100644 --- a/engine/sw/d_trans.c +++ b/engine/sw/d_trans.c @@ -447,8 +447,6 @@ void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *p { int y, x; - return; //the following code is actually 24 bit. :( - D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly if (r_pixbytes == 1) { @@ -462,19 +460,19 @@ void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *p for (y=0 ; y>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; - 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; - 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; - 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; } } @@ -482,6 +480,7 @@ void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *p } else if (r_pixbytes == 2) { + /* this still expects 32bit input extern int redbits, redshift; extern int greenbits, greenshift; extern int bluebits, blueshift; @@ -508,6 +507,7 @@ extern int bluebits, blueshift; } } } + */ } else if (r_pixbytes == 4) { @@ -521,15 +521,15 @@ extern int bluebits, blueshift; for (y=0 ; y>16)*4+2]; - dest[x+1] = src[(f>>16)*4+1]; - dest[x+2] = src[(f>>16)*4]; + dest[x] = palette[src[(f>>16)]*3+2]; + dest[x+1] = palette[src[(f>>16)]*3+1]; + dest[x+2] = palette[src[(f>>16)]*3]; f += fstep; } } diff --git a/engine/sw/r_alias.c b/engine/sw/r_alias.c index df6f9ed77..715b5a452 100644 --- a/engine/sw/r_alias.c +++ b/engine/sw/r_alias.c @@ -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 // right now, but that should move) -#undef id386 - #define Q2RF_DEPTHHACK 16 // for view weapon Z crunching #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 - oframe = currententity->frame; + oframe = currententity->oldframe; // TODO: don't repeat this check when drawing? if ((oframe >= pmdl->numframes) || (oframe < 0)) { @@ -299,6 +297,8 @@ R_AliasPreparePoints General clipped case ================ */ +mstvert_t *stc; +mtriangle_t *tn; void R_AliasPreparePoints (void) { void (*drawfnc) (void); @@ -313,24 +313,17 @@ void R_AliasPreparePoints (void) fv = pfinalverts; av = pauxverts; -#if 0//id386 - if (t_state & TT_ONE) //use the asm routines if we have it, and don't have alpha - { - if (r_pixbytes == 4) - drawfnc = D_PolysetDraw32; - else if (r_pixbytes == 2) - drawfnc = D_PolysetDraw16; - else - drawfnc = D_PolysetDrawAsm; - } + if (r_pixbytes == 4) + drawfnc = D_PolysetDraw32; + else if (r_pixbytes == 2) + drawfnc = D_PolysetDraw16; else -#endif { - if (r_pixbytes == 4) - drawfnc = D_PolysetDraw32; - else if (r_pixbytes == 2) - drawfnc = D_PolysetDraw16; +#if id386 + if (t_state & TT_ONE) + drawfnc = D_PolysetDrawAsm; else +#endif 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 // @@ -373,8 +366,10 @@ void R_AliasPreparePoints (void) if ( ! ( (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) ) { // totally unclipped + extern int r_p0[6], r_p1[6], r_p2[6]; r_affinetridesc.pfinalverts = pfinalverts; r_affinetridesc.ptriangles = ptri; + drawfnc (); } else @@ -618,7 +613,7 @@ void R_AliasPrepareUnclippedPoints (void) if (r_pixbytes == 4) D_PolysetDraw32 (); #if id386 - else if (currententity->alpha == 1) + else if (t_state & TT_ONE) D_PolysetDrawAsm (); #endif else diff --git a/engine/sw/r_draw.c b/engine/sw/r_draw.c index dfd1cad97..c29b83f7c 100644 --- a/engine/sw/r_draw.c +++ b/engine/sw/r_draw.c @@ -2499,12 +2499,24 @@ void R_ClipAndDrawPoly ( float alpha, int isturbulent, qboolean textured ) } else { - if (alpha < 0.5) - r_q2polydesc.drawspanlet = R_DrawSpanlet33Stipple; - else if (alpha < 0.9) - r_q2polydesc.drawspanlet = R_DrawSpanlet66Stipple; + if (isturbulent) + { + if (alpha < 0.5) + r_q2polydesc.drawspanlet = R_DrawSpanletTurbulentStipple33; + else if (alpha < 0.9) + r_q2polydesc.drawspanlet = R_DrawSpanletTurbulentStipple66; + else + r_q2polydesc.drawspanlet = R_8DrawSpanletAlphaTest; + } 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 ) { @@ -2711,14 +2723,14 @@ void SWR_DrawAlphaSurfaces( void ) 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) { - 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 - 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; s = s->nextalphasurface;