diff options
author | Fire_Head <Fire-Head@users.noreply.github.com> | 2020-12-29 18:51:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 18:51:37 +0100 |
commit | 89e27093040067ca80ce2e174c19427222167e8e (patch) | |
tree | bf4183a78beb0c3e747fbc1f6a8c4f3c1e114d5c /src/extras | |
parent | master gxt (diff) | |
parent | Reorder CEntity functions into their original order (diff) | |
download | re3-89e27093040067ca80ce2e174c19427222167e8e.tar re3-89e27093040067ca80ce2e174c19427222167e8e.tar.gz re3-89e27093040067ca80ce2e174c19427222167e8e.tar.bz2 re3-89e27093040067ca80ce2e174c19427222167e8e.tar.lz re3-89e27093040067ca80ce2e174c19427222167e8e.tar.xz re3-89e27093040067ca80ce2e174c19427222167e8e.tar.zst re3-89e27093040067ca80ce2e174c19427222167e8e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/extras/custompipes.cpp | 6 | ||||
-rw-r--r-- | src/extras/custompipes_d3d9.cpp | 1 | ||||
-rw-r--r-- | src/extras/debugmenu.h | 2 | ||||
-rw-r--r-- | src/extras/screendroplets.cpp | 36 |
4 files changed, 38 insertions, 7 deletions
diff --git a/src/extras/custompipes.cpp b/src/extras/custompipes.cpp index bb3ebd2e..e6dff12a 100644 --- a/src/extras/custompipes.cpp +++ b/src/extras/custompipes.cpp @@ -133,7 +133,11 @@ EnvMapRender(void) EnvMapCam->getFrame()->matrix.pos = camPos; EnvMapCam->getFrame()->transform(&EnvMapCam->getFrame()->matrix, rw::COMBINEREPLACE); - rw::RGBA skycol = { CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255 }; + rw::RGBA skycol; + skycol.red = CTimeCycle::GetSkyBottomRed(); + skycol.green = CTimeCycle::GetSkyBottomGreen(); + skycol.blue = CTimeCycle::GetSkyBottomBlue(); + skycol.alpha = 255; EnvMapCam->clear(&skycol, rwCAMERACLEARZ|rwCAMERACLEARIMAGE); RwCameraBeginUpdate(EnvMapCam); bRenderingEnvMap = true; diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp index b39efd47..27006c6a 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -245,6 +245,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) drawInst(header, inst); inst++; } + d3d::setTexture(1, nil); } void diff --git a/src/extras/debugmenu.h b/src/extras/debugmenu.h index eb56c8f9..c2198aca 100644 --- a/src/extras/debugmenu.h +++ b/src/extras/debugmenu.h @@ -15,7 +15,7 @@ struct MenuEntry Menu *menu; MenuEntry(const char *name); - virtual ~MenuEntry(void) {} + virtual ~MenuEntry(void) { free((void*)name); } }; typedef MenuEntry DebugMenuEntry; diff --git a/src/extras/screendroplets.cpp b/src/extras/screendroplets.cpp index 3f91a754..6ea72f09 100644 --- a/src/extras/screendroplets.cpp +++ b/src/extras/screendroplets.cpp @@ -8,11 +8,11 @@ #endif #include "General.h" -#include "Main.h" +#include "main.h" #include "RwHelper.h" -#include "Main.h" #include "Timer.h" #include "Camera.h" +#include "World.h" #include "ZoneCull.h" #include "Weather.h" #include "ParticleObject.h" @@ -76,11 +76,36 @@ ScreenDroplets::Initialise(void) ms_splashObject = nil; } +// Create white circle mask for rain drops +static RwTexture* +CreateDropMask(int32 size) +{ + RwImage *img = RwImageCreate(size, size, 32); + RwImageAllocatePixels(img); + + uint8 *pixels = RwImageGetPixels(img); + int32 stride = RwImageGetStride(img); + + for(int y = 0; y < size; y++){ + float yf = ((y + 0.5f)/size - 0.5f)*2.0f; + for(int x = 0; x < size; x++){ + float xf = ((x + 0.5f)/size - 0.5f)*2.0f; + memset(&pixels[y*stride + x*4], xf*xf + yf*yf < 1.0f ? 0xFF : 0x00, 4); + } + } + + int32 width, height, depth, format; + RwImageFindRasterFormat(img, rwRASTERTYPETEXTURE, &width, &height, &depth, &format); + RwRaster *ras = RwRasterCreate(width, height, depth, format); + RwRasterSetFromImage(ras, img); + RwImageDestroy(img); + return RwTextureCreate(ras); +} + void ScreenDroplets::InitDraw(void) { - if(CustomPipes::neoTxd) - ms_maskTex = CustomPipes::neoTxd->find("dropmask"); + ms_maskTex = CreateDropMask(64); ms_screenTex = RwTextureCreate(nil); RwTextureSetFilterMode(ms_screenTex, rwFILTERLINEAR); @@ -392,7 +417,8 @@ ScreenDroplets::ProcessCameraMovement(void) uint16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; bool isTopDown = mode == CCam::MODE_TOPDOWN || mode == CCam::MODE_GTACLASSIC || mode == CCam::MODE_TOP_DOWN_PED; - bool isLookingInDirection = CPad::GetPad(0)->GetLookBehindForCar() || CPad::GetPad(0)->GetLookLeft() || CPad::GetPad(0)->GetLookRight(); + bool isLookingInDirection = FindPlayerVehicle() && mode == CCam::MODE_1STPERSON && + (CPad::GetPad(0)->GetLookBehindForCar() || CPad::GetPad(0)->GetLookLeft() || CPad::GetPad(0)->GetLookRight()); ms_enabled = !isTopDown && !isLookingInDirection; ms_movingEnabled = !isTopDown && !isLookingInDirection; |