drunk blur done

This commit is contained in:
aap 2020-08-09 19:51:16 +02:00
parent 43bf854374
commit e57d450809

View File

@ -255,6 +255,11 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
#endif
}
static uint8 DrunkBlurRed = 128;
static uint8 DrunkBlurGreen = 128;
static uint8 DrunkBlurBlue = 128;
static int32 DrunkBlurIncrement = 1;
void
CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, int32 bluralpha)
{
@ -367,7 +372,36 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
}
}
// TODO(MIAMI): drunkness
int DrunkBlurAlpha = 175.0f * Drunkness;
if(DrunkBlurAlpha != 0){
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
if(BlurOn){
RwIm2DVertexSetIntRGBA(&Vertex[0], 255, 255, 255, DrunkBlurAlpha);
RwIm2DVertexSetIntRGBA(&Vertex[1], 255, 255, 255, DrunkBlurAlpha);
RwIm2DVertexSetIntRGBA(&Vertex[2], 255, 255, 255, DrunkBlurAlpha);
RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, DrunkBlurAlpha);
}else{
RwIm2DVertexSetIntRGBA(&Vertex[0], DrunkBlurRed, DrunkBlurGreen, DrunkBlurBlue, DrunkBlurAlpha);
RwIm2DVertexSetIntRGBA(&Vertex[1], DrunkBlurRed, DrunkBlurGreen, DrunkBlurBlue, DrunkBlurAlpha);
RwIm2DVertexSetIntRGBA(&Vertex[2], DrunkBlurRed, DrunkBlurGreen, DrunkBlurBlue, DrunkBlurAlpha);
RwIm2DVertexSetIntRGBA(&Vertex[3], DrunkBlurRed, DrunkBlurGreen, DrunkBlurBlue, DrunkBlurAlpha);
if(DrunkBlurIncrement){
if(DrunkBlurRed < 255) DrunkBlurRed++;
if(DrunkBlurGreen < 255) DrunkBlurGreen++;
if(DrunkBlurBlue < 255) DrunkBlurBlue++;
if(DrunkBlurRed == 255)
DrunkBlurIncrement = 0;
}else{
if(DrunkBlurRed > 128) DrunkBlurRed--;
if(DrunkBlurGreen > 128) DrunkBlurGreen--;
if(DrunkBlurBlue > 128) DrunkBlurBlue--;
if(DrunkBlurRed == 128)
DrunkBlurIncrement = 1;
}
}
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
}
// TODO(MIAMI): OverlayRenderFx