diff options
author | aap <aap@papnet.eu> | 2020-05-12 16:27:26 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-05-12 16:27:39 +0200 |
commit | 40829b52422cfcd031961fabf60ad99b3ae69ccc (patch) | |
tree | 73cb776ada029a62cdc026e35f3fdbcc9c738e8f | |
parent | fix garages (diff) | |
download | re3-40829b52422cfcd031961fabf60ad99b3ae69ccc.tar re3-40829b52422cfcd031961fabf60ad99b3ae69ccc.tar.gz re3-40829b52422cfcd031961fabf60ad99b3ae69ccc.tar.bz2 re3-40829b52422cfcd031961fabf60ad99b3ae69ccc.tar.lz re3-40829b52422cfcd031961fabf60ad99b3ae69ccc.tar.xz re3-40829b52422cfcd031961fabf60ad99b3ae69ccc.tar.zst re3-40829b52422cfcd031961fabf60ad99b3ae69ccc.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/Cam.cpp | 4 | ||||
-rw-r--r-- | src/core/Game.cpp | 7 | ||||
-rw-r--r-- | src/core/Game.h | 1 | ||||
-rw-r--r-- | src/render/Clouds.cpp | 226 | ||||
-rw-r--r-- | src/render/Clouds.h | 2 | ||||
-rw-r--r-- | src/render/Coronas.cpp | 2 | ||||
-rw-r--r-- | src/render/Coronas.h | 2 | ||||
-rw-r--r-- | src/render/Particle.cpp | 8 | ||||
-rw-r--r-- | src/render/Sprite.cpp | 8 | ||||
-rw-r--r-- | src/render/Sprite2d.cpp | 17 | ||||
-rw-r--r-- | src/render/Sprite2d.h | 2 | ||||
-rw-r--r-- | src/render/Weather.cpp | 1 | ||||
-rw-r--r-- | src/render/Weather.h | 1 | ||||
-rw-r--r-- | src/weapons/Weapon.cpp | 2 |
14 files changed, 159 insertions, 124 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 3357c5c0..30336423 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -5101,7 +5101,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, CColPoint foundCol; CEntity* foundEnt; CWorld::pIgnoreEntity = CamTargetEntity; - if (CWorld::ProcessLineOfSight(TargetCoors, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false)) { + if (CWorld::ProcessLineOfSight(TargetCoors, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, false, false, true, false)) { float obstacleTargetDist = (TargetCoors - foundCol.point).Magnitude(); float obstacleCamDist = newDistance - obstacleTargetDist; if (!foundEnt->IsPed() || obstacleCamDist <= 1.0f) { @@ -5110,7 +5110,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, RwCameraSetNearClipPlane(Scene.camera, Max(0.05f, obstacleTargetDist - 0.3f)); } } else { - if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false)) { + if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, false, false, true, false)) { float lessClip = obstacleCamDist - 0.35f; if (lessClip <= DEFAULT_NEAR) RwCameraSetNearClipPlane(Scene.camera, lessClip); diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 2ba3ae3a..6a6b31e7 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -661,6 +661,13 @@ void CGame::Process(void) } } +bool +CGame::CanSeeOutSideFromCurrArea(void) +{ + return currArea == AREA_MAIN_MAP || currArea == AREA_MALL || + currArea == AREA_MANSION || currArea == AREA_HOTEL; +} + void CGame::DrasticTidyUpMemory(bool) { #ifdef PS2 diff --git a/src/core/Game.h b/src/core/Game.h index ed9ded4f..6efacf8d 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -60,6 +60,7 @@ public: static void Process(void); static bool IsInInterior(void) { return currArea != AREA_MAIN_MAP; } + static bool CanSeeOutSideFromCurrArea(void); // NB: these do something on PS2 static void TidyUpMemory(bool, bool); diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 07688491..9cd3b5d2 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -3,6 +3,7 @@ #include "Sprite.h" #include "Sprite2d.h" #include "General.h" +#include "Game.h" #include "Coronas.h" #include "Camera.h" #include "TxdStore.h" @@ -23,8 +24,10 @@ uint32 CClouds::IndividualRotation; float CClouds::ms_cameraRoll; float CClouds::ms_horizonZ; +float CClouds::ms_HorizonTilt; CRGBA CClouds::ms_colourTop; CRGBA CClouds::ms_colourBottom; +CRGBA CClouds::ms_colourBkGrd; void CClouds::Init(void) @@ -44,33 +47,23 @@ void CClouds::Shutdown(void) { RwTextureDestroy(gpCloudTex[0]); -#ifdef GTA3_1_1_PATCH gpCloudTex[0] = nil; -#endif RwTextureDestroy(gpCloudTex[1]); -#ifdef GTA3_1_1_PATCH gpCloudTex[1] = nil; -#endif RwTextureDestroy(gpCloudTex[2]); -#ifdef GTA3_1_1_PATCH gpCloudTex[2] = nil; -#endif RwTextureDestroy(gpCloudTex[3]); -#ifdef GTA3_1_1_PATCH gpCloudTex[3] = nil; -#endif RwTextureDestroy(gpCloudTex[4]); -#ifdef GTA3_1_1_PATCH gpCloudTex[4] = nil; -#endif } void CClouds::Update(void) { float s = Sin(TheCamera.Orientation - 0.85f); - CloudRotation += CWeather::Wind*s*0.0025f; - IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f; + CloudRotation += CWeather::Wind*s*0.001f; + IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep()*0.5f + 0.3f) * 60.0f; } void @@ -81,6 +74,9 @@ CClouds::Render(void) RwV3d screenpos; RwV3d worldpos; + if(!CGame::CanSeeOutSideFromCurrArea()) + return; + CCoronas::SunBlockedByClouds = false; RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); @@ -90,26 +86,21 @@ CClouds::Render(void) RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); CSprite::InitSpriteBuffer(); - int minute = CClock::GetHours()*60 + CClock::GetMinutes(); + float minute = CClock::GetHours()*60 + CClock::GetMinutes() + CClock::GetSeconds()/60.0f; RwV3d campos = *(RwV3d*)&TheCamera.GetPosition(); - float coverage = CWeather::CloudCoverage <= CWeather::Foggyness ? CWeather::Foggyness : CWeather::CloudCoverage; + 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 - int brightness = (1.0f - coverage) * (180 - moonfadeout); + float moonfadeout = Abs(minute - 180.0f); // fully visible at 3AM + if((int)moonfadeout < 180){ // fade in/out 3 hours + int brightness = (1.0f - coverage) * (180 - (int)moonfadeout); RwV3d pos = { 0.0f, -100.0f, 15.0f }; RwV3dAdd(&worldpos, &campos, &pos); if(CSprite::CalcScreenCoors(worldpos, &screenpos, &szx, &szy, false)){ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[2])); - if(CCoronas::bSmallMoon){ - szx *= 4.0f; - szy *= 4.0f; - }else{ - szx *= 10.0f; - szy *= 10.0f; - } + szx *= CCoronas::MoonSize*2.0f + 4.0f; + szy *= CCoronas::MoonSize*2.0f + 4.0f; CSprite::RenderOneXLUSprite(screenpos.x, screenpos.y, screenpos.z, szx, szy, brightness, brightness, brightness, 255, 1.0f/screenpos.z, 255); } @@ -127,7 +118,7 @@ CClouds::Render(void) 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 StarCoorsX[9] = { 0.0f, 0.05f, 0.13f, 0.4f, 0.7f, 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 }; int brightness = (1.0f - coverage) * starintens; @@ -165,7 +156,7 @@ CClouds::Render(void) 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(coverage, CWeather::ExtraSunnyness); int r = CTimeCycle::GetLowCloudsRed() * lowcloudintensity; int g = CTimeCycle::GetLowCloudsGreen() * lowcloudintensity; int b = CTimeCycle::GetLowCloudsBlue() * lowcloudintensity; @@ -186,7 +177,7 @@ CClouds::Render(void) // Fluffy clouds float rot_sin = Sin(CloudRotation); float rot_cos = Cos(CloudRotation); - int fluffyalpha = 160 * (1.0f - CWeather::Foggyness); + int fluffyalpha = 160 * (1.0f - Max(CWeather::Foggyness, CWeather::ExtraSunnyness)); if(fluffyalpha != 0){ static float CoorsOffsetX[37] = { 0.0f, 60.0f, 72.0f, 48.0f, 21.0f, 12.0f, @@ -213,7 +204,7 @@ CClouds::Render(void) 2.0f, 2.0f, 1.5f, 1.2f, 1.7f, 1.5f, 2.1f }; static bool bCloudOnScreen[37]; - float hilight; + float sundist, hilight; RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); @@ -225,15 +216,16 @@ CClouds::Render(void) worldpos.z = pos.z; if(CSprite::CalcScreenCoors(worldpos, &screenpos, &szx, &szy, false)){ - float sundist = Sqrt(sq(screenpos.x-CCoronas::SunScreenX) + sq(screenpos.y-CCoronas::SunScreenY)); + sundist = Sqrt(sq(screenpos.x-CCoronas::SunScreenX) + sq(screenpos.y-CCoronas::SunScreenY)); int tr = CTimeCycle::GetFluffyCloudsTopRed(); int tg = CTimeCycle::GetFluffyCloudsTopGreen(); int tb = CTimeCycle::GetFluffyCloudsTopBlue(); int br = CTimeCycle::GetFluffyCloudsBottomRed(); int bg = CTimeCycle::GetFluffyCloudsBottomGreen(); int bb = CTimeCycle::GetFluffyCloudsBottomBlue(); - if(sundist < SCREEN_WIDTH/2){ - hilight = (1.0f - coverage) * (1.0f - sundist/(SCREEN_WIDTH/2)); + int distLimit = (3*SCREEN_WIDTH)/4; + if(sundist < distLimit){ + hilight = (1.0f - coverage) * (1.0f - sundist/(float)distLimit); tr = tr*(1.0f-hilight) + 255*hilight; tg = tg*(1.0f-hilight) + 190*hilight; tb = tb*(1.0f-hilight) + 190*hilight; @@ -267,8 +259,7 @@ CClouds::Render(void) worldpos.y = campos.x*rot_sin + campos.y*rot_cos + pos.y; worldpos.z = pos.z; if(bCloudOnScreen[i] && CSprite::CalcScreenCoors(worldpos, &screenpos, &szx, &szy, false)){ - // BUG: this is stupid....would have to do this for each cloud individually - if(hilight > 0.0f){ + if(sundist < SCREEN_WIDTH/3){ CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(screenpos.x, screenpos.y, screenpos.z, szx*30.0f, szy*30.0f, 200*hilight, 0, 0, 255, 1.0f/screenpos.z, @@ -308,22 +299,24 @@ CClouds::Render(void) bool UseDarkBackground(void) { - return RwFrameGetLTM(RwCameraGetFrame(TheCamera.m_pRwCamera))->up.z < -0.9f || - gbShowCollisionPolys; + return TheCamera.GetForward().z < -0.9f || gbShowCollisionPolys; } void CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue, int16 botred, int16 botgreen, int16 botblue, int16 alpha) { - RwMatrix *mat = RwFrameGetLTM(RwCameraGetFrame(TheCamera.m_pRwCamera)); - float c = Sqrt(mat->right.x * mat->right.x + mat->right.y * mat->right.y); + CVector right = CrossProduct(TheCamera.GetUp(), TheCamera.GetForward()); + right.Normalise(); + float c = right.Magnitude2D(); if(c > 1.0f) c = 1.0f; ms_cameraRoll = Acos(c); - if(mat->right.z < 0.0f) + if(right.z < 0.0f) ms_cameraRoll = -ms_cameraRoll; + ms_HorizonTilt = SCREEN_WIDTH/2.0f * Tan(ms_cameraRoll); + if(UseDarkBackground()){ ms_colourTop.r = 50; ms_colourTop.g = 50; @@ -346,75 +339,74 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue, }else{ ms_horizonZ = CSprite::CalcHorizonCoors(); + int fogr = (topred + 2 * botred) / 3; + int fogg = (topgreen + 2 * botgreen) / 3; + int fogb = (topblue + 2 * botblue) / 3; + // Draw top/bottom gradient float gradheight = SCREEN_HEIGHT/2.0f; - float topedge = ms_horizonZ - gradheight; - float botpos, toppos; - if(ms_horizonZ > 0.0f && topedge < SCREEN_HEIGHT){ - ms_colourTop.r = topred; - ms_colourTop.g = topgreen; - ms_colourTop.b = topblue; - ms_colourTop.a = alpha; - ms_colourBottom.r = botred; - ms_colourBottom.g = botgreen; - ms_colourBottom.b = botblue; - ms_colourBottom.a = alpha; - - if(ms_horizonZ < SCREEN_HEIGHT) - botpos = ms_horizonZ; - else{ - float f = (ms_horizonZ - SCREEN_HEIGHT)/gradheight; - ms_colourBottom.r = topred*f + (1.0f-f)*botred; - ms_colourBottom.g = topgreen*f + (1.0f-f)*botgreen; - ms_colourBottom.b = topblue*f + (1.0f-f)*botblue; - botpos = SCREEN_HEIGHT; - } - if(topedge >= 0.0f) - toppos = topedge; - else{ - float f = (0.0f - topedge)/gradheight; - ms_colourTop.r = botred*f + (1.0f-f)*topred; - ms_colourTop.g = botgreen*f + (1.0f-f)*topgreen; - ms_colourTop.b = botblue*f + (1.0f-f)*topblue; - toppos = 0.0f; - } - CSprite2d::DrawRect(CRect(0, toppos, SCREEN_WIDTH, botpos), - ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); - } + + ms_colourTop.r = topred; + ms_colourTop.g = topgreen; + ms_colourTop.b = topblue; + ms_colourTop.a = alpha; + ms_colourBottom.r = botred; + ms_colourBottom.g = botgreen; + ms_colourBottom.b = botblue; + ms_colourBottom.a = alpha; + + float botright = ms_horizonZ - ms_HorizonTilt; + float botleft = ms_horizonZ + ms_HorizonTilt; + float topright = botright - gradheight; + float topleft = botleft - gradheight; + + CSprite2d::DrawAnyRect(0.0f, topleft, SCREEN_WIDTH, topright, 0.0f, botleft, SCREEN_WIDTH, botright, + ms_colourTop, ms_colourTop, ms_colourBottom, ms_colourBottom); // draw the small stripe (whatever it's supposed to be) - if(ms_horizonZ > -SMALLSTRIPHEIGHT && ms_horizonZ < SCREEN_HEIGHT){ - // Same colour as fog - ms_colourTop.r = (topred + 2 * botred) / 3; - ms_colourTop.g = (topgreen + 2 * botgreen) / 3; - ms_colourTop.b = (topblue + 2 * botblue) / 3; - CSprite2d::DrawRect(CRect(0, ms_horizonZ, SCREEN_WIDTH, ms_horizonZ+SMALLSTRIPHEIGHT), - ms_colourTop, ms_colourTop, ms_colourTop, ms_colourTop); - } + ms_colourTop.r = fogr; + ms_colourTop.g = fogg; + ms_colourTop.b = fogb; + ms_colourTop.a = alpha; + topright = ms_horizonZ - ms_HorizonTilt; + topleft = ms_horizonZ + ms_HorizonTilt; + botright = topright + SMALLSTRIPHEIGHT; + botleft = topleft + SMALLSTRIPHEIGHT; + CSprite2d::DrawAnyRect(0.0f, topleft, SCREEN_WIDTH, topright, 0.0f, botleft, SCREEN_WIDTH, botright, + ms_colourTop, ms_colourTop, ms_colourTop, ms_colourTop); // Only top - if(topedge > 0.0f){ + if(ms_horizonZ + ms_HorizonTilt - gradheight > 0.0f || + ms_horizonZ - ms_HorizonTilt - gradheight > 0.0f){ ms_colourTop.r = topred; ms_colourTop.g = topgreen; ms_colourTop.b = topblue; ms_colourTop.a = alpha; - ms_colourBottom.r = topred; - ms_colourBottom.g = topgreen; - ms_colourBottom.b = topblue; - ms_colourBottom.a = alpha; - - botpos = Min(SCREEN_HEIGHT, topedge); - CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos), - ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); + + if(ms_horizonZ - Abs(ms_HorizonTilt) - gradheight > SCREEN_HEIGHT){ + // only top is visible + topleft = 0.0f; + topright = 0.0f; + botleft = SCREEN_HEIGHT; + botright = SCREEN_HEIGHT; + }else{ + botright = ms_horizonZ - ms_HorizonTilt - gradheight; + botleft = ms_horizonZ + ms_HorizonTilt - gradheight; + topright = Min(ms_horizonZ - ms_HorizonTilt - 2*SCREEN_HEIGHT, 0.0f); + topleft = Min(ms_horizonZ + ms_HorizonTilt - 2*SCREEN_HEIGHT, 0.0f); + } + + CSprite2d::DrawAnyRect(0.0f, topleft, SCREEN_WIDTH, topright, 0.0f, botleft, SCREEN_WIDTH, botright, + ms_colourTop, ms_colourTop, ms_colourTop, ms_colourTop); } // Set both to fog colour for RenderHorizon - ms_colourTop.r = (topred + 2 * botred) / 3; - ms_colourTop.g = (topgreen + 2 * botgreen) / 3; - ms_colourTop.b = (topblue + 2 * botblue) / 3; - ms_colourBottom.r = (topred + 2 * botred) / 3; - ms_colourBottom.g = (topgreen + 2 * botgreen) / 3; - ms_colourBottom.b = (topblue + 2 * botblue) / 3; + ms_colourTop.r = fogr; + ms_colourTop.g = fogg; + ms_colourTop.b = fogb; + ms_colourBottom.r = fogr; + ms_colourBottom.g = fogg; + ms_colourBottom.b = fogb; } } @@ -427,21 +419,35 @@ CClouds::RenderHorizon(void) ms_colourBottom.a = 230; ms_colourTop.a = 80; - if(ms_horizonZ > SCREEN_HEIGHT) - return; + float topright = ms_horizonZ - ms_HorizonTilt; + float topleft = ms_horizonZ + ms_HorizonTilt; + float botright = topright + SMALLSTRIPHEIGHT; + float botleft = topleft + SMALLSTRIPHEIGHT; + + CSprite2d::DrawAnyRect(0.0f, topleft, SCREEN_WIDTH, topright, 0.0f, botleft, SCREEN_WIDTH, botright, + ms_colourTop, ms_colourTop, ms_colourBottom, ms_colourBottom); + + + ms_colourBkGrd.r = 128.0f*CTimeCycle::GetAmbientRed(); + ms_colourBkGrd.g = 128.0f*CTimeCycle::GetAmbientGreen(); + ms_colourBkGrd.b = 128.0f*CTimeCycle::GetAmbientBlue(); + ms_colourBkGrd.a = 255; + + float horzstrip = SCREEN_STRETCH_Y(HORIZSTRIPHEIGHT); + topright = botright; + topleft = botleft; + botright = topright + horzstrip; + botleft = topleft + horzstrip; + + CSprite2d::DrawAnyRect(0.0f, topleft, SCREEN_WIDTH, topright, 0.0f, botleft, SCREEN_WIDTH, botright, + ms_colourBottom, ms_colourBottom, ms_colourBkGrd, ms_colourBkGrd); + + + topright = botright; + topleft = botleft; + botright = Max(topright, SCREEN_HEIGHT); + botleft = Max(topleft, SCREEN_HEIGHT); - float z1 = Min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT); - CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREEN_WIDTH, z1), - ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); - - // This is just weird - float a = SCREEN_HEIGHT/400.0f * HORIZSTRIPHEIGHT + - SCREEN_HEIGHT/300.0f * Max(TheCamera.GetPosition().z, 0.0f); - float b = TheCamera.GetUp().z < 0.0f ? - SCREEN_HEIGHT : - SCREEN_HEIGHT * Abs(TheCamera.GetRight().z); - float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier; - z2 = Min(z2, SCREEN_HEIGHT); - CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2), - ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); + CSprite2d::DrawAnyRect(0.0f, topleft, SCREEN_WIDTH, topright, 0.0f, botleft, SCREEN_WIDTH, botright, + ms_colourBkGrd, ms_colourBkGrd, ms_colourBkGrd, ms_colourBkGrd); } diff --git a/src/render/Clouds.h b/src/render/Clouds.h index 4d8cd2c8..ef33030b 100644 --- a/src/render/Clouds.h +++ b/src/render/Clouds.h @@ -8,8 +8,10 @@ public: static float ms_cameraRoll; static float ms_horizonZ; + static float ms_HorizonTilt; static CRGBA ms_colourTop; static CRGBA ms_colourBottom; + static CRGBA ms_colourBkGrd; static void Init(void); static void Shutdown(void); diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index de3b5c78..e36bdf3d 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -53,7 +53,7 @@ RwTexture *gpCoronaTexture[9] = { nil, nil, nil, nil, nil, nil, nil, nil, nil }; float CCoronas::LightsMult = 1.0f; float CCoronas::SunScreenX; float CCoronas::SunScreenY; -bool CCoronas::bSmallMoon; +int CCoronas::MoonSize; bool CCoronas::SunBlockedByClouds; int CCoronas::bChangeBrightnessImmediately; diff --git a/src/render/Coronas.h b/src/render/Coronas.h index 46eb4315..70e9ccd5 100644 --- a/src/render/Coronas.h +++ b/src/render/Coronas.h @@ -81,7 +81,7 @@ public: static float LightsMult; static float SunScreenY; static float SunScreenX; - static bool bSmallMoon; + static int MoonSize; static bool SunBlockedByClouds; static int bChangeBrightnessImmediately; diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 5995432b..3babbe44 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -1542,7 +1542,7 @@ void CParticle::Render() particle->m_fSize * 63.0f, particle->m_Color, particle->m_nColorIntensity, - (float)particle->m_nRotation, //DEGTORAD((float)particle->m_nRotation) ps2 + DEGTORAD(particle->m_nRotation), particle->m_nAlpha); } else @@ -1582,7 +1582,7 @@ void CParticle::Render() particle->m_Color.blue, particle->m_nColorIntensity, 1.0f / coors.z, - float(particle->m_nRotation), // DEGTORAD((float)particle->m_nRotation) ps2 + DEGTORAD(particle->m_nRotation), particle->m_nAlpha); } else if ( psystem->Flags & SCREEN_TRAIL ) @@ -1635,7 +1635,7 @@ void CParticle::Render() particle->m_Color.blue, particle->m_nColorIntensity, 1.0f / coors.z, - fRotation, + DEGTORAD(fRotation), particle->m_nAlpha); particle->m_vecScreenPosition = coors; @@ -1684,7 +1684,7 @@ void CParticle::Render() particle->m_Color.blue, particle->m_nColorIntensity, 1.0f / coors.z, - fRotation, + DEGTORAD(fRotation), particle->m_nAlpha); } else if ( psystem->Flags & VERT_TRAIL ) diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 1dd1aaab..9631aced 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -267,8 +267,8 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(float x, float y, float z, { m_bFlushSpriteBufferSwitchZTest = 0; // TODO: replace with lookup - float c = Cos(DEGTORAD(rotation)); - float s = Sin(DEGTORAD(rotation)); + float c = Cos(rotation); + float s = Sin(rotation); float xs[4]; float ys[4]; @@ -580,8 +580,8 @@ CSprite::RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w { m_bFlushSpriteBufferSwitchZTest = 1; CRGBA col(intens * colour.red >> 8, intens * colour.green >> 8, intens * colour.blue >> 8, alpha); - float c = Cos(DEGTORAD(rotation)); - float s = Sin(DEGTORAD(rotation)); + float c = Cos(rotation); + float s = Sin(rotation); Set6Vertices2D(&SpriteBufferVerts[6 * nSpriteBufferIndex], x + c*w - s*h, diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index 52b85018..189c9797 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -151,7 +151,6 @@ CSprite2d::Draw(float x1, float y1, float x2, float y2, float x3, float y3, floa RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::maVertices, 4); } - // Arguments: // 2---3 // | | @@ -461,6 +460,22 @@ CSprite2d::DrawRectXLU(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); } +void +CSprite2d::DrawAnyRect(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, + const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3) +{ + SetVertices(x1, y1, x2, y2, x3, y3, x4, y4, c0, c1, c2, c3); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); + RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEGOURAUD); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)(c0.alpha != 255 || c1.alpha != 255 || c2.alpha != 255 || c3.alpha != 255)); + RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::maVertices, 4); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEGOURAUD); +} + void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, const CRGBA &color) { SetVertices(x1, y1, x2, y2, x3, y3, x4, y4, color, color, color, color); diff --git a/src/render/Sprite2d.h b/src/render/Sprite2d.h index 0e12d441..04b40591 100644 --- a/src/render/Sprite2d.h +++ b/src/render/Sprite2d.h @@ -46,6 +46,8 @@ public: static void DrawRect(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3); static void DrawRect(const CRect &r, const CRGBA &col); static void DrawRectXLU(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3); + static void DrawAnyRect(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, + const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3); static void Draw2DPolygon(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, const CRGBA &color); diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index b4031705..25e67281 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -32,6 +32,7 @@ uint32 CWeather::LightningFlashLastChange; uint32 CWeather::WhenToPlayLightningSound; uint32 CWeather::LightningDuration; +float CWeather::ExtraSunnyness; float CWeather::Foggyness; float CWeather::CloudCoverage; float CWeather::Wind; diff --git a/src/render/Weather.h b/src/render/Weather.h index 9c670317..4bf2fd8f 100644 --- a/src/render/Weather.h +++ b/src/render/Weather.h @@ -30,6 +30,7 @@ public: static uint32 WhenToPlayLightningSound; static uint32 LightningDuration; + static float ExtraSunnyness; static float Foggyness; static float CloudCoverage; static float Wind; diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index aef53094..f64368f6 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -1511,7 +1511,7 @@ CWeapon::FireSniper(CEntity *shooter) CVector dir = cam->Front; if ( DotProduct(dir, CVector(0.0f, -0.9894f, 0.145f)) > 0.997f ) - CCoronas::bSmallMoon = !CCoronas::bSmallMoon; + CCoronas::MoonSize = (CCoronas::MoonSize+1) & 7; dir.Normalise(); dir *= 16.0f; |