summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/sampman_oal.cpp6
-rw-r--r--src/control/Darkel.cpp16
-rw-r--r--src/control/Darkel.h6
-rw-r--r--src/core/CdStreamPosix.cpp11
-rw-r--r--src/core/ControllerConfig.cpp10
-rw-r--r--src/core/FileMgr.h1
-rw-r--r--src/core/Game.cpp4
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp38
-rw-r--r--src/core/re3.cpp9
-rw-r--r--src/extras/postfx.cpp475
-rw-r--r--src/extras/postfx.h35
-rw-r--r--src/extras/shaders/Makefile16
-rw-r--r--src/extras/shaders/colourfilterIII.frag28
-rw-r--r--src/extras/shaders/colourfilterIII_PS.csobin0 -> 452 bytes
-rw-r--r--src/extras/shaders/colourfilterIII_PS.hlsl15
-rw-r--r--src/extras/shaders/colourfilterIII_PS.inc40
-rw-r--r--src/extras/shaders/colourfilterIII_fs_gl3.inc30
-rw-r--r--src/extras/shaders/contrast.frag18
-rw-r--r--src/extras/shaders/contrastPS.csobin0 -> 344 bytes
-rw-r--r--src/extras/shaders/contrastPS.hlsl21
-rw-r--r--src/extras/shaders/contrastPS.inc31
-rw-r--r--src/extras/shaders/contrast_fs_gl3.inc20
-rw-r--r--src/extras/shaders/im2d.vert21
-rw-r--r--src/extras/shaders/im2d_gl3.inc23
-rw-r--r--src/extras/shaders/make.cmd3
-rw-r--r--src/extras/shaders/makeinc.sh5
-rw-r--r--src/peds/Ped.cpp6
-rw-r--r--src/render/Clouds.cpp84
-rw-r--r--src/render/Coronas.cpp41
-rw-r--r--src/render/Hud.cpp63
-rw-r--r--src/render/MBlur.cpp16
-rw-r--r--src/render/PointLights.cpp13
-rw-r--r--src/render/Renderer.cpp9
-rw-r--r--src/render/Sprite2d.cpp17
-rw-r--r--src/render/Timecycle.cpp120
-rw-r--r--src/render/Timecycle.h172
-rw-r--r--src/skel/glfw/glfw.cpp20
-rw-r--r--src/skel/platform.h1
-rw-r--r--src/skel/skeleton.cpp9
-rw-r--r--src/skel/skeleton.h3
-rw-r--r--src/skel/win/win.cpp26
42 files changed, 1214 insertions, 269 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 0e173152..5e4b5aba 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -587,16 +587,16 @@ cSampleManager::Initialise(void)
}
nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = (uintptr)malloc(nSampleBankSize[SAMPLEBANK_MAIN]);
- ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != NULL);
+ ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0);
- if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == NULL )
+ if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == 0 )
{
Terminate();
return false;
}
nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX);
- ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != NULL);
+ ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0);
}
diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp
index cfd58340..02627f33 100644
--- a/src/control/Darkel.cpp
+++ b/src/control/Darkel.cpp
@@ -30,9 +30,9 @@ int8 CDarkel::InterruptedWeapon;
* makes game handle sounds & messages instead of SCM (just like in GTA2)
* but it's never been used in the game. Has unused sliding text when frenzy completed etc.
*/
-int8 CDarkel::bStandardSoundAndMessages;
-int8 CDarkel::bNeedHeadShot;
-int8 CDarkel::bProperKillFrenzy;
+bool CDarkel::bStandardSoundAndMessages;
+bool CDarkel::bNeedHeadShot;
+bool CDarkel::bProperKillFrenzy;
uint16 CDarkel::Status;
uint16 CDarkel::RegisteredKills[NUM_DEFAULT_MODELS];
int32 CDarkel::ModelToKill;
@@ -108,9 +108,15 @@ CDarkel::DrawMessages()
sprintf(gString, "%d", (CDarkel::KillsNeeded >= 0 ? CDarkel::KillsNeeded : 0));
AsciiToUnicode(gString, gUString);
CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString);
+#ifdef FIX_BUGS
+#define DARKEL_COUNTER_HEIGHT 143.0f
+#else
+#define DARKEL_COUNTER_HEIGHT 128.0f
+#endif
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT + 1.0f), gUString);
CFont::SetColor(CRGBA(255, 128, 128, 255));
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(143.0f), gUString);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT), gUString);
+#undef DARKEL_COUNTER_HEIGHT
break;
}
case KILLFRENZY_PASSED:
diff --git a/src/control/Darkel.h b/src/control/Darkel.h
index 14529c63..0f5c2329 100644
--- a/src/control/Darkel.h
+++ b/src/control/Darkel.h
@@ -24,9 +24,9 @@ private:
static int32 AmmoInterruptedWeapon;
static int32 KillsNeeded;
static int8 InterruptedWeapon;
- static int8 bStandardSoundAndMessages;
- static int8 bNeedHeadShot;
- static int8 bProperKillFrenzy;
+ static bool bStandardSoundAndMessages;
+ static bool bNeedHeadShot;
+ static bool bProperKillFrenzy;
static uint16 Status;
static uint16 RegisteredKills[NUM_DEFAULT_MODELS];
static int32 ModelToKill;
diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp
index 45fd9832..e114a29a 100644
--- a/src/core/CdStreamPosix.cpp
+++ b/src/core/CdStreamPosix.cpp
@@ -150,9 +150,11 @@ CdStreamInit(int32 numChannels)
ASSERT(0);
return;
}
-
+#ifdef __linux__
_gdwCdStreamFlags = O_RDONLY | O_NOATIME;
-
+#else
+ _gdwCdStreamFlags = O_RDONLY;
+#endif
// People say it's slower
/*
if ( fsInfo.f_bsize <= CDSTREAM_SECTOR_SIZE )
@@ -400,9 +402,12 @@ void *CdStreamThread(void *param)
if (gCdStreamThreadStatus == 0){
gCdStreamThreadStatus = 1;
#endif
+
+#ifdef __linux__
pid_t tid = syscall(SYS_gettid);
int ret = setpriority(PRIO_PROCESS, tid, getpriority(PRIO_PROCESS, getpid()) + 1);
- }
+#endif
+ }
// spurious wakeup or we sent interrupt signal for flushing
if(pChannel->nSectorsToRead == 0)
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index 6a5080e5..fe1821c2 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -633,6 +633,11 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown(int32 button,
}
AffectControllerStateOn_ButtonDown_AllStates(button, type, *state);
+
+#ifdef REGISTER_START_BUTTON
+ if (button == 12)
+ state->Start = 255;
+#endif
}
}
}
@@ -1036,6 +1041,11 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonUp(int32 button, eC
{
if (FrontEndMenuManager.GetIsMenuActive())
AffectControllerStateOn_ButtonUp_All_Player_States(button, type, *state);
+
+#ifdef REGISTER_START_BUTTON
+ if (button == 12)
+ state->Start = 0;
+#endif
}
}
}
diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h
index 0ad9daa7..4734720e 100644
--- a/src/core/FileMgr.h
+++ b/src/core/FileMgr.h
@@ -19,4 +19,5 @@ public:
static bool ReadLine(int fd, char *buf, int len);
static int CloseFile(int fd);
static int GetErrorReadWrite(int fd);
+ static char *GetRootDirName() { return ms_rootDirName; }
};
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 08623c65..d5b376f6 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -87,6 +87,7 @@
#include "Zones.h"
#include "debugmenu.h"
#include "frontendoption.h"
+#include "postfx.h"
eLevelName CGame::currLevel;
bool CGame::bDemoMode = true;
@@ -148,6 +149,9 @@ CGame::InitialiseOnceBeforeRW(void)
CFileMgr::Initialise();
CdStreamInit(MAX_CDCHANNELS);
ValidateVersion();
+#ifdef EXTENDED_COLOURFILTER
+ CPostFX::InitOnce();
+#endif
return true;
}
diff --git a/src/core/config.h b/src/core/config.h
index 43fc54fa..bb6adce6 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -208,6 +208,7 @@ enum Config {
//#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
//#define USE_TEXTURE_POOL
#define CUTSCENE_BORDERS_SWITCH
+//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
// Particle
//#define PC_PARTICLE
diff --git a/src/core/main.cpp b/src/core/main.cpp
index b63688ec..8458a248 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -2,6 +2,7 @@
#include "rpmatfx.h"
#include "rphanim.h"
#include "rpskin.h"
+#include "rtbmp.h"
#include "main.h"
#include "CdStream.h"
@@ -61,6 +62,7 @@
#include "MemoryCard.h"
#include "SceneEdit.h"
#include "debugmenu.h"
+#include "Clock.h"
GlobalScene Scene;
@@ -288,6 +290,28 @@ DoFade(void)
}
}
+bool
+RwGrabScreen(RwCamera *camera, RwChar *filename)
+{
+ char temp[255];
+ RwImage *pImage = RsGrabScreen(camera);
+ bool result = true;
+
+ if (pImage == nil)
+ return false;
+
+ strcpy(temp, CFileMgr::GetRootDirName());
+ strcat(temp, filename);
+
+ if (RtBMPImageWrite(pImage, &temp[0]) == nil)
+ result = false;
+ RwImageDestroy(pImage);
+ return result;
+}
+
+#define TILE_WIDTH 576
+#define TILE_HEIGHT 432
+
void
DoRWStuffEndOfFrame(void)
{
@@ -296,6 +320,20 @@ DoRWStuffEndOfFrame(void)
FlushObrsPrintfs();
RwCameraEndUpdate(Scene.camera);
RsCameraShowRaster(Scene.camera);
+#ifndef MASTER
+ char s[48];
+ if (CPad::GetPad(1)->GetLeftShockJustDown()) {
+ // try using both controllers for this thing... crazy bastards
+ if (CPad::GetPad(0)->GetRightStickY() > 0) {
+ sprintf(s, "screen%d%d.ras", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes);
+ // TODO
+ //RtTileRender(Scene.camera, TILE_WIDTH * 2, TILE_HEIGHT * 2, TILE_WIDTH, TILE_HEIGHT, &NewTileRendererCB, nil, s);
+ } else {
+ sprintf(s, "screen%d%d.bmp", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes);
+ RwGrabScreen(Scene.camera, s);
+ }
+ }
+#endif // !MASTER
}
static RwBool
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index f9be4b51..9edd9497 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -29,6 +29,8 @@
#include "Text.h"
#include "WaterLevel.h"
#include "main.h"
+#include "MBlur.h"
+#include "postfx.h"
#ifndef _WIN32
#include "assert.h"
@@ -461,6 +463,13 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
+#ifdef EXTENDED_COLOURFILTER
+ static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
+ e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);
+ DebugMenuEntrySetWrap(e, true);
+ DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f);
+ DebugMenuAddVarBool8("Render", "Motion Blur", &CPostFX::MotionBlurOn, nil);
+#endif
DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil);
DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil);
DebugMenuAddVarBool8("Render", "Show Car Path Links", &gbShowCarPathsLinks, nil);
diff --git a/src/extras/postfx.cpp b/src/extras/postfx.cpp
new file mode 100644
index 00000000..6355dfb1
--- /dev/null
+++ b/src/extras/postfx.cpp
@@ -0,0 +1,475 @@
+#define WITHWINDOWS
+#define WITH_D3D
+#include "common.h"
+
+#ifdef EXTENDED_COLOURFILTER
+
+#ifndef LIBRW
+#error "Need librw for EXTENDED_COLOURFILTER"
+#endif
+
+#include "RwHelper.h"
+#include "Camera.h"
+#include "MBlur.h"
+#include "postfx.h"
+
+RwRaster *CPostFX::pFrontBuffer;
+RwRaster *CPostFX::pBackBuffer;
+bool CPostFX::bJustInitialised;
+int CPostFX::EffectSwitch = POSTFX_NORMAL;
+bool CPostFX::MotionBlurOn = false;
+
+static RwIm2DVertex Vertex[4];
+static RwIm2DVertex Vertex2[4];
+static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
+
+#ifdef RW_D3D9
+void *colourfilterIII_PS;
+void *contrast_PS;
+#endif
+#ifdef RW_OPENGL
+int32 u_blurcolor;
+int32 u_contrastAdd;
+int32 u_contrastMult;
+rw::gl3::Shader *colourFilterIII;
+rw::gl3::Shader *contrast;
+#endif
+
+void
+CPostFX::InitOnce(void)
+{
+#ifdef RW_OPENGL
+ u_blurcolor = rw::gl3::registerUniform("u_blurcolor");
+ u_contrastAdd = rw::gl3::registerUniform("u_contrastAdd");
+ u_contrastMult = rw::gl3::registerUniform("u_contrastMult");
+#endif
+}
+
+void
+CPostFX::Open(RwCamera *cam)
+{
+ uint32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1);
+ uint32 height = Pow(2.0f, int32(log2(RwRasterGetHeight(RwCameraGetRaster(cam))))+1);
+ uint32 depth = RwRasterGetDepth(RwCameraGetRaster(cam));
+ pFrontBuffer = RwRasterCreate(width, height, depth, rwRASTERTYPECAMERATEXTURE);
+ pBackBuffer = RwRasterCreate(width, height, depth, rwRASTERTYPECAMERATEXTURE);
+ bJustInitialised = true;
+
+ float zero, xmax, ymax;
+
+ if(RwRasterGetDepth(RwCameraGetRaster(cam)) == 16){
+ zero = HALFPX;
+ xmax = width + HALFPX;
+ ymax = height + HALFPX;
+ }else{
+ zero = -HALFPX;
+ xmax = width - HALFPX;
+ ymax = height - HALFPX;
+ }
+
+ RwIm2DVertexSetScreenX(&Vertex[0], zero);
+ RwIm2DVertexSetScreenY(&Vertex[0], zero);
+ RwIm2DVertexSetScreenZ(&Vertex[0], RwIm2DGetNearScreenZ());
+ RwIm2DVertexSetCameraZ(&Vertex[0], RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetRecipCameraZ(&Vertex[0], 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetU(&Vertex[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetV(&Vertex[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetIntRGBA(&Vertex[0], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&Vertex[1], zero);
+ RwIm2DVertexSetScreenY(&Vertex[1], ymax);
+ RwIm2DVertexSetScreenZ(&Vertex[1], RwIm2DGetNearScreenZ());
+ RwIm2DVertexSetCameraZ(&Vertex[1], RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetRecipCameraZ(&Vertex[1], 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetU(&Vertex[1], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetV(&Vertex[1], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetIntRGBA(&Vertex[1], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&Vertex[2], xmax);
+ RwIm2DVertexSetScreenY(&Vertex[2], ymax);
+ RwIm2DVertexSetScreenZ(&Vertex[2], RwIm2DGetNearScreenZ());
+ RwIm2DVertexSetCameraZ(&Vertex[2], RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetRecipCameraZ(&Vertex[2], 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetU(&Vertex[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetV(&Vertex[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetIntRGBA(&Vertex[2], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&Vertex[3], xmax);
+ RwIm2DVertexSetScreenY(&Vertex[3], zero);
+ RwIm2DVertexSetScreenZ(&Vertex[3], RwIm2DGetNearScreenZ());
+ RwIm2DVertexSetCameraZ(&Vertex[3], RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetRecipCameraZ(&Vertex[3], 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetU(&Vertex[3], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetV(&Vertex[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
+ RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, 255);
+
+
+ RwIm2DVertexSetScreenX(&Vertex2[0], zero + 2.0f);
+ RwIm2DVertexSetScreenY(&Vertex2[0], zero + 2.0f);
+ 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], 2.0f);
+ RwIm2DVertexSetScreenY(&Vertex2[1], ymax + 2.0f);
+ 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 + 2.0f);
+ RwIm2DVertexSetScreenY(&Vertex2[2], ymax + 2.0f);
+ 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 + 2.0f);
+ RwIm2DVertexSetScreenY(&Vertex2[3], zero + 2.0f);
+ 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);
+
+
+#ifdef RW_D3D9
+#include "shaders/colourfilterIII_PS.inc"
+ colourfilterIII_PS = rw::d3d::createPixelShader(colourfilterIII_PS_cso);
+#include "shaders/contrastPS.inc"
+ contrast_PS = rw::d3d::createPixelShader(contrastPS_cso);
+#endif
+#ifdef RW_OPENGL
+ using namespace rw::gl3;
+ {
+#ifdef RW_GLES2
+#include "gl2_shaders/im2d_gl2.inc"
+#include "gl2_shaders/colourfilterIII_fs_gl2.inc"
+#else
+#include "shaders/im2d_gl3.inc"
+#include "shaders/colourfilterIII_fs_gl3.inc"
+#endif
+ const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil };
+ const char *fs[] = { shaderDecl, header_frag_src, colourfilterIII_frag_src, nil };
+ colourFilterIII = Shader::create(vs, fs);
+ assert(colourFilterIII);
+ }
+
+ {
+#ifdef RW_GLES2
+#include "gl2_shaders/im2d_gl2.inc"
+#include "gl2_shaders/contrast_fs_gl2.inc"
+#else
+#include "shaders/im2d_gl3.inc"
+#include "shaders/contrast_fs_gl3.inc"
+ const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil };
+ const char *fs[] = { shaderDecl, header_frag_src, contrast_frag_src, nil };
+ contrast = Shader::create(vs, fs);
+ assert(contrast);
+#endif
+ }
+
+#endif
+}
+
+void
+CPostFX::Close(void)
+{
+ if(pFrontBuffer){
+ RwRasterDestroy(pFrontBuffer);
+ pFrontBuffer = nil;
+ }
+ if(pBackBuffer){
+ RwRasterDestroy(pBackBuffer);
+ pBackBuffer = nil;
+ }
+#ifdef RW_D3D9
+ if(colourfilterIII_PS){
+ rw::d3d::destroyPixelShader(colourfilterIII_PS);
+ colourfilterIII_PS = nil;
+ }
+ if(contrast_PS){
+ rw::d3d::destroyPixelShader(contrast_PS);
+ contrast_PS = nil;
+ }
+#endif
+#ifdef RW_OPENGL
+ if(colourFilterIII){
+ colourFilterIII->destroy();
+ colourFilterIII = nil;
+ }
+ if(contrast){
+ contrast->destroy();
+ contrast = nil;
+ }
+#endif
+}
+
+void
+CPostFX::RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
+{
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+
+ RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a);
+ RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, a);
+ RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, a);
+ RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, a);
+
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+
+ RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
+}
+
+void
+CPostFX::RenderOverlaySimple(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
+{
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+
+ r *= 0.6f;
+ g *= 0.6f;
+ b *= 0.6f;
+ a *= 0.6f;
+
+ RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a);
+ RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, a);
+ RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, a);
+ RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, a);
+
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+
+ RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
+}
+
+void
+CPostFX::RenderOverlaySniper(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
+{
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+
+ RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, 80);
+ RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, 80);
+ RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, 80);
+ RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, 80);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+
+ RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
+}
+
+float CPostFX::Intensity = 1.0f;
+
+void
+CPostFX::RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
+{
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pBackBuffer);
+
+ if(EffectSwitch == POSTFX_MOBILE){
+ float mult[3], add[3];
+ mult[0] = (r-64)/384.0f + 1.14f;
+ mult[1] = (g-64)/384.0f + 1.14f;
+ mult[2] = (b-64)/384.0f + 1.14f;
+ add[0] = r/1536.f;
+ add[1] = g/1536.f;
+ add[2] = b/1536.f;
+#ifdef RW_D3D9
+ rw::d3d::d3ddevice->SetPixelShaderConstantF(10, mult, 1);
+ rw::d3d::d3ddevice->SetPixelShaderConstantF(11, add, 1);
+
+ rw::d3d::im2dOverridePS = contrast_PS;
+#endif
+#ifdef RW_OPENGL
+ rw::gl3::im2dOverrideShader = contrast;
+ contrast->use();
+ glUniform3fv(contrast->uniformLocations[u_contrastMult], 1, mult);
+ glUniform3fv(contrast->uniformLocations[u_contrastAdd], 1, add);
+#endif
+ }else{
+ float f = Intensity;
+ float blurcolors[4];
+ blurcolors[0] = r/255.0f;
+ blurcolors[1] = g/255.0f;
+ blurcolors[2] = b/255.0f;
+ blurcolors[3] = a*f/255.0f;
+#ifdef RW_D3D9
+ rw::d3d::d3ddevice->SetPixelShaderConstantF(10, blurcolors, 1);
+ rw::d3d::im2dOverridePS = colourfilterIII_PS;
+#endif
+#ifdef RW_OPENGL
+ rw::gl3::im2dOverrideShader = colourFilterIII;
+ colourFilterIII->use();
+ glUniform4fv(colourFilterIII->uniformLocations[u_blurcolor], 1, blurcolors);
+#endif
+ }
+ RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
+#ifdef RW_D3D9
+ rw::d3d::im2dOverridePS = nil;
+#endif
+#ifdef RW_OPENGL
+ rw::gl3::im2dOverrideShader = nil;
+#endif
+}
+
+void
+CPostFX::RenderMotionBlur(RwCamera *cam, uint32 blur)
+{
+ if(blur == 0)
+ return;
+
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+
+ RwIm2DVertexSetIntRGBA(&Vertex[0], 255, 255, 255, blur);
+ RwIm2DVertexSetIntRGBA(&Vertex[1], 255, 255, 255, blur);
+ RwIm2DVertexSetIntRGBA(&Vertex[2], 255, 255, 255, blur);
+ RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, blur);
+
+ RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
+}
+
+bool
+CPostFX::NeedBackBuffer(void)
+{
+ // Current frame -- needed for non-blur effect
+ switch(EffectSwitch){
+ case POSTFX_OFF:
+ // no actual rendering here
+ return false;
+ case POSTFX_SIMPLE:
+ return false;
+ case POSTFX_NORMAL:
+ if(MotionBlurOn)
+ return false;
+ else
+ return true;
+ case POSTFX_MOBILE:
+ return true;
+ }
+ return false;
+}
+
+bool
+CPostFX::NeedFrontBuffer(int32 type)
+{
+ // Last frame -- needed for motion blur
+ if(MotionBlurOn)
+ return true;
+ if(type == MOTION_BLUR_SNIPER)
+ return true;
+
+ return false;
+}
+
+void
+CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha)
+{
+ switch(type)
+ {
+ case MOTION_BLUR_SECURITY_CAM:
+ red = 0;
+ green = 255;
+ blue = 0;
+ blur = 128;
+ break;
+ case MOTION_BLUR_INTRO:
+ red = 100;
+ green = 220;
+ blue = 230;
+ blur = 158;
+ break;
+ case MOTION_BLUR_INTRO2:
+ red = 80;
+ green = 255;
+ blue = 230;
+ blur = 138;
+ break;
+ case MOTION_BLUR_INTRO3:
+ red = 255;
+ green = 60;
+ blue = 60;
+ blur = 200;
+ break;
+ case MOTION_BLUR_INTRO4:
+ red = 255;
+ green = 180;
+ blue = 180;
+ blur = 128;
+ break;
+ }
+
+ if(pFrontBuffer == nil)
+ Open(cam);
+ assert(pFrontBuffer);
+ assert(pBackBuffer);
+
+ if(NeedBackBuffer()){
+ RwRasterPushContext(pBackBuffer);
+ RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
+ RwRasterPopContext();
+ }
+
+ DefinedState();
+
+ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+
+ if(type == MOTION_BLUR_SNIPER){
+ if(!bJustInitialised)
+ RenderOverlaySniper(cam, red, green, blue, blur);
+ }else switch(EffectSwitch){
+ case POSTFX_OFF:
+ // no actual rendering here
+ break;
+ case POSTFX_SIMPLE:
+ RenderOverlaySimple(cam, red, green, blue, blur);
+ break;
+ case POSTFX_NORMAL:
+ if(MotionBlurOn){
+ if(!bJustInitialised)
+ RenderOverlayBlur(cam, red, green, blue, blur);
+ }else{
+ RenderOverlayShader(cam, red, green, blue, blur);
+ }
+ break;
+ case POSTFX_MOBILE:
+ RenderOverlayShader(cam, red, green, blue, blur);
+ break;
+ }
+
+ // TODO? maybe we want this even without motion blur on sometimes?
+ if(MotionBlurOn)
+ if(!bJustInitialised)
+ RenderMotionBlur(cam, bluralpha);
+
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+
+ if(NeedFrontBuffer(type)){
+ RwRasterPushContext(pFrontBuffer);
+ RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
+ RwRasterPopContext();
+ bJustInitialised = false;
+ }else
+ bJustInitialised = true;
+}
+
+#endif
diff --git a/src/extras/postfx.h b/src/extras/postfx.h
new file mode 100644
index 00000000..658c2d88
--- /dev/null
+++ b/src/extras/postfx.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#ifdef EXTENDED_COLOURFILTER
+
+class CPostFX
+{
+public:
+ enum {
+ POSTFX_OFF,
+ POSTFX_SIMPLE,
+ POSTFX_NORMAL,
+ POSTFX_MOBILE
+ };
+ static RwRaster *pFrontBuffer;
+ static RwRaster *pBackBuffer;
+ static bool bJustInitialised;
+ static int EffectSwitch;
+ static bool MotionBlurOn; // or use CMblur for that?
+ static float Intensity;
+
+ static void InitOnce(void);
+ static void Open(RwCamera *cam);
+ static void Close(void);
+ static void RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a);
+ static void RenderOverlaySimple(RwCamera *cam, int32 r, int32 g, int32 b, int32 a);
+ static void RenderOverlaySniper(RwCamera *cam, int32 r, int32 g, int32 b, int32 a);
+ static void RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a);
+ static void RenderMotionBlur(RwCamera *cam, uint32 blur);
+ static void Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha);
+ static bool NeedBackBuffer(void);
+ static bool NeedFrontBuffer(int32 type);
+ static bool UseBlurColours(void) { return EffectSwitch != POSTFX_SIMPLE; }
+};
+
+#endif
diff --git a/src/extras/shaders/Makefile b/src/extras/shaders/Makefile
new file mode 100644
index 00000000..87be011e
--- /dev/null
+++ b/src/extras/shaders/Makefile
@@ -0,0 +1,16 @@
+all: im2d_gl3.inc colourfilterIII_fs_gl3.inc contrast_fs_gl3.inc
+
+im2d_gl3.inc: im2d.vert
+ (echo 'const char *im2d_vert_src =';\
+ sed 's/..*/"&\\n"/' im2d.vert;\
+ echo ';') >im2d_gl3.inc
+
+colourfilterIII_fs_gl3.inc: colourfilterIII.frag
+ (echo 'const char *colourfilterIII_frag_src =';\
+ sed 's/..*/"&\\n"/' colourfilterIII.frag;\
+ echo ';') >colourfilterIII_fs_gl3.inc
+
+contrast_fs_gl3.inc: contrast.frag
+ (echo 'const char *contrast_frag_src =';\
+ sed 's/..*/"&\\n"/' contrast.frag;\
+ echo ';') >contrast_fs_gl3.inc
diff --git a/src/extras/shaders/colourfilterIII.frag b/src/extras/shaders/colourfilterIII.frag
new file mode 100644
index 00000000..e19a8600
--- /dev/null
+++ b/src/extras/shaders/colourfilterIII.frag
@@ -0,0 +1,28 @@
+uniform sampler2D tex0;
+uniform vec4 u_blurcolor;
+
+in vec4 v_color;
+in vec2 v_tex0;
+in float v_fog;
+
+out vec4 color;
+
+void
+main(void)
+{
+ float a = u_blurcolor.a;
+
+ vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);
+ vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
+ vec4 prev = dst;
+ for(int i = 0; i < 5; i++){
+// vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);
+ vec4 tmp = dst*(1.0-a) + prev*doublec*a;
+ tmp += prev*u_blurcolor;
+ tmp += prev*u_blurcolor;
+ prev = clamp(tmp, 0.0, 1.0);
+ }
+ color.rgb = prev.rgb;
+ color.a = 1.0f;
+}
+
diff --git a/src/extras/shaders/colourfilterIII_PS.cso b/src/extras/shaders/colourfilterIII_PS.cso
new file mode 100644
index 00000000..cc41bcec
--- /dev/null
+++ b/src/extras/shaders/colourfilterIII_PS.cso
Binary files differ
diff --git a/src/extras/shaders/colourfilterIII_PS.hlsl b/src/extras/shaders/colourfilterIII_PS.hlsl
new file mode 100644
index 00000000..27f099ef
--- /dev/null
+++ b/src/extras/shaders/colourfilterIII_PS.hlsl
@@ -0,0 +1,15 @@
+sampler2D tex : register(s0);
+float4 blurcol : register(c10);
+
+float4 main(in float2 texcoord : TEXCOORD0) : COLOR0
+{
+ float a = blurcol.a;
+ float4 dst = tex2D(tex, texcoord.xy);
+ float4 prev = dst;
+ for(int i = 0; i < 5; i++){
+ float4 tmp = dst*(1-a) + prev*blurcol*a;
+ prev = saturate(tmp);
+ }
+ prev.a = 1.0f;
+ return prev;
+}
diff --git a/src/extras/shaders/colourfilterIII_PS.inc b/src/extras/shaders/colourfilterIII_PS.inc
new file mode 100644
index 00000000..db49de6c
--- /dev/null
+++ b/src/extras/shaders/colourfilterIII_PS.inc
@@ -0,0 +1,40 @@
+static unsigned char colourfilterIII_PS_cso[] = {
+ 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42,
+ 0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
+ 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00,
+ 0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
+ 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72,
+ 0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00,
+ 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d,
+ 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29,
+ 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72,
+ 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e,
+ 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00,
+ 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0,
+ 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0,
+ 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0,
+ 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80,
+ 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04,
+ 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80,
+ 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80,
+ 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04,
+ 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80,
+ 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80,
+ 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04,
+ 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80,
+ 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80,
+ 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04,
+ 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80,
+ 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80,
+ 0x02, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04,
+ 0x02, 0x00, 0x17, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80,
+ 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x08, 0x80,
+ 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80,
+ 0x02, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00
+};
diff --git a/src/extras/shaders/colourfilterIII_fs_gl3.inc b/src/extras/shaders/colourfilterIII_fs_gl3.inc
new file mode 100644
index 00000000..f57b9cdd
--- /dev/null
+++ b/src/extras/shaders/colourfilterIII_fs_gl3.inc
@@ -0,0 +1,30 @@
+const char *colourfilterIII_frag_src =
+"uniform sampler2D tex0;\n"
+"uniform vec4 u_blurcolor;\n"
+
+"in vec4 v_color;\n"
+"in vec2 v_tex0;\n"
+"in float v_fog;\n"
+
+"out vec4 color;\n"
+
+"void\n"
+"main(void)\n"
+"{\n"
+" float a = u_blurcolor.a;\n"
+
+" vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);\n"
+" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
+" vec4 prev = dst;\n"
+" for(int i = 0; i < 5; i++){\n"
+"// vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);\n"
+" vec4 tmp = dst*(1.0-a) + prev*doublec*a;\n"
+" tmp += prev*u_blurcolor;\n"
+" tmp += prev*u_blurcolor;\n"
+" prev = clamp(tmp, 0.0, 1.0);\n"
+" }\n"
+" color.rgb = prev.rgb;\n"
+" color.a = 1.0f;\n"
+"}\n"
+
+;
diff --git a/src/extras/shaders/contrast.frag b/src/extras/shaders/contrast.frag
new file mode 100644
index 00000000..d6dec478
--- /dev/null
+++ b/src/extras/shaders/contrast.frag
@@ -0,0 +1,18 @@
+uniform sampler2D tex0;
+uniform vec3 u_contrastAdd;
+uniform vec3 u_contrastMult;
+
+in vec4 v_color;
+in vec2 v_tex0;
+in float v_fog;
+
+out vec4 color;
+
+void
+main(void)
+{
+ vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
+ color.rgb = dst.rgb*u_contrastMult + u_contrastAdd;
+ color.a = 1.0f;
+}
+
diff --git a/src/extras/shaders/contrastPS.cso b/src/extras/shaders/contrastPS.cso
new file mode 100644
index 00000000..a87c48d7
--- /dev/null
+++ b/src/extras/shaders/contrastPS.cso
Binary files differ
diff --git a/src/extras/shaders/contrastPS.hlsl b/src/extras/shaders/contrastPS.hlsl
new file mode 100644
index 00000000..a1de1d81
--- /dev/null
+++ b/src/extras/shaders/contrastPS.hlsl
@@ -0,0 +1,21 @@
+struct PS_INPUT
+{
+ float4 position : POSITION;
+ float3 texcoord0 : TEXCOORD0;
+ float4 color : COLOR0;
+};
+
+uniform float3 contrastMult : register(c10);
+uniform float3 contrastAdd : register(c11);
+
+sampler2D tex : register(s0);
+
+float4
+main(PS_INPUT In) : COLOR
+{
+ float4 dst = tex2D(tex, In.texcoord0.xy);
+
+ dst.rgb = dst.rgb*contrastMult + contrastAdd;
+ dst.a = 1.0;
+ return dst;
+}
diff --git a/src/extras/shaders/contrastPS.inc b/src/extras/shaders/contrastPS.inc
new file mode 100644
index 00000000..5386792f
--- /dev/null
+++ b/src/extras/shaders/contrastPS.inc
@@ -0,0 +1,31 @@
+static unsigned char contrastPS_cso[] = {
+ 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x35, 0x00, 0x43, 0x54, 0x41, 0x42,
+ 0x1c, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
+ 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x98, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x00,
+ 0x01, 0x00, 0x2e, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x2a, 0x00,
+ 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x88, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x73, 0x74,
+ 0x41, 0x64, 0x64, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x03, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x74,
+ 0x72, 0x61, 0x73, 0x74, 0x4d, 0x75, 0x6c, 0x74, 0x00, 0x74, 0x65, 0x78,
+ 0x00, 0xab, 0xab, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32,
+ 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
+ 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68,
+ 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
+ 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33,
+ 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0,
+ 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80,
+ 0x00, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90,
+ 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80,
+ 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02,
+ 0x01, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
+ 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80,
+ 0x0b, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80,
+ 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80,
+ 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00
+};
diff --git a/src/extras/shaders/contrast_fs_gl3.inc b/src/extras/shaders/contrast_fs_gl3.inc
new file mode 100644
index 00000000..58aaf079
--- /dev/null
+++ b/src/extras/shaders/contrast_fs_gl3.inc
@@ -0,0 +1,20 @@
+const char *contrast_frag_src =
+"uniform sampler2D tex0;\n"
+"uniform vec3 u_contrastAdd;\n"
+"uniform vec3 u_contrastMult;\n"
+
+"in vec4 v_color;\n"
+"in vec2 v_tex0;\n"
+"in float v_fog;\n"
+
+"out vec4 color;\n"
+
+"void\n"
+"main(void)\n"
+"{\n"
+" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
+" color.rgb = dst.rgb*u_contrastMult + u_contrastAdd;\n"
+" color.a = 1.0f;\n"
+"}\n"
+
+;
diff --git a/src/extras/shaders/im2d.vert b/src/extras/shaders/im2d.vert
new file mode 100644
index 00000000..241593b1
--- /dev/null
+++ b/src/extras/shaders/im2d.vert
@@ -0,0 +1,21 @@
+uniform vec4 u_xform;
+
+layout(location = 0) in vec4 in_pos;
+layout(location = 2) in vec4 in_color;
+layout(location = 3) in vec2 in_tex0;
+
+out vec4 v_color;
+out vec2 v_tex0;
+out float v_fog;
+
+void
+main(void)
+{
+ gl_Position = in_pos;
+ gl_Position.w = 1.0;
+ gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw;
+ v_fog = DoFog(gl_Position.z);
+ gl_Position.xyz *= gl_Position.w;
+ v_color = in_color;
+ v_tex0 = in_tex0;
+}
diff --git a/src/extras/shaders/im2d_gl3.inc b/src/extras/shaders/im2d_gl3.inc
new file mode 100644
index 00000000..68341b39
--- /dev/null
+++ b/src/extras/shaders/im2d_gl3.inc
@@ -0,0 +1,23 @@
+const char *im2d_vert_src =
+"uniform vec4 u_xform;\n"
+
+"layout(location = 0) in vec4 in_pos;\n"
+"layout(location = 2) in vec4 in_color;\n"
+"layout(location = 3) in vec2 in_tex0;\n"
+
+"out vec4 v_color;\n"
+"out vec2 v_tex0;\n"
+"out float v_fog;\n"
+
+"void\n"
+"main(void)\n"
+"{\n"
+" gl_Position = in_pos;\n"
+" gl_Position.w = 1.0;\n"
+" gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw;\n"
+" v_fog = DoFog(gl_Position.z);\n"
+" gl_Position.xyz *= gl_Position.w;\n"
+" v_color = in_color;\n"
+" v_tex0 = in_tex0;\n"
+"}\n"
+;
diff --git a/src/extras/shaders/make.cmd b/src/extras/shaders/make.cmd
new file mode 100644
index 00000000..8404ac6c
--- /dev/null
+++ b/src/extras/shaders/make.cmd
@@ -0,0 +1,3 @@
+@echo off
+for %%f in (*PS.hlsl) do "%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T ps_2_0 /nologo /E main /Fo %%~nf.cso %%f
+for %%f in (*VS.hlsl) do "%DXSDK_DIR%\Utilities\bin\x86\fxc.exe" /T vs_2_0 /nologo /E main /Fo %%~nf.cso %%f
diff --git a/src/extras/shaders/makeinc.sh b/src/extras/shaders/makeinc.sh
new file mode 100644
index 00000000..a649af33
--- /dev/null
+++ b/src/extras/shaders/makeinc.sh
@@ -0,0 +1,5 @@
+#!sh
+for i in *cso; do
+ (echo -n 'static '
+ xxd -i $i | grep -v '_len = ') > ${i%cso}inc
+done
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index f52b373e..a15927ff 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -10232,7 +10232,11 @@ CPed::ProcessControl(void)
CPed::Chat();
break;
case PED_AIM_GUN:
- if (m_pPointGunAt && m_pPointGunAt->IsPed() && ((CPed*)m_pPointGunAt)->CanSeeEntity(this, CAN_SEE_ENTITY_ANGLE_THRESHOLD * 2)) {
+ if (m_pPointGunAt && m_pPointGunAt->IsPed()
+#ifdef FIX_BUGS
+ && !GetWeapon()->IsTypeMelee()
+#endif
+ && ((CPed*)m_pPointGunAt)->CanSeeEntity(this, CAN_SEE_ENTITY_ANGLE_THRESHOLD * 2)) {
((CPed*)m_pPointGunAt)->ReactToPointGun(this);
}
PointGunAt();
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index 60450213..05ddbcdc 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -78,6 +78,43 @@ CClouds::Update(void)
#endif
}
+float StarCoorsX[9] = { 0.0f, 0.05f, 0.12f, 0.5f, 0.8f, 0.6f, 0.27f, 0.55f, 0.75f };
+float StarCoorsY[9] = { 0.0f, 0.45f, 0.9f, 1.0f, 0.85f, 0.52f, 0.48f, 0.35f, 0.2f };
+float StarSizes[9] = { 1.0f, 1.4f, 0.9f, 1.0f, 0.6f, 1.5f, 1.3f, 1.0f, 0.8f };
+
+float LowCloudsX[12] = { 1.0f, 0.7f, 0.0f, -0.7f, -1.0f, -0.7f, 0.0f, 0.7f, 0.8f, -0.8f, 0.4f, -0.4f };
+float LowCloudsY[12] = { 0.0f, -0.7f, -1.0f, -0.7f, 0.0f, 0.7f, 1.0f, 0.7f, 0.4f, 0.4f, -0.8f, -0.8f };
+float LowCloudsZ[12] = { 0.0f, 1.0f, 0.5f, 0.0f, 1.0f, 0.3f, 0.9f, 0.4f, 1.3f, 1.4f, 1.2f, 1.7f };
+
+float CoorsOffsetX[37] = {
+ 0.0f, 60.0f, 72.0f, 48.0f, 21.0f, 12.0f,
+ 9.0f, -3.0f, -8.4f, -18.0f, -15.0f, -36.0f,
+ -40.0f, -48.0f, -60.0f, -24.0f, 100.0f, 100.0f,
+ 100.0f, 100.0f, 100.0f, 100.0f, 100.0f, 100.0f,
+ 100.0f, 100.0f, -30.0f, -20.0f, 10.0f, 30.0f,
+ 0.0f, -100.0f, -100.0f, -100.0f, -100.0f, -100.0f, -100.0f
+};
+float CoorsOffsetY[37] = {
+ 100.0f, 100.0f, 100.0f, 100.0f, 100.0f, 100.0f,
+ 100.0f, 100.0f, 100.0f, 100.0f, 100.0f, 100.0f,
+ 100.0f, 100.0f, 100.0f, 100.0f, -30.0f, 10.0f,
+ -25.0f, -5.0f, 28.0f, -10.0f, 10.0f, 0.0f,
+ 15.0f, 40.0f, -100.0f, -100.0f, -100.0f, -100.0f,
+ -100.0f, -40.0f, -20.0f, 0.0f, 10.0f, 30.0f, 35.0f
+};
+float CoorsOffsetZ[37] = {
+ 2.0f, 1.0f, 0.0f, 0.3f, 0.7f, 1.4f,
+ 1.7f, 0.24f, 0.7f, 1.3f, 1.6f, 1.0f,
+ 1.2f, 0.3f, 0.7f, 1.4f, 0.0f, 0.1f,
+ 0.5f, 0.4f, 0.55f, 0.75f, 1.0f, 1.4f,
+ 1.7f, 2.0f, 2.0f, 2.3f, 1.9f, 2.4f,
+ 2.0f, 2.0f, 1.5f, 1.2f, 1.7f, 1.5f, 2.1f
+};
+
+uint8 BowRed[6] = { 30, 30, 30, 10, 0, 15 };
+uint8 BowGreen[6] = { 0, 15, 30, 30, 0, 0 };
+uint8 BowBlue[6] = { 0, 0, 0, 10, 30, 30 };
+
void
CClouds::Render(void)
{
@@ -98,11 +135,10 @@ CClouds::Render(void)
int minute = CClock::GetHours()*60 + CClock::GetMinutes();
RwV3d campos = *(RwV3d*)&TheCamera.GetPosition();
- float coverage = Max(CWeather::Foggyness, CWeather::Foggyness);
-
// Moon
int moonfadeout = Abs(minute - 180); // fully visible at 3AM
if(moonfadeout < 180){ // fade in/out 3 hours
+ float coverage = Max(CWeather::Foggyness, CWeather::CloudCoverage);
int brightness = (1.0f - coverage) * (180 - moonfadeout);
RwV3d pos = { 0.0f, -100.0f, 15.0f };
RwV3dAdd(&worldpos, &campos, &pos);
@@ -131,11 +167,10 @@ CClouds::Render(void)
else if(CClock::GetHours() == 5)
starintens = 255 * (60 - CClock::GetMinutes())/60.0f;
if(starintens != 0){
- // R
- static float StarCoorsX[9] = { 0.0f, 0.05f, 0.12f, 0.5f, 0.8f, 0.6f, 0.27f, 0.55f, 0.75f };
- static float StarCoorsY[9] = { 0.0f, 0.45f, 0.9f, 1.0f, 0.85f, 0.52f, 0.48f, 0.35f, 0.2f };
- static float StarSizes[9] = { 1.0f, 1.4f, 0.9f, 1.0f, 0.6f, 1.5f, 1.3f, 1.0f, 0.8f };
+ float coverage = Max(CWeather::Foggyness, CWeather::CloudCoverage);
int brightness = (1.0f - coverage) * starintens;
+
+ // R
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
for(i = 0; i < 11; i++){
RwV3d pos = { 100.0f, 0.0f, 10.0f };
@@ -164,13 +199,7 @@ CClouds::Render(void)
}
// Low clouds
- static float LowCloudsX[12] = { 1.0f, 0.7f, 0.0f, -0.7f, -1.0f, -0.7f,
- 0.0f, 0.7f, 0.8f, -0.8f, 0.4f, -0.4f };
- static float LowCloudsY[12] = { 0.0f, -0.7f, -1.0f, -0.7f, 0.0f, 0.7f,
- 1.0f, 0.7f, 0.4f, 0.4f, -0.8f, -0.8f };
- static float LowCloudsZ[12] = { 0.0f, 1.0f, 0.5f, 0.0f, 1.0f, 0.3f,
- 0.9f, 0.4f, 1.3f, 1.4f, 1.2f, 1.7f };
- float lowcloudintensity = 1.0f - coverage;
+ float lowcloudintensity = 1.0f - Max(CWeather::Foggyness, CWeather::CloudCoverage);
int r = CTimeCycle::GetLowCloudsRed() * lowcloudintensity;
int g = CTimeCycle::GetLowCloudsGreen() * lowcloudintensity;
int b = CTimeCycle::GetLowCloudsBlue() * lowcloudintensity;
@@ -193,30 +222,6 @@ CClouds::Render(void)
float rot_cos = Cos(CloudRotation);
int fluffyalpha = 160 * (1.0f - CWeather::Foggyness);
if(fluffyalpha != 0){
- static float CoorsOffsetX[37] = {
- 0.0f, 60.0f, 72.0f, 48.0f, 21.0f, 12.0f,
- 9.0f, -3.0f, -8.4f, -18.0f, -15.0f, -36.0f,
- -40.0f, -48.0f, -60.0f, -24.0f, 100.0f, 100.0f,
- 100.0f, 100.0f, 100.0f, 100.0f, 100.0f, 100.0f,
- 100.0f, 100.0f, -30.0f, -20.0f, 10.0f, 30.0f,
- 0.0f, -100.0f, -100.0f, -100.0f, -100.0f, -100.0f, -100.0f
- };
- static float CoorsOffsetY[37] = {
- 100.0f, 100.0f, 100.0f, 100.0f, 100.0f, 100.0f,
- 100.0f, 100.0f, 100.0f, 100.0f, 100.0f, 100.0f,
- 100.0f, 100.0f, 100.0f, 100.0f, -30.0f, 10.0f,
- -25.0f, -5.0f, 28.0f, -10.0f, 10.0f, 0.0f,
- 15.0f, 40.0f, -100.0f, -100.0f, -100.0f, -100.0f,
- -100.0f, -40.0f, -20.0f, 0.0f, 10.0f, 30.0f, 35.0f
- };
- static float CoorsOffsetZ[37] = {
- 2.0f, 1.0f, 0.0f, 0.3f, 0.7f, 1.4f,
- 1.7f, 0.24f, 0.7f, 1.3f, 1.6f, 1.0f,
- 1.2f, 0.3f, 0.7f, 1.4f, 0.0f, 0.1f,
- 0.5f, 0.4f, 0.55f, 0.75f, 1.0f, 1.4f,
- 1.7f, 2.0f, 2.0f, 2.3f, 1.9f, 2.4f,
- 2.0f, 2.0f, 1.5f, 1.2f, 1.7f, 1.5f, 2.1f
- };
static bool bCloudOnScreen[37];
float hilight;
@@ -238,7 +243,7 @@ CClouds::Render(void)
int bg = CTimeCycle::GetFluffyCloudsBottomGreen();
int bb = CTimeCycle::GetFluffyCloudsBottomBlue();
if(sundist < SCREEN_WIDTH/2){
- hilight = (1.0f - coverage) * (1.0f - sundist/(SCREEN_WIDTH/2));
+ hilight = (1.0f - Max(CWeather::Foggyness, CWeather::CloudCoverage)) * (1.0f - sundist/(SCREEN_WIDTH/2));
tr = tr*(1.0f-hilight) + 255*hilight;
tg = tg*(1.0f-hilight) + 190*hilight;
tb = tb*(1.0f-hilight) + 190*hilight;
@@ -286,9 +291,6 @@ CClouds::Render(void)
// Rainbow
if(CWeather::Rainbow != 0.0f){
- static uint8 BowRed[6] = { 30, 30, 30, 10, 0, 15 };
- static uint8 BowGreen[6] = { 0, 15, 30, 30, 0, 0 };
- static uint8 BowBlue[6] = { 0, 0, 0, 10, 30, 30 };
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
for(i = 0; i < 6; i++){
RwV3d pos = { i*1.5f, 100.0f, 5.0f };
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index 5bf89403..d2d229f9 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -255,7 +255,10 @@ CCoronas::Render(void)
CVector spriteCoors;
float spritew, spriteh;
- if(CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){
+ if(!CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){
+ aCoronas[i].offScreen = true;
+ aCoronas[i].sightClear = false;
+ }else{
aCoronas[i].offScreen = false;
if(spriteCoors.x < 0.0f || spriteCoors.y < 0.0f ||
@@ -289,10 +292,7 @@ CCoronas::Render(void)
}
- if(aCoronas[i].fadeAlpha == 0)
- continue;
-
- if(spriteCoors.z < aCoronas[i].drawDist){
+ if(aCoronas[i].fadeAlpha && spriteCoors.z < aCoronas[i].drawDist){
float recipz = 1.0f/spriteCoors.z;
float fadeDistance = aCoronas[i].drawDist / 2.0f;
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
@@ -367,9 +367,6 @@ CCoronas::Render(void)
recipz, 255);
}
}
- }else{
- aCoronas[i].offScreen = true;
- aCoronas[i].sightClear = false;
}
}
}
@@ -390,23 +387,24 @@ CCoronas::Render(void)
if(!aCoronas[i].hasValue[j] || !aCoronas[i].hasValue[j+1])
continue;
- int mod1 = (float)(6 - j) / 6 * 128;
- int mod2 = (float)(6 - (j+1)) / 6 * 128;
+ int alpha1 = (float)(6 - j) / 6 * 128;
+ int alpha2 = (float)(6 - (j+1)) / 6 * 128;
RwIm2DVertexSetScreenX(&vertexbufferX[0], aCoronas[i].prevX[j]);
RwIm2DVertexSetScreenY(&vertexbufferX[0], aCoronas[i].prevY[j]);
- RwIm2DVertexSetIntRGBA(&vertexbufferX[0], aCoronas[i].prevRed[j] * mod1 / 256, aCoronas[i].prevGreen[j] * mod1 / 256, aCoronas[i].prevBlue[j] * mod1 / 256, 255);
+ RwIm2DVertexSetIntRGBA(&vertexbufferX[0], aCoronas[i].prevRed[j] * alpha1 / 256, aCoronas[i].prevGreen[j] * alpha1 / 256, aCoronas[i].prevBlue[j] * alpha1 / 256, 255);
RwIm2DVertexSetScreenX(&vertexbufferX[1], aCoronas[i].prevX[j+1]);
RwIm2DVertexSetScreenY(&vertexbufferX[1], aCoronas[i].prevY[j+1]);
- RwIm2DVertexSetIntRGBA(&vertexbufferX[1], aCoronas[i].prevRed[j+1] * mod2 / 256, aCoronas[i].prevGreen[j+1] * mod2 / 256, aCoronas[i].prevBlue[j+1] * mod2 / 256, 255);
+ RwIm2DVertexSetIntRGBA(&vertexbufferX[1], aCoronas[i].prevRed[j+1] * alpha2 / 256, aCoronas[i].prevGreen[j+1] * alpha2 / 256, aCoronas[i].prevBlue[j+1] * alpha2 / 256, 255);
- // BUG: game doesn't do this
+#ifdef FIX_BUGS
RwIm2DVertexSetScreenZ(&vertexbufferX[0], RwIm2DGetNearScreenZ());
RwIm2DVertexSetCameraZ(&vertexbufferX[0], RwCameraGetNearClipPlane(Scene.camera));
RwIm2DVertexSetRecipCameraZ(&vertexbufferX[0], 1.0f/RwCameraGetNearClipPlane(Scene.camera));
RwIm2DVertexSetScreenZ(&vertexbufferX[1], RwIm2DGetNearScreenZ());
RwIm2DVertexSetCameraZ(&vertexbufferX[1], RwCameraGetNearClipPlane(Scene.camera));
RwIm2DVertexSetRecipCameraZ(&vertexbufferX[1], 1.0f/RwCameraGetNearClipPlane(Scene.camera));
+#endif
RwIm2DRenderLine(vertexbufferX, 2, 0, 1);
}
@@ -425,6 +423,10 @@ CCoronas::RenderReflections(void)
CEntity *entity;
if(CWeather::WetRoads > 0.0f){
+#ifdef FIX_BUGS
+ CSprite::InitSpriteBuffer();
+#endif
+
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
@@ -435,7 +437,8 @@ CCoronas::RenderReflections(void)
for(i = 0; i < NUMCORONAS; i++){
if(aCoronas[i].id == 0 ||
- aCoronas[i].fadeAlpha == 0 && aCoronas[i].alpha == 0)
+ aCoronas[i].fadeAlpha == 0 && aCoronas[i].alpha == 0 ||
+ aCoronas[i].reflection == 0)
continue;
// check if we want a reflection on this corona
@@ -450,11 +453,8 @@ CCoronas::RenderReflections(void)
}
}
- if(!aCoronas[i].renderReflection)
- continue;
-
// Don't draw if reflection is too high
- if(aCoronas[i].heightAboveRoad < 20.0f){
+ if(aCoronas[i].renderReflection && aCoronas[i].heightAboveRoad < 20.0f){
// don't draw if camera is below road
if(CCoronas::aCoronas[i].coors.z - aCoronas[i].heightAboveRoad > TheCamera.GetPosition().z)
continue;
@@ -466,13 +466,14 @@ CCoronas::RenderReflections(void)
float spritew, spriteh;
if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
float drawDist = 0.75f * aCoronas[i].drawDist;
- drawDist = Min(drawDist, 50.0f);
+ drawDist = Min(drawDist, 55.0f);
if(spriteCoors.z < drawDist){
float fadeDistance = drawDist / 2.0f;
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
distanceFade = clamp(distanceFade, 0.0f, 1.0f);
float recipz = 1.0f/RwCameraGetNearClipPlane(Scene.camera);
- int intensity = (20.0f - aCoronas[i].heightAboveRoad) * 230.0 * distanceFade*CWeather::WetRoads * 0.05f;
+ float heightFade = (20.0f - aCoronas[i].heightAboveRoad)/20.0f;
+ int intensity = distanceFade*heightFade * 230.0 * CWeather::WetRoads;
CSprite::RenderBufferedOneXLUSprite(
spriteCoors.x, spriteCoors.y, RwIm2DGetNearScreenZ(),
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 1e536382..08c0cb85 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -175,7 +175,8 @@ void CHud::Draw()
rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.6f);
rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.6f);
- Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
}
else {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.4f);
@@ -183,7 +184,8 @@ void CHud::Draw()
rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.4f);
rect.bottom = f3rdY + SCREEN_SCALE_Y(32.0f * 0.4f);
- Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
}
}
else {
@@ -194,7 +196,9 @@ void CHud::Draw()
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f);
rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f);
rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f);
- Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
+
}
else if (Mode == CCam::MODE_1STPERSON_RUNABOUT) {
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f);
@@ -202,7 +206,8 @@ void CHud::Draw()
rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f);
rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f * 0.7f);
- Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
}
else if (Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT) {
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
@@ -216,29 +221,33 @@ void CHud::Draw()
}
else {
// Sniper
- rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f);
- rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f);
- rect.right = SCREEN_WIDTH / 2;
- rect.bottom = SCREEN_HEIGHT / 2;
- Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
-
- rect.right = (SCREEN_WIDTH / 2);
- rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f);
- rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2);
- rect.bottom = SCREEN_HEIGHT / 2;
- Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
-
- rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f);
- rect.bottom = (SCREEN_HEIGHT / 2);
- rect.right = (SCREEN_WIDTH / 2);
- rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2);
- Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
-
- rect.right = (SCREEN_WIDTH / 2);
- rect.bottom = (SCREEN_HEIGHT / 2);
- rect.left = SCREEN_SCALE_X(210.0f) + (SCREEN_WIDTH / 2);
- rect.top = SCREEN_SCALE_Y(210.0f) + (SCREEN_HEIGHT / 2);
- Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ rect.left = SCREEN_WIDTH/2 - SCREEN_SCALE_X(210.0f);
+ rect.top = SCREEN_HEIGHT/2 - SCREEN_SCALE_Y(210.0f);
+ rect.right = SCREEN_WIDTH/2;
+ rect.bottom = SCREEN_HEIGHT/2;
+ Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.01f, 0.01f, 1.0f, 0.0f, 0.01f, 1.0f, 1.0f, 1.0f);
+
+ rect.left = SCREEN_WIDTH/2;
+ rect.top = SCREEN_HEIGHT/2 - SCREEN_SCALE_Y(210.0f);
+ rect.right = SCREEN_WIDTH/2 + SCREEN_SCALE_X(210.0f);
+ rect.bottom = SCREEN_HEIGHT/2;
+ Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.99f, 0.0f, 0.01f, 0.01f, 0.99f, 1.0f, 0.01f, 1.0f);
+
+ rect.left = SCREEN_WIDTH/2 - SCREEN_SCALE_X(210.0f);
+ rect.top = SCREEN_HEIGHT/2;
+ rect.right = SCREEN_WIDTH/2;
+ rect.bottom = SCREEN_HEIGHT/2 + SCREEN_SCALE_Y(210.0f);
+ Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.01f, 0.99f, 1.0f, 0.99f, 0.01f, 0.01f, 1.0f, 0.01f);
+
+ rect.left = SCREEN_WIDTH/2;
+ rect.top = SCREEN_HEIGHT/2;
+ rect.right = SCREEN_WIDTH/2 + SCREEN_SCALE_X(210.0f);
+ rect.bottom = SCREEN_HEIGHT/2 + SCREEN_SCALE_Y(210.0f);
+ Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
+ 0.99f, 0.99f, 0.01f, 0.99f, 0.99f, 0.01f, 0.1f, 0.01f);
}
}
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp
index ec811e56..de15358e 100644
--- a/src/render/MBlur.cpp
+++ b/src/render/MBlur.cpp
@@ -10,6 +10,7 @@
#include "RwHelper.h"
#include "Camera.h"
#include "MBlur.h"
+#include "postfx.h"
// Originally taken from RW example 'mblur'
@@ -27,6 +28,10 @@ extern "C" D3DCAPS8 _RwD3D8DeviceCaps;
RwBool
CMBlur::MotionBlurOpen(RwCamera *cam)
{
+#ifdef EXTENDED_COLOURFILTER
+ CPostFX::Open(cam);
+ return TRUE;
+#else
#ifdef GTA_PS2
RwRect rect = {0, 0, 0, 0};
@@ -127,18 +132,22 @@ CMBlur::MotionBlurOpen(RwCamera *cam)
return TRUE;
#endif
+#endif
}
RwBool
CMBlur::MotionBlurClose(void)
{
+#ifdef EXTENDED_COLOURFILTER
+ CPostFX::Close();
+#else
if(pFrontBuffer){
RwRasterDestroy(pFrontBuffer);
pFrontBuffer = nil;
return TRUE;
}
-
+#endif
return FALSE;
}
@@ -192,12 +201,14 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect)
RwIm2DVertexSetU(&Vertex[3], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetV(&Vertex[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, 255);
-
}
void
CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha)
{
+#ifdef EXTENDED_COLOURFILTER
+ CPostFX::Render(cam, red, green, blue, blur, type, bluralpha);
+#else
RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur };
#ifdef GTA_PS2
if( pFrontBuffer )
@@ -217,6 +228,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
OverlayRender(cam, nil, color, type, bluralpha);
}
#endif
+#endif
}
void
diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp
index 88b9aaea..0713dc6d 100644
--- a/src/render/PointLights.cpp
+++ b/src/render/PointLights.cpp
@@ -86,12 +86,11 @@ CPointLights::GenerateLightsAffectingObject(Const CVector *objCoors)
ret *= distNorm;
}else{
float intensity;
+ // distance fade
if(distNorm < 0.5f)
- // near enough
intensity = 1.0f;
else
- // attenuate
- intensity = 1.0f - (distNorm - 0.5f)*2.0f;
+ intensity = 1.0f - (distNorm - 0.5f)/(1.0f - 0.5f);
if(distance != 0.0f){
CVector dir = dist / distance;
@@ -153,7 +152,7 @@ CPointLights::RenderFogEffect(void)
if(aLights[i].fogType != FOG_NORMAL && aLights[i].fogType != FOG_ALWAYS)
continue;
- fogginess = aLights[i].fogType == FOG_ALWAYS ? 1.0f : CWeather::Foggyness;
+ fogginess = aLights[i].fogType == FOG_NORMAL ? CWeather::Foggyness : 1.0f;
if(fogginess == 0.0f)
continue;
@@ -198,7 +197,7 @@ CPointLights::RenderFogEffect(void)
float distsq = sq(dx) + sq(dy);
float linedistsq = distsq - sq(dot);
if(dot > 0.0f && dot < FOG_AREA_LENGTH && linedistsq < sq(FOG_AREA_WIDTH)){
- CVector fogcoors(xi, yi, aLights[i].coors.z + 1.0f);
+ CVector fogcoors(xi, yi, aLights[i].coors.z + 10.0f);
if(CWorld::ProcessVerticalLine(fogcoors, fogcoors.z - 20.0f,
point, entity, true, false, false, false, true, false, nil)){
// Now same check again in xyz
@@ -220,7 +219,7 @@ CPointLights::RenderFogEffect(void)
intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH);
if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
- float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x1FFF;
+ float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x2000;
float size = FogSizes[r>>1];
CSprite::RenderOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
spritew * size, spriteh * size,
@@ -269,7 +268,7 @@ CPointLights::RenderFogEffect(void)
CVector fogcoors(xi, yi, point.point.z + 1.6f);
if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
- float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x3FFF;
+ float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x4000;
float size = FogSizes[r>>1];
CSprite::RenderOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
spritew * size, spriteh * size,
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 717021a7..7ae29a2f 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -836,8 +836,13 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
a2 = i;
}
}
+#ifdef FIX_BUGS
+ y = Floor(miny);
+ yend = Floor(maxy);
+#else
y = miny;
yend = maxy;
+#endif
// Go left in poly to find first edge b
b2 = a2;
@@ -875,8 +880,8 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
while(y <= yend && y < NUMSECTORS_Y){
// scan one x-line
if(y >= 0 && xstart < NUMSECTORS_X)
- for(x = xstart; x <= xend; x++)
- if(x >= 0 && x != NUMSECTORS_X)
+ for(x = xstart; x <= xend && x != NUMSECTORS_X; x++)
+ if(x >= 0)
scanfunc(CWorld::GetSector(x, y)->m_lists);
// advance one scan line
diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp
index 453ed004..98bb6eb2 100644
--- a/src/render/Sprite2d.cpp
+++ b/src/render/Sprite2d.cpp
@@ -178,6 +178,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
z = 1.0f/RecipNearClip;
}
recipz = 1.0f/z;
+ float offset = 1.0f/1024.0f;
// This is what we draw:
// 0---1
@@ -189,8 +190,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[0], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[0], recipz);
RwIm2DVertexSetIntRGBA(&maVertices[0], c2.r, c2.g, c2.b, c2.a);
- RwIm2DVertexSetU(&maVertices[0], 0.0f, recipz);
- RwIm2DVertexSetV(&maVertices[0], 0.0f, recipz);
+ RwIm2DVertexSetU(&maVertices[0], 0.0f+offset, recipz);
+ RwIm2DVertexSetV(&maVertices[0], 0.0f+offset, recipz);
RwIm2DVertexSetScreenX(&maVertices[1], r.right);
RwIm2DVertexSetScreenY(&maVertices[1], r.top);
@@ -198,8 +199,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[1], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[1], recipz);
RwIm2DVertexSetIntRGBA(&maVertices[1], c3.r, c3.g, c3.b, c3.a);
- RwIm2DVertexSetU(&maVertices[1], 1.0f, recipz);
- RwIm2DVertexSetV(&maVertices[1], 0.0f, recipz);
+ RwIm2DVertexSetU(&maVertices[1], 1.0f+offset, recipz);
+ RwIm2DVertexSetV(&maVertices[1], 0.0f+offset, recipz);
RwIm2DVertexSetScreenX(&maVertices[2], r.right);
RwIm2DVertexSetScreenY(&maVertices[2], r.bottom);
@@ -207,8 +208,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[2], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[2], recipz);
RwIm2DVertexSetIntRGBA(&maVertices[2], c1.r, c1.g, c1.b, c1.a);
- RwIm2DVertexSetU(&maVertices[2], 1.0f, recipz);
- RwIm2DVertexSetV(&maVertices[2], 1.0f, recipz);
+ RwIm2DVertexSetU(&maVertices[2], 1.0f+offset, recipz);
+ RwIm2DVertexSetV(&maVertices[2], 1.0f+offset, recipz);
RwIm2DVertexSetScreenX(&maVertices[3], r.left);
RwIm2DVertexSetScreenY(&maVertices[3], r.bottom);
@@ -216,8 +217,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetCameraZ(&maVertices[3], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[3], recipz);
RwIm2DVertexSetIntRGBA(&maVertices[3], c0.r, c0.g, c0.b, c0.a);
- RwIm2DVertexSetU(&maVertices[3], 0.0f, recipz);
- RwIm2DVertexSetV(&maVertices[3], 1.0f, recipz);
+ RwIm2DVertexSetU(&maVertices[3], 0.0f+offset, recipz);
+ RwIm2DVertexSetV(&maVertices[3], 1.0f+offset, recipz);
}
void
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index 162983dd..0d94dbd6 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -10,42 +10,42 @@
#include "FileMgr.h"
#include "Timecycle.h"
-int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fSunSize[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
-short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS];
-short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
-short CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
+int16 CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS];
+int16 CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
+int16 CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
-int CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
+int32 CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS];
float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS];
@@ -57,47 +57,47 @@ float CTimeCycle::m_fCurrentAmbientBlue;
float CTimeCycle::m_fCurrentDirectionalRed;
float CTimeCycle::m_fCurrentDirectionalGreen;
float CTimeCycle::m_fCurrentDirectionalBlue;
-int CTimeCycle::m_nCurrentSkyTopRed;
-int CTimeCycle::m_nCurrentSkyTopGreen;
-int CTimeCycle::m_nCurrentSkyTopBlue;
-int CTimeCycle::m_nCurrentSkyBottomRed;
-int CTimeCycle::m_nCurrentSkyBottomGreen;
-int CTimeCycle::m_nCurrentSkyBottomBlue;
-int CTimeCycle::m_nCurrentSunCoreRed;
-int CTimeCycle::m_nCurrentSunCoreGreen;
-int CTimeCycle::m_nCurrentSunCoreBlue;
-int CTimeCycle::m_nCurrentSunCoronaRed;
-int CTimeCycle::m_nCurrentSunCoronaGreen;
-int CTimeCycle::m_nCurrentSunCoronaBlue;
+int32 CTimeCycle::m_nCurrentSkyTopRed;
+int32 CTimeCycle::m_nCurrentSkyTopGreen;
+int32 CTimeCycle::m_nCurrentSkyTopBlue;
+int32 CTimeCycle::m_nCurrentSkyBottomRed;
+int32 CTimeCycle::m_nCurrentSkyBottomGreen;
+int32 CTimeCycle::m_nCurrentSkyBottomBlue;
+int32 CTimeCycle::m_nCurrentSunCoreRed;
+int32 CTimeCycle::m_nCurrentSunCoreGreen;
+int32 CTimeCycle::m_nCurrentSunCoreBlue;
+int32 CTimeCycle::m_nCurrentSunCoronaRed;
+int32 CTimeCycle::m_nCurrentSunCoronaGreen;
+int32 CTimeCycle::m_nCurrentSunCoronaBlue;
float CTimeCycle::m_fCurrentSunSize;
float CTimeCycle::m_fCurrentSpriteSize;
float CTimeCycle::m_fCurrentSpriteBrightness;
-int CTimeCycle::m_nCurrentShadowStrength;
-int CTimeCycle::m_nCurrentLightShadowStrength;
-int CTimeCycle::m_nCurrentTreeShadowStrength;
+int32 CTimeCycle::m_nCurrentShadowStrength;
+int32 CTimeCycle::m_nCurrentLightShadowStrength;
+int32 CTimeCycle::m_nCurrentTreeShadowStrength;
float CTimeCycle::m_fCurrentFogStart;
float CTimeCycle::m_fCurrentFarClip;
float CTimeCycle::m_fCurrentLightsOnGroundBrightness;
-int CTimeCycle::m_nCurrentLowCloudsRed;
-int CTimeCycle::m_nCurrentLowCloudsGreen;
-int CTimeCycle::m_nCurrentLowCloudsBlue;
-int CTimeCycle::m_nCurrentFluffyCloudsTopRed;
-int CTimeCycle::m_nCurrentFluffyCloudsTopGreen;
-int CTimeCycle::m_nCurrentFluffyCloudsTopBlue;
-int CTimeCycle::m_nCurrentFluffyCloudsBottomRed;
-int CTimeCycle::m_nCurrentFluffyCloudsBottomGreen;
-int CTimeCycle::m_nCurrentFluffyCloudsBottomBlue;
+int32 CTimeCycle::m_nCurrentLowCloudsRed;
+int32 CTimeCycle::m_nCurrentLowCloudsGreen;
+int32 CTimeCycle::m_nCurrentLowCloudsBlue;
+int32 CTimeCycle::m_nCurrentFluffyCloudsTopRed;
+int32 CTimeCycle::m_nCurrentFluffyCloudsTopGreen;
+int32 CTimeCycle::m_nCurrentFluffyCloudsTopBlue;
+int32 CTimeCycle::m_nCurrentFluffyCloudsBottomRed;
+int32 CTimeCycle::m_nCurrentFluffyCloudsBottomGreen;
+int32 CTimeCycle::m_nCurrentFluffyCloudsBottomBlue;
float CTimeCycle::m_fCurrentBlurRed;
float CTimeCycle::m_fCurrentBlurGreen;
float CTimeCycle::m_fCurrentBlurBlue;
float CTimeCycle::m_fCurrentBlurAlpha;
-int CTimeCycle::m_nCurrentFogColourRed;
-int CTimeCycle::m_nCurrentFogColourGreen;
-int CTimeCycle::m_nCurrentFogColourBlue;
+int32 CTimeCycle::m_nCurrentFogColourRed;
+int32 CTimeCycle::m_nCurrentFogColourGreen;
+int32 CTimeCycle::m_nCurrentFogColourBlue;
-int CTimeCycle::m_FogReduction;
+int32 CTimeCycle::m_FogReduction;
-int CTimeCycle::m_CurrentStoredValue;
+int32 CTimeCycle::m_CurrentStoredValue;
CVector CTimeCycle::m_VectorToSun[16];
float CTimeCycle::m_fShadowFrontX[16];
float CTimeCycle::m_fShadowFrontY[16];
@@ -227,7 +227,7 @@ CTimeCycle::Update(void)
float c2 = (1.0f-timeInterp) * CWeather::InterpolationValue;
float c3 = timeInterp * CWeather::InterpolationValue;
-#define INTERP(v) v[h1][w1]*c0 + v[h2][w1]*c1 + v[h1][w2]*c2 + v[h2][w2]*c3;
+#define INTERP(v) v[h1][w1]*c0 + v[h2][w1]*c1 + v[h1][w2]*c2 + v[h2][w2]*c3
m_nCurrentSkyTopRed = INTERP(m_nSkyTopRed);
m_nCurrentSkyTopGreen = INTERP(m_nSkyTopGreen);
diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h
index 0cb02b67..d5d7b67a 100644
--- a/src/render/Timecycle.h
+++ b/src/render/Timecycle.h
@@ -2,42 +2,42 @@
class CTimeCycle
{
- static int m_nAmbientRed[NUMHOURS][NUMWEATHERS];
- static int m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
- static int m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
- static int m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
- static int m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
- static int m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
- static int m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
- static int m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
- static int m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
- static int m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
- static int m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
- static int m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
- static int m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
- static int m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
- static int m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
- static int m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
- static int m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
- static int m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nAmbientRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
static float m_fSunSize[NUMHOURS][NUMWEATHERS];
static float m_fSpriteSize[NUMHOURS][NUMWEATHERS];
static float m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
- static short m_nShadowStrength[NUMHOURS][NUMWEATHERS];
- static short m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
- static short m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
+ static int16 m_nShadowStrength[NUMHOURS][NUMWEATHERS];
+ static int16 m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
+ static int16 m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
static float m_fFogStart[NUMHOURS][NUMWEATHERS];
static float m_fFarClip[NUMHOURS][NUMWEATHERS];
static float m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
- static int m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
- static int m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
- static int m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
- static int m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
- static int m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
- static int m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
- static int m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
- static int m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
- static int m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
+ static int32 m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
+ static int32 m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
+ static int32 m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
static float m_fBlurRed[NUMHOURS][NUMWEATHERS];
static float m_fBlurGreen[NUMHOURS][NUMWEATHERS];
static float m_fBlurBlue[NUMHOURS][NUMWEATHERS];
@@ -49,48 +49,48 @@ class CTimeCycle
static float m_fCurrentDirectionalRed;
static float m_fCurrentDirectionalGreen;
static float m_fCurrentDirectionalBlue;
- static int m_nCurrentSkyTopRed;
- static int m_nCurrentSkyTopGreen;
- static int m_nCurrentSkyTopBlue;
- static int m_nCurrentSkyBottomRed;
- static int m_nCurrentSkyBottomGreen;
- static int m_nCurrentSkyBottomBlue;
- static int m_nCurrentSunCoreRed;
- static int m_nCurrentSunCoreGreen;
- static int m_nCurrentSunCoreBlue;
- static int m_nCurrentSunCoronaRed;
- static int m_nCurrentSunCoronaGreen;
- static int m_nCurrentSunCoronaBlue;
+ static int32 m_nCurrentSkyTopRed;
+ static int32 m_nCurrentSkyTopGreen;
+ static int32 m_nCurrentSkyTopBlue;
+ static int32 m_nCurrentSkyBottomRed;
+ static int32 m_nCurrentSkyBottomGreen;
+ static int32 m_nCurrentSkyBottomBlue;
+ static int32 m_nCurrentSunCoreRed;
+ static int32 m_nCurrentSunCoreGreen;
+ static int32 m_nCurrentSunCoreBlue;
+ static int32 m_nCurrentSunCoronaRed;
+ static int32 m_nCurrentSunCoronaGreen;
+ static int32 m_nCurrentSunCoronaBlue;
static float m_fCurrentSunSize;
static float m_fCurrentSpriteSize;
static float m_fCurrentSpriteBrightness;
- static int m_nCurrentShadowStrength;
- static int m_nCurrentLightShadowStrength;
- static int m_nCurrentTreeShadowStrength;
+ static int32 m_nCurrentShadowStrength;
+ static int32 m_nCurrentLightShadowStrength;
+ static int32 m_nCurrentTreeShadowStrength;
static float m_fCurrentFogStart;
static float m_fCurrentFarClip;
static float m_fCurrentLightsOnGroundBrightness;
- static int m_nCurrentLowCloudsRed;
- static int m_nCurrentLowCloudsGreen;
- static int m_nCurrentLowCloudsBlue;
- static int m_nCurrentFluffyCloudsTopRed;
- static int m_nCurrentFluffyCloudsTopGreen;
- static int m_nCurrentFluffyCloudsTopBlue;
- static int m_nCurrentFluffyCloudsBottomRed;
- static int m_nCurrentFluffyCloudsBottomGreen;
- static int m_nCurrentFluffyCloudsBottomBlue;
+ static int32 m_nCurrentLowCloudsRed;
+ static int32 m_nCurrentLowCloudsGreen;
+ static int32 m_nCurrentLowCloudsBlue;
+ static int32 m_nCurrentFluffyCloudsTopRed;
+ static int32 m_nCurrentFluffyCloudsTopGreen;
+ static int32 m_nCurrentFluffyCloudsTopBlue;
+ static int32 m_nCurrentFluffyCloudsBottomRed;
+ static int32 m_nCurrentFluffyCloudsBottomGreen;
+ static int32 m_nCurrentFluffyCloudsBottomBlue;
static float m_fCurrentBlurRed;
static float m_fCurrentBlurGreen;
static float m_fCurrentBlurBlue;
static float m_fCurrentBlurAlpha;
- static int m_nCurrentFogColourRed;
- static int m_nCurrentFogColourGreen;
- static int m_nCurrentFogColourBlue;
+ static int32 m_nCurrentFogColourRed;
+ static int32 m_nCurrentFogColourGreen;
+ static int32 m_nCurrentFogColourBlue;
- static int m_FogReduction;
+ static int32 m_FogReduction;
public:
- static int m_CurrentStoredValue;
+ static int32 m_CurrentStoredValue;
static CVector m_VectorToSun[16];
static float m_fShadowFrontX[16];
static float m_fShadowFrontY[16];
@@ -105,40 +105,40 @@ public:
static float GetDirectionalRed(void) { return m_fCurrentDirectionalRed; }
static float GetDirectionalGreen(void) { return m_fCurrentDirectionalGreen; }
static float GetDirectionalBlue(void) { return m_fCurrentDirectionalBlue; }
- static int GetSkyTopRed(void) { return m_nCurrentSkyTopRed; }
- static int GetSkyTopGreen(void) { return m_nCurrentSkyTopGreen; }
- static int GetSkyTopBlue(void) { return m_nCurrentSkyTopBlue; }
- static int GetSkyBottomRed(void) { return m_nCurrentSkyBottomRed; }
- static int GetSkyBottomGreen(void) { return m_nCurrentSkyBottomGreen; }
- static int GetSkyBottomBlue(void) { return m_nCurrentSkyBottomBlue; }
- static int GetSunCoreRed(void) { return m_nCurrentSunCoreRed; }
- static int GetSunCoreGreen(void) { return m_nCurrentSunCoreGreen; }
- static int GetSunCoreBlue(void) { return m_nCurrentSunCoreBlue; }
- static int GetSunCoronaRed(void) { return m_nCurrentSunCoronaRed; }
- static int GetSunCoronaGreen(void) { return m_nCurrentSunCoronaGreen; }
- static int GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; }
+ static int32 GetSkyTopRed(void) { return m_nCurrentSkyTopRed; }
+ static int32 GetSkyTopGreen(void) { return m_nCurrentSkyTopGreen; }
+ static int32 GetSkyTopBlue(void) { return m_nCurrentSkyTopBlue; }
+ static int32 GetSkyBottomRed(void) { return m_nCurrentSkyBottomRed; }
+ static int32 GetSkyBottomGreen(void) { return m_nCurrentSkyBottomGreen; }
+ static int32 GetSkyBottomBlue(void) { return m_nCurrentSkyBottomBlue; }
+ static int32 GetSunCoreRed(void) { return m_nCurrentSunCoreRed; }
+ static int32 GetSunCoreGreen(void) { return m_nCurrentSunCoreGreen; }
+ static int32 GetSunCoreBlue(void) { return m_nCurrentSunCoreBlue; }
+ static int32 GetSunCoronaRed(void) { return m_nCurrentSunCoronaRed; }
+ static int32 GetSunCoronaGreen(void) { return m_nCurrentSunCoronaGreen; }
+ static int32 GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; }
static float GetSunSize(void) { return m_fCurrentSunSize; }
static float GetSpriteBrightness(void) { return m_fCurrentSpriteBrightness; }
static float GetSpriteSize(void) { return m_fCurrentSpriteSize; }
- static int GetShadowStrength(void) { return m_nCurrentShadowStrength; }
- static int GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; }
+ static int32 GetShadowStrength(void) { return m_nCurrentShadowStrength; }
+ static int32 GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; }
static float GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
static float GetFarClip(void) { return m_fCurrentFarClip; }
static float GetFogStart(void) { return m_fCurrentFogStart; }
- static int GetLowCloudsRed(void) { return m_nCurrentLowCloudsRed; }
- static int GetLowCloudsGreen(void) { return m_nCurrentLowCloudsGreen; }
- static int GetLowCloudsBlue(void) { return m_nCurrentLowCloudsBlue; }
- static int GetFluffyCloudsTopRed(void) { return m_nCurrentFluffyCloudsTopRed; }
- static int GetFluffyCloudsTopGreen(void) { return m_nCurrentFluffyCloudsTopGreen; }
- static int GetFluffyCloudsTopBlue(void) { return m_nCurrentFluffyCloudsTopBlue; }
- static int GetFluffyCloudsBottomRed(void) { return m_nCurrentFluffyCloudsBottomRed; }
- static int GetFluffyCloudsBottomGreen(void) { return m_nCurrentFluffyCloudsBottomGreen; }
- static int GetFluffyCloudsBottomBlue(void) { return m_nCurrentFluffyCloudsBottomBlue; }
- static int GetFogRed(void) { return m_nCurrentFogColourRed; }
- static int GetFogGreen(void) { return m_nCurrentFogColourGreen; }
- static int GetFogBlue(void) { return m_nCurrentFogColourBlue; }
- static int GetFogReduction(void) { return m_FogReduction; }
+ static int32 GetLowCloudsRed(void) { return m_nCurrentLowCloudsRed; }
+ static int32 GetLowCloudsGreen(void) { return m_nCurrentLowCloudsGreen; }
+ static int32 GetLowCloudsBlue(void) { return m_nCurrentLowCloudsBlue; }
+ static int32 GetFluffyCloudsTopRed(void) { return m_nCurrentFluffyCloudsTopRed; }
+ static int32 GetFluffyCloudsTopGreen(void) { return m_nCurrentFluffyCloudsTopGreen; }
+ static int32 GetFluffyCloudsTopBlue(void) { return m_nCurrentFluffyCloudsTopBlue; }
+ static int32 GetFluffyCloudsBottomRed(void) { return m_nCurrentFluffyCloudsBottomRed; }
+ static int32 GetFluffyCloudsBottomGreen(void) { return m_nCurrentFluffyCloudsBottomGreen; }
+ static int32 GetFluffyCloudsBottomBlue(void) { return m_nCurrentFluffyCloudsBottomBlue; }
+ static int32 GetFogRed(void) { return m_nCurrentFogColourRed; }
+ static int32 GetFogGreen(void) { return m_nCurrentFogColourGreen; }
+ static int32 GetFogBlue(void) { return m_nCurrentFogColourBlue; }
+ static int32 GetFogReduction(void) { return m_FogReduction; }
static void Initialise(void);
static void Update(void);
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index a1170c61..920bb8a9 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -181,6 +181,22 @@ psCameraShowRaster(RwCamera *camera)
return;
}
+/*
+ *****************************************************************************
+ */
+RwImage *
+psGrabScreen(RwCamera *pCamera)
+{
+#ifndef LIBRW
+ RwRaster *pRaster = RwCameraGetRaster(pCamera);
+ if (RwImage *pImage = RwImageCreate(pRaster->width, pRaster->height, 32)) {
+ RwImageAllocatePixels(pImage);
+ RwImageSetFromRaster(pImage, pRaster);
+ return pImage;
+ }
+#endif
+ return nil;
+}
/*
*****************************************************************************
@@ -209,7 +225,11 @@ double
psTimer(void)
{
struct timespec start;
+#ifdef __linux__
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
+#else
+ clock_gettime(CLOCK_MONOTONIC, &start);
+#endif
return start.tv_sec * 1000.0 + start.tv_nsec/1000000.0;
}
#endif
diff --git a/src/skel/platform.h b/src/skel/platform.h
index 0f314b9d..c9a8a11f 100644
--- a/src/skel/platform.h
+++ b/src/skel/platform.h
@@ -22,6 +22,7 @@ extern void psTerminate(void);
extern void psCameraShowRaster(RwCamera *camera);
extern RwBool psCameraBeginUpdate(RwCamera *camera);
+extern RwImage *psGrabScreen(RwCamera *camera);
extern void psMouseSetPos(RwV2d *pos);
diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp
index 8191107e..4780316a 100644
--- a/src/skel/skeleton.cpp
+++ b/src/skel/skeleton.cpp
@@ -53,6 +53,15 @@ RsCameraBeginUpdate(RwCamera * camera)
/*
*****************************************************************************
*/
+RwImage*
+RsGrabScreen(RwCamera *camera)
+{
+ return psGrabScreen(camera);
+}
+
+/*
+ *****************************************************************************
+ */
RwBool
RsRegisterImageLoader(void)
{
diff --git a/src/skel/skeleton.h b/src/skel/skeleton.h
index b5ea5abf..1c468179 100644
--- a/src/skel/skeleton.h
+++ b/src/skel/skeleton.h
@@ -274,6 +274,9 @@ RsCameraBeginUpdate(RwCamera *camera);
//extern void
//RsMouseSetVisibility(RwBool visible);
+extern RwImage*
+RsGrabScreen(RwCamera *camera);
+
extern void
RsMouseSetPos(RwV2d *pos);
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index 5c5c7ece..a064788c 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -241,6 +241,23 @@ psCameraShowRaster(RwCamera *camera)
/*
*****************************************************************************
*/
+RwImage *
+psGrabScreen(RwCamera *pCamera)
+{
+#ifndef LIBRW
+ RwRaster *pRaster = RwCameraGetRaster(pCamera);
+ if (RwImage *pImage = RwImageCreate(pRaster->width, pRaster->height, 32)) {
+ RwImageAllocatePixels(pImage);
+ RwImageSetFromRaster(pImage, pRaster);
+ return pImage;
+ }
+#endif
+ return nil;
+}
+
+/*
+ *****************************************************************************
+ */
RwUInt32
psTimer(void)
{
@@ -1851,7 +1868,11 @@ void PlayMovieInWindow(int cmdShow, const char* szFile)
MultiByteToWideChar(CP_ACP, 0, szFile, -1, wFileName, sizeof(wFileName) - 1);
// Initialize COM
+#ifdef FIX_BUGS // will also return S_FALSE if it has already been inited in the same thread
+ CoInitialize(nil);
+#else
JIF(CoInitialize(nil));
+#endif
// Get the interface for DirectShow's GraphBuilder
JIF(CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC,
@@ -2223,9 +2244,10 @@ WinMain(HINSTANCE instance,
case GS_INIT_INTRO_MPEG:
{
+#ifndef NO_MOVIES
CloseClip();
-
CoUninitialize();
+#endif
if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN )
PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg");
@@ -2259,8 +2281,10 @@ WinMain(HINSTANCE instance,
case GS_INIT_ONCE:
{
+#ifndef NO_MOVIES
CloseClip();
CoUninitialize();
+#endif
#ifdef FIX_BUGS
// draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on