From c556cbbbe016858537ebc2950e2803bcb85f93d5 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 18 Aug 2020 10:58:15 +0200 Subject: neo pipelines --- src/core/Game.cpp | 5 +++++ src/core/config.h | 4 +++- src/core/main.cpp | 27 +++++++++++++++++++++++++-- src/core/re3.cpp | 12 ++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/Game.cpp b/src/core/Game.cpp index d5b376f6..c0530709 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -88,6 +88,7 @@ #include "debugmenu.h" #include "frontendoption.h" #include "postfx.h" +#include "custompipes.h" eLevelName CGame::currLevel; bool CGame::bDemoMode = true; @@ -360,6 +361,10 @@ bool CGame::Initialise(const char* datFile) CdStreamAddImage("MODELS\\GTA3.IMG"); CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); CFileLoader::LoadLevel(datFile); +#ifdef EXTENDED_PIPELINES + // for generic fallback + CustomPipes::SetTxdFindCallback(); +#endif CWorld::AddParticles(); CVehicleModelInfo::LoadVehicleColours(); CVehicleModelInfo::LoadEnvironmentMaps(); diff --git a/src/core/config.h b/src/core/config.h index bb6adce6..055fcd00 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -8,7 +8,8 @@ enum Config { MAX_CDCHANNELS = 5, MODELINFOSIZE = 5500, - TXDSTORESIZE = 850, +// TXDSTORESIZE = 850, + TXDSTORESIZE = 1024, // for Xbox map EXTRADIRSIZE = 128, CUTSCENEDIRSIZE = 512, @@ -209,6 +210,7 @@ enum Config { //#define USE_TEXTURE_POOL #define CUTSCENE_BORDERS_SWITCH //#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur) +//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo) // Particle //#define PC_PARTICLE diff --git a/src/core/main.cpp b/src/core/main.cpp index b63688ec..7cde9c4d 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -61,6 +61,7 @@ #include "MemoryCard.h" #include "SceneEdit.h" #include "debugmenu.h" +#include "custompipes.h" GlobalScene Scene; @@ -349,6 +350,9 @@ PluginAttach(void) return FALSE; } +#ifdef EXTENDED_PIPELINES + CustomPipes::CustomPipeRegister(); +#endif return TRUE; } @@ -362,7 +366,11 @@ Initialise3D(void *param) DebugMenuInit(); DebugMenuPopulate(); #endif // !DEBUGMENU - return CGame::InitialiseRenderWare(); + bool ret = CGame::InitialiseRenderWare(); +#ifdef EXTENDED_PIPELINES + CustomPipes::CustomPipeInit(); // need Scene.world for this +#endif + return ret; } return (FALSE); @@ -371,6 +379,9 @@ Initialise3D(void *param) static void Terminate3D(void) { +#ifdef EXTENDED_PIPELINES + CustomPipes::CustomPipeShutdown(); +#endif CGame::ShutdownRenderWare(); #ifdef DEBUGMENU DebugMenuShutdown(); @@ -1061,6 +1072,12 @@ Idle(void *arg) tbEndTimer("PreRender"); #endif +#ifdef FIX_BUGS + // This has to be done BEFORE RwCameraBeginUpdate + RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip()); + RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart()); +#endif + if(CWeather::LightningFlash && !CCullZones::CamNoRain()){ if(!DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255)) return; @@ -1073,9 +1090,10 @@ Idle(void *arg) DefinedState(); - // BUG. This has to be done BEFORE RwCameraBeginUpdate +#ifndef FIX_BUGS RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip()); RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart()); +#endif #ifdef TIMEBARS tbStartTimer(0, "RenderScene"); @@ -1084,6 +1102,11 @@ Idle(void *arg) #ifdef TIMEBARS tbEndTimer("RenderScene"); #endif + +#ifdef EXTENDED_PIPELINES + CustomPipes::EnvMapRender(); +#endif + RenderDebugShit(); RenderEffects(); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 9edd9497..e8d14435 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -31,6 +31,7 @@ #include "main.h" #include "MBlur.h" #include "postfx.h" +#include "custompipes.h" #ifndef _WIN32 #include "assert.h" @@ -469,6 +470,17 @@ DebugMenuPopulate(void) DebugMenuEntrySetWrap(e, true); DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f); DebugMenuAddVarBool8("Render", "Motion Blur", &CPostFX::MotionBlurOn, nil); +#endif +#ifdef EXTENDED_PIPELINES + static const char *vehpipenames[] = { "MatFX", "Neo" }; + e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil, + 1, CustomPipes::VEHICLEPIPE_MATFX, CustomPipes::VEHICLEPIPE_NEO, vehpipenames); + DebugMenuEntrySetWrap(e, true); + DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f); + DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f); + DebugMenuAddVar("Render", "Neo Ped Rim light", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f); + DebugMenuAddVar("Render", "Neo World Lightmaps", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f); + DebugMenuAddVar("Render", "Neo Road Gloss", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f); #endif DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil); DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil); -- cgit v1.2.3 From 4d1cfb7214a4867487f128c7e3360681f47e0239 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 19 Aug 2020 03:31:42 +0300 Subject: Island loading cleanup and fix --- src/core/Collision.cpp | 33 ++++++++++++++------------------- src/core/Frontend.h | 6 ++++++ src/core/Pad.cpp | 4 ++++ src/core/Streaming.cpp | 8 ++------ 4 files changed, 26 insertions(+), 25 deletions(-) (limited to 'src/core') diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index bd0dfb92..d8603cd8 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -521,10 +521,12 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange) } if (level == CGame::currLevel || forceChange) { +#ifdef FIX_BUGS + CTimer::Suspend(); +#else CTimer::Stop(); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + ISLAND_LOADING_IS(LOW) { DMAudio.SetEffectsFadeVol(0); CPad::StopPadsShaking(); @@ -534,17 +536,13 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange) CPopulation::DealWithZoneChange(ms_collisionInMemory, CGame::currLevel, false); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) -#endif + ISLAND_LOADING_ISNT(HIGH) { CStreaming::RemoveIslandsNotUsed(LEVEL_INDUSTRIAL); CStreaming::RemoveIslandsNotUsed(LEVEL_COMMERCIAL); CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); } -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + ISLAND_LOADING_IS(LOW) { CStreaming::RemoveBigBuildings(LEVEL_INDUSTRIAL); CStreaming::RemoveBigBuildings(LEVEL_COMMERCIAL); @@ -557,9 +555,7 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange) ms_collisionInMemory = CGame::currLevel; CReplay::EmptyReplayBuffer(); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + ISLAND_LOADING_IS(LOW) { if (CGame::currLevel != LEVEL_GENERIC) LoadSplash(GetLevelSplashScreen(CGame::currLevel)); @@ -572,18 +568,19 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange) CStreaming::RequestIslands(CGame::currLevel); #endif CStreaming::LoadAllRequestedModels(true); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + + ISLAND_LOADING_IS(LOW) { CStreaming::HaveAllBigBuildingsLoaded(CGame::currLevel); CGame::TidyUpMemory(true, true); } +#ifdef FIX_BUGS + CTimer::Resume(); +#else CTimer::Update(); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + ISLAND_LOADING_IS(LOW) DMAudio.SetEffectsFadeVol(127); } } @@ -596,9 +593,7 @@ CCollision::SortOutCollisionAfterLoad(void) { if(ms_collisionInMemory == CGame::currLevel) return; -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + ISLAND_LOADING_IS(LOW) CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); if (CGame::currLevel != LEVEL_GENERIC) { diff --git a/src/core/Frontend.h b/src/core/Frontend.h index d631a7d1..cf112b3d 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -635,6 +635,12 @@ public: static int8 m_DisplayIslandLoading; static int8 m_PrefsIslandLoading; + + #define ISLAND_LOADING_IS(p) if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_##p) + #define ISLAND_LOADING_ISNT(p) if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_##p) +#else + #define ISLAND_LOADING_IS(p) + #define ISLAND_LOADING_ISNT(p) #endif public: diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index d4ffc5ea..3b46a110 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -11,7 +11,11 @@ #include "platform.h" #ifdef XINPUT #include +#if !defined(PSAPI_VERSION) || (PSAPI_VERSION > 1) #pragma comment( lib, "Xinput9_1_0.lib" ) +#else +#pragma comment( lib, "Xinput.lib" ) +#endif #endif #include "Pad.h" diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 089e8b23..1892bf57 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -743,9 +743,7 @@ CStreaming::RequestBigBuildings(eLevelName level) void CStreaming::RequestIslands(eLevelName level) { -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) -#endif + ISLAND_LOADING_ISNT(HIGH) switch(level){ case LEVEL_INDUSTRIAL: RequestModel(islandLODcomInd, BIGBUILDINGFLAGS); @@ -946,9 +944,7 @@ CStreaming::RemoveBuildings(eLevelName level) void CStreaming::RemoveUnusedBigBuildings(eLevelName level) { -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + ISLAND_LOADING_IS(LOW) { if (level != LEVEL_INDUSTRIAL) RemoveBigBuildings(LEVEL_INDUSTRIAL); -- cgit v1.2.3