From 0898cc6640dd98272e4e72fd5f995f4c7bfec42c Mon Sep 17 00:00:00 2001 From: tx00100xt Date: Sat, 14 Oct 2023 23:18:05 +0300 Subject: [PATCH] Fixed some textures after Save/Load (First Encounter) --- CHANGELOG.md | 1 + SamTFE/Sources/GameMP/Game.cpp | 78 +++++++++++++++++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fdc7f22..4da56a5d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -180,3 +180,4 @@ All notable changes to this project will be documented in this file. - SeriousSkaStudio: Fixed conversion of pointers to 32 bits (Win). - Fixed HUD, player FOV, weapon FOV for Serious Editor. - Restored name for Serious Editor log file. +- Fixed some textures after Save/Load (First Encounter). diff --git a/SamTFE/Sources/GameMP/Game.cpp b/SamTFE/Sources/GameMP/Game.cpp index bf8caf28..c249a7ee 100644 --- a/SamTFE/Sources/GameMP/Game.cpp +++ b/SamTFE/Sources/GameMP/Game.cpp @@ -170,9 +170,86 @@ static FLOAT gam_fChatSoundVolume = 0.25f; BOOL map_bIsFirstEncounter = FALSE; BOOL _bUserBreakEnabled = FALSE; +void _FixTexturesOnObelisk(CTFileName strLevelName) +{ + // for each entity in the world + {FOREACHINDYNAMICCONTAINER(_pNetwork->ga_World.wo_cenEntities, CEntity, iten) { + // if it is brush entity + if (iten->en_RenderType == CEntity::RT_BRUSH) { + // for each mip in its brush + FOREACHINLIST(CBrushMip, bm_lnInBrush, iten->en_pbrBrush->br_lhBrushMips, itbm) { + // for all sectors in this mip + FOREACHINDYNAMICARRAY(itbm->bm_abscSectors, CBrushSector, itbsc) { + // for all polygons in sector + FOREACHINSTATICARRAY(itbsc->bsc_abpoPolygons, CBrushPolygon, itbpo) + { + CTFileName strTextureName = itbpo->bpo_abptTextures[1].bpt_toTexture.GetName().FileName(); + int _Obelisk02Light_found = strncmp((const char *)strTextureName, (const char *) "Obelisk02Light", (size_t) 14 ); + if (_Obelisk02Light_found == 0 ){ + if ( strLevelName=="KarnakDemo" || strLevelName=="Intro" || strLevelName=="08_Suburbs" + || strLevelName=="13_Luxor" || strLevelName=="14_SacredYards") { + itbpo->bpo_abptTextures[1].s.bpt_colColor = (C_WHITE| 0x5F); + } else if ( strLevelName=="04_ValleyOfTheKings" || strLevelName=="11_AlleyOfSphinxes" || strLevelName=="12_Karnak"){ + itbpo->bpo_abptTextures[1].s.bpt_colColor = (C_GRAY| 0x2F); + } + } + } + } + } + } // + }} +} + +void _FixTexturesOnAlleyOfSphinxes(void) +{ + // for each entity in the world + {FOREACHINDYNAMICCONTAINER(_pNetwork->ga_World.wo_cenEntities, CEntity, iten) { + // if it is brush entity + if (iten->en_RenderType == CEntity::RT_BRUSH) { + // for each mip in its brush + FOREACHINLIST(CBrushMip, bm_lnInBrush, iten->en_pbrBrush->br_lhBrushMips, itbm) { + // for all sectors in this mip + FOREACHINDYNAMICARRAY(itbm->bm_abscSectors, CBrushSector, itbsc) { + // for all polygons in sector + FOREACHINSTATICARRAY(itbsc->bsc_abpoPolygons, CBrushPolygon, itbpo) + { + CTFileName strTextureName = itbpo->bpo_abptTextures[1].bpt_toTexture.GetName().FileName(); + int _EyeOfRa_found = strncmp((const char *)strTextureName, (const char *) "EyeOfRa", (size_t) 7 ); + int _Wall12_found = strncmp((const char *)strTextureName, (const char *) "Wall12", (size_t) 6 ); + int _Wingy02_found = strncmp((const char *)strTextureName, (const char *) "Wingy02", (size_t) 7 ); + if (_EyeOfRa_found == 0 || _Wall12_found == 0 || _Wingy02_found == 0){ + itbpo->bpo_abptTextures[1].s.bpt_ubBlend = BPT_BLEND_BLEND; + itbpo->bpo_abptTextures[1].s.bpt_colColor = C_GRAY|0x80; + } + } + } + } + } // + }} +} + // make sure that console doesn't show last lines if not playing in network void MaybeDiscardLastLines(void) { + // Fix Textures Stuff + CTString strLevelName = _pNetwork->ga_fnmWorld.FileName(); + //CPrintF("[strLevelName ==: %s]\n", (const char*)strLevelName); + CTString strModName = _pShell->GetValue("sys_strModName"); + //CPrintF("[strModName ==: %s]\n", (const char*)strModName); + + // Fix Obelisk textures + if ( strModName=="" ) { + if ( strLevelName=="04_ValleyOfTheKings" || strLevelName=="11_AlleyOfSphinxes" || strLevelName=="12_Karnak" + || strLevelName=="13_Luxor" || strLevelName=="KarnakDemo" || strLevelName=="Intro" + || strLevelName=="08_Suburbs" || strLevelName=="14_SacredYards") { + _FixTexturesOnObelisk(strLevelName); + } + } + // Fix Alley Of Sphinxes textures + if ( strModName=="" && strLevelName=="11_AlleyOfSphinxes") { + _FixTexturesOnAlleyOfSphinxes(); + } + // if not in network if (!_pNetwork->IsNetworkEnabled()) { // don't show last lines on screen after exiting console @@ -180,7 +257,6 @@ void MaybeDiscardLastLines(void) } } - class CEnableUserBreak { public: BOOL bOld;