Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-05-06 11:38:02 +03:00
commit 98177f27ba
10 changed files with 279 additions and 84 deletions

2
librw

@ -1 +1 @@
Subproject commit b3ad490d1be3c1f41b416d3ceeaff3453bd2d28d Subproject commit bdbc92d86eef28344e01c992d55a9c4f43629f84

View File

@ -3182,14 +3182,12 @@ CCamera::GetScreenFadeStatus(void)
void void
CCamera::RenderMotionBlur(void) CCamera::RenderMotionBlur(void)
{ {
#ifndef MIAMI // temporary
if(m_BlurType == 0) if(m_BlurType == 0)
return; return;
CMBlur::MotionBlurRender(m_pRwCamera, CMBlur::MotionBlurRender(m_pRwCamera,
m_BlurRed, m_BlurGreen, m_BlurBlue, m_BlurRed, m_BlurGreen, m_BlurBlue,
m_motionBlur, m_BlurType, m_imotionBlurAddAlpha); m_motionBlur, m_BlurType);
#endif
} }
void void

View File

@ -66,7 +66,7 @@ enum Config {
PATHNODESIZE = 4500, PATHNODESIZE = 4500,
NUMWEATHERS = 4, NUMWEATHERS = 7,
NUMHOURS = 24, NUMHOURS = 24,
NUMEXTRADIRECTIONALS = 4, NUMEXTRADIRECTIONALS = 4,

View File

@ -429,8 +429,7 @@ void RwIm3DVertexSetU(RwIm3DVertex *vert, RwReal u) { vert->setU(u); }
void RwIm3DVertexSetV(RwIm3DVertex *vert, RwReal v) { vert->setV(v); } void RwIm3DVertexSetV(RwIm3DVertex *vert, RwReal v) { vert->setV(v); }
void RwIm3DVertexSetRGBA(RwIm3DVertex *vert, RwUInt8 r, RwUInt8 g, RwUInt8 b, RwUInt8 a) { vert->setColor(r, g, b, a); } void RwIm3DVertexSetRGBA(RwIm3DVertex *vert, RwUInt8 r, RwUInt8 g, RwUInt8 b, RwUInt8 a) { vert->setColor(r, g, b, a); }
// WARNING: ignoring flags void *RwIm3DTransform(RwIm3DVertex *pVerts, RwUInt32 numVerts, RwMatrix *ltm, RwUInt32 flags) { im3d::Transform(pVerts, numVerts, ltm, flags); return pVerts; }
void *RwIm3DTransform(RwIm3DVertex *pVerts, RwUInt32 numVerts, RwMatrix *ltm, RwUInt32 flags) { im3d::Transform(pVerts, numVerts, ltm); return pVerts; }
RwBool RwIm3DEnd(void) { im3d::End(); return true; } RwBool RwIm3DEnd(void) { im3d::End(); return true; }
RwBool RwIm3DRenderLine(RwInt32 vert1, RwInt32 vert2) { RwBool RwIm3DRenderLine(RwInt32 vert1, RwInt32 vert2) {
RwImVertexIndex indices[2]; RwImVertexIndex indices[2];

View File

@ -20,11 +20,11 @@ typedef RwUInt16 RwImVertexIndex;
enum RwIm3DTransformFlags enum RwIm3DTransformFlags
{ {
rwIM3D_VERTEXUV = 1, rwIM3D_VERTEXUV = rw::im3d::VERTEXUV,
rwIM3D_ALLOPAQUE = 2, rwIM3D_ALLOPAQUE = rw::im3d::ALLOPAQUE,
rwIM3D_NOCLIP = 4, rwIM3D_NOCLIP = rw::im3d::NOCLIP,
rwIM3D_VERTEXXYZ = 8, rwIM3D_VERTEXXYZ = rw::im3d::VERTEXXYZ,
rwIM3D_VERTEXRGBA = 16, rwIM3D_VERTEXRGBA = rw::im3d::VERTEXRGBA,
}; };
void RwIm2DVertexSetCameraX(RwIm2DVertex *vert, RwReal camx); void RwIm2DVertexSetCameraX(RwIm2DVertex *vert, RwReal camx);

View File

@ -11,6 +11,7 @@ bool CMBlur::ms_bJustInitialised;
bool CMBlur::BlurOn; bool CMBlur::BlurOn;
static RwIm2DVertex Vertex[4]; static RwIm2DVertex Vertex[4];
static RwIm2DVertex Vertex2[4];
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 }; static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
void void
@ -103,29 +104,62 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect)
RwIm2DVertexSetV(&Vertex[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam)); RwIm2DVertexSetV(&Vertex[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, 255); RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, 255);
RwIm2DVertexSetScreenX(&Vertex2[0], zero);
RwIm2DVertexSetScreenY(&Vertex2[0], zero);
RwIm2DVertexSetScreenZ(&Vertex2[0], RwIm2DGetNearScreenZ());
RwIm2DVertexSetCameraZ(&Vertex2[0], RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetRecipCameraZ(&Vertex2[0], 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetU(&Vertex2[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetV(&Vertex2[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetIntRGBA(&Vertex2[0], 255, 255, 255, 255);
RwIm2DVertexSetScreenX(&Vertex2[1], zero);
RwIm2DVertexSetScreenY(&Vertex2[1], ymax);
RwIm2DVertexSetScreenZ(&Vertex2[1], RwIm2DGetNearScreenZ());
RwIm2DVertexSetCameraZ(&Vertex2[1], RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetRecipCameraZ(&Vertex2[1], 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetU(&Vertex2[1], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetV(&Vertex2[1], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetIntRGBA(&Vertex2[1], 255, 255, 255, 255);
RwIm2DVertexSetScreenX(&Vertex2[2], xmax);
RwIm2DVertexSetScreenY(&Vertex2[2], ymax);
RwIm2DVertexSetScreenZ(&Vertex2[2], RwIm2DGetNearScreenZ());
RwIm2DVertexSetCameraZ(&Vertex2[2], RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetRecipCameraZ(&Vertex2[2], 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetU(&Vertex2[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetV(&Vertex2[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetIntRGBA(&Vertex2[2], 255, 255, 255, 255);
RwIm2DVertexSetScreenX(&Vertex2[3], xmax);
RwIm2DVertexSetScreenY(&Vertex2[3], zero);
RwIm2DVertexSetScreenZ(&Vertex2[3], RwIm2DGetNearScreenZ());
RwIm2DVertexSetCameraZ(&Vertex2[3], RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetRecipCameraZ(&Vertex2[3], 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetU(&Vertex2[3], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetV(&Vertex2[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetIntRGBA(&Vertex2[3], 255, 255, 255, 255);
} }
void void
CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha) CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type)
{ {
RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur }; RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur };
if(BlurOn){
if(pFrontBuffer){
if(ms_bJustInitialised) if(ms_bJustInitialised)
ms_bJustInitialised = false; ms_bJustInitialised = false;
else else
OverlayRender(cam, pFrontBuffer, color, type, addalpha); OverlayRender(cam, pFrontBuffer, color, type);
} if(BlurOn){
RwRasterPushContext(pFrontBuffer); RwRasterPushContext(pFrontBuffer);
RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0); RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
RwRasterPopContext(); RwRasterPopContext();
}else{
OverlayRender(cam, nil, color, type, addalpha);
} }
} }
void void
CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 addalpha) CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type)
{ {
int r, g, b, a; int r, g, b, a;
@ -170,40 +204,74 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
} }
if(!BlurOn){ if(!BlurOn){
r *= 0.6f; // gta clamps these to 255 (probably a macro or inlined function)
g *= 0.6f; int ovR = r * 0.6f;
b *= 0.6f; int ovG = g * 0.6f;
if(type != 1) int ovB = b * 0.6f;
a *= 0.6f; int ovA = type == MBLUR_SNIPER ? a : a*0.6f;
// game clamps to 255 here, but why? RwIm2DVertexSetIntRGBA(&Vertex[0], ovR, ovG, ovB, ovA);
} RwIm2DVertexSetIntRGBA(&Vertex[1], ovR, ovG, ovB, ovA);
RwIm2DVertexSetIntRGBA(&Vertex[2], ovR, ovG, ovB, ovA);
RwIm2DVertexSetIntRGBA(&Vertex[3], ovR, ovG, ovB, ovA);
}else{
RwIm2DVertexSetIntRGBA(&Vertex2[0], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex2[1], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex2[2], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, a);
}
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, BlurOn ? raster : nil); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, raster);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
if(BlurOn){
if(type == MBLUR_SNIPER){
RwIm2DVertexSetIntRGBA(&Vertex2[0], r, g, b, 80);
RwIm2DVertexSetIntRGBA(&Vertex2[1], r, g, b, 80);
RwIm2DVertexSetIntRGBA(&Vertex2[2], r, g, b, 80);
RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, 80);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
// TODO(MIAMI): pBufVertCount = 0;
}else{
RwIm2DVertexSetIntRGBA(&Vertex2[0], r*2, g*2, b*2, 30);
RwIm2DVertexSetIntRGBA(&Vertex2[1], r*2, g*2, b*2, 30);
RwIm2DVertexSetIntRGBA(&Vertex2[2], r*2, g*2, b*2, 30);
RwIm2DVertexSetIntRGBA(&Vertex2[3], r*2, g*2, b*2, 30);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
a = addalpha/2; RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex2, 4, Index, 6);
if(a < 30)
a = 30;
if(BlurOn && a != 0){ // the second condition should always be true RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
RwIm2DVertexSetIntRGBA(&Vertex[0], 255, 255, 255, a); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwIm2DVertexSetIntRGBA(&Vertex[1], 255, 255, 255, a);
RwIm2DVertexSetIntRGBA(&Vertex[2], 255, 255, 255, a); RwIm2DVertexSetIntRGBA(&Vertex2[0], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, a); RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex2[1], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex2[2], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, a);
RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, a);
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6); RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex2, 4, Index, 6);
} }
}
// TODO(MIAMI): drunkness
// TODO(MIAMI): OverlayRenderFx
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);

View File

@ -11,6 +11,6 @@ public:
static void MotionBlurOpen(RwCamera *cam); static void MotionBlurOpen(RwCamera *cam);
static void MotionBlurClose(void); static void MotionBlurClose(void);
static void CreateImmediateModeData(RwCamera *cam, RwRect *rect); static void CreateImmediateModeData(RwCamera *cam, RwRect *rect);
static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha); static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type);
static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 bluralpha); static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type);
}; };

