diff --git a/SamTFE/Scripts/CustomOptions/GFX-AdvancedRendering.cfg b/SamTFE/Scripts/CustomOptions/GFX-AdvancedRendering.cfg index bc187ec1..cfffa6c0 100755 --- a/SamTFE/Scripts/CustomOptions/GFX-AdvancedRendering.cfg +++ b/SamTFE/Scripts/CustomOptions/GFX-AdvancedRendering.cfg @@ -1,4 +1,29 @@ +// +Gadget: TTRS Illuminations bugfix metod +Type: Separator +// +Gadget: TTRS +Type: Separator + + +// +Gadget: TTRS Metod +Tip: TTRS set textures illuminations bugfix metod +Type: Toggle +Var: gam_bFixIlluminationsMetod + +String: TTRS None +Value: 0 +String: TTRS Rewrite texture settings +Value: 1 +String: TTRS Create additional lighting (better) +Value: 2 + + +// +Gadget: TTRS +Type: Separator // Gadget: TTRS Texture settings Type: Separator diff --git a/SamTFE/Sources/Entities/Common/LightFixes.h b/SamTFE/Sources/Entities/Common/LightFixes.h new file mode 100644 index 00000000..aa1059cc --- /dev/null +++ b/SamTFE/Sources/Entities/Common/LightFixes.h @@ -0,0 +1,303 @@ +#ifndef SE_INCL_LIGHTFIXES_H +#define SE_INCL_LIGHTFIXES_H +// ******************************************************************************************** +// ********** Arrays of light source coordinates to correct texture illumination ********** +// ******************************************************************************************** + +// Valley Of The Kings +FLOAT _fValleyOfTheKingsCoordinates[4][3] { +-55.9375f,-16.25f,-231.75, +-40.625f,-15.375f,-232.188f, +-23.0f,-15.0f,-232.0f, +-8.875f,-14.0625f,-231.562f +}; + +// Dunes +FLOAT _fDunesCoordinates[8][3] { +-284.5f,171.625f, +-495.625f,-285.5f, +170.125f,-534.875f, +-167.875f,170.375f, +-544.875f,-169.25f, +170.375f,-497.25f, +-41.875f,171.125f, +-741.625f,26.375f, +170.625f,-746.125f, +271.75f,170.5f, +-448.5f,224.0f, +169.875f,-440.75f +}; + +// Suburbs +FLOAT _fSuburbsCoordinates[21][3] { +224.125f,171.125f,887.375f, +270.125f,170.0f,889.0f, +370.125f,172.0f,822.125f, +369.0f,170.375f,811.625f, +370.0f,167.125f,759.25f, +370.25f,172.375f,769.5f, +267.0f,169.125f,720.875f, +268.375f,167.75f,711.375f, +226.75f,170.375f,709.625f, +187.0f,171.0f,492.0f, +181.75f,164.125f,447.125f, +21.125f,166.75f,476.875f, +-41.5f,170.25f,477.0f, +-243.75f,170.375f,569.5f, +-289.5f,170.5f,569.125f, +-170.875f,162.0f,784.125f, +-170.875f,166.25f,830.625f, +-318.25f,170.25f,870.125f, +-314.125f,173.5f,886.875f, +-318.375f,170.0f,908.875f, +-319.0f,169.25f,922.0f +}; + +// Metropolis +FLOAT _fMetropolisCoordinates[1][3] { +147.125f,64.3125f,26.6875f +}; + +// Alley Of Sphinxes +FLOAT _fAlleyOfSphinxesCoordinates[37][3] { +1594.0f,125.125f,2162.0f, +1592.25f,128.375f,2181.38f, +1586.0f,122.625f,1926.12f, +1595.25f,124.25f,1914.0f, +1338.88f,121.875f,1916.75f, +1344.38f,128.375f,2162.62f, +920.0f,116.125f,2040.12f, +1038.5f,115.375f,2006.0f, +1030.62f,111.625f,2022.88f, +1041.88f,116.875f,2070.12f, +1030.12f,116.5f,2081.0f, +1618.25f,8.625f,2053.62f, +1589.75f,9.75f,2041.75f, +1590.12f,9.5f,2053.25f, +1513.88f,12.625f,2160.0f, +1497.0f,34.5f,2151.0f, +1420.75f,17.375f,2160.0f, +1282.25f,12.0f,2182.12f, +1264.88f,9.875f,2179.25f, +1265.25f,10.875f,2167.62f, +1281.5f,11.25f,2166.62f, +1075.12f,12.5f,2162.62f, +1074.75f,11.5f,2177.5f, +1091.62f,13.125f,2180.0f, +1092.25f,13.0f,2188.38f, +1094.5f,11.25f,2174.5f, +1100.75f,11.875f,2163.75f, +1101.88f,12.125f,2183.88f, +1073.5f,10.25f,1922.62f, +1072.88f,10.625f,1908.5f, +1088.75f,10.5f,1909.75f, +1089.88f,11.125f,1921.88f, +1287.0f,14.0f,1909.62f, +1287.62f,13.625f,1924.5f, +1266.38f,12.25f,1922.75f, +1267.38f,13.0f,1910.0f, +1593.62f,-2.75f,2049.5f +}; + +// Karnak +FLOAT _fKarnakCoordinates[42][3] { +-186.938f,168.688f,1516.5f, +-196.5f,171.562f,1493.06f, +-275.062f,86.5f,1440.88f, +-293.0f,87.1875f,1446.62f, +-276.375f,81.1875f,1556.56f, +-293.5f,82.5f,1569.88f, +-219.688f,116.812f,1687.75f, +-212.75f,113.938f,1685.31f, +-177.875f,113.125f,1696.56f, +-158.875f,115.625f,1691.62f, +-92.0f,84.0f,1571.31f, +-104.938f,86.0625f,1555.69f, +-91.125f,86.5f,1437.94f, +-102.5f,87.9375f,1435.44f, +330.0f,127.312f,1455.62f, +315.25f,132.688f,1448.0f, +310.375f,122.375f,1825.19f, +328.125f,117.625f,1815.56f, +610.188f,120.688f,1888.12f, +613.25f,124.375f,1888.69f, +922.625f,92.6875f,2040.06f, +920.0f,92.4375f,2053.69f, +1032.12f,134.25f,2012.25f, +1032.25f,134.75f,2076.75f, +1344.75f,160.25f,1902.31f, +1325.31f,171.375f,1910.81f, +1325.12f,171.0f,2183.0f, +1344.31f,170.188f,2175.75f, +1597.06f,170.812f,1910.0f, +1617.0f,171.188f,1905.06f, +1597.25f,171.188f,2186.81f, +1597.69f,170.938f,2177.69f, +1610.75f,170.625f,2170.44f, +633.0f,123.938f,2809.06f, +647.938f,122.375f,2808.62f, +-590.938f,123.0f,2038.19f, +-595.688f,125.062f,2038.5f, +-97.0625f,108.438f,2457.38f, +-81.4375f,113.25f,2454.75f, +-49.75f,113.625f,2461.0f, +-29.0625f,109.75f,2459.5f, +660.0f,9.1875f,1915.56f +}; + +// Luxor +FLOAT _fLuxorCoordinates[51][3] { +-85.875f,14.4375f,6.6875f, +-75.3125f,14.8125f,-5.0625f, +-308.562f,116.312f,-7.8125f, +107.75f,123.062f,-144.125f, +124.625f,123.688f,-128.625f, +150.062f,122.562f,-158.875f, +159.875f,122.438f,-169.938f, +105.062f,110.375f,-241.375f, +111.188f,112.625f,-222.125f, +134.438f,108.875f,-238.688f, +144.25f,107.688f,-221.938f, +7.125f,111.938f,-279.438f, +10.1875f,112.875f,-294.25f, +15.0f,109.125f,-314.0f, +-26.5625f,109.125f,-398.125f, +-36.1875f,109.312f,-416.25f, +118.875f,105.188f,-391.562f, +128.625f,106.25f,-374.0f, +103.562f,113.875f,-296.812f, +111.438f,113.125f,-313.875f, +133.812f,100.562f,-335.812f, +145.062f,104.0f,-346.125f, +142.438f,110.0f,-326.0f, +146.0f,106.25f,-314.062f, +133.875f,104.375f,-304.25f, +105.75f,113.438f,-345.625f, +277.5f,106.125f,-539.625f, +272.438f,108.5f,-526.375f, +250.75f,109.375f,-523.125f, +260.688f,108.062f,-506.0f, +247.688f,116.625f,-280.438f, +279.812f,113.125f,-279.75f, +304.875f,117.0f,-137.875f, +375.0f,113.0f,-279.062f, +374.625f,112.562f,-246.75f, +442.438f,122.188f,-153.562f, +447.0f,121.938f,-134.25f, +441.125f,120.562f,-121.25f, +448.688f,121.938f,-102.25f, +438.375f,121.562f,105.875f, +447.938f,119.625f,122.0f, +441.312f,121.125f,134.562f, +447.438f,120.125f,153.938f, +415.625f,113.188f,296.375f, +416.938f,112.625f,326.875f, +281.25f,111.875f,246.562f, +248.625f,112.5f,247.188f, +183.875f,113.75f,292.188f, +152.562f,112.5f,291.25f, +124.562f,119.312f,206.875f, +93.1875f,119.812f,206.562f +}; + +// Sacred Yards +FLOAT _fSacredYardsCoordinates[27][3] { +71.0f,108.938f,199.562f, +87.75f,108.562f,182.938f, +-150.5f,105.938f,89.0f, +-170.0f,110.062f,94.9375, +188.0f,115.688f,121.188f, +197.812f,115.875f,104.0f, +238.125f,113.188f,113.25f, +247.812f,112.0f,102.0f, +350.188f,113.438f,90.3125f, +367.625f,110.125f,79.125f, +399.875f,108.625f,79.5625f, +417.562f,111.312f,81.125f, +527.5f,113.25f,198.188f, +520.375f,115.375f,214.688f, +401.25f,115.812f,552.625f, +345.625f,116.75f,552.812f, +216.625f,116.938f,482.75f, +-170.0f,111.75f,343.062f, +-158.625f,110.0f,334.0f, +153.188f,111.688f,446.0f, +148.812f,115.625f,446.5f, +95.1875f,113.0f,446.125f, +86.75f,115.375f,455.938f, +26.3125f,112.375f,562.062f, +18.0f,111.375f,570.562f, +-28.0625f,111.062f,562.0f, +-37.625f,114.375f,571.75 +}; + +// Karnak Demo +FLOAT _fKarnakDemoCoordinates[50][3] { +-186.938f,168.688f,1516.5f, +-196.5f,171.562f,1493.06f, +-275.062f,86.5f,1440.88f, +-293.0f,87.1875f,1446.62f, +-276.375f,81.1875f,1556.56f, +-293.5f,82.5f,1569.88f, +-219.688f,116.812f,1687.75f, +-212.75f,113.938f,1685.31f, +-177.875f,113.125f,1696.56f, +-158.875f,115.625f,1691.62f, +-92.0f,84.0f,1571.31f, +-104.938f,86.0625f,1555.69f, +-91.125f,86.5f,1437.94f, +-102.5f,87.9375f,1435.44f, +330.0f,127.312f,1455.62f, +315.25f,132.688f,1448.0f, +310.375f,122.375f,1825.19f, +328.125f,117.625f,1815.56f, +610.188f,120.688f,1888.12f, +613.25f,124.375f,1888.69f, +922.625f,92.6875f,2040.06f, +920.0f,92.4375f,2053.69f, +1032.12f,134.25f,2012.25f, +1032.25f,134.75f,2076.75f, +1344.75f,160.25f,1902.31f, +1325.31f,171.375f,1910.81f, +1325.12f,171.0f,2183.0f, +1344.31f,170.188f,2175.75f, +1597.06f,170.812f,1910.0f, +1617.0f,171.188f,1905.06f, +1597.25f,171.188f,2186.81f, +1597.69f,170.938f,2177.69f, +1610.75f,170.625f,2170.44f, +633.0f,123.938f,2809.06f, +647.938f,122.375f,2808.62f, +-590.938f,123.0f,2038.19f, +-595.688f,125.062f,2038.5f, +-97.0625f,108.438f,2457.38f, +-81.4375f,113.25f,2454.75f, +-49.75f,113.625f,2461.0f, +-29.0625f,109.75f,2459.5f, +361.25f,119.25f,2016.62f, +359.875f,120.5f,2067.88f, +265.75f,120.25f,2064.62f, +268.25f,120.25f,2015.62f, +198.125f,118.375f,2012.25f, +197.5f,118.0f,2068.5f, +172.0f,118.875f,2071.12f, +174.0f,119.0f,2012.62f, +660.0f,9.1875f,1915.56f +}; + +// Intro +FLOAT _fIntroCoordinates[8][3] { +361.25f,119.25f,2016.62f, +359.875f,120.5f,2067.88f, +265.75f,120.25f,2064.62f, +268.25f,120.25f,2015.62f, +198.125f,118.375f,2012.25f, +197.5f,118.0f,2068.5f, +172.0f,118.875f,2071.12f, +174.0f,119.0f,2012.62f +}; + +// ******************************************************************************************** +// ******************************************************************************************** +// ******************************************************************************************** +#endif // include once check diff --git a/SamTFE/Sources/Entities/MusicHolder.es b/SamTFE/Sources/Entities/MusicHolder.es index 0f82aebb..d45776e6 100644 --- a/SamTFE/Sources/Entities/MusicHolder.es +++ b/SamTFE/Sources/Entities/MusicHolder.es @@ -4,6 +4,8 @@ #include "Entities/EnemyBase.h" #include "Entities/EnemySpawner.h" #include "Entities/Trigger.h" +#include "Entities/Light.h" +#include "Entities/Common/LightFixes.h" %} enum MusicType { @@ -104,20 +106,279 @@ properties: } components: - 1 model MODEL_MARKER "Models\\Editor\\MusicHolder.mdl", - 2 texture TEXTURE_MARKER "Models\\Editor\\MusicHolder.tex" - + 1 model MODEL_MARKER "Models\\Editor\\MusicHolder.mdl", + 2 texture TEXTURE_MARKER "Models\\Editor\\MusicHolder.tex", + 3 class CLASS_LIGHT "Classes\\Light.ecl", functions: -//*************************************************************** -//*************** Fixed Textures on Obelisk ******************* -//*************************************************************** + //*************************************************************** + //**************** Fix Textures on some levels **************** + //*************************************************************** + + void ClearLights(void) + { + {FOREACHINDYNAMICCONTAINER(_pNetwork->ga_World.wo_cenEntities, CEntity, pen) { + if(IsDerivedFromClass(pen, "Light")) { + if(((CLight&)*pen).m_strName == "fix_texture"){ + pen->Destroy(); + } + } + }} + } + + void FixTexturesValleyOfTheKings(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 4; i++) { + FLOAT m_fCoord1 = _fValleyOfTheKingsCoordinates[i][0]; + FLOAT m_fCoord2 = _fValleyOfTheKingsCoordinates[i][1]; + FLOAT m_fCoord3 = _fValleyOfTheKingsCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + } + + void FixTexturesDunes(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 8; i++) { + FLOAT m_fCoord1 = _fDunesCoordinates[i][0]; + FLOAT m_fCoord2 = _fDunesCoordinates[i][1]; + FLOAT m_fCoord3 = _fDunesCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + } + + void FixTexturesSuburbs(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 21; i++) { + FLOAT m_fCoord1 = _fSuburbsCoordinates[i][0]; + FLOAT m_fCoord2 = _fSuburbsCoordinates[i][1]; + FLOAT m_fCoord3 = _fSuburbsCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + } + + void FixTexturesMetropolis(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + FLOAT m_fCoord1 = _fMetropolisCoordinates[0][0]; + FLOAT m_fCoord2 = _fMetropolisCoordinates[0][1]; + FLOAT m_fCoord3 = _fMetropolisCoordinates[0][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + + void FixTexturesAlleyOfSphinxes(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 37; i++) { + FLOAT m_fCoord1 = _fAlleyOfSphinxesCoordinates[i][0]; + FLOAT m_fCoord2 = _fAlleyOfSphinxesCoordinates[i][1]; + FLOAT m_fCoord3 = _fAlleyOfSphinxesCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + } + + void FixTexturesKarnak(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 41; i++) { + FLOAT m_fCoord1 = _fKarnakCoordinates[i][0]; + FLOAT m_fCoord2 = _fKarnakCoordinates[i][1]; + FLOAT m_fCoord3 = _fKarnakCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + FLOAT m_fCoord1 = _fKarnakCoordinates[41][0]; + FLOAT m_fCoord2 = _fKarnakCoordinates[41][1]; + FLOAT m_fCoord3 = _fKarnakCoordinates[41][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + + void FixTexturesLuxor(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 51; i++) { + FLOAT m_fCoord1 = _fLuxorCoordinates[i][0]; + FLOAT m_fCoord2 = _fLuxorCoordinates[i][1]; + FLOAT m_fCoord3 = _fLuxorCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + } + + void FixTexturesSacredYards(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 27; i++) { + FLOAT m_fCoord1 = _fSacredYardsCoordinates[i][0]; + FLOAT m_fCoord2 = _fSacredYardsCoordinates[i][1]; + FLOAT m_fCoord3 = _fSacredYardsCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + } + + void FixTexturesKarnakDemo(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 49; i++) { + FLOAT m_fCoord1 = _fKarnakDemoCoordinates[i][0]; + FLOAT m_fCoord2 = _fKarnakDemoCoordinates[i][1]; + FLOAT m_fCoord3 = _fKarnakDemoCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + FLOAT m_fCoord1 = _fKarnakDemoCoordinates[49][0]; + FLOAT m_fCoord2 = _fKarnakDemoCoordinates[49][1]; + FLOAT m_fCoord3 = _fKarnakDemoCoordinates[49][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + + void FixTexturesIntro(void) + { + ClearLights(); + CEntity *pen = NULL; + CPlacement3D pl; + for(int i = 0; i < 8; i++) { + FLOAT m_fCoord1 = _fIntroCoordinates[i][0]; + FLOAT m_fCoord2 = _fIntroCoordinates[i][1]; + FLOAT m_fCoord3 = _fIntroCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + pen = CreateEntity(pl, CLASS_LIGHT); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = 8.0f; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); + } + } + + //*************************************************************** + //*********************** Old metods: *************************** + //**************** Fix Textures on Obelisk ******************** + //*************************************************************** void FixTexturesOnObelisk(CTFileName strLevelName) { // for each entity in the world {FOREACHINDYNAMICCONTAINER(GetWorld()->wo_cenEntities, CEntity, iten) { - //CEntity *pen = iten; // if it is brush entity if (iten->en_RenderType == CEntity::RT_BRUSH) { // for each mip in its brush @@ -130,11 +391,11 @@ functions: 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 ){ - // REM Settings: - // itbpo->bpo_abptTextures[1].bpt_toTexture.GetName().FileName() - // itbpo->bpo_abptTextures[1].s.bpt_ubBlend - // itbpo->bpo_abptTextures[1].s.bpt_ubFlags - // itbpo->bpo_abptTextures[1].s.bpt_colColor + // Settings: + // itbpo->bpo_abptTextures[1].bpt_toTexture.GetName().FileName() + // itbpo->bpo_abptTextures[1].s.bpt_ubBlend + // itbpo->bpo_abptTextures[1].s.bpt_ubFlags + // itbpo->bpo_abptTextures[1].s.bpt_colColor if ( strLevelName=="KarnakDemo" || strLevelName=="Intro" || strLevelName=="08_Suburbs" || strLevelName=="13_Luxor" || strLevelName=="14_SacredYards") { itbpo->bpo_abptTextures[1].s.bpt_colColor = (C_WHITE| 0x5F); @@ -145,17 +406,17 @@ functions: } } } - } // END if() + } /// END if() }} } -//*************************************************************** -//*********^** Fixed Textures on Alley Of Sphinxes ************ -//*************************************************************** + + //*************************************************************** + //**********^** Fix Textures on Alley Of Sphinxes ************* + //*************************************************************** void FixTexturesOnAlleyOfSphinxes(void) { // for each entity in the world {FOREACHINDYNAMICCONTAINER(GetWorld()->wo_cenEntities, CEntity, iten) { - //CEntity *pen = iten; // if it is brush entity if (iten->en_RenderType == CEntity::RT_BRUSH) { // for each mip in its brush @@ -172,16 +433,17 @@ functions: 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; - } + } } } } } // END if() }} } -//*************************************************************** -//*************************************************************** -//*************************************************************** + + //*************************************************************** + //*************************************************************** + //*************************************************************** // count enemies in current world void CountEnemies(void) @@ -368,23 +630,47 @@ procedures: // wait for game to start autowait(_pTimer->TickQuantum); - // Overlord Stuff + // Get Level Name and Mod Name 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); + INDEX iBugFixMetod = _pShell->GetINDEX("gam_bFixIlluminationsMetod"); + + if(iBugFixMetod == 1) { + // 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(); + } + } else if(iBugFixMetod == 2) { + // Fix textures + if ( strModName=="" && strLevelName=="04_ValleyOfTheKings") { + FixTexturesValleyOfTheKings(); + } else if ( strModName=="" && strLevelName=="07_Dunes") { + FixTexturesDunes(); + } else if ( strModName=="" && strLevelName=="08_Suburbs") { + FixTexturesSuburbs(); + } else if ( strModName=="" && strLevelName=="10_Metropolis") { + FixTexturesMetropolis(); + } else if ( strModName=="" && strLevelName=="11_AlleyOfSphinxes") { + FixTexturesAlleyOfSphinxes(); + } else if ( strModName=="" && strLevelName=="12_Karnak") { + FixTexturesKarnak(); + } else if ( strModName=="" && strLevelName=="13_Luxor") { + FixTexturesLuxor(); + } else if ( strModName=="" && strLevelName=="14_SacredYards") { + FixTexturesSacredYards(); + } else if ( strModName=="" && strLevelName=="KarnakDemo") { + FixTexturesKarnakDemo(); + } else if ( strModName=="" && strLevelName=="Intro") { + FixTexturesIntro(); } - } - // Fix Alley Of Sphinxes textures - if ( strModName=="" && strLevelName=="11_AlleyOfSphinxes") { - FixTexturesOnAlleyOfSphinxes(); } // prepare initial music channel values diff --git a/SamTFE/Sources/GameMP/Game.cpp b/SamTFE/Sources/GameMP/Game.cpp index c249a7ee..36950216 100644 --- a/SamTFE/Sources/GameMP/Game.cpp +++ b/SamTFE/Sources/GameMP/Game.cpp @@ -30,6 +30,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include +#include "Entities/Common/LightFixes.h" #include "Camera.h" #include "LCDDrawing.h" @@ -170,6 +172,181 @@ static FLOAT gam_fChatSoundVolume = 0.25f; BOOL map_bIsFirstEncounter = FALSE; BOOL _bUserBreakEnabled = FALSE; +// Fix illuminations bug metod +// 0 - none +// 1 - fix textrure settings +// 2 - create additional lighting (better) +INDEX gam_bFixIlluminationsMetod = 2; + +//*************************************************************** +//**************** Fix Textures on some levels **************** +//*************************************************************** +void _ClearLights(void) +{ + {FOREACHINDYNAMICCONTAINER(_pNetwork->ga_World.wo_cenEntities, CEntity, pen) { + if(IsDerivedFromClass(pen, "Light")) { + if(((CLight&)*pen).m_strName == "fix_texture"){ + pen->Destroy(); + } + } + }} +} + +void _CreateLights(CPlacement3D pl, FLOAT _fFallOffRange) +{ + CEntity *pen = NULL; + pen = _pNetwork->ga_World.CreateEntity_t(pl, CTFILENAME("Classes\\Light.ecl")); + pen->Initialize(); + ((CLight&)*pen).m_colColor = C_GRAY; + ((CLight&)*pen).m_ltType = LT_POINT; + ((CLight&)*pen).m_bDarkLight = TRUE; + ((CLight&)*pen).m_rFallOffRange = _fFallOffRange; + ((CLight&)*pen).m_strName = "fix_texture"; + pen->en_ulSpawnFlags =0xFFFFFFFF; + pen->Reinitialize(); +} + +void _FixTexturesValleyOfTheKings(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 4; i++) { + FLOAT m_fCoord1 = _fValleyOfTheKingsCoordinates[i][0]; + FLOAT m_fCoord2 = _fValleyOfTheKingsCoordinates[i][1]; + FLOAT m_fCoord3 = _fValleyOfTheKingsCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } +} + +void _FixTexturesDunes(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 8; i++) { + FLOAT m_fCoord1 = _fDunesCoordinates[i][0]; + FLOAT m_fCoord2 = _fDunesCoordinates[i][1]; + FLOAT m_fCoord3 = _fDunesCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } +} + +void _FixTexturesSuburbs(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 21; i++) { + FLOAT m_fCoord1 = _fSuburbsCoordinates[i][0]; + FLOAT m_fCoord2 = _fSuburbsCoordinates[i][1]; + FLOAT m_fCoord3 = _fSuburbsCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } +} + +void _FixTexturesMetropolis(void) +{ + _ClearLights(); + CPlacement3D pl; + FLOAT m_fCoord1 = _fMetropolisCoordinates[0][0]; + FLOAT m_fCoord2 = _fMetropolisCoordinates[0][1]; + FLOAT m_fCoord3 = _fMetropolisCoordinates[0][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); +} + +void _FixTexturesAlleyOfSphinxes(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 37; i++) { + FLOAT m_fCoord1 = _fAlleyOfSphinxesCoordinates[i][0]; + FLOAT m_fCoord2 = _fAlleyOfSphinxesCoordinates[i][1]; + FLOAT m_fCoord3 = _fAlleyOfSphinxesCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } +} + +void _FixTexturesKarnak(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 41; i++) { + FLOAT m_fCoord1 = _fKarnakCoordinates[i][0]; + FLOAT m_fCoord2 = _fKarnakCoordinates[i][1]; + FLOAT m_fCoord3 = _fKarnakCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } + FLOAT m_fCoord1 = _fKarnakCoordinates[41][0]; + FLOAT m_fCoord2 = _fKarnakCoordinates[41][1]; + FLOAT m_fCoord3 = _fKarnakCoordinates[41][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 4.0f); +} + +void _FixTexturesLuxor(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 51; i++) { + FLOAT m_fCoord1 = _fLuxorCoordinates[i][0]; + FLOAT m_fCoord2 = _fLuxorCoordinates[i][1]; + FLOAT m_fCoord3 = _fLuxorCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } +} + +void _FixTexturesSacredYards(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 27; i++) { + FLOAT m_fCoord1 = _fSacredYardsCoordinates[i][0]; + FLOAT m_fCoord2 = _fSacredYardsCoordinates[i][1]; + FLOAT m_fCoord3 = _fSacredYardsCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } +} + +void _FixTexturesKarnakDemo(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 49; i++) { + FLOAT m_fCoord1 = _fKarnakDemoCoordinates[i][0]; + FLOAT m_fCoord2 = _fKarnakDemoCoordinates[i][1]; + FLOAT m_fCoord3 = _fKarnakDemoCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } + FLOAT m_fCoord1 = _fKarnakDemoCoordinates[49][0]; + FLOAT m_fCoord2 = _fKarnakDemoCoordinates[49][1]; + FLOAT m_fCoord3 = _fKarnakDemoCoordinates[49][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 4.0f); +} + +void _FixTexturesIntro(void) +{ + _ClearLights(); + CPlacement3D pl; + for(int i = 0; i < 8; i++) { + FLOAT m_fCoord1 = _fIntroCoordinates[i][0]; + FLOAT m_fCoord2 = _fIntroCoordinates[i][1]; + FLOAT m_fCoord3 = _fIntroCoordinates[i][2]; + pl = CPlacement3D(FLOAT3D(m_fCoord1, m_fCoord2, m_fCoord3), ANGLE3D(0, 0, 0)); + _CreateLights(pl, 8.0f); + } +} +//*************************************************************** +//*********************** Old metods: *************************** +//**************** Fix Textures on Obelisk ******************** +//*************************************************************** void _FixTexturesOnObelisk(CTFileName strLevelName) { // for each entity in the world @@ -186,6 +363,11 @@ void _FixTexturesOnObelisk(CTFileName strLevelName) 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 ){ + // Settings: + // itbpo->bpo_abptTextures[1].bpt_toTexture.GetName().FileName() + // itbpo->bpo_abptTextures[1].s.bpt_ubBlend + // itbpo->bpo_abptTextures[1].s.bpt_ubFlags + // itbpo->bpo_abptTextures[1].s.bpt_colColor if ( strLevelName=="KarnakDemo" || strLevelName=="Intro" || strLevelName=="08_Suburbs" || strLevelName=="13_Luxor" || strLevelName=="14_SacredYards") { itbpo->bpo_abptTextures[1].s.bpt_colColor = (C_WHITE| 0x5F); @@ -196,10 +378,12 @@ void _FixTexturesOnObelisk(CTFileName strLevelName) } } } - } // + } // END if() }} } - +//*************************************************************** +//**********^** Fix Textures on Alley Of Sphinxes ************* +//*************************************************************** void _FixTexturesOnAlleyOfSphinxes(void) { // for each entity in the world @@ -224,30 +408,57 @@ void _FixTexturesOnAlleyOfSphinxes(void) } } } - } // + } // END if() }} } +//*************************************************************** +//*************************************************************** +//*************************************************************** // make sure that console doesn't show last lines if not playing in network void MaybeDiscardLastLines(void) { - // Fix Textures Stuff + // Get Level Name and Mod Name 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); + INDEX iBugFixMetod = _pShell->GetINDEX("gam_bFixIlluminationsMetod"); + + if(iBugFixMetod == 1) { + // 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(); + } + } else if (iBugFixMetod == 2) { + // Fix textures + if ( strModName=="" && strLevelName=="04_ValleyOfTheKings") { + _FixTexturesValleyOfTheKings(); + } else if ( strModName=="" && strLevelName=="07_Dunes") { + _FixTexturesDunes(); + } else if ( strModName=="" && strLevelName=="08_Suburbs") { + _FixTexturesSuburbs(); + } else if ( strModName=="" && strLevelName=="10_Metropolis") { + _FixTexturesMetropolis(); + } else if ( strModName=="" && strLevelName=="11_AlleyOfSphinxes") { + _FixTexturesAlleyOfSphinxes(); + } else if ( strModName=="" && strLevelName=="12_Karnak") { + _FixTexturesKarnak(); + } else if ( strModName=="" && strLevelName=="13_Luxor") { + _FixTexturesLuxor(); + } else if ( strModName=="" && strLevelName=="14_SacredYards") { + _FixTexturesSacredYards(); + } else if ( strModName=="" && strLevelName=="KarnakDemo") { + _FixTexturesKarnakDemo(); + } else if ( strModName=="" && strLevelName=="Intro") { + _FixTexturesIntro(); } - } - // Fix Alley Of Sphinxes textures - if ( strModName=="" && strLevelName=="11_AlleyOfSphinxes") { - _FixTexturesOnAlleyOfSphinxes(); } // if not in network @@ -256,6 +467,9 @@ void MaybeDiscardLastLines(void) CON_DiscardLastLineTimes(); } } +//*************************************************************** +//*************************************************************** +//*************************************************************** class CEnableUserBreak { public: @@ -272,7 +486,6 @@ CEnableUserBreak::~CEnableUserBreak() { _bUserBreakEnabled = bOld; } - // wrapper function for dump and printout of extensive demo profile report static void DumpDemoProfile(void) { @@ -1124,6 +1337,12 @@ void CGame::InitInternal( void) _pShell->DeclareSymbol("user void StopSound(INDEX);", (void *)&StopScriptSound); _pShell->DeclareSymbol("user INDEX IsSoundPlaying(INDEX);", (void *)&IsScriptSoundPlaying); + // Fix illuminations bug metod: + // 0 - none + // 1 - fix textrure settings fix + // 2 - create additional lighting (better) + _pShell->DeclareSymbol("persistent user INDEX gam_bFixIlluminationsMetod;", (void *)&gam_bFixIlluminationsMetod); + CAM_Init(); // load persistent symbols @@ -1364,7 +1583,6 @@ BOOL CGame::LoadGame(const CTFileName &fnGame) gam_bQuickSave = TRUE; } - MaybeDiscardLastLines(); return TRUE; }