diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 432725db5..112b134b8 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -4724,15 +4724,15 @@ static void setup_globals_sprite1(const uspritetype *tspr, const usectortype *se static uint8_t falpha_to_blend(float alpha, int32_t *cstatptr, int32_t transbit1, int32_t transbit2) { - int32_t blendidx, cstat = *cstatptr; + int32_t cstat = *cstatptr; if (cstat&transbit1) - alpha = 1.0f - (1.0f - alpha) * ((cstat&transbit2) ? 0.33f : 0.66f); + alpha = 1.0f - (1.0f - alpha) * ((cstat&transbit2) ? (1.f/3.f) : (2.f/3.f)); cstat |= transbit1; cstat &= ~transbit2; - blendidx = max(1, (int32_t)(alpha * (2*numalphatabs))); // [1 .. 2*numalphatabs-1] + int32_t blendidx = max(1, Blrintf(alpha * (2*numalphatabs))); // [1 .. 2*numalphatabs-1] if (blendidx > numalphatabs) { blendidx = 2*numalphatabs - blendidx; @@ -4784,20 +4784,21 @@ static void drawsprite_classic(int32_t snum) if (numalphatabs != 0) { blendidx = falpha_to_blend(alpha, &cstat, 2, 512); - tspr->cstat = cstat; } - else if (alpha >= 0.33f) + else if (alpha >= 1.f/3.f) { + cstat &= ~512; + if ((cstat&2) && alpha >= 0.5f) // this covers the multiplicative aspect used in the Polymodes cstat |= 512; cstat |= 2; - if (alpha >= 0.66f) + if (alpha >= 2.f/3.f) cstat |= 512; - - tspr->cstat = cstat; } + + tspr->cstat = cstat; } tilenum = tspr->picnum; @@ -6634,6 +6635,8 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t } else if (daalpha > 84) { + dastat &= ~RS_TRANS2; + if ((dastat & RS_TRANS1) && daalpha > 127) // this covers the multiplicative aspect used in the Polymodes dastat |= RS_TRANS2; diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index c6ac8e1ad..aa713d5b5 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -2202,9 +2202,9 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr) if (have_basepal_tint()) hictinting_apply(pc, MAXPALOOKUPS-1); - if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66f; else pc[3] = 0.33f; } - else pc[3] = 1.0f; + pc[3] = (tspr->cstat&2) ? !(tspr->cstat&512) ? (2.f/3.f) : (1.f/3.f) : 1.0f; pc[3] *= 1.0f - sext->alpha; + if (m->usesalpha) //Sprites with alpha in texture { // bglEnable(GL_BLEND);// bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); @@ -2220,7 +2220,8 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr) } else { - if ((tspr->cstat&2) || sext->alpha > 0.f || pc[3] < 1.0f) bglEnable(GL_BLEND); //else bglDisable(GL_BLEND); + if ((tspr->cstat&2) || sext->alpha > 0.f || pc[3] < 1.0f) + bglEnable(GL_BLEND); //else bglDisable(GL_BLEND); } bglColor4f(pc[0],pc[1],pc[2],pc[3]); //if (MFLAGS_NOCONV(m)) diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 21883014b..bdaf8b5e2 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -125,7 +125,7 @@ int32_t r_downsizevar = -1; static float fogresult, fogresult2; coltypef fogcol, fogtable[MAXPALOOKUPS]; -static const float float_trans[4] = { 1.0f, 1.0f, 0.66f, 0.33f }; +static const float float_trans[4] = { 1.0f, 1.0f, 2.f/3.f, 1.f/3.f }; char ptempbuf[MAXWALLSB<<1]; diff --git a/polymer/eduke32/build/src/voxmodel.c b/polymer/eduke32/build/src/voxmodel.c index 59648e194..b860a762a 100644 --- a/polymer/eduke32/build/src/voxmodel.c +++ b/polymer/eduke32/build/src/voxmodel.c @@ -978,11 +978,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr) (float)(numshades-min(max((globalshade * shadescale)+m->shadeoff, 0), numshades)) / (float)numshades; hictinting_apply(pc, globalpal); - if (tspr->cstat&2) - pc[3] = !(tspr->cstat&512) ? 0.66f : 0.33f; - else - pc[3] = 1.0f; - + pc[3] = (tspr->cstat&2) ? !(tspr->cstat&512) ? (2.f/3.f) : (1.f/3.f) : 1.0f; pc[3] *= 1.0f - spriteext[tspr->owner].alpha; if ((tspr->cstat&2) || spriteext[tspr->owner].alpha > 0.f || pc[3] < 1.0f)