View File

@ -10,9 +10,20 @@
#include "FileMgr.h" #include "FileMgr.h"
#include "Timecycle.h" #include "Timecycle.h"
// TODO(MIAMI): change some of the types here
int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS]; int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS]; int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS]; int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS]; int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
@ -33,7 +44,7 @@ float CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS]; short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS];
short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
short CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS]; short CTimeCycle::m_nPoleShadowStrength[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
@ -49,11 +60,24 @@ int CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fBlurAlpha[NUMHOURS][NUMWEATHERS]; float CTimeCycle::m_fWaterRed[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fWaterGreen[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fWaterBlue[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fWaterAlpha[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fCurrentAmbientRed; float CTimeCycle::m_fCurrentAmbientRed;
float CTimeCycle::m_fCurrentAmbientGreen; float CTimeCycle::m_fCurrentAmbientGreen;
float CTimeCycle::m_fCurrentAmbientBlue; float CTimeCycle::m_fCurrentAmbientBlue;
float CTimeCycle::m_fCurrentAmbientRed_Obj;
float CTimeCycle::m_fCurrentAmbientGreen_Obj;
float CTimeCycle::m_fCurrentAmbientBlue_Obj;
float CTimeCycle::m_fCurrentAmbientRed_Bl;
float CTimeCycle::m_fCurrentAmbientGreen_Bl;
float CTimeCycle::m_fCurrentAmbientBlue_Bl;
float CTimeCycle::m_fCurrentAmbientRed_Obj_Bl;
float CTimeCycle::m_fCurrentAmbientGreen_Obj_Bl;
float CTimeCycle::m_fCurrentAmbientBlue_Obj_Bl;
float CTimeCycle::m_fCurrentDirectionalRed; float CTimeCycle::m_fCurrentDirectionalRed;
float CTimeCycle::m_fCurrentDirectionalGreen; float CTimeCycle::m_fCurrentDirectionalGreen;
float CTimeCycle::m_fCurrentDirectionalBlue; float CTimeCycle::m_fCurrentDirectionalBlue;
@ -74,7 +98,7 @@ float CTimeCycle::m_fCurrentSpriteSize;
float CTimeCycle::m_fCurrentSpriteBrightness; float CTimeCycle::m_fCurrentSpriteBrightness;
int CTimeCycle::m_nCurrentShadowStrength; int CTimeCycle::m_nCurrentShadowStrength;
int CTimeCycle::m_nCurrentLightShadowStrength; int CTimeCycle::m_nCurrentLightShadowStrength;
int CTimeCycle::m_nCurrentTreeShadowStrength; int CTimeCycle::m_nCurrentPoleShadowStrength;
float CTimeCycle::m_fCurrentFogStart; float CTimeCycle::m_fCurrentFogStart;
float CTimeCycle::m_fCurrentFarClip; float CTimeCycle::m_fCurrentFarClip;
float CTimeCycle::m_fCurrentLightsOnGroundBrightness; float CTimeCycle::m_fCurrentLightsOnGroundBrightness;
@ -90,7 +114,10 @@ int CTimeCycle::m_nCurrentFluffyCloudsBottomBlue;
float CTimeCycle::m_fCurrentBlurRed; float CTimeCycle::m_fCurrentBlurRed;
float CTimeCycle::m_fCurrentBlurGreen; float CTimeCycle::m_fCurrentBlurGreen;
float CTimeCycle::m_fCurrentBlurBlue; float CTimeCycle::m_fCurrentBlurBlue;
float CTimeCycle::m_fCurrentBlurAlpha; float CTimeCycle::m_fCurrentWaterRed;
float CTimeCycle::m_fCurrentWaterGreen;
float CTimeCycle::m_fCurrentWaterBlue;
float CTimeCycle::m_fCurrentWaterAlpha;
int CTimeCycle::m_nCurrentFogColourRed; int CTimeCycle::m_nCurrentFogColourRed;
int CTimeCycle::m_nCurrentFogColourGreen; int CTimeCycle::m_nCurrentFogColourGreen;
int CTimeCycle::m_nCurrentFogColourBlue; int CTimeCycle::m_nCurrentFogColourBlue;
@ -115,18 +142,22 @@ CTimeCycle::Initialise(void)
char line[1040]; char line[1040];
int ambR, ambG, ambB; int ambR, ambG, ambB;
int ambobjR, ambobjG, ambobjB;
int ambblR, ambblG, ambblB;
int ambobjblR, ambobjblG, ambobjblB;
int dirR, dirG, dirB; int dirR, dirG, dirB;
int skyTopR, skyTopG, skyTopB; int skyTopR, skyTopG, skyTopB;
int skyBotR, skyBotG, skyBotB; int skyBotR, skyBotG, skyBotB;
int sunCoreR, sunCoreG, sunCoreB; int sunCoreR, sunCoreG, sunCoreB;
int sunCoronaR, sunCoronaG, sunCoronaB; int sunCoronaR, sunCoronaG, sunCoronaB;
float sunSz, sprSz, sprBght; float sunSz, sprSz, sprBght;
int shad, lightShad, treeShad; int shad, lightShad, poleShad;
float farClp, fogSt, lightGnd; float farClp, fogSt, lightGnd;
int cloudR, cloudG, cloudB; int cloudR, cloudG, cloudB;
int fluffyTopR, fluffyTopG, fluffyTopB; int fluffyTopR, fluffyTopG, fluffyTopB;
int fluffyBotR, fluffyBotG, fluffyBotB; int fluffyBotR, fluffyBotG, fluffyBotB;
float blurR, blurG, blurB, blurA; float blurR, blurG, blurB;
float waterR, waterG, waterB, waterA;
debug("Intialising CTimeCycle...\n"); debug("Intialising CTimeCycle...\n");
@ -150,25 +181,39 @@ CTimeCycle::Initialise(void)
bi++; bi++;
sscanf(line, "%d %d %d %d %d %d %d %d %d %d %d %d " sscanf(line, "%d %d %d %d %d %d %d %d %d %d %d %d "
"%d %d %d %d %d %d %d %d %d "
"%d %d %d %d %d %d %f %f %f %d %d %d %f %f %f " "%d %d %d %d %d %d %f %f %f %d %d %d %f %f %f "
"%d %d %d %d %d %d %d %d %d %f %f %f %f", "%d %d %d %d %d %d %d %d %d %f %f %f %f %f %f %f",
&ambR, &ambG, &ambB, &ambR, &ambG, &ambB,
&ambobjR, &ambobjG, &ambobjB,
&ambblR, &ambblG, &ambblB,
&ambobjblR, &ambobjblG, &ambobjblB,
&dirR, &dirG, &dirB, &dirR, &dirG, &dirB,
&skyTopR, &skyTopG, &skyTopB, &skyTopR, &skyTopG, &skyTopB,
&skyBotR, &skyBotG, &skyBotB, &skyBotR, &skyBotG, &skyBotB,
&sunCoreR, &sunCoreG, &sunCoreB, &sunCoreR, &sunCoreG, &sunCoreB,
&sunCoronaR, &sunCoronaG, &sunCoronaB, &sunCoronaR, &sunCoronaG, &sunCoronaB,
&sunSz, &sprSz, &sprBght, &sunSz, &sprSz, &sprBght,
&shad, &lightShad, &treeShad, &shad, &lightShad, &poleShad,
&farClp, &fogSt, &lightGnd, &farClp, &fogSt, &lightGnd,
&cloudR, &cloudG, &cloudB, &cloudR, &cloudG, &cloudB,
&fluffyTopR, &fluffyTopG, &fluffyTopB, &fluffyTopR, &fluffyTopG, &fluffyTopB,
&fluffyBotR, &fluffyBotG, &fluffyBotB, &fluffyBotR, &fluffyBotG, &fluffyBotB,
&blurR, &blurG, &blurB, &blurA); &blurR, &blurG, &blurB,
&waterR, &waterG, &waterB, &waterA);
m_nAmbientRed[h][w] = ambR; m_nAmbientRed[h][w] = ambR;
m_nAmbientGreen[h][w] = ambG; m_nAmbientGreen[h][w] = ambG;
m_nAmbientBlue[h][w] = ambB; m_nAmbientBlue[h][w] = ambB;
m_nAmbientRed_Obj[h][w] = ambobjR;
m_nAmbientGreen_Obj[h][w] = ambobjG;
m_nAmbientBlue_Obj[h][w] = ambobjB;
m_nAmbientRed_Bl[h][w] = ambblR;
m_nAmbientGreen_Bl[h][w] = ambblG;
m_nAmbientBlue_Bl[h][w] = ambblB;
m_nAmbientRed_Obj_Bl[h][w] = ambobjblR;
m_nAmbientGreen_Obj_Bl[h][w] = ambobjblG;
m_nAmbientBlue_Obj_Bl[h][w] = ambobjblB;
m_nDirectionalRed[h][w] = dirR; m_nDirectionalRed[h][w] = dirR;
m_nDirectionalGreen[h][w] = dirG; m_nDirectionalGreen[h][w] = dirG;
m_nDirectionalBlue[h][w] = dirB; m_nDirectionalBlue[h][w] = dirB;
@ -189,7 +234,7 @@ CTimeCycle::Initialise(void)
m_fSpriteBrightness[h][w] = sprBght; m_fSpriteBrightness[h][w] = sprBght;
m_nShadowStrength[h][w] = shad; m_nShadowStrength[h][w] = shad;
m_nLightShadowStrength[h][w] = lightShad; m_nLightShadowStrength[h][w] = lightShad;
m_nTreeShadowStrength[h][w] = treeShad; m_nPoleShadowStrength[h][w] = poleShad;
m_fFarClip[h][w] = farClp; m_fFarClip[h][w] = farClp;
m_fFogStart[h][w] = fogSt; m_fFogStart[h][w] = fogSt;
m_fLightsOnGroundBrightness[h][w] = lightGnd; m_fLightsOnGroundBrightness[h][w] = lightGnd;
@ -205,7 +250,10 @@ CTimeCycle::Initialise(void)
m_fBlurRed[h][w] = blurR; m_fBlurRed[h][w] = blurR;
m_fBlurGreen[h][w] = blurG; m_fBlurGreen[h][w] = blurG;
m_fBlurBlue[h][w] = blurB; m_fBlurBlue[h][w] = blurB;
m_fBlurAlpha[h][w] = blurA; m_fWaterRed[h][w] = waterR;
m_fWaterGreen[h][w] = waterG;
m_fWaterBlue[h][w] = waterB;
m_fWaterAlpha[h][w] = waterA;
} }
m_FogReduction = 0; m_FogReduction = 0;
@ -220,7 +268,7 @@ CTimeCycle::Update(void)
int h2 = (h1+1)%24; int h2 = (h1+1)%24;
int w1 = CWeather::OldWeatherType; int w1 = CWeather::OldWeatherType;
int w2 = CWeather::NewWeatherType; int w2 = CWeather::NewWeatherType;
float timeInterp = CClock::GetMinutes()/60.0f; float timeInterp = (CClock::GetMinutes() + CClock::GetSeconds()/60.0f)/60.0f;
// coefficients for a bilinear interpolation // coefficients for a bilinear interpolation
float c0 = (1.0f-timeInterp) * (1.0f-CWeather::InterpolationValue); float c0 = (1.0f-timeInterp) * (1.0f-CWeather::InterpolationValue);
float c1 = timeInterp * (1.0f-CWeather::InterpolationValue); float c1 = timeInterp * (1.0f-CWeather::InterpolationValue);
@ -240,16 +288,22 @@ CTimeCycle::Update(void)
m_fCurrentAmbientRed = INTERP(m_nAmbientRed); m_fCurrentAmbientRed = INTERP(m_nAmbientRed);
m_fCurrentAmbientGreen = INTERP(m_nAmbientGreen); m_fCurrentAmbientGreen = INTERP(m_nAmbientGreen);
m_fCurrentAmbientBlue = INTERP(m_nAmbientBlue); m_fCurrentAmbientBlue = INTERP(m_nAmbientBlue);
m_fCurrentAmbientRed /= 255.0f;
m_fCurrentAmbientGreen /= 255.0f; m_fCurrentAmbientRed_Obj = INTERP(m_nAmbientRed_Obj);
m_fCurrentAmbientBlue /= 255.0f; m_fCurrentAmbientGreen_Obj = INTERP(m_nAmbientGreen_Obj);
m_fCurrentAmbientBlue_Obj = INTERP(m_nAmbientBlue_Obj);
m_fCurrentAmbientRed_Bl = INTERP(m_nAmbientRed_Bl);
m_fCurrentAmbientGreen_Bl = INTERP(m_nAmbientGreen_Bl);
m_fCurrentAmbientBlue_Bl = INTERP(m_nAmbientBlue_Bl);
m_fCurrentAmbientRed_Obj_Bl = INTERP(m_nAmbientRed_Obj_Bl);
m_fCurrentAmbientGreen_Obj_Bl = INTERP(m_nAmbientGreen_Obj_Bl);
m_fCurrentAmbientBlue_Obj_Bl = INTERP(m_nAmbientBlue_Obj_Bl);
m_fCurrentDirectionalRed = INTERP(m_nDirectionalRed); m_fCurrentDirectionalRed = INTERP(m_nDirectionalRed);
m_fCurrentDirectionalGreen = INTERP(m_nDirectionalGreen); m_fCurrentDirectionalGreen = INTERP(m_nDirectionalGreen);
m_fCurrentDirectionalBlue = INTERP(m_nDirectionalBlue); m_fCurrentDirectionalBlue = INTERP(m_nDirectionalBlue);
m_fCurrentDirectionalRed /= 255.0f;
m_fCurrentDirectionalGreen /= 255.0f;
m_fCurrentDirectionalBlue /= 255.0f;
m_nCurrentSunCoreRed = INTERP(m_nSunCoreRed); m_nCurrentSunCoreRed = INTERP(m_nSunCoreRed);
m_nCurrentSunCoreGreen = INTERP(m_nSunCoreGreen); m_nCurrentSunCoreGreen = INTERP(m_nSunCoreGreen);
@ -264,7 +318,7 @@ CTimeCycle::Update(void)
m_fCurrentSpriteBrightness = INTERP(m_fSpriteBrightness); m_fCurrentSpriteBrightness = INTERP(m_fSpriteBrightness);
m_nCurrentShadowStrength = INTERP(m_nShadowStrength); m_nCurrentShadowStrength = INTERP(m_nShadowStrength);
m_nCurrentLightShadowStrength = INTERP(m_nLightShadowStrength); m_nCurrentLightShadowStrength = INTERP(m_nLightShadowStrength);
m_nCurrentTreeShadowStrength = INTERP(m_nTreeShadowStrength); m_nCurrentPoleShadowStrength = INTERP(m_nPoleShadowStrength);
m_fCurrentFarClip = INTERP(m_fFarClip); m_fCurrentFarClip = INTERP(m_fFarClip);
m_fCurrentFogStart = INTERP(m_fFogStart); m_fCurrentFogStart = INTERP(m_fFogStart);
m_fCurrentLightsOnGroundBrightness = INTERP(m_fLightsOnGroundBrightness); m_fCurrentLightsOnGroundBrightness = INTERP(m_fLightsOnGroundBrightness);
@ -284,26 +338,49 @@ CTimeCycle::Update(void)
m_fCurrentBlurRed = INTERP(m_fBlurRed); m_fCurrentBlurRed = INTERP(m_fBlurRed);
m_fCurrentBlurGreen = INTERP(m_fBlurGreen); m_fCurrentBlurGreen = INTERP(m_fBlurGreen);
m_fCurrentBlurBlue = INTERP(m_fBlurBlue); m_fCurrentBlurBlue = INTERP(m_fBlurBlue);
m_fCurrentBlurAlpha = INTERP(m_fBlurAlpha);
if(TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) m_fCurrentWaterRed = INTERP(m_fWaterRed);
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL); m_fCurrentWaterGreen = INTERP(m_fWaterGreen);
m_fCurrentWaterBlue = INTERP(m_fWaterBlue);
m_fCurrentWaterAlpha = INTERP(m_fWaterAlpha);
if(m_FogReduction != 0) if(m_FogReduction != 0)
m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f); m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
m_CurrentStoredValue = (m_CurrentStoredValue+1)&0xF; m_CurrentStoredValue = (m_CurrentStoredValue+1)&0xF;
float sunAngle = 2*PI*(CClock::GetMinutes() + CClock::GetHours()*60)/(24*60); float sunAngle = 2*PI*(CClock::GetSeconds()/60.0f + CClock::GetMinutes() + CClock::GetHours()*60)/(24*60);
CVector &sunPos = GetSunPosition(); CVector &sunPos = GetSunPosition();
sunPos.x = Sin(sunAngle); sunPos.x = Sin(sunAngle);
sunPos.y = 1.0f; sunPos.y = 1.0f;
sunPos.z = 0.2f - Cos(sunAngle); sunPos.z = 0.2f - Cos(sunAngle);
sunPos.Normalise(); sunPos.Normalise();
// TODO(MIAMI): extra colours
if(TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, 5, MBLUR_NORMAL);
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
m_fCurrentAmbientRed /= 255.0f;
m_fCurrentAmbientGreen /= 255.0f;
m_fCurrentAmbientBlue /= 255.0f;
m_fCurrentAmbientRed_Obj /= 255.0f;
m_fCurrentAmbientGreen_Obj /= 255.0f;
m_fCurrentAmbientBlue_Obj /= 255.0f;
m_fCurrentAmbientRed_Bl /= 255.0f;
m_fCurrentAmbientGreen_Bl /= 255.0f;
m_fCurrentAmbientBlue_Bl /= 255.0f;
m_fCurrentAmbientRed_Obj_Bl /= 255.0f;
m_fCurrentAmbientGreen_Obj_Bl /= 255.0f;
m_fCurrentAmbientBlue_Obj_Bl /= 255.0f;
m_fCurrentDirectionalRed /= 255.0f;
m_fCurrentDirectionalGreen /= 255.0f;
m_fCurrentDirectionalBlue /= 255.0f;
CShadows::CalcPedShadowValues(sunPos, CShadows::CalcPedShadowValues(sunPos,
&m_fShadowFrontX[m_CurrentStoredValue], &m_fShadowFrontY[m_CurrentStoredValue], &m_fShadowFrontX[m_CurrentStoredValue], &m_fShadowFrontY[m_CurrentStoredValue],
&m_fShadowSideX[m_CurrentStoredValue], &m_fShadowSideY[m_CurrentStoredValue], &m_fShadowSideX[m_CurrentStoredValue], &m_fShadowSideY[m_CurrentStoredValue],

View File

@ -5,6 +5,15 @@ class CTimeCycle
static int m_nAmbientRed[NUMHOURS][NUMWEATHERS]; static int m_nAmbientRed[NUMHOURS][NUMWEATHERS];
static int m_nAmbientGreen[NUMHOURS][NUMWEATHERS]; static int m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
static int m_nAmbientBlue[NUMHOURS][NUMWEATHERS]; static int m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
static int m_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS];
static int m_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS];
static int m_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS];
static int m_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS];
static int m_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS];
static int m_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS];
static int m_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS];
static int m_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS];
static int m_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS];
static int m_nDirectionalRed[NUMHOURS][NUMWEATHERS]; static int m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
static int m_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; static int m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
static int m_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; static int m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
@ -25,7 +34,7 @@ class CTimeCycle
static float m_fSpriteBrightness[NUMHOURS][NUMWEATHERS]; static float m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
static short m_nShadowStrength[NUMHOURS][NUMWEATHERS]; static short m_nShadowStrength[NUMHOURS][NUMWEATHERS];
static short m_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; static short m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
static short m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS]; static short m_nPoleShadowStrength[NUMHOURS][NUMWEATHERS];
static float m_fFogStart[NUMHOURS][NUMWEATHERS]; static float m_fFogStart[NUMHOURS][NUMWEATHERS];
static float m_fFarClip[NUMHOURS][NUMWEATHERS]; static float m_fFarClip[NUMHOURS][NUMWEATHERS];
static float m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS]; static float m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
@ -41,11 +50,23 @@ class CTimeCycle
static float m_fBlurRed[NUMHOURS][NUMWEATHERS]; static float m_fBlurRed[NUMHOURS][NUMWEATHERS];
static float m_fBlurGreen[NUMHOURS][NUMWEATHERS]; static float m_fBlurGreen[NUMHOURS][NUMWEATHERS];
static float m_fBlurBlue[NUMHOURS][NUMWEATHERS]; static float m_fBlurBlue[NUMHOURS][NUMWEATHERS];
static float m_fBlurAlpha[NUMHOURS][NUMWEATHERS]; static float m_fWaterRed[NUMHOURS][NUMWEATHERS];
static float m_fWaterGreen[NUMHOURS][NUMWEATHERS];
static float m_fWaterBlue[NUMHOURS][NUMWEATHERS];
static float m_fWaterAlpha[NUMHOURS][NUMWEATHERS];
static float m_fCurrentAmbientRed; static float m_fCurrentAmbientRed;
static float m_fCurrentAmbientGreen; static float m_fCurrentAmbientGreen;
static float m_fCurrentAmbientBlue; static float m_fCurrentAmbientBlue;
static float m_fCurrentAmbientRed_Obj;
static float m_fCurrentAmbientGreen_Obj;
static float m_fCurrentAmbientBlue_Obj;
static float m_fCurrentAmbientRed_Bl;
static float m_fCurrentAmbientGreen_Bl;
static float m_fCurrentAmbientBlue_Bl;
static float m_fCurrentAmbientRed_Obj_Bl;
static float m_fCurrentAmbientGreen_Obj_Bl;
static float m_fCurrentAmbientBlue_Obj_Bl;
static float m_fCurrentDirectionalRed; static float m_fCurrentDirectionalRed;
static float m_fCurrentDirectionalGreen; static float m_fCurrentDirectionalGreen;
static float m_fCurrentDirectionalBlue; static float m_fCurrentDirectionalBlue;
@ -66,7 +87,7 @@ class CTimeCycle
static float m_fCurrentSpriteBrightness; static float m_fCurrentSpriteBrightness;
static int m_nCurrentShadowStrength; static int m_nCurrentShadowStrength;
static int m_nCurrentLightShadowStrength; static int m_nCurrentLightShadowStrength;
static int m_nCurrentTreeShadowStrength; static int m_nCurrentPoleShadowStrength;
static float m_fCurrentFogStart; static float m_fCurrentFogStart;
static float m_fCurrentFarClip; static float m_fCurrentFarClip;
static float m_fCurrentLightsOnGroundBrightness; static float m_fCurrentLightsOnGroundBrightness;
@ -82,7 +103,10 @@ class CTimeCycle
static float m_fCurrentBlurRed; static float m_fCurrentBlurRed;
static float m_fCurrentBlurGreen; static float m_fCurrentBlurGreen;
static float m_fCurrentBlurBlue; static float m_fCurrentBlurBlue;
static float m_fCurrentBlurAlpha; static float m_fCurrentWaterRed;
static float m_fCurrentWaterGreen;
static float m_fCurrentWaterBlue;
static float m_fCurrentWaterAlpha;
static int m_nCurrentFogColourRed; static int m_nCurrentFogColourRed;
static int m_nCurrentFogColourGreen; static int m_nCurrentFogColourGreen;
static int m_nCurrentFogColourBlue; static int m_nCurrentFogColourBlue;
@ -102,6 +126,15 @@ public:
static float GetAmbientRed(void) { return m_fCurrentAmbientRed; } static float GetAmbientRed(void) { return m_fCurrentAmbientRed; }
static float GetAmbientGreen(void) { return m_fCurrentAmbientGreen; } static float GetAmbientGreen(void) { return m_fCurrentAmbientGreen; }
static float GetAmbientBlue(void) { return m_fCurrentAmbientBlue; } static float GetAmbientBlue(void) { return m_fCurrentAmbientBlue; }
static float GetAmbientRed_Obj(void) { return m_fCurrentAmbientRed_Obj; }
static float GetAmbientGreen_Obj(void) { return m_fCurrentAmbientGreen_Obj; }
static float GetAmbientBlue_Obj(void) { return m_fCurrentAmbientBlue_Obj; }
static float GetAmbientRed_Bl(void) { return m_fCurrentAmbientRed_Bl; }
static float GetAmbientGreen_Bl(void) { return m_fCurrentAmbientGreen_Bl; }
static float GetAmbientBlue_Bl(void) { return m_fCurrentAmbientBlue_Bl; }
static float GetAmbientRed_Obj_Bl(void) { return m_fCurrentAmbientRed_Obj_Bl; }
static float GetAmbientGreen_Obj_Bl(void) { return m_fCurrentAmbientGreen_Obj_Bl; }
static float GetAmbientBlue_Obj_Bl(void) { return m_fCurrentAmbientBlue_Obj_Bl; }
static float GetDirectionalRed(void) { return m_fCurrentDirectionalRed; } static float GetDirectionalRed(void) { return m_fCurrentDirectionalRed; }
static float GetDirectionalGreen(void) { return m_fCurrentDirectionalGreen; } static float GetDirectionalGreen(void) { return m_fCurrentDirectionalGreen; }
static float GetDirectionalBlue(void) { return m_fCurrentDirectionalBlue; } static float GetDirectionalBlue(void) { return m_fCurrentDirectionalBlue; }

