Skip to content

Commit

Permalink
Fixed|Doom: Reset invulnerability effect when leaving map
Browse files Browse the repository at this point in the history
IssueID #1776
  • Loading branch information
skyjake committed Apr 23, 2014
1 parent e8772a6 commit 1a0ad9c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions doomsday/plugins/common/src/g_game.cpp
Expand Up @@ -1870,6 +1870,10 @@ void G_PlayerLeaveMap(int player)
p->update |= PSF_POWERS;
de::zap(p->powers);

#if __JDOOM__
G_UpdateSpecialFilterWithTimeDelta(player, 0 /* instantly */);
#endif

#if __JHEXEN__
if(!newHub && !COMMON_GAMESESSION->rules().deathmatch)
{
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/doom/include/d_refresh.h
Expand Up @@ -42,6 +42,8 @@ void G_InitSpecialFilter(void);
*/
void G_UpdateSpecialFilter(int player);

void G_UpdateSpecialFilterWithTimeDelta(int player, float delta);

void D_DrawWindow(Size2Raw const *windowSize);

void D_EndFrame(void);
Expand Down
13 changes: 9 additions & 4 deletions doomsday/plugins/doom/src/d_refresh.cpp
Expand Up @@ -50,7 +50,7 @@ void G_InitSpecialFilter()
}
}

void G_UpdateSpecialFilter(int player)
void G_UpdateSpecialFilterWithTimeDelta(int player, float delta)
{
// In HacX a simple blue shift is used instead.
if(gameMode == doom2_hacx) return;
Expand All @@ -63,7 +63,7 @@ void G_UpdateSpecialFilter(int player)
// Clear the filter.
if(appliedFilter[player] > 0)
{
DD_Executef(true, "postfx %i opacity 1; postfx %i none 0.3", player, player);
DD_Executef(true, "postfx %i opacity 1; postfx %i none %f", player, player, delta);
appliedFilter[player] = -1;
}
return;
Expand All @@ -72,13 +72,13 @@ void G_UpdateSpecialFilter(int player)
float str = 1; // Full inversion.
if(filter < 4 * 32 && !(filter & 8))
{
str = 0; //.7f;
str = 0;
}

// Activate the filter.
if(appliedFilter[player] < 0)
{
DD_Executef(true, "postfx %i monochrome.inverted 0.3", player);
DD_Executef(true, "postfx %i monochrome.inverted %f", player, delta);
}

// Update filter opacity.
Expand All @@ -90,6 +90,11 @@ void G_UpdateSpecialFilter(int player)
appliedFilter[player] = str;
}

void G_UpdateSpecialFilter(int player)
{
G_UpdateSpecialFilterWithTimeDelta(player, .3f);
}

dd_bool R_ViewFilterColor(float rgba[4], int filter)
{
if(!rgba) return false;
Expand Down

0 comments on commit 1a0ad9c

Please sign in to comment.