From 7a7b3527932d4ef5ff7d1676f8af022ae28cbdf5 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:32:37 +0200 Subject: added FreeBSD support --- src/core/CdStreamPosix.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp index 45fd9832..ff36c18f 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; - +#elif __FreeBSD__ + _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) -- cgit v1.2.3 From c4f9bfdc441fb0a0d6bfde208cd1f8192bacc880 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:33:50 +0200 Subject: added FreeBSD support --- src/skel/glfw/glfw.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index a1170c61..643a9e64 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -209,7 +209,11 @@ double psTimer(void) { struct timespec start; +#ifdef __linux__ clock_gettime(CLOCK_MONOTONIC_RAW, &start); +#elif __FreeBSD__ + clock_gettime(CLOCK_MONOTONIC, &start); +#endif return start.tv_sec * 1000.0 + start.tv_nsec/1000000.0; } #endif -- cgit v1.2.3 From 56ea53a5db82887163eb76388ad936f71788490e Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:35:24 +0200 Subject: clang throws an error if fixed comparisons are against NULL --- src/audio/sampman_oal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3 From 4b6cc0188bcbfa0469d2d1d7ed674945e243b5cb Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Fri, 7 Aug 2020 17:51:15 +0200 Subject: Update CdStreamPosix.cpp --- src/core/CdStreamPosix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp index ff36c18f..e114a29a 100644 --- a/src/core/CdStreamPosix.cpp +++ b/src/core/CdStreamPosix.cpp @@ -152,7 +152,7 @@ CdStreamInit(int32 numChannels) } #ifdef __linux__ _gdwCdStreamFlags = O_RDONLY | O_NOATIME; -#elif __FreeBSD__ +#else _gdwCdStreamFlags = O_RDONLY; #endif // People say it's slower -- cgit v1.2.3 From 8392b9ad2fc578fd42dc9b5fa27a5da175bf92f5 Mon Sep 17 00:00:00 2001 From: blingu <36486731+blingu@users.noreply.github.com> Date: Fri, 7 Aug 2020 17:51:43 +0200 Subject: Update glfw.cpp --- src/skel/glfw/glfw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 643a9e64..ed442348 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -211,7 +211,7 @@ psTimer(void) struct timespec start; #ifdef __linux__ clock_gettime(CLOCK_MONOTONIC_RAW, &start); -#elif __FreeBSD__ +#else clock_gettime(CLOCK_MONOTONIC, &start); #endif return start.tv_sec * 1000.0 + start.tv_nsec/1000000.0; -- cgit v1.2.3 From ce0633a0c2370ad0e075ca5ae0a65bc7061cc65d Mon Sep 17 00:00:00 2001 From: withmorten Date: Fri, 7 Aug 2020 18:21:05 +0200 Subject: remove CoUninitialize calls for FIX_BUGS (fixes PIX crash) and don't check return value for CoInitialize --- src/skel/win/win.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 5c5c7ece..6d44ce80 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1851,7 +1851,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, @@ -2225,7 +2229,9 @@ WinMain(HINSTANCE instance, { CloseClip(); - CoUninitialize(); +#ifndef FIX_BUGS + CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter +#endif if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN ) PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg"); @@ -2260,7 +2266,9 @@ WinMain(HINSTANCE instance, case GS_INIT_ONCE: { CloseClip(); - CoUninitialize(); +#ifndef FIX_BUGS + CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter +#endif #ifdef FIX_BUGS // draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on -- cgit v1.2.3 From 24a1644b2a1f4cd0b20385fd29acd7be9808e027 Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 8 Aug 2020 17:12:23 +0200 Subject: don't CoUninitialize for NO_MOVIES --- src/skel/win/win.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 6d44ce80..cf4749b1 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2227,10 +2227,9 @@ WinMain(HINSTANCE instance, case GS_INIT_INTRO_MPEG: { +#ifndef NO_MOVIES CloseClip(); - -#ifndef FIX_BUGS - CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter + CoUninitialize(); #endif if ( CMenuManager::OS_Language == LANG_FRENCH || CMenuManager::OS_Language == LANG_GERMAN ) @@ -2265,9 +2264,9 @@ WinMain(HINSTANCE instance, case GS_INIT_ONCE: { +#ifndef NO_MOVIES CloseClip(); -#ifndef FIX_BUGS - CoUninitialize(); // CoUninitialize should only be called at the shutdown of a program, and by then it doesn't matter + CoUninitialize(); #endif #ifdef FIX_BUGS -- cgit v1.2.3 From 5dc7ff98f2b14985693524a7a660990268f30095 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 9 Aug 2020 13:17:05 +0200 Subject: corona fixes --- src/render/Coronas.cpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'src') 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(), -- cgit v1.2.3 From 59d25d3ad8271ec46326a8e69e692e231a4eb076 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 9 Aug 2020 15:45:54 +0200 Subject: pointlight fixes --- src/render/PointLights.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') 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, -- cgit v1.2.3 From a149d9d511e432fbaa36382407fd14a8524c9e59 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 9 Aug 2020 19:32:32 +0200 Subject: little timecycle cleanup --- src/render/Timecycle.cpp | 120 ++++++++++++++++----------------- src/render/Timecycle.h | 172 +++++++++++++++++++++++------------------------ 2 files changed, 146 insertions(+), 146 deletions(-) (limited to 'src') 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); -- cgit v1.2.3