View File

@ -8,6 +8,7 @@
#include "Weather.h" #include "Weather.h"
#include "ZoneCull.h" #include "ZoneCull.h"
#include "Frontend.h" #include "Frontend.h"
#include "MBlur.h"
RpLight *pAmbient; RpLight *pAmbient;
RpLight *pDirect; RpLight *pDirect;
@ -22,6 +23,7 @@ RwRGBAReal DirectionalLightColourForFrame;
RwRGBAReal AmbientLightColour; RwRGBAReal AmbientLightColour;
RwRGBAReal DirectionalLightColour; RwRGBAReal DirectionalLightColour;
//--MIAMI: done
void void
SetLightsWithTimeOfDayColour(RpWorld *) SetLightsWithTimeOfDayColour(RpWorld *)
{ {
@ -29,17 +31,35 @@ SetLightsWithTimeOfDayColour(RpWorld *)
RwMatrix mat; RwMatrix mat;
if(pAmbient){ if(pAmbient){
if(CMBlur::BlurOn){
AmbientLightColourForFrame.red = CTimeCycle::GetAmbientRed_Bl() * CCoronas::LightsMult;
AmbientLightColourForFrame.green = CTimeCycle::GetAmbientGreen_Bl() * CCoronas::LightsMult;
AmbientLightColourForFrame.blue = CTimeCycle::GetAmbientBlue_Bl() * CCoronas::LightsMult;
}else{
AmbientLightColourForFrame.red = CTimeCycle::GetAmbientRed() * CCoronas::LightsMult; AmbientLightColourForFrame.red = CTimeCycle::GetAmbientRed() * CCoronas::LightsMult;
AmbientLightColourForFrame.green = CTimeCycle::GetAmbientGreen() * CCoronas::LightsMult; AmbientLightColourForFrame.green = CTimeCycle::GetAmbientGreen() * CCoronas::LightsMult;
AmbientLightColourForFrame.blue = CTimeCycle::GetAmbientBlue() * CCoronas::LightsMult; AmbientLightColourForFrame.blue = CTimeCycle::GetAmbientBlue() * CCoronas::LightsMult;
}
if(CMBlur::BlurOn){
AmbientLightColourForFrame_PedsCarsAndObjects.red = CTimeCycle::GetAmbientRed_Obj_Bl() * CCoronas::LightsMult;
AmbientLightColourForFrame_PedsCarsAndObjects.green = CTimeCycle::GetAmbientGreen_Obj_Bl() * CCoronas::LightsMult;
AmbientLightColourForFrame_PedsCarsAndObjects.blue = CTimeCycle::GetAmbientBlue_Obj_Bl() * CCoronas::LightsMult;
}else{
AmbientLightColourForFrame_PedsCarsAndObjects.red = CTimeCycle::GetAmbientRed_Obj() * CCoronas::LightsMult;
AmbientLightColourForFrame_PedsCarsAndObjects.green = CTimeCycle::GetAmbientGreen_Obj() * CCoronas::LightsMult;
AmbientLightColourForFrame_PedsCarsAndObjects.blue = CTimeCycle::GetAmbientBlue_Obj() * CCoronas::LightsMult;
}
if(CWeather::LightningFlash && !CCullZones::CamNoRain()){ if(CWeather::LightningFlash && !CCullZones::CamNoRain()){
AmbientLightColourForFrame.red = 1.0f; AmbientLightColourForFrame.red = 1.0f;
AmbientLightColourForFrame.green = 1.0f; AmbientLightColourForFrame.green = 1.0f;
AmbientLightColourForFrame.blue = 1.0f; AmbientLightColourForFrame.blue = 1.0f;
AmbientLightColourForFrame_PedsCarsAndObjects.red = 1.0f;
AmbientLightColourForFrame_PedsCarsAndObjects.green = 1.0f;
AmbientLightColourForFrame_PedsCarsAndObjects.blue = 1.0f;
} }
AmbientLightColourForFrame_PedsCarsAndObjects.red = Min(1.0f, AmbientLightColourForFrame.red*1.3f);
AmbientLightColourForFrame_PedsCarsAndObjects.green = Min(1.0f, AmbientLightColourForFrame.green*1.3f);
AmbientLightColourForFrame_PedsCarsAndObjects.blue = Min(1.0f, AmbientLightColourForFrame.blue*1.3f);
RpLightSetColor(pAmbient, &AmbientLightColourForFrame); RpLightSetColor(pAmbient, &AmbientLightColourForFrame);
} }