diff --git a/Quake/pr_ext.c b/Quake/pr_ext.c index 81951819..924f86fc 100644 --- a/Quake/pr_ext.c +++ b/Quake/pr_ext.c @@ -9069,6 +9069,7 @@ void PR_DumpPlatform_f(void) fprintf(f, "const float EF_MUZZLEFLASH = %i;\n", EF_MUZZLEFLASH); fprintf(f, "const float EF_BRIGHTLIGHT = %i;\n", EF_BRIGHTLIGHT); fprintf(f, "const float EF_DIMLIGHT = %i;\n", EF_DIMLIGHT); + fprintf(f, "const float EF_ADDITIVE = %i;\n", EF_ADDITIVE); fprintf(f, "const float EF_BLUE = %i;\n", EF_BLUE); fprintf(f, "const float EF_RED = %i;\n", EF_RED); fprintf(f, "const float EF_FULLBRIGHT = %i;\n", EF_FULLBRIGHT); diff --git a/Quake/protocol.h b/Quake/protocol.h index c7dc62d0..2508c12b 100644 --- a/Quake/protocol.h +++ b/Quake/protocol.h @@ -440,7 +440,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define EF_BRIGHTLIGHT 4 #define EF_DIMLIGHT 8 //#define EF_NODRAW 16 -//#define EF_ADDITIVE 32 +#define EF_ADDITIVE 32 #define EF_BLUE 64 #define EF_RED 128 //#define EFDP_NOGUNBOB (1u<<8) diff --git a/Quake/r_alias.c b/Quake/r_alias.c index a7c31dcd..b2fe01a6 100644 --- a/Quake/r_alias.c +++ b/Quake/r_alias.c @@ -1185,6 +1185,11 @@ void R_DrawAliasModel (entity_t *e) } else if (alphatest) glEnable (GL_ALPHA_TEST); + if (e->effects & EF_ADDITIVE) + { + glBlendFunc (GL_SRC_ALPHA, GL_ONE); + glEnable(GL_BLEND); + } // // set up lighting @@ -1432,6 +1437,8 @@ cleanup: glColor3f(1,1,1); if (e->eflags & EFLAGS_VIEWMODEL) glDepthRange (0, 1); + if (e->effects & EF_ADDITIVE) + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glPopMatrix (); } diff --git a/Quake/r_world.c b/Quake/r_world.c index 00266074..61c9d1bf 100644 --- a/Quake/r_world.c +++ b/Quake/r_world.c @@ -985,11 +985,19 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain) int lastlightmap; gltexture_t *fullbright = NULL; float entalpha; + unsigned int enteffects; entalpha = (ent != NULL) ? ENTALPHA_DECODE(ent->alpha) : 1.0f; + enteffects = (ent != NULL) ? ent->effects : 0; // enable blending / disable depth writes - if (entalpha < 1) + if (enteffects & EF_ADDITIVE) + { + glDepthMask (GL_FALSE); + glBlendFunc (GL_SRC_ALPHA, GL_ONE); + glEnable (GL_BLEND); + } + else if (entalpha < 1) { glDepthMask (GL_FALSE); glEnable (GL_BLEND); @@ -1078,7 +1086,13 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain) GL_UseProgramFunc (0); GL_SelectTexture (GL_TEXTURE0); - if (entalpha < 1) + if (enteffects & EF_ADDITIVE) + { + glDepthMask (GL_TRUE); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //our normal alpha setting. + glDisable (GL_BLEND); + } + else if (entalpha < 1) { glDepthMask (GL_TRUE); glDisable (GL_BLEND);