Skip to content

Commit

Permalink
Fixed BUG #1634605: Broken invincibility ring effect in jHeretic.
Browse files Browse the repository at this point in the history
Fixed: Filters and special filter drawing, affecting the view border in all games.
  • Loading branch information
danij committed Jan 28, 2007
1 parent e90439a commit c92c2bc
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 62 deletions.
8 changes: 4 additions & 4 deletions doomsday/engine/portable/src/gl_draw.c
Expand Up @@ -399,10 +399,10 @@ int GL_DrawFilter()
(curfilter >> 16) & 0xff, (curfilter >> 24) & 0xff);

gl.Begin(DGL_QUADS);
gl.Vertex2f(0, 0);
gl.Vertex2f(320, 0);
gl.Vertex2f(320, 200);
gl.Vertex2f(0, 200);
gl.Vertex2f(viewwindowx, viewwindowy);
gl.Vertex2f(viewwindowx + viewwidth, viewwindowy);
gl.Vertex2f(viewwindowx + viewwidth, viewwindowy + viewheight);
gl.Vertex2f(viewwindowx, viewwindowy + viewheight);
gl.End();

gl.Enable(DGL_TEXTURING);
Expand Down
22 changes: 8 additions & 14 deletions doomsday/plugins/doom64tc/src/d_refresh.c
Expand Up @@ -111,7 +111,7 @@ void R_InitTranslation(void)
}
}

/*
/**
* Draws a special filter over the screen
* (eg the inversing filter used when in god mode).
*/
Expand All @@ -121,6 +121,7 @@ void R_DrawSpecialFilter(void)

if(player->powers[PT_INVULNERABILITY])
{
float x, y, w, h;
float max = 30;
float str, r, g, b;
int t = player->powers[PT_INVULNERABILITY];
Expand All @@ -140,19 +141,12 @@ void R_DrawSpecialFilter(void)
r = str * 2;
g = str * 2 - .4;
b = str * 2 - .8;
if(r < 0)
r = 0;
if(r > 1)
r = 1;
if(g < 0)
g = 0;
if(g > 1)
g = 1;
if(b < 0)
b = 0;
if(b > 1)
b = 1;
GL_DrawRect(0, 0, 320, 200, r, g, b, 1);
CLAMP(r, 0, 1);
CLAMP(g, 0, 1);
CLAMP(b, 0, 1);

R_GetViewWindow(&x, &y, &w, &h);
GL_DrawRect(x, y, w, h, r, g, b, 1);

// Restore the normal rendering state.
gl.Func(DGL_BLENDING, DGL_SRC_ALPHA, DGL_ONE_MINUS_SRC_ALPHA);
Expand Down
30 changes: 13 additions & 17 deletions doomsday/plugins/jdoom/src/d_refresh.c
Expand Up @@ -110,7 +110,7 @@ void R_InitTranslation(void)
}
}

/*
/**
* Draws a special filter over the screen
* (eg the inversing filter used when in god mode).
*/
Expand All @@ -120,9 +120,10 @@ void R_DrawSpecialFilter(void)

if(player->powers[PT_INVULNERABILITY])
{
float max = 30;
float str, r, g, b;
int t = player->powers[PT_INVULNERABILITY];
float x, y, w, h;
float max = 30;
float str, r, g, b;
int t = player->powers[PT_INVULNERABILITY];

if(t < max)
str = t / max;
Expand All @@ -132,26 +133,21 @@ void R_DrawSpecialFilter(void)
str = (INVULNTICS - t) / max;
else
str = 1; // Full inversion.

// Draw an inversing filter.
gl.Disable(DGL_TEXTURING);
gl.Func(DGL_BLENDING, DGL_ONE_MINUS_DST_COLOR,
DGL_ONE_MINUS_SRC_COLOR);

r = str * 2;
g = str * 2 - .4;
b = str * 2 - .8;
if(r < 0)
r = 0;
if(r > 1)
r = 1;
if(g < 0)
g = 0;
if(g > 1)
g = 1;
if(b < 0)
b = 0;
if(b > 1)
b = 1;
GL_DrawRect(0, 0, 320, 200, r, g, b, 1);
CLAMP(r, 0, 1);
CLAMP(g, 0, 1);
CLAMP(b, 0, 1);

R_GetViewWindow(&x, &y, &w, &h);
GL_DrawRect(x, y, w, h, r, g, b, 1);

// Restore the normal rendering state.
gl.Func(DGL_BLENDING, DGL_SRC_ALPHA, DGL_ONE_MINUS_SRC_ALPHA);
Expand Down
21 changes: 11 additions & 10 deletions doomsday/plugins/jheretic/src/h_refresh.c
Expand Up @@ -107,42 +107,43 @@ void R_InitTranslationTables(void)
}
}

/*
/**
* Draws a special filter over the screen
*/
void R_DrawSpecialFilter(void)
{
player_t *player = &players[displayplayer];
float x, y, w, h;
player_t *player = &players[displayplayer];

if(!(player->powers[PT_INVULNERABILITY] > BLINKTHRESHOLD) ||
if(player->powers[PT_INVULNERABILITY] <= BLINKTHRESHOLD &&
!(player->powers[PT_INVULNERABILITY] & 8))
return;

R_GetViewWindow(&x, &y, &w, &h);
gl.Disable(DGL_TEXTURING);
if(cfg.ringFilter == 1)
{
gl.Func(DGL_BLENDING, DGL_SRC_COLOR, DGL_SRC_COLOR);
GL_DrawRect(0, 0, 320, 200, .5f, .35f, .1f, 1);
GL_DrawRect(x, y, w, h, .5f, .35f, .1f, 1);

/*gl.Func(DGL_BLENDING, DGL_ZERO, DGL_SRC_COLOR);
GL_DrawRect(0, 0, 320, 200, 1, .7f, 0, 1);
GL_DrawRect(x, y, w, h, 1, .7f, 0, 1);
gl.Func(DGL_BLENDING, DGL_ONE, DGL_DST_COLOR);
GL_DrawRect(0, 0, 320, 200, .1f, 0, 0, 1); */
GL_DrawRect(x, y, w, h, .1f, 0, 0, 1); */

/*gl.Func(DGL_BLENDING, DGL_ZERO, DGL_SRC_COLOR);
GL_DrawRect(0, 0, 320, 200, 0, .6f, 0, 1);
GL_DrawRect(x, y, w, h, 0, .6f, 0, 1);
gl.Func(DGL_BLENDING, DGL_ONE_MINUS_DST_COLOR, DGL_ONE_MINUS_SRC_COLOR);
GL_DrawRect(0, 0, 320, 200, 1, 0, 0, 1); */
GL_DrawRect(x, y, w, h, 1, 0, 0, 1); */
}
else
{
gl.Func(DGL_BLENDING, DGL_DST_COLOR, DGL_SRC_COLOR);
GL_DrawRect(0, 0, 320, 200, 0, 0, .6f, 1);
GL_DrawRect(x, y, w, h, 0, 0, .6f, 1);
}
// Restore the normal rendering state.
gl.Func(DGL_BLENDING, DGL_SRC_ALPHA, DGL_ONE_MINUS_SRC_ALPHA);
gl.Enable(DGL_TEXTURING);

}

/*
Expand Down
28 changes: 11 additions & 17 deletions doomsday/plugins/wolftc/src/d_refresh.c
Expand Up @@ -109,7 +109,7 @@ void R_InitTranslation(void)
}
}

/*
/**
* Draws a special filter over the screen
* (eg the inversing filter used when in god mode).
*/
Expand All @@ -119,9 +119,10 @@ void R_DrawSpecialFilter(void)

if(player->powers[PT_INVULNERABILITY])
{
float max = 30;
float str, r, g, b;
int t = player->powers[PT_INVULNERABILITY];
float x, y, w, h;
float max = 30;
float str, r, g, b;
int t = player->powers[PT_INVULNERABILITY];

if(t < max)
str = t / max;
Expand All @@ -138,19 +139,12 @@ void R_DrawSpecialFilter(void)
r = str * 2;
g = str * 2 - .4;
b = str * 2 - .8;
if(r < 0)
r = 0;
if(r > 1)
r = 1;
if(g < 0)
g = 0;
if(g > 1)
g = 1;
if(b < 0)
b = 0;
if(b > 1)
b = 1;
GL_DrawRect(0, 0, 320, 200, r, g, b, 1);
CLAMP(r, 0, 1);
CLAMP(g, 0, 1);
CLAMP(b, 0, 1);

R_GetViewWindow(&x, &y, &w, &h);
GL_DrawRect(x, y, w, h, r, g, b, 1);

// Restore the normal rendering state.
gl.Func(DGL_BLENDING, DGL_SRC_ALPHA, DGL_ONE_MINUS_SRC_ALPHA);
Expand Down

0 comments on commit c92c2bc

Please sign in to comment.