raze/source/games/whaven/src/screenflash.cpp
Christoph Oelckers 5c22908dc2 - added the screen flash code, although I have no idea how to properly render this.
What's there is an extrapolation of how Exhumed handled a similar blend mode but this needs thorough testing to fine tune.
2020-10-31 14:07:38 +01:00

62 lines
1.3 KiB
C++

#include "ns.h"
#include "wh.h"
BEGIN_WH_NS
static int redcount, whitecount, greencount, bluecount;
void updatepaletteshifts()
{
if (whitecount != 0)
whitecount = std::max(whitecount - TICSPERFRAME, 0);
if (redcount != 0)
redcount = std::max(redcount - TICSPERFRAME, 0);
if (bluecount != 0)
bluecount = std::max(bluecount - TICSPERFRAME, 0);
if (greencount != 0)
greencount = std::max(greencount - TICSPERFRAME, 0);
}
void startredflash(int damage)
{
redcount = std::min(redcount + 3 * damage, 100);
}
void startblueflash(int bluetime)
{
bluecount = std::min(bluecount + 3 * bluetime, 100);
}
void startwhiteflash(int whitetime)
{
whitecount = std::min(whitecount + 3 * whitetime, 100);
}
void startgreenflash(int greentime)
{
greencount = std::min(greencount + 3 * greentime, 100);
}
void resetflash()
{
redcount = 0;
whitecount = 0;
greencount = 0;
bluecount = 0;
videoTintBlood(0, 0, 0);
}
void applyflash()
{
// no idea if this is righz. Needs to be tested.
if (redcount) videoTintBlood(5*redcount/2, -5*redcount/2, -5*redcount/2);
else if (greencount) videoTintBlood(-5*redcount/2, 5*redcount/2, -5*redcount/2);
else if (bluecount) videoTintBlood(-5*redcount/2, -5*redcount/2, 5*redcount/2);
else if (whitecount) videoTintBlood(5*redcount/2, 5*redcount/2, 5*redcount/2);
else videoTintBlood(0, 0, 0);
}
END_WH_NS