├── source ├── dllInit.h └── readme.txt ├── game ├── core │ ├── fonts │ │ └── .gitignore │ ├── scripts │ │ ├── client │ │ │ ├── helperfuncs.cs │ │ │ ├── postFx │ │ │ │ ├── noise.png │ │ │ │ ├── AreaMap33.dds │ │ │ │ ├── null_color_ramp.png │ │ │ │ ├── textures │ │ │ │ │ ├── caustics_1.png │ │ │ │ │ └── caustics_2.png │ │ │ │ ├── MotionBlurFx.cs │ │ │ │ ├── turbulence.cs │ │ │ │ ├── flash.cs │ │ │ │ ├── fxaa.cs │ │ │ │ ├── GammaPostFX.cs │ │ │ │ ├── caustics.cs │ │ │ │ ├── chromaticLens.cs │ │ │ │ ├── postFxManager.persistance.cs │ │ │ │ ├── default.postfxpreset.cs │ │ │ │ ├── lightRay.cs │ │ │ │ ├── glow.cs │ │ │ │ ├── edgeAA.cs │ │ │ │ └── fog.cs │ │ │ ├── lighting │ │ │ │ ├── advanced │ │ │ │ │ ├── depthviz.png │ │ │ │ │ ├── shadowViz.gui │ │ │ │ │ ├── init.cs │ │ │ │ │ └── shadowViz.cs │ │ │ │ ├── shadowMaps │ │ │ │ │ └── init.cs │ │ │ │ └── basic │ │ │ │ │ ├── shadowFilter.cs │ │ │ │ │ └── init.cs │ │ │ ├── commands.cs │ │ │ ├── imposter.cs │ │ │ ├── scriptDoc.cs │ │ │ ├── terrainBlock.cs │ │ │ ├── materials.cs │ │ │ ├── audioAmbiences.cs │ │ │ ├── devHelpers.cs │ │ │ ├── scatterSky.cs │ │ │ ├── clouds.cs │ │ │ ├── actionMap.cs │ │ │ ├── client.cs │ │ │ ├── commonMaterialData.cs │ │ │ ├── postFx.cs │ │ │ ├── centerPrint.cs │ │ │ ├── lighting.cs │ │ │ ├── shaders.cs │ │ │ ├── cursor.cs │ │ │ ├── message.cs │ │ │ ├── recordings.cs │ │ │ ├── audioDescriptions.cs │ │ │ ├── mission.cs │ │ │ ├── audioStates.cs │ │ │ └── screenshot.cs │ │ ├── gui │ │ │ ├── messageBoxes │ │ │ │ ├── messageBoxSound.wav │ │ │ │ ├── messagePopup.ed.gui │ │ │ │ ├── messageBoxOk.ed.gui │ │ │ │ ├── messageBoxOkCancel.ed.gui │ │ │ │ ├── messageBoxYesNo.ed.gui │ │ │ │ ├── messageBoxYesNoCancel.ed.gui │ │ │ │ └── MessageBoxOKCancelDetailsDlg.ed.gui │ │ │ ├── cursors.cs │ │ │ ├── guiTreeViewCtrl.cs │ │ │ └── help.cs │ │ └── server │ │ │ ├── kickban.cs │ │ │ ├── audio.cs │ │ │ ├── defaults.cs │ │ │ ├── camera.cs │ │ │ ├── centerPrint.cs │ │ │ └── levelInfo.cs │ └── profile │ │ ├── D3D9.cs │ │ ├── D3D9.NVIDIA.cs │ │ ├── D3D9.ATITechnologiesInc.cs │ │ ├── D3D9.NVIDIA.GeForce8600.cs │ │ └── D3D9.NVIDIA.QuadroFXGo1000.cs ├── runTests.cs └── scripts │ ├── server │ ├── scriptExec.cs │ ├── commands.cs │ ├── defaults.cs │ └── init.cs │ ├── client │ ├── commands.cs │ └── defaults.cs │ ├── gui │ ├── loadingGui.cs │ └── playGui.cs │ └── main.cs ├── thumb.png ├── DeleteCachedDTSs.bat ├── cleanShaders.command ├── DeletePrefs.bat ├── cleanShaders.bat ├── DeletePrefs.command ├── DeleteCachedDTSs.command ├── DeleteDSOs.bat ├── DeleteDSOs.command ├── generateProjects.command ├── generateProjects.bat ├── LICENSE └── README.md /source/dllInit.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /game/core/fonts/.gitignore: -------------------------------------------------------------------------------- 1 | # Keep directory in git repo 2 | -------------------------------------------------------------------------------- /thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/thumb.png -------------------------------------------------------------------------------- /DeleteCachedDTSs.bat: -------------------------------------------------------------------------------- 1 | for /R %%a IN (*.dae) do IF EXIST "%%~pna.cached.dts" del "%%~pna.cached.dts" 2 | -------------------------------------------------------------------------------- /cleanShaders.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd "`dirname "$0"`" 4 | rm -rf game/shaders/procedural/*.* 5 | -------------------------------------------------------------------------------- /game/core/scripts/client/helperfuncs.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/game/core/scripts/client/helperfuncs.cs -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/game/core/scripts/client/postFx/noise.png -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/AreaMap33.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/game/core/scripts/client/postFx/AreaMap33.dds -------------------------------------------------------------------------------- /DeletePrefs.bat: -------------------------------------------------------------------------------- 1 | del /s prefs.cs 2 | del /s config.cs 3 | del /s banlist.cs 4 | del /s config.cs.dso 5 | del /s prefs.cs.dso 6 | del /s banlist.cs.dso 7 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/null_color_ramp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/game/core/scripts/client/postFx/null_color_ramp.png -------------------------------------------------------------------------------- /game/core/scripts/client/lighting/advanced/depthviz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/game/core/scripts/client/lighting/advanced/depthviz.png -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/textures/caustics_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/game/core/scripts/client/postFx/textures/caustics_1.png -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/textures/caustics_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/game/core/scripts/client/postFx/textures/caustics_2.png -------------------------------------------------------------------------------- /game/core/scripts/gui/messageBoxes/messageBoxSound.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/figment/Untorque/HEAD/game/core/scripts/gui/messageBoxes/messageBoxSound.wav -------------------------------------------------------------------------------- /cleanShaders.bat: -------------------------------------------------------------------------------- 1 | REM Delete procedural shaders 2 | 3 | del /q /a:-R game\shaders\procedural\*.* 4 | 5 | REM Delete dumped shader disassembly files 6 | 7 | del /q /s /a:-R *_dis.txt -------------------------------------------------------------------------------- /DeletePrefs.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | find "`dirname "$0"`" -type f \( -name "prefs.cs" -or -name "config.cs" -or -name "banlist.cs" -or -name "prefs.cs.dso" -or -name "config.cs.dso" -or -name "banlist.cs.dso" \) -exec rm {} \; 4 | -------------------------------------------------------------------------------- /source/readme.txt: -------------------------------------------------------------------------------- 1 | Your project specific source files and subfolders go into this directory. 2 | 3 | Simply add them to this folder and then regenerate your project 4 | Visual Studio Solution/XCode workspace with the Torque Toolbox. 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DeleteCachedDTSs.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd "`dirname "$0"`" 4 | 5 | for i in $(find . -type f \( -iname "*.dae" \)) 6 | do 7 | len=$((${#i} - 4)) 8 | file=${i:0:$len}.cached.dts 9 | if [ -e $file ] 10 | then 11 | echo "Removing ${file}" 12 | rm $file 13 | fi 14 | done 15 | 16 | -------------------------------------------------------------------------------- /DeleteDSOs.bat: -------------------------------------------------------------------------------- 1 | for /R %%a IN (*.cs) do IF EXIST "%%a.dso" del "%%a.dso" 2 | for /R %%a IN (*.cs) do IF EXIST "%%a.edso" del "%%a.edso" 3 | for /R %%a IN (*.gui) do IF EXIST "%%a.dso" del "%%a.dso" 4 | for /R %%a IN (*.gui) do IF EXIST "%%a.edso" del "%%a.edso" 5 | for /R %%a IN (*.ts) do IF EXIST "%%a.dso" del "%%a.dso" 6 | for /R %%a IN (*.ts) do IF EXIST "%%a.edso" del "%%a.edso" 7 | -------------------------------------------------------------------------------- /DeleteDSOs.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd "`dirname "$0"`" 4 | 5 | for i in $(find . -type f \( -iname "*.cs" \)) 6 | do 7 | file=${i}.dso 8 | if [ -e $file ] 9 | then 10 | echo "Removing ${file}" 11 | rm $file 12 | fi 13 | file=${i}.edso 14 | if [ -e $file ] 15 | then 16 | echo "Removing ${file}" 17 | rm $file 18 | fi 19 | done 20 | -------------------------------------------------------------------------------- /generateProjects.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd "`dirname "$0"`" 4 | 5 | OS=`uname` 6 | 7 | if [ "$OS" = "Darwin" ]; then 8 | /usr/bin/php ../../Tools/projectGenerator/projectGenerator.php buildFiles/config/project.mac.conf 9 | else 10 | /usr/bin/php ../../Tools/projectGenerator/projectGenerator.php buildFiles/config/project.linux.conf 11 | /usr/bin/php ../../Tools/projectGenerator/projectGenerator.php buildFiles/config/project.linux_ded.conf 12 | fi 13 | -------------------------------------------------------------------------------- /game/runTests.cs: -------------------------------------------------------------------------------- 1 | new GuiControlProfile(GuiDefaultProfile); 2 | new GuiControlProfile(GuiToolTipProfile); 3 | new GuiCanvas(Canvas); 4 | function onLightManagerActivate() {} 5 | function onLightManagerDeactivate() {} 6 | Canvas.setWindowTitle("Torque 3D Unit Tests"); 7 | new RenderPassManager(DiffuseRenderPassManager); 8 | setLightManager("Basic Lighting"); 9 | setLogMode(2); 10 | $Con::LogBufferEnabled = false; 11 | $Testing::checkMemoryLeaks = false; 12 | runAllUnitTests(); 13 | quit(); 14 | -------------------------------------------------------------------------------- /generateProjects.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | SET TORQUEDIR=%2 5 | IF NOT DEFINED TORQUEDIR SET TORQUEDIR=..\.. 6 | 7 | %TORQUEDIR%\engine\bin\php\php %TORQUEDIR%\Tools\projectGenerator\projectGenerator.php buildFiles/config/project.conf %TORQUEDIR% 8 | 9 | endlocal 10 | 11 | if X%1 == X ( 12 | 13 | echo. 14 | echo REMEMBER: Restart VisualStudio if you are running it to be sure the new 15 | echo project files are loaded! See docs for more info! 16 | echo. 17 | 18 | pause 19 | ) 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /game/core/scripts/gui/messageBoxes/messagePopup.ed.gui: -------------------------------------------------------------------------------- 1 | //--- OBJECT WRITE BEGIN --- 2 | %guiContent = new GuiControl(MessagePopupDlg) { 3 | profile = "GuiDefaultProfile"; 4 | horizSizing = "width"; 5 | vertSizing = "height"; 6 | position = "0 0"; 7 | extent = "640 480"; 8 | minExtent = "8 8"; 9 | visible = "1"; 10 | helpTag = "0"; 11 | 12 | new GuiWindowCtrl(MessagePopFrame) { 13 | profile = "GuiWindowProfile"; 14 | horizSizing = "center"; 15 | vertSizing = "center"; 16 | position = "170 175"; 17 | extent = "300 92"; 18 | minExtent = "48 92"; 19 | visible = "1"; 20 | helpTag = "0"; 21 | maxLength = "255"; 22 | resizeWidth = "1"; 23 | resizeHeight = "1"; 24 | canMove = "1"; 25 | canClose = "1"; 26 | text = ""; 27 | canMinimize = "0"; 28 | canMaximize = "0"; 29 | minSize = "50 50"; 30 | 31 | new GuiMLTextCtrl(MessagePopText) { 32 | profile = "GuiMLTextProfile"; 33 | horizSizing = "center"; 34 | vertSizing = "bottom"; 35 | position = "32 39"; 36 | extent = "236 24"; 37 | minExtent = "8 8"; 38 | visible = "1"; 39 | helpTag = "0"; 40 | lineSpacing = "2"; 41 | allowColorChars = "0"; 42 | maxChars = "-1"; 43 | }; 44 | }; 45 | }; 46 | //--- OBJECT WRITE END --- 47 | -------------------------------------------------------------------------------- /game/scripts/server/scriptExec.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // Load up all scripts. This function is called when 24 | // a server is constructed. 25 | -------------------------------------------------------------------------------- /game/core/profile/D3D9.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // Direct3D 9 Renderer Profile Script 24 | // 25 | // This script is responsible for setting global 26 | // capability strings based on the D3D9 renderer type. -------------------------------------------------------------------------------- /game/core/scripts/client/commands.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // Sync the Camera and the EditorGui 24 | function clientCmdSyncEditorGui() 25 | { 26 | if (isObject(EditorGui)) 27 | EditorGui.syncCameraGui(); 28 | } -------------------------------------------------------------------------------- /game/scripts/server/commands.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | // Misc. server commands avialable to clients 25 | //----------------------------------------------------------------------------- -------------------------------------------------------------------------------- /game/scripts/client/commands.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //---------------------------------------------------------------------------- 24 | // Game start / end events sent from the server 25 | //---------------------------------------------------------------------------- 26 | 27 | function clientCmdGameEnd(%seq) 28 | { 29 | // Stop local activity... the game will be destroyed on the server 30 | sfxStopAll(); 31 | } 32 | -------------------------------------------------------------------------------- /game/core/scripts/client/imposter.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | function imposterMetricsCallback() 25 | { 26 | return " | IMPOSTER |" @ 27 | " Rendered: " @ $ImposterStats::rendered @ 28 | " Batches: " @ $ImposterStats::batches @ 29 | " DrawCalls: " @ $ImposterStats::drawCalls @ 30 | " Polys: " @ $ImposterStats::polyCount @ 31 | " RtChanges: " @ $ImposterStats::rtChanges; 32 | } -------------------------------------------------------------------------------- /game/core/profile/D3D9.NVIDIA.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // nVidia Vendor Profile Script 24 | // 25 | // This script is responsible for setting global 26 | // capability strings based on the nVidia vendor. 27 | 28 | if(GFXCardProfiler::getVersion() < 56.72) 29 | { 30 | $GFX::OutdatedDrivers = true; 31 | $GFX::OutdatedDriversLink = "You can get newer drivers here.."; 32 | } 33 | else 34 | { 35 | $GFX::OutdatedDrivers = false; 36 | } 37 | -------------------------------------------------------------------------------- /game/core/scripts/gui/cursors.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | if($platform $= "macos") 24 | { 25 | new GuiCursor(DefaultCursor) 26 | { 27 | hotSpot = "4 4"; 28 | renderOffset = "0 0"; 29 | bitmapName = "~/art/gui/images/macCursor"; 30 | }; 31 | } 32 | else 33 | { 34 | new GuiCursor(DefaultCursor) 35 | { 36 | hotSpot = "1 1"; 37 | renderOffset = "0 0"; 38 | bitmapName = "~/art/gui/images/defaultCursor"; 39 | }; 40 | } -------------------------------------------------------------------------------- /game/core/profile/D3D9.ATITechnologiesInc.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // ATI Vendor Profile Script 24 | // 25 | // This script is responsible for setting global 26 | // capability strings based on the nVidia vendor. 27 | 28 | if(GFXCardProfiler::getVersion() < 64.44) 29 | { 30 | $GFX::OutdatedDrivers = true; 31 | $GFX::OutdatedDriversLink = "You can get newer drivers here.."; 32 | } 33 | else 34 | { 35 | $GFX::OutdatedDrivers = false; 36 | } 37 | -------------------------------------------------------------------------------- /game/core/profile/D3D9.NVIDIA.GeForce8600.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // nVidia Vendor Profile Script 24 | // 25 | // This script is responsible for setting global 26 | // capability strings based on the nVidia vendor. 27 | 28 | if(GFXCardProfiler::getVersion() < 1.2) 29 | { 30 | $GFX::OutdatedDrivers = true; 31 | $GFX::OutdatedDriversLink = "You can get newer drivers here.."; 32 | } 33 | else 34 | { 35 | $GFX::OutdatedDrivers = false; 36 | } 37 | -------------------------------------------------------------------------------- /game/core/scripts/client/scriptDoc.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // Writes out all script functions to a file. 24 | function writeOutFunctions() 25 | { 26 | new ConsoleLogger(logger, "scriptFunctions.txt", false); 27 | dumpConsoleFunctions(); 28 | logger.delete(); 29 | } 30 | 31 | // Writes out all script classes to a file. 32 | function writeOutClasses() 33 | { 34 | new ConsoleLogger(logger, "scriptClasses.txt", false); 35 | dumpConsoleClasses(); 36 | logger.delete(); 37 | } 38 | -------------------------------------------------------------------------------- /game/core/scripts/client/lighting/shadowMaps/init.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | new ShaderData(BlurDepthShader) 25 | { 26 | DXVertexShaderFile = "shaders/common/lighting/shadowMap/boxFilterV.hlsl"; 27 | DXPixelShaderFile = "shaders/common/lighting/shadowMap/boxFilterP.hlsl"; 28 | 29 | OGLVertexShaderFile = "shaders/common/lighting/shadowMap/gl/boxFilterV.glsl"; 30 | OGLPixelShaderFile = "shaders/common/lighting/shadowMap/gl/boxFilterP.glsl"; 31 | pixVersion = 2.0; 32 | }; 33 | -------------------------------------------------------------------------------- /game/core/scripts/client/terrainBlock.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | /// Used when generating the blended base texture. 24 | singleton ShaderData( TerrainBlendShader ) 25 | { 26 | DXVertexShaderFile = "shaders/common/terrain/blendV.hlsl"; 27 | DXPixelShaderFile = "shaders/common/terrain/blendP.hlsl"; 28 | 29 | OGLVertexShaderFile = "shaders/common/terrain/gl/blendV.glsl"; 30 | OGLPixelShaderFile = "shaders/common/terrain/gl/blendP.glsl"; 31 | 32 | pixVersion = 2.0; 33 | }; 34 | -------------------------------------------------------------------------------- /game/core/scripts/client/materials.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | singleton Material( WarningMaterial ) 24 | { 25 | diffuseMap[0] = "~/art/warnMat"; 26 | emissive[0] = false; 27 | translucent = false; 28 | }; 29 | 30 | 31 | singleton CubemapData( WarnMatCubeMap ) 32 | { 33 | cubeFace[0] = "~/art/warnMat"; 34 | cubeFace[1] = "~/art/warnMat"; 35 | cubeFace[2] = "~/art/warnMat"; 36 | cubeFace[3] = "~/art/warnMat"; 37 | cubeFace[4] = "~/art/warnMat"; 38 | cubeFace[5] = "~/art/warnMat"; 39 | }; 40 | -------------------------------------------------------------------------------- /game/core/scripts/gui/messageBoxes/messageBoxOk.ed.gui: -------------------------------------------------------------------------------- 1 | //--- OBJECT WRITE BEGIN --- 2 | %guiContent = new GuiControl(MessageBoxOKDlg) { 3 | profile = "GuiOverlayProfile"; 4 | horizSizing = "width"; 5 | vertSizing = "height"; 6 | position = "0 0"; 7 | extent = "640 480"; 8 | minExtent = "8 8"; 9 | visible = "1"; 10 | helpTag = "0"; 11 | 12 | new GuiWindowCtrl(MBOKFrame) { 13 | profile = "GuiWindowProfile"; 14 | horizSizing = "center"; 15 | vertSizing = "center"; 16 | position = "170 175"; 17 | extent = "300 107"; 18 | minExtent = "48 95"; 19 | visible = "1"; 20 | helpTag = "0"; 21 | maxLength = "255"; 22 | resizeWidth = "1"; 23 | resizeHeight = "1"; 24 | canMove = "1"; 25 | canClose = "0"; 26 | canMinimize = "0"; 27 | canMaximize = "0"; 28 | minSize = "50 50"; 29 | text = ""; 30 | 31 | new GuiMLTextCtrl(MBOKText) { 32 | profile = "GuiMLTextProfile"; 33 | horizSizing = "center"; 34 | vertSizing = "bottom"; 35 | position = "9 35"; 36 | extent = "281 24"; 37 | minExtent = "8 8"; 38 | visible = "1"; 39 | helpTag = "0"; 40 | lineSpacing = "2"; 41 | allowColorChars = "0"; 42 | maxChars = "-1"; 43 | }; 44 | new GuiButtonCtrl() { 45 | profile = "GuiButtonProfile"; 46 | horizSizing = "right"; 47 | vertSizing = "top"; 48 | position = "111 75"; 49 | extent = "80 24"; 50 | minExtent = "8 8"; 51 | visible = "1"; 52 | command = "MessageCallback(MessageBoxOKDlg,MessageBoxOKDlg.callback);"; 53 | accelerator = "return"; 54 | helpTag = "0"; 55 | text = "Ok"; 56 | simpleStyle = "0"; 57 | }; 58 | }; 59 | }; 60 | //--- OBJECT WRITE END --- 61 | -------------------------------------------------------------------------------- /game/scripts/client/defaults.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // First we execute the core default preferences. 24 | exec( "core/scripts/client/defaults.cs" ); 25 | 26 | 27 | // Now add your own game specific client preferences as 28 | // well as any overloaded core defaults here. 29 | 30 | 31 | 32 | 33 | // Finally load the preferences saved from the last 34 | // game execution if they exist. 35 | if ( $platform !$= "xenon" ) 36 | { 37 | if ( isFile( "./prefs.cs" ) ) 38 | exec( "./prefs.cs" ); 39 | } 40 | else 41 | { 42 | echo( "Not loading client prefs.cs on Xbox360" ); 43 | } -------------------------------------------------------------------------------- /game/core/profile/D3D9.NVIDIA.QuadroFXGo1000.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // nVidia Vendor Profile Script 24 | // 25 | // This script is responsible for setting global 26 | // capability strings based on the nVidia vendor. 27 | 28 | if(GFXCardProfiler::getVersion() < 53.82) 29 | { 30 | $GFX::OutdatedDrivers = true; 31 | $GFX::OutdatedDriversLink = "You can get newer drivers here.."; 32 | } 33 | else 34 | { 35 | $GFX::OutdatedDrivers = false; 36 | } 37 | 38 | // Silly card has trouble with this! 39 | GFXCardProfiler::setCapability("autoMipmapLevel", false); 40 | -------------------------------------------------------------------------------- /game/scripts/server/defaults.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // First we execute the core default preferences. 24 | exec( "core/scripts/server/defaults.cs" ); 25 | 26 | 27 | // Now add your own game specific server preferences as 28 | // well as any overloaded core defaults here. 29 | 30 | 31 | 32 | 33 | // Finally load the preferences saved from the last 34 | // game execution if they exist. 35 | if ( $platform !$= "xenon" ) 36 | { 37 | if ( isFile( "./prefs.cs" ) ) 38 | exec( "./prefs.cs" ); 39 | } 40 | else 41 | { 42 | echo( "Not loading server prefs.cs on Xbox360" ); 43 | } 44 | -------------------------------------------------------------------------------- /game/core/scripts/client/audioAmbiences.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | singleton SFXAmbience( AudioAmbienceDefault ) 25 | { 26 | environment = AudioEnvOff; 27 | }; 28 | 29 | singleton SFXAmbience( AudioAmbienceOutside ) 30 | { 31 | environment = AudioEnvPlain; 32 | states[ 0 ] = AudioLocationOutside; 33 | }; 34 | 35 | singleton SFXAmbience( AudioAmbienceInside ) 36 | { 37 | environment = AudioEnvRoom; 38 | states[ 0 ] = AudioLocationInside; 39 | }; 40 | 41 | singleton SFXAmbience( AudioAmbienceUnderwater ) 42 | { 43 | environment = AudioEnvUnderwater; 44 | states[ 0 ] = AudioLocationUnderwater; 45 | }; 46 | -------------------------------------------------------------------------------- /game/core/scripts/client/devHelpers.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | /// Shortcut for typing dbgSetParameters with the default values torsion uses. 24 | function dbgTorsion() 25 | { 26 | dbgSetParameters( 6060, "password", false ); 27 | } 28 | 29 | /// Reset the input state to a default of all-keys-up. 30 | /// A helpful remedy for when Torque misses a button up event do to your breakpoints 31 | /// and can't stop shooting / jumping / strafing. 32 | function mvReset() 33 | { 34 | for ( %i = 0; %i < 6; %i++ ) 35 | setVariable( "mvTriggerCount" @ %i, 0 ); 36 | 37 | $mvUpAction = 0; 38 | $mvDownAction = 0; 39 | $mvLeftAction = 0; 40 | $mvRightAction = 0; 41 | 42 | // There are others. 43 | } -------------------------------------------------------------------------------- /game/core/scripts/server/kickban.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | 25 | function kick(%client) 26 | { 27 | messageAll( 'MsgAdminForce', '\c2The Admin has kicked %1.', %client.playerName); 28 | 29 | if (!%client.isAIControlled()) 30 | BanList::add(%client.guid, %client.getAddress(), $Pref::Server::KickBanTime); 31 | %client.delete("You have been kicked from this server"); 32 | } 33 | 34 | function ban(%client) 35 | { 36 | messageAll('MsgAdminForce', '\c2The Admin has banned %1.', %client.playerName); 37 | 38 | if (!%client.isAIControlled()) 39 | BanList::add(%client.guid, %client.getAddress(), $Pref::Server::BanTime); 40 | %client.delete("You have been banned from this server"); 41 | } 42 | -------------------------------------------------------------------------------- /game/core/scripts/server/audio.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | 25 | function ServerPlay2D(%profile) 26 | { 27 | // Play the given sound profile on every client. 28 | // The sounds will be transmitted as an event, not attached to any object. 29 | for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) 30 | ClientGroup.getObject(%idx).play2D(%profile); 31 | } 32 | 33 | function ServerPlay3D(%profile,%transform) 34 | { 35 | // Play the given sound profile at the given position on every client 36 | // The sound will be transmitted as an event, not attached to any object. 37 | for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) 38 | ClientGroup.getObject(%idx).play3D(%profile,%transform); 39 | } 40 | 41 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/MotionBlurFx.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | singleton ShaderData( PFX_MotionBlurShader ) 24 | { 25 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; //we use the bare-bones postFxV.hlsl 26 | DXPixelShaderFile = "shaders/common/postFx/motionBlurP.hlsl"; //new pixel shader 27 | 28 | pixVersion = 3.0; 29 | }; 30 | 31 | singleton PostEffect(MotionBlurFX) 32 | { 33 | isEnabled = false; 34 | 35 | renderTime = "PFXAfterDiffuse"; 36 | 37 | shader = PFX_MotionBlurShader; 38 | stateBlock = PFX_DefaultStateBlock; 39 | texture[0] = "$backbuffer"; 40 | texture[1] = "#prepass"; 41 | target = "$backBuffer"; 42 | }; 43 | 44 | function MotionBlurFX::setShaderConsts(%this) 45 | { 46 | %this.setShaderConst( "$velocityMultiplier", 3000 ); 47 | } 48 | -------------------------------------------------------------------------------- /game/core/scripts/client/scatterSky.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | new GFXStateBlockData( ScatterSkySBData ) 24 | { 25 | cullDefined = true; 26 | cullMode = "GFXCullNone"; 27 | 28 | zDefined = true; 29 | zEnable = true; 30 | zWriteEnable = false; 31 | zFunc = "GFXCmpLessEqual"; 32 | 33 | samplersDefined = true; 34 | samplerStates[0] = SamplerClampLinear; 35 | samplerStates[1] = SamplerClampLinear; 36 | vertexColorEnable = true; 37 | }; 38 | 39 | singleton ShaderData( ScatterSkyShaderData ) 40 | { 41 | DXVertexShaderFile = "shaders/common/scatterSkyV.hlsl"; 42 | DXPixelShaderFile = "shaders/common/scatterSkyP.hlsl"; 43 | 44 | OGLVertexShaderFile = "shaders/common/gl/scatterSkyV.glsl"; 45 | OGLPixelShaderFile = "shaders/common/gl/scatterSkyP.glsl"; 46 | 47 | pixVersion = 2.0; 48 | }; 49 | -------------------------------------------------------------------------------- /game/scripts/gui/loadingGui.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //------------------------------------------------------------------------------ 24 | function LoadingGui::onAdd(%this) 25 | { 26 | %this.qLineCount = 0; 27 | } 28 | 29 | //------------------------------------------------------------------------------ 30 | function LoadingGui::onWake(%this) 31 | { 32 | // Play sound... 33 | //CloseMessagePopup(); 34 | } 35 | 36 | //------------------------------------------------------------------------------ 37 | function LoadingGui::onSleep(%this) 38 | { 39 | // Clear the load info: 40 | if ( %this.qLineCount !$= "" ) 41 | { 42 | for ( %line = 0; %line < %this.qLineCount; %line++ ) 43 | %this.qLine[%line] = ""; 44 | } 45 | %this.qLineCount = 0; 46 | 47 | LoadingProgress.setValue( 0 ); 48 | LoadingProgressTxt.setValue( "WAITING FOR SERVER" ); 49 | 50 | // Stop sound... 51 | } 52 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/turbulence.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | singleton GFXStateBlockData( PFX_TurbulenceStateBlock : PFX_DefaultStateBlock) 24 | { 25 | zDefined = false; 26 | zEnable = false; 27 | zWriteEnable = false; 28 | 29 | samplersDefined = true; 30 | samplerStates[0] = SamplerClampLinear; 31 | }; 32 | 33 | singleton ShaderData( PFX_TurbulenceShader ) 34 | { 35 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 36 | DXPixelShaderFile = "shaders/common/postFx/turbulenceP.hlsl"; 37 | 38 | pixVersion = 3.0; 39 | }; 40 | 41 | singleton PostEffect( TurbulenceFx ) 42 | { 43 | isEnabled = false; 44 | allowReflectPass = true; 45 | 46 | renderTime = "PFXAfterBin"; 47 | renderBin = "GlowBin"; 48 | renderPriority = 0.5; // Render after the glows themselves 49 | 50 | shader = PFX_TurbulenceShader; 51 | stateBlock=PFX_TurbulenceStateBlock; 52 | texture[0] = "$backBuffer"; 53 | }; 54 | -------------------------------------------------------------------------------- /game/core/scripts/gui/messageBoxes/messageBoxOkCancel.ed.gui: -------------------------------------------------------------------------------- 1 | //--- OBJECT WRITE BEGIN --- 2 | %guiContent = new GuiControl(MessageBoxOKCancelDlg) { 3 | profile = "GuiOverlayProfile"; 4 | horizSizing = "width"; 5 | vertSizing = "height"; 6 | position = "0 0"; 7 | extent = "640 480"; 8 | minExtent = "8 8"; 9 | visible = "1"; 10 | helpTag = "0"; 11 | 12 | new GuiWindowCtrl(MBOKCancelFrame) { 13 | profile = "GuiWindowProfile"; 14 | horizSizing = "center"; 15 | vertSizing = "center"; 16 | position = "170 175"; 17 | extent = "300 100"; 18 | minExtent = "48 92"; 19 | visible = "1"; 20 | helpTag = "0"; 21 | maxLength = "255"; 22 | resizeWidth = "1"; 23 | resizeHeight = "1"; 24 | canMove = "1"; 25 | canClose = "0"; 26 | canMinimize = "0"; 27 | canMaximize = "0"; 28 | minSize = "50 50"; 29 | text = ""; 30 | 31 | new GuiMLTextCtrl(MBOKCancelText) { 32 | profile = "GuiMLTextProfile"; 33 | horizSizing = "center"; 34 | vertSizing = "bottom"; 35 | position = "8 34"; 36 | extent = "283 24"; 37 | minExtent = "8 8"; 38 | visible = "1"; 39 | helpTag = "0"; 40 | lineSpacing = "2"; 41 | allowColorChars = "0"; 42 | maxChars = "-1"; 43 | 44 | }; 45 | new GuiButtonCtrl() { 46 | profile = "GuiButtonProfile"; 47 | horizSizing = "right"; 48 | vertSizing = "top"; 49 | position = "66 68"; 50 | extent = "80 24"; 51 | minExtent = "8 8"; 52 | visible = "1"; 53 | command = "MessageCallback(MessageBoxOKCancelDlg,MessageBoxOKCancelDlg.callback);"; 54 | accelerator = "return"; 55 | helpTag = "0"; 56 | text = "Ok"; 57 | simpleStyle = "0"; 58 | }; 59 | new GuiButtonCtrl() { 60 | profile = "GuiButtonProfile"; 61 | horizSizing = "right"; 62 | vertSizing = "top"; 63 | position = "156 68"; 64 | extent = "80 24"; 65 | minExtent = "8 8"; 66 | visible = "1"; 67 | command = "MessageCallback(MessageBoxOKCancelDlg,MessageBoxOKCancelDlg.cancelCallback);"; 68 | accelerator = "escape"; 69 | helpTag = "0"; 70 | text = "Cancel"; 71 | simpleStyle = "0"; 72 | }; 73 | }; 74 | }; 75 | //--- OBJECT WRITE END --- 76 | -------------------------------------------------------------------------------- /game/core/scripts/gui/messageBoxes/messageBoxYesNo.ed.gui: -------------------------------------------------------------------------------- 1 | //--- OBJECT WRITE BEGIN --- 2 | %guiContent = new GuiControl(MessageBoxYesNoDlg) { 3 | profile = "GuiOverlayProfile"; 4 | horizSizing = "width"; 5 | vertSizing = "height"; 6 | position = "0 0"; 7 | extent = "640 480"; 8 | minExtent = "8 8"; 9 | visible = "1"; 10 | helpTag = "0"; 11 | 12 | new GuiWindowCtrl(MBYesNoFrame) { 13 | profile = "GuiWindowProfile"; 14 | horizSizing = "center"; 15 | vertSizing = "center"; 16 | position = "170 175"; 17 | extent = "300 100"; 18 | minExtent = "48 92"; 19 | visible = "1"; 20 | helpTag = "0"; 21 | maxLength = "255"; 22 | resizeWidth = "1"; 23 | resizeHeight = "1"; 24 | canMove = "1"; 25 | canClose = "1"; 26 | canMinimize = "0"; 27 | canMaximize = "0"; 28 | minSize = "50 50"; 29 | text = ""; 30 | closeCommand = "MessageCallback(MessageBoxYesNoDlg,MessageBoxYesNoDlg.noCallback);"; 31 | 32 | new GuiMLTextCtrl(MBYesNoText) { 33 | profile = "GuiMLTextProfile"; 34 | horizSizing = "center"; 35 | vertSizing = "bottom"; 36 | position = "11 38"; 37 | extent = "280 14"; 38 | minExtent = "8 8"; 39 | visible = "1"; 40 | helpTag = "0"; 41 | lineSpacing = "2"; 42 | allowColorChars = "0"; 43 | maxChars = "-1"; 44 | }; 45 | new GuiButtonCtrl() { 46 | profile = "GuiButtonProfile"; 47 | horizSizing = "right"; 48 | vertSizing = "top"; 49 | position = "70 68"; 50 | extent = "80 22"; 51 | minExtent = "8 8"; 52 | visible = "1"; 53 | command = "MessageCallback(MessageBoxYesNoDlg,MessageBoxYesNoDlg.yesCallback);"; 54 | accelerator = "return"; 55 | helpTag = "0"; 56 | text = "Yes"; 57 | simpleStyle = "0"; 58 | }; 59 | new GuiButtonCtrl() { 60 | profile = "GuiButtonProfile"; 61 | horizSizing = "right"; 62 | vertSizing = "top"; 63 | position = "167 68"; 64 | extent = "80 22"; 65 | minExtent = "8 8"; 66 | visible = "1"; 67 | command = "MessageCallback(MessageBoxYesNoDlg,MessageBoxYesNoDlg.noCallback);"; 68 | accelerator = "escape"; 69 | helpTag = "0"; 70 | text = "No"; 71 | simpleStyle = "0"; 72 | }; 73 | }; 74 | }; 75 | //--- OBJECT WRITE END --- 76 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/flash.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | singleton ShaderData( PFX_FlashShader ) 24 | { 25 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 26 | DXPixelShaderFile = "shaders/common/postFx/flashP.hlsl"; 27 | 28 | defines = "WHITE_COLOR=float4(1.0,1.0,1.0,0.0);MUL_COLOR=float4(1.0,0.25,0.25,0.0)"; 29 | 30 | pixVersion = 2.0; 31 | }; 32 | 33 | singleton PostEffect( FlashFx ) 34 | { 35 | isEnabled = false; 36 | allowReflectPass = false; 37 | 38 | renderTime = "PFXAfterDiffuse"; 39 | 40 | shader = PFX_FlashShader; 41 | texture[0] = "$backBuffer"; 42 | renderPriority = 10; 43 | stateBlock = PFX_DefaultStateBlock; 44 | }; 45 | 46 | function FlashFx::setShaderConsts( %this ) 47 | { 48 | if ( isObject( ServerConnection ) ) 49 | { 50 | %this.setShaderConst( "$damageFlash", ServerConnection.getDamageFlash() ); 51 | %this.setShaderConst( "$whiteOut", ServerConnection.getWhiteOut() ); 52 | } 53 | else 54 | { 55 | %this.setShaderConst( "$damageFlash", 0 ); 56 | %this.setShaderConst( "$whiteOut", 0 ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/fxaa.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // An implementation of "NVIDIA FXAA 3.11" by TIMOTHY LOTTES 24 | // 25 | // http://timothylottes.blogspot.com/ 26 | // 27 | // The shader is tuned for the defaul quality and good performance. 28 | // See shaders\common\postFx\fxaa\fxaaP.hlsl to tweak the internal 29 | // quality and performance settings. 30 | 31 | singleton GFXStateBlockData( FXAA_StateBlock : PFX_DefaultStateBlock ) 32 | { 33 | samplersDefined = true; 34 | samplerStates[0] = SamplerClampLinear; 35 | }; 36 | 37 | singleton ShaderData( FXAA_ShaderData ) 38 | { 39 | DXVertexShaderFile = "shaders/common/postFx/fxaa/fxaaV.hlsl"; 40 | DXPixelShaderFile = "shaders/common/postFx/fxaa/fxaaP.hlsl"; 41 | 42 | samplerNames[0] = "$colorTex"; 43 | 44 | pixVersion = 3.0; 45 | }; 46 | 47 | singleton PostEffect( FXAA_PostEffect ) 48 | { 49 | isEnabled = false; 50 | 51 | allowReflectPass = false; 52 | renderTime = "PFXAfterDiffuse"; 53 | 54 | texture[0] = "$backBuffer"; 55 | 56 | target = "$backBuffer"; 57 | 58 | stateBlock = FXAA_StateBlock; 59 | shader = FXAA_ShaderData; 60 | }; 61 | 62 | -------------------------------------------------------------------------------- /game/core/scripts/gui/guiTreeViewCtrl.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | function GuiTreeViewCtrl::onDefineIcons( %this ) 24 | { 25 | %icons = "core/art/gui/images/treeview/default:" @ 26 | "core/art/gui/images/treeview/simgroup:" @ 27 | "core/art/gui/images/treeview/simgroup_closed:" @ 28 | "core/art/gui/images/treeview/simgroup_selected:" @ 29 | "core/art/gui/images/treeview/simgroup_selected_closed:" @ 30 | "core/art/gui/images/treeview/hidden:" @ 31 | "core/art/gui/images/treeview/shll_icon_passworded_hi:" @ 32 | "core/art/gui/images/treeview/shll_icon_passworded:" @ 33 | "core/art/gui/images/treeview/default"; 34 | 35 | %this.buildIconTable(%icons); 36 | } 37 | 38 | function GuiTreeViewCtrl::handleRenameObject( %this, %name, %obj ) 39 | { 40 | %inspector = GuiInspector::findByObject( %obj ); 41 | 42 | if( isObject( %inspector ) ) 43 | { 44 | %field = ( %this.renameInternal ) ? "internalName" : "name"; 45 | %inspector.setObjectField( %field, %name ); 46 | return true; 47 | } 48 | 49 | return false; 50 | } 51 | -------------------------------------------------------------------------------- /game/core/scripts/client/clouds.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //------------------------------------------------------------------------------ 24 | // CloudLayer 25 | //------------------------------------------------------------------------------ 26 | 27 | singleton ShaderData( CloudLayerShader ) 28 | { 29 | DXVertexShaderFile = "shaders/common/cloudLayerV.hlsl"; 30 | DXPixelShaderFile = "shaders/common/cloudLayerP.hlsl"; 31 | 32 | OGLVertexShaderFile = "shaders/common/gl/cloudLayerV.glsl"; 33 | OGLPixelShaderFile = "shaders/common/gl/cloudLayerP.glsl"; 34 | 35 | pixVersion = 2.0; 36 | }; 37 | 38 | //------------------------------------------------------------------------------ 39 | // BasicClouds 40 | //------------------------------------------------------------------------------ 41 | 42 | singleton ShaderData( BasicCloudsShader ) 43 | { 44 | DXVertexShaderFile = "shaders/common/basicCloudsV.hlsl"; 45 | DXPixelShaderFile = "shaders/common/basicCloudsP.hlsl"; 46 | 47 | //OGLVertexShaderFile = "shaders/common/gl/basicCloudsV.glsl"; 48 | //OGLPixelShaderFile = "shaders/common/gl/basicCloudsP.glsl"; 49 | 50 | pixVersion = 2.0; 51 | }; 52 | -------------------------------------------------------------------------------- /game/core/scripts/client/lighting/advanced/shadowViz.gui: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------------------------- 2 | // Torque 3D 3 | // Copyright (C) GarageGames.com, Inc. 4 | //--------------------------------------------------------------------------------------------- 5 | 6 | //--- OBJECT WRITE BEGIN --- 7 | %guiContent = new GuiControl(AL_ShadowVizOverlayCtrl) { 8 | canSaveDynamicFields = "0"; 9 | isContainer = "1"; 10 | Profile = "GuiModelessDialogProfile"; 11 | HorizSizing = "right"; 12 | VertSizing = "bottom"; 13 | Position = "0 0"; 14 | Extent = "1024 768"; 15 | MinExtent = "8 8"; 16 | canSave = "1"; 17 | Visible = "1"; 18 | tooltipprofile = "GuiToolTipProfile"; 19 | hovertime = "1000"; 20 | noCursor = true; 21 | 22 | new GuiWindowCtrl() { 23 | internalName = "WindowCtrl"; 24 | canSaveDynamicFields = "0"; 25 | isContainer = "1"; 26 | Profile = "GuiWindowProfile"; 27 | HorizSizing = "right"; 28 | VertSizing = "bottom"; 29 | Position = "50 50"; 30 | Extent = "347 209"; 31 | MinExtent = "150 100"; 32 | canSave = "1"; 33 | Visible = "1"; 34 | tooltipprofile = "GuiToolTipProfile"; 35 | hovertime = "1000"; 36 | Margin = "0 0 0 0"; 37 | Padding = "0 0 0 0"; 38 | AnchorTop = "1"; 39 | AnchorBottom = "0"; 40 | AnchorLeft = "1"; 41 | AnchorRight = "0"; 42 | resizeWidth = "1"; 43 | resizeHeight = "1"; 44 | canMove = "1"; 45 | canClose = "1"; 46 | canMinimize = "0"; 47 | canMaximize = "1"; 48 | minSize = "50 50"; 49 | EdgeSnap = "1"; 50 | text = "ShadowViz"; 51 | closeCommand = "toggleShadowViz();"; 52 | 53 | new GuiMaterialCtrl() { 54 | internalName = "MatCtrl"; 55 | canSaveDynamicFields = "0"; 56 | isContainer = "0"; 57 | Profile = "GuiDefaultProfile"; 58 | HorizSizing = "width"; 59 | VertSizing = "height"; 60 | Position = "3 23"; 61 | Extent = "341 181"; 62 | MinExtent = "8 2"; 63 | canSave = "1"; 64 | Visible = "1"; 65 | tooltipprofile = "GuiToolTipProfile"; 66 | hovertime = "1000"; 67 | Docking = "Client"; 68 | Margin = "2 2 2 2"; 69 | Padding = "0 0 0 0"; 70 | AnchorTop = "1"; 71 | AnchorBottom = "0"; 72 | AnchorLeft = "1"; 73 | AnchorRight = "0"; 74 | materialName = "AL_ShadowVisualizeMaterial"; 75 | }; 76 | }; 77 | }; 78 | //--- OBJECT WRITE END --- 79 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/GammaPostFX.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | singleton ShaderData( GammaShader ) 24 | { 25 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 26 | DXPixelShaderFile = "shaders/common/postFx/gammaP.hlsl"; 27 | 28 | pixVersion = 2.0; 29 | }; 30 | 31 | singleton GFXStateBlockData( GammaStateBlock : PFX_DefaultStateBlock ) 32 | { 33 | samplersDefined = true; 34 | samplerStates[0] = SamplerClampLinear; 35 | samplerStates[1] = SamplerClampLinear; 36 | }; 37 | 38 | singleton PostEffect( GammaPostFX ) 39 | { 40 | isEnabled = true; 41 | allowReflectPass = false; 42 | 43 | renderTime = "PFXBeforeBin"; 44 | renderBin = "EditorBin"; 45 | renderPriority = 9999; 46 | 47 | shader = GammaShader; 48 | stateBlock = GammaStateBlock; 49 | 50 | texture[0] = "$backBuffer"; 51 | texture[1] = $HDRPostFX::colorCorrectionRamp; 52 | }; 53 | 54 | function GammaPostFX::preProcess( %this ) 55 | { 56 | if ( %this.texture[1] !$= $HDRPostFX::colorCorrectionRamp ) 57 | %this.setTexture( 1, $HDRPostFX::colorCorrectionRamp ); 58 | } 59 | 60 | function GammaPostFX::setShaderConsts( %this ) 61 | { 62 | %clampedGamma = mClamp( $pref::Video::Gamma, 0.001, 2.2); 63 | %this.setShaderConst( "$OneOverGamma", 1 / %clampedGamma ); 64 | } -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/caustics.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | singleton GFXStateBlockData( PFX_CausticsStateBlock : PFX_DefaultStateBlock ) 24 | { 25 | blendDefined = true; 26 | blendEnable = true; 27 | blendSrc = GFXBlendOne; 28 | blendDest = GFXBlendOne; 29 | 30 | samplersDefined = true; 31 | samplerStates[0] = SamplerClampLinear; 32 | samplerStates[1] = SamplerWrapLinear; 33 | samplerStates[2] = SamplerWrapLinear; 34 | }; 35 | 36 | singleton ShaderData( PFX_CausticsShader ) 37 | { 38 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 39 | DXPixelShaderFile = "shaders/common/postFx/caustics/causticsP.hlsl"; 40 | 41 | //OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl"; 42 | //OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl"; 43 | 44 | pixVersion = 3.0; 45 | }; 46 | 47 | singleton PostEffect( CausticsPFX ) 48 | { 49 | isEnabled = false; 50 | renderTime = "PFXBeforeBin"; 51 | renderBin = "ObjTranslucentBin"; 52 | //renderPriority = 0.1; 53 | 54 | shader = PFX_CausticsShader; 55 | stateBlock = PFX_CausticsStateBlock; 56 | texture[0] = "#prepass"; 57 | texture[1] = "textures/caustics_1"; 58 | texture[2] = "textures/caustics_2"; 59 | target = "$backBuffer"; 60 | }; 61 | -------------------------------------------------------------------------------- /game/core/scripts/client/actionMap.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //------------------------------------------------------------------------------ 24 | // Utility remap functions: 25 | //------------------------------------------------------------------------------ 26 | 27 | function ActionMap::copyBind( %this, %otherMap, %command ) 28 | { 29 | if ( !isObject( %otherMap ) ) 30 | { 31 | error( "ActionMap::copyBind - \"" @ %otherMap @ "\" is not an object!" ); 32 | return; 33 | } 34 | 35 | %bind = %otherMap.getBinding( %command ); 36 | if ( %bind !$= "" ) 37 | { 38 | %device = getField( %bind, 0 ); 39 | %action = getField( %bind, 1 ); 40 | %flags = %otherMap.isInverted( %device, %action ) ? "SDI" : "SD"; 41 | %deadZone = %otherMap.getDeadZone( %device, %action ); 42 | %scale = %otherMap.getScale( %device, %action ); 43 | %this.bind( %device, %action, %flags, %deadZone, %scale, %command ); 44 | } 45 | } 46 | 47 | //------------------------------------------------------------------------------ 48 | function ActionMap::blockBind( %this, %otherMap, %command ) 49 | { 50 | if ( !isObject( %otherMap ) ) 51 | { 52 | error( "ActionMap::blockBind - \"" @ %otherMap @ "\" is not an object!" ); 53 | return; 54 | } 55 | 56 | %bind = %otherMap.getBinding( %command ); 57 | if ( %bind !$= "" ) 58 | %this.bind( getField( %bind, 0 ), getField( %bind, 1 ), "" ); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /game/core/scripts/client/client.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | function initBaseClient() 24 | { 25 | // Base client functionality 26 | exec( "./message.cs" ); 27 | exec( "./mission.cs" ); 28 | exec( "./missionDownload.cs" ); 29 | exec( "./actionMap.cs" ); 30 | exec( "./renderManager.cs" ); 31 | exec( "./lighting.cs" ); 32 | 33 | initRenderManager(); 34 | initLightingSystems(); 35 | } 36 | 37 | /// A helper function which will return the ghosted client object 38 | /// from a server object when connected to a local server. 39 | function serverToClientObject( %serverObject ) 40 | { 41 | assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" ); 42 | assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" ); 43 | 44 | %ghostId = LocalClientConnection.getGhostId( %serverObject ); 45 | if ( %ghostId == -1 ) 46 | return 0; 47 | 48 | return ServerConnection.resolveGhostID( %ghostId ); 49 | } 50 | 51 | //---------------------------------------------------------------------------- 52 | // Debug commands 53 | //---------------------------------------------------------------------------- 54 | 55 | function netSimulateLag( %msDelay, %packetLossPercent ) 56 | { 57 | if ( %packetLossPercent $= "" ) 58 | %packetLossPercent = 0; 59 | 60 | commandToServer( 'NetSimulateLag', %msDelay, %packetLossPercent ); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/chromaticLens.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | /// 24 | $CAPostFx::enabled = false; 25 | 26 | /// The lens distortion coefficient. 27 | $CAPostFx::distCoeffecient = -0.05; 28 | 29 | /// The cubic distortion value. 30 | $CAPostFx::cubeDistortionFactor = -0.1; 31 | 32 | /// The amount and direction of the maxium shift for 33 | /// the red, green, and blue channels. 34 | $CAPostFx::colorDistortionFactor = "0.005 -0.005 0.01"; 35 | 36 | 37 | singleton GFXStateBlockData( PFX_DefaultChromaticLensStateBlock ) 38 | { 39 | zDefined = true; 40 | zEnable = false; 41 | zWriteEnable = false; 42 | samplersDefined = true; 43 | samplerStates[0] = SamplerClampPoint; 44 | }; 45 | 46 | singleton ShaderData( PFX_ChromaticLensShader ) 47 | { 48 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 49 | DXPixelShaderFile = "shaders/common/postFx/chromaticLens.hlsl"; 50 | pixVersion = 3.0; 51 | }; 52 | 53 | singleton PostEffect( ChromaticLensPostFX ) 54 | { 55 | renderTime = "PFXAfterDiffuse"; 56 | renderPriority = 0.2; 57 | isEnabled = false; 58 | allowReflectPass = false; 59 | 60 | shader = PFX_ChromaticLensShader; 61 | stateBlock = PFX_DefaultChromaticLensStateBlock; 62 | texture[0] = "$backBuffer"; 63 | target = "$backBuffer"; 64 | }; 65 | 66 | function ChromaticLensPostFX::setShaderConsts( %this ) 67 | { 68 | %this.setShaderConst( "$distCoeff", $CAPostFx::distCoeffecient ); 69 | %this.setShaderConst( "$cubeDistort", $CAPostFx::cubeDistortionFactor ); 70 | %this.setShaderConst( "$colorDistort", $CAPostFx::colorDistortionFactor ); 71 | } 72 | -------------------------------------------------------------------------------- /game/scripts/gui/playGui.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | // PlayGui is the main TSControl through which the game is viewed. 25 | // The PlayGui also contains the hud controls. 26 | //----------------------------------------------------------------------------- 27 | 28 | function PlayGui::onWake(%this) 29 | { 30 | // Turn off any shell sounds... 31 | // sfxStop( ... ); 32 | 33 | $enableDirectInput = "1"; 34 | activateDirectInput(); 35 | 36 | // Message hud dialog 37 | if ( isObject( MainChatHud ) ) 38 | { 39 | Canvas.pushDialog( MainChatHud ); 40 | chatHud.attach(HudMessageVector); 41 | } 42 | 43 | // just update the action map here 44 | moveMap.push(); 45 | 46 | // hack city - these controls are floating around and need to be clamped 47 | if ( isFunction( "refreshCenterTextCtrl" ) ) 48 | schedule(0, 0, "refreshCenterTextCtrl"); 49 | if ( isFunction( "refreshBottomTextCtrl" ) ) 50 | schedule(0, 0, "refreshBottomTextCtrl"); 51 | } 52 | 53 | function PlayGui::onSleep(%this) 54 | { 55 | if ( isObject( MainChatHud ) ) 56 | Canvas.popDialog( MainChatHud ); 57 | 58 | // pop the keymaps 59 | moveMap.pop(); 60 | } 61 | 62 | function PlayGui::clearHud( %this ) 63 | { 64 | Canvas.popDialog( MainChatHud ); 65 | 66 | while ( %this.getCount() > 0 ) 67 | %this.getObject( 0 ).delete(); 68 | } 69 | 70 | //----------------------------------------------------------------------------- 71 | 72 | function refreshBottomTextCtrl() 73 | { 74 | BottomPrintText.position = "0 0"; 75 | } 76 | 77 | function refreshCenterTextCtrl() 78 | { 79 | CenterPrintText.position = "0 0"; 80 | } 81 | -------------------------------------------------------------------------------- /game/core/scripts/client/lighting/basic/shadowFilter.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | singleton ShaderData( BL_ShadowFilterShaderV ) 25 | { 26 | DXVertexShaderFile = "shaders/common/lighting/basic/shadowFilterV.hlsl"; 27 | DXPixelShaderFile = "shaders/common/lighting/basic/shadowFilterP.hlsl"; 28 | 29 | OGLVertexShaderFile = "shaders/common/lighting/basic/gl/shadowFilterV.glsl"; 30 | OGLPixelShaderFile = "shaders/common/lighting/basic/gl/shadowFilterP.glsl"; 31 | 32 | samplerNames[0] = "$diffuseMap"; 33 | 34 | defines = "BLUR_DIR=float2(1.0,0.0)"; 35 | 36 | pixVersion = 2.0; 37 | }; 38 | 39 | singleton ShaderData( BL_ShadowFilterShaderH : BL_ShadowFilterShaderV ) 40 | { 41 | defines = "BLUR_DIR=float2(0.0,1.0)"; 42 | }; 43 | 44 | 45 | singleton GFXStateBlockData( BL_ShadowFilterSB : PFX_DefaultStateBlock ) 46 | { 47 | colorWriteDefined=true; 48 | colorWriteRed=false; 49 | colorWriteGreen=false; 50 | colorWriteBlue=false; 51 | blendDefined = true; 52 | blendEnable = true; 53 | }; 54 | 55 | // NOTE: This is ONLY used in Basic Lighting, and 56 | // only directly by the ProjectedShadow. It is not 57 | // meant to be manually enabled like other PostEffects. 58 | singleton PostEffect( BL_ShadowFilterPostFx ) 59 | { 60 | // Blur vertically 61 | shader = BL_ShadowFilterShaderV; 62 | stateBlock = PFX_DefaultStateBlock; 63 | targetClear = "PFXTargetClear_OnDraw"; 64 | targetClearColor = "0 0 0 0"; 65 | texture[0] = "$inTex"; 66 | target = "$outTex"; 67 | 68 | // Blur horizontal 69 | new PostEffect() 70 | { 71 | shader = BL_ShadowFilterShaderH; 72 | stateBlock = PFX_DefaultStateBlock; 73 | texture[0] = "$inTex"; 74 | target = "$outTex"; 75 | }; 76 | }; 77 | -------------------------------------------------------------------------------- /game/core/scripts/client/lighting/advanced/init.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | /////////////////////////////////////////////////////////////////////////////// 24 | // Default Prefs 25 | 26 | /* 27 | $pref::LightManager::sgAtlasMaxDynamicLights = "16"; 28 | $pref::LightManager::sgDynamicShadowDetailSize = "0"; 29 | $pref::LightManager::sgDynamicShadowQuality = "0"; 30 | $pref::LightManager::sgLightingProfileAllowShadows = "1"; 31 | $pref::LightManager::sgLightingProfileQuality = "0"; 32 | $pref::LightManager::sgMaxBestLights = "10"; 33 | $pref::LightManager::sgMultipleDynamicShadows = "1"; 34 | $pref::LightManager::sgShowCacheStats = "0"; 35 | $pref::LightManager::sgUseBloom = ""; 36 | $pref::LightManager::sgUseDRLHighDynamicRange = "0"; 37 | $pref::LightManager::sgUseDynamicRangeLighting = "0"; 38 | $pref::LightManager::sgUseDynamicShadows = "1"; 39 | $pref::LightManager::sgUseToneMapping = ""; 40 | */ 41 | 42 | exec( "./shaders.cs" ); 43 | exec( "./lightViz.cs" ); 44 | exec( "./shadowViz.cs" ); 45 | exec( "./shadowViz.gui" ); 46 | 47 | function onActivateAdvancedLM() 48 | { 49 | // Don't allow the offscreen target on OSX. 50 | if ( $platform $= "macos" ) 51 | return; 52 | 53 | // On the Xbox360 we know what will be enabled so don't do any trickery to 54 | // disable MSAA 55 | if ( $platform $= "xenon" ) 56 | return; 57 | 58 | // Enable the offscreen target so that AL will work 59 | // with MSAA back buffers and for HDR rendering. 60 | AL_FormatToken.enable(); 61 | } 62 | 63 | function onDeactivateAdvancedLM() 64 | { 65 | // Disable the offscreen render target. 66 | AL_FormatToken.disable(); 67 | } 68 | 69 | function setAdvancedLighting() 70 | { 71 | setLightManager( "Advanced Lighting" ); 72 | } 73 | 74 | -------------------------------------------------------------------------------- /game/core/scripts/server/defaults.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // List of master servers to query, each one is tried in order 24 | // until one responds 25 | $Pref::Server::RegionMask = 2; 26 | $pref::Master[0] = "2:master.garagegames.com:28002"; 27 | 28 | // Information about the server 29 | $Pref::Server::Name = "Torque 3D Server"; 30 | $Pref::Server::Info = "This is a Torque 3D server."; 31 | 32 | // The connection error message is transmitted to the client immediatly 33 | // on connection, if any further error occures during the connection 34 | // process, such as network traffic mismatch, or missing files, this error 35 | // message is display. This message should be replaced with information 36 | // usefull to the client, such as the url or ftp address of where the 37 | // latest version of the game can be obtained. 38 | $Pref::Server::ConnectionError = 39 | "You do not have the correct version of the FPS starter kit or "@ 40 | "the related art needed to play on this server, please contact "@ 41 | "the server operator for more information."; 42 | 43 | // The network port is also defined by the client, this value 44 | // overrides pref::net::port for dedicated servers 45 | $Pref::Server::Port = 28000; 46 | 47 | // If the password is set, clients must provide it in order 48 | // to connect to the server 49 | $Pref::Server::Password = ""; 50 | 51 | // Password for admin clients 52 | $Pref::Server::AdminPassword = ""; 53 | 54 | // Misc server settings. 55 | $Pref::Server::MaxPlayers = 64; 56 | $Pref::Server::TimeLimit = 20; // In minutes 57 | $Pref::Server::KickBanTime = 300; // specified in seconds 58 | $Pref::Server::BanTime = 1800; // specified in seconds 59 | $Pref::Server::FloodProtectionEnabled = 1; 60 | $Pref::Server::MaxChatLen = 120; 61 | -------------------------------------------------------------------------------- /game/core/scripts/gui/help.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | function HelpDlg::onWake(%this) 24 | { 25 | HelpFileList.entryCount = 0; 26 | HelpFileList.clear(); 27 | for(%file = findFirstFile("*.hfl"); %file !$= ""; %file = findNextFile("*.hfl")) 28 | { 29 | HelpFileList.fileName[HelpFileList.entryCount] = %file; 30 | HelpFileList.addRow(HelpFileList.entryCount, fileBase(%file)); 31 | HelpFileList.entryCount++; 32 | } 33 | HelpFileList.sortNumerical(0); 34 | for(%i = 0; %i < HelpFileList.entryCount; %i++) 35 | { 36 | %rowId = HelpFileList.getRowId(%i); 37 | %text = HelpFileList.getRowTextById(%rowId); 38 | %text = %i + 1 @ ". " @ restWords(%text); 39 | HelpFileList.setRowById(%rowId, %text); 40 | } 41 | HelpFileList.setSelectedRow(0); 42 | } 43 | 44 | function HelpFileList::onSelect(%this, %row) 45 | { 46 | %fo = new FileObject(); 47 | %fo.openForRead(%this.fileName[%row]); 48 | %text = ""; 49 | while(!%fo.isEOF()) 50 | %text = %text @ %fo.readLine() @ "\n"; 51 | 52 | %fo.delete(); 53 | HelpText.setText(%text); 54 | } 55 | 56 | function getHelp(%helpName) 57 | { 58 | Canvas.pushDialog(HelpDlg); 59 | if(%helpName !$= "") 60 | { 61 | %index = HelpFileList.findTextIndex(%helpName); 62 | HelpFileList.setSelectedRow(%index); 63 | } 64 | } 65 | 66 | function contextHelp() 67 | { 68 | for(%i = 0; %i < Canvas.getCount(); %i++) 69 | { 70 | if(Canvas.getObject(%i).getName() $= HelpDlg) 71 | { 72 | Canvas.popDialog(HelpDlg); 73 | return; 74 | } 75 | } 76 | %content = Canvas.getContent(); 77 | %helpPage = %content.getHelpPage(); 78 | getHelp(%helpPage); 79 | } 80 | 81 | function GuiControl::getHelpPage(%this) 82 | { 83 | return %this.helpPage; 84 | } 85 | 86 | function GuiMLTextCtrl::onURL(%this, %url) 87 | { 88 | gotoWebPage( %url ); 89 | } 90 | 91 | -------------------------------------------------------------------------------- /game/core/scripts/server/camera.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // Global movement speed that affects all cameras. This should be moved 24 | // into the camera datablock. 25 | $Camera::movementSpeed = 30; 26 | 27 | function Observer::onTrigger(%this,%obj,%trigger,%state) 28 | { 29 | // state = 0 means that a trigger key was released 30 | if (%state == 0) 31 | return; 32 | 33 | // Default player triggers: 0=fire 1=altFire 2=jump 34 | %client = %obj.getControllingClient(); 35 | switch$ (%obj.mode) 36 | { 37 | case "Observer": 38 | // Do something interesting. 39 | 40 | case "Corpse": 41 | // Viewing dead corpse, so we probably want to respawn. 42 | %client.spawnPlayer(); 43 | 44 | // Set the camera back into observer mode, since in 45 | // debug mode we like to switch to it. 46 | %this.setMode(%obj,"Observer"); 47 | } 48 | } 49 | 50 | function Observer::setMode(%this,%obj,%mode,%arg1,%arg2,%arg3) 51 | { 52 | switch$ (%mode) 53 | { 54 | case "Observer": 55 | // Let the player fly around 56 | %obj.setFlyMode(); 57 | 58 | case "Corpse": 59 | // Lock the camera down in orbit around the corpse, 60 | // which should be arg1 61 | %transform = %arg1.getTransform(); 62 | %obj.setOrbitMode(%arg1, %transform, 0.5, 4.5, 4.5); 63 | 64 | } 65 | %obj.mode = %mode; 66 | } 67 | 68 | 69 | //----------------------------------------------------------------------------- 70 | // Camera methods 71 | //----------------------------------------------------------------------------- 72 | 73 | //----------------------------------------------------------------------------- 74 | 75 | function Camera::onAdd(%this,%obj) 76 | { 77 | // Default start mode 78 | %this.setMode(%this.mode); 79 | } 80 | 81 | function Camera::setMode(%this,%mode,%arg1,%arg2,%arg3) 82 | { 83 | // Punt this one over to our datablock 84 | %this.getDatablock().setMode(%this,%mode,%arg1,%arg2,%arg3); 85 | } 86 | -------------------------------------------------------------------------------- /game/core/scripts/client/commonMaterialData.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | // Anim flag settings - must match material.h 25 | // These cannot be enumed through script becuase it cannot 26 | // handle the "|" operation for combining them together 27 | // ie. Scroll | Wave does not work. 28 | //----------------------------------------------------------------------------- 29 | $scroll = 1; 30 | $rotate = 2; 31 | $wave = 4; 32 | $scale = 8; 33 | $sequence = 16; 34 | 35 | 36 | // Common stateblock definitions 37 | new GFXSamplerStateData(SamplerClampLinear) 38 | { 39 | textureColorOp = GFXTOPModulate; 40 | addressModeU = GFXAddressClamp; 41 | addressModeV = GFXAddressClamp; 42 | addressModeW = GFXAddressClamp; 43 | magFilter = GFXTextureFilterLinear; 44 | minFilter = GFXTextureFilterLinear; 45 | mipFilter = GFXTextureFilterLinear; 46 | }; 47 | 48 | new GFXSamplerStateData(SamplerClampPoint) 49 | { 50 | textureColorOp = GFXTOPModulate; 51 | addressModeU = GFXAddressClamp; 52 | addressModeV = GFXAddressClamp; 53 | addressModeW = GFXAddressClamp; 54 | magFilter = GFXTextureFilterPoint; 55 | minFilter = GFXTextureFilterPoint; 56 | mipFilter = GFXTextureFilterPoint; 57 | }; 58 | 59 | new GFXSamplerStateData(SamplerWrapLinear) 60 | { 61 | textureColorOp = GFXTOPModulate; 62 | addressModeU = GFXTextureAddressWrap; 63 | addressModeV = GFXTextureAddressWrap; 64 | addressModeW = GFXTextureAddressWrap; 65 | magFilter = GFXTextureFilterLinear; 66 | minFilter = GFXTextureFilterLinear; 67 | mipFilter = GFXTextureFilterLinear; 68 | }; 69 | 70 | new GFXSamplerStateData(SamplerWrapPoint) 71 | { 72 | textureColorOp = GFXTOPModulate; 73 | addressModeU = GFXTextureAddressWrap; 74 | addressModeV = GFXTextureAddressWrap; 75 | addressModeW = GFXTextureAddressWrap; 76 | magFilter = GFXTextureFilterPoint; 77 | minFilter = GFXTextureFilterPoint; 78 | mipFilter = GFXTextureFilterPoint; 79 | }; 80 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | singleton GFXStateBlockData( PFX_DefaultStateBlock ) 25 | { 26 | zDefined = true; 27 | zEnable = false; 28 | zWriteEnable = false; 29 | 30 | samplersDefined = true; 31 | samplerStates[0] = SamplerClampLinear; 32 | }; 33 | 34 | singleton ShaderData( PFX_PassthruShader ) 35 | { 36 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 37 | DXPixelShaderFile = "shaders/common/postFx/passthruP.hlsl"; 38 | 39 | // OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl"; 40 | // OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl"; 41 | 42 | samplerNames[0] = "$inputTex"; 43 | 44 | pixVersion = 2.0; 45 | }; 46 | 47 | function initPostEffects() 48 | { 49 | // First exec the scripts for the different light managers 50 | // in the lighting folder. 51 | 52 | %pattern = "./postFx/*.cs"; 53 | %file = findFirstFile( %pattern ); 54 | if ( %file $= "" ) 55 | { 56 | // Try for DSOs next. 57 | %pattern = "./postFx/*.cs.dso"; 58 | %file = findFirstFile( %pattern ); 59 | } 60 | 61 | while( %file !$= "" ) 62 | { 63 | exec( %file ); 64 | %file = findNextFile( %pattern ); 65 | } 66 | } 67 | 68 | function PostEffect::inspectVars( %this ) 69 | { 70 | %name = %this.getName(); 71 | %globals = "$" @ %name @ "::*"; 72 | inspectVars( %globals ); 73 | } 74 | 75 | function PostEffect::viewDisassembly( %this ) 76 | { 77 | %file = %this.dumpShaderDisassembly(); 78 | 79 | if ( %file $= "" ) 80 | { 81 | echo( "PostEffect::viewDisassembly - no shader disassembly found." ); 82 | } 83 | else 84 | { 85 | echo( "PostEffect::viewDisassembly - shader disassembly file dumped ( " @ %file @ " )." ); 86 | openFile( %file ); 87 | } 88 | } 89 | 90 | // Return true if we really want the effect enabled. 91 | // By default this is the case. 92 | function PostEffect::onEnabled( %this ) 93 | { 94 | return true; 95 | } -------------------------------------------------------------------------------- /game/core/scripts/client/lighting/basic/init.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | exec( "./shadowFilter.cs" ); 24 | 25 | singleton GFXStateBlockData( BL_ProjectedShadowSBData ) 26 | { 27 | blendDefined = true; 28 | blendEnable = true; 29 | blendSrc = GFXBlendDestColor; 30 | blendDest = GFXBlendZero; 31 | 32 | zDefined = true; 33 | zEnable = true; 34 | zWriteEnable = false; 35 | 36 | samplersDefined = true; 37 | samplerStates[0] = SamplerClampLinear; 38 | vertexColorEnable = true; 39 | }; 40 | 41 | singleton ShaderData( BL_ProjectedShadowShaderData ) 42 | { 43 | DXVertexShaderFile = "shaders/common/projectedShadowV.hlsl"; 44 | DXPixelShaderFile = "shaders/common/projectedShadowP.hlsl"; 45 | 46 | OGLVertexShaderFile = "shaders/common/gl/projectedShadowV.glsl"; 47 | OGLPixelShaderFile = "shaders/common/gl/projectedShadowP.glsl"; 48 | 49 | pixVersion = 2.0; 50 | }; 51 | 52 | singleton CustomMaterial( BL_ProjectedShadowMaterial ) 53 | { 54 | sampler["inputTex"] = "$miscbuff"; 55 | 56 | shader = BL_ProjectedShadowShaderData; 57 | stateBlock = BL_ProjectedShadowSBData; 58 | version = 2.0; 59 | forwardLit = true; 60 | }; 61 | 62 | function onActivateBasicLM() 63 | { 64 | // If HDR is enabled... enable the special format token. 65 | if ( $platform !$= "macos" && HDRPostFx.isEnabled ) 66 | AL_FormatToken.enable(); 67 | 68 | // Create render pass for projected shadow. 69 | new RenderPassManager( BL_ProjectedShadowRPM ); 70 | 71 | // Create the mesh bin and add it to the manager. 72 | %meshBin = new RenderMeshMgr(); 73 | BL_ProjectedShadowRPM.addManager( %meshBin ); 74 | 75 | // Add both to the root group so that it doesn't 76 | // end up in the MissionCleanup instant group. 77 | RootGroup.add( BL_ProjectedShadowRPM ); 78 | RootGroup.add( %meshBin ); 79 | } 80 | 81 | function onDeactivateBasicLM() 82 | { 83 | // Delete the pass manager which also deletes the bin. 84 | BL_ProjectedShadowRPM.delete(); 85 | } 86 | 87 | function setBasicLighting() 88 | { 89 | setLightManager( "Basic Lighting" ); 90 | } 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Untorque 2 | 3 | Untorque is a command line based Torque3D Script DSO decompiler. 4 | 5 | > **Note:** 6 | > This tool was developed quick and is not intended to be a perfect decompiler and trying to effectively work on simple use cases that cover most features. 7 | > 8 | > It was compiled with Torque3D 3.5.1 and will likely break with any other build if not manually updated. 9 | 10 | 11 | > **Warning:** 12 | > Untorque does not try to create intermediate folders or protect the user from overwriting files so please use at your own risk and backup files before using this tool. 13 | 14 | 15 | ## Installation 16 | 17 | 1. Download the latest release from my github page [Untorque](https://github.com/figment/Untorque/releases) 18 | 2. Unzip untorque.exe to the root game folder of the Torque engine required 19 | * It is not strictly required as there are no dependencies but examples use this convention 20 | 21 | ---------- 22 | 23 | ## Example 24 | 25 | The following are simple usage examples for decompling files and outputing to a location. 26 | 27 | Untorque decompile scripts\main.cs.dso scripts\main.cs 28 | Untorque decompile --dump art\gui\StartupGui.gui.dso art\gui\StartupGui.gui 29 | 30 | The following are simple usage examples for compling files and outputing to a specific location. 31 | 32 | Untorque compile scripts\main.cs scripts\main.cs.dso 33 | Untorque compile --dump art\gui\StartupGui.gui art\gui\StartupGui.gui.dso 34 | 35 | ### Automation Examples 36 | 37 | #### **DumpScripts.bat** 38 | This batch file assumes Untorque is in the game folder and this batch file is in the same folder. It will decompile all dso files to source and may overwrite existing files if they are present. 39 | 40 | @echo off 41 | pushd "%~dp0" 42 | for /f "usebackq delims=|" %%i in (`dir /b /s "*.dso"`) do ( 43 | echo %%~dpni 44 | Untorque decompile "%%i" "%%~dpni" 45 | ) 46 | popd 47 | 48 | ---------- 49 | 50 | ## Uninstall 51 | 52 | * Delete untorque.exe from the root game folder of the Torque engine 53 | 54 | ---------- 55 | 56 | ## Development 57 | 58 | ### Requirements 59 | 60 | 1. Torque3D 3.5.1 was used in development 61 | 2. DirectX SDK June 2010 is a Torque3D Requirement 62 | 63 | Please use my [Torque3D](https://github.com/figment/Torque3D) development-3.5.2 branch as there are several fixes to the string and compiler that are required for the Torque code not to crash and fail repeatedly. 64 | 65 | > **Note:** 66 | > Edit the *Untorque\buildFiles\VisualStudio 2010\projects\Environment.vcprops* file to fix the DirectX SDK install location. You can use the Property Manager to change the User Macros which holds the environment variable. 67 | > 68 | > Sorry Visual Studio does not make it easy to handle project level environment settings without modifying global environment variables which I do not like so I use this technique but it confuses most developers. 69 | 70 | ### Compiling 71 | Check out [Untorque](https://github.com/figment/Untorque) project to the *My Projects* folder in your Torque3D checkout. 72 | > **Note:** 73 | > Git and github do not like projects within projects. Git has submodules but github does not seem to properly use them. 74 | > 75 | > I used Junction from sysinternals.com to create symbolic links between the real Untorque and the Torque3D folder but is not what I would generally recommend. However Git allows me to manage the Untorque in this mode with fewer issues. 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/postFxManager.persistance.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | // Used to name the saved files. 25 | $PostFXManager::fileExtension = ".postfxpreset.cs"; 26 | 27 | // The filter string for file open/save dialogs. 28 | $PostFXManager::fileFilter = "Post Effect Presets|*.postfxpreset.cs"; 29 | 30 | // Enable / disable PostFX when loading presets or just apply the settings? 31 | $PostFXManager::forceEnableFromPresets = true; 32 | 33 | //Load a preset file from the disk, and apply the settings to the 34 | //controls. If bApplySettings is true - the actual values in the engine 35 | //will be changed to reflect the settings from the file. 36 | function PostFXManager::loadPresetFile() 37 | { 38 | //Show the dialog and set the flag 39 | getLoadFilename($PostFXManager::fileFilter, "PostFXManager::loadPresetHandler"); 40 | } 41 | 42 | function PostFXManager::loadPresetHandler( %filename ) 43 | { 44 | //Check the validity of the file 45 | if ( isScriptFile( %filename ) ) 46 | { 47 | %filename = expandFilename(%filename); 48 | postVerbose("% - PostFX Manager - Executing " @ %filename); 49 | exec(%filename); 50 | 51 | PostFXManager.settingsApplyFromPreset(); 52 | } 53 | } 54 | 55 | //Save a preset file to the specified file. The extension used 56 | //is specified by $PostFXManager::fileExtension for on the fly 57 | //name changes to the extension used. 58 | 59 | function PostFXManager::savePresetFile(%this) 60 | { 61 | %defaultFile = filePath($Client::MissionFile) @ "/" @ fileBase($Client::MissionFile); 62 | getSaveFilename($PostFXManager::fileFilter, "PostFXManager::savePresetHandler", %defaultFile); 63 | } 64 | 65 | //Called from the PostFXManager::savePresetFile() function 66 | function PostFXManager::savePresetHandler( %filename ) 67 | { 68 | %filename = makeRelativePath( %filename, getMainDotCsDir() ); 69 | if(strStr(%filename, ".") == -1) 70 | %filename = %filename @ $PostFXManager::fileExtension; 71 | 72 | //Apply the current settings to the preset 73 | PostFXManager.settingsApplyAll(); 74 | 75 | export("$PostFXManager::Settings::*", %filename, false); 76 | 77 | postVerbose("% - PostFX Manager - Save complete. Preset saved at : " @ %filename); 78 | } 79 | 80 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/default.postfxpreset.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | $PostFXManager::Settings::DOF::BlurCurveFar = ""; 24 | $PostFXManager::Settings::DOF::BlurCurveNear = ""; 25 | $PostFXManager::Settings::DOF::BlurMax = ""; 26 | $PostFXManager::Settings::DOF::BlurMin = ""; 27 | $PostFXManager::Settings::DOF::EnableAutoFocus = ""; 28 | $PostFXManager::Settings::DOF::EnableDOF = ""; 29 | $PostFXManager::Settings::DOF::FocusRangeMax = ""; 30 | $PostFXManager::Settings::DOF::FocusRangeMin = ""; 31 | $PostFXManager::Settings::HDR::adaptRate = "2"; 32 | $PostFXManager::Settings::HDR::blueShiftColor = "1.05 0.97 1.27"; 33 | $PostFXManager::Settings::HDR::brightPassThreshold = "1"; 34 | $PostFXManager::Settings::HDR::enableBloom = "1"; 35 | $PostFXManager::Settings::HDR::enableBlueShift = "0"; 36 | $PostFXManager::Settings::HDR::enableToneMapping = "1"; 37 | $PostFXManager::Settings::HDR::gaussMean = "0"; 38 | $PostFXManager::Settings::HDR::gaussMultiplier = "0.3"; 39 | $PostFXManager::Settings::HDR::gaussStdDev = "0.8"; 40 | $PostFXManager::Settings::HDR::keyValue = "0.18"; 41 | $PostFXManager::Settings::HDR::minLuminace = "0.001"; 42 | $PostFXManager::Settings::HDR::whiteCutoff = "1"; 43 | $PostFXManager::Settings::LightRays::brightScalar = "0.75"; 44 | $PostFXManager::Settings::SSAO::blurDepthTol = "0.001"; 45 | $PostFXManager::Settings::SSAO::blurNormalTol = "0.95"; 46 | $PostFXManager::Settings::SSAO::lDepthMax = "2"; 47 | $PostFXManager::Settings::SSAO::lDepthMin = "0.2"; 48 | $PostFXManager::Settings::SSAO::lDepthPow = "0.2"; 49 | $PostFXManager::Settings::SSAO::lNormalPow = "2"; 50 | $PostFXManager::Settings::SSAO::lNormalTol = "-0.5"; 51 | $PostFXManager::Settings::SSAO::lRadius = "1"; 52 | $PostFXManager::Settings::SSAO::lStrength = "10"; 53 | $PostFXManager::Settings::SSAO::overallStrength = "2"; 54 | $PostFXManager::Settings::SSAO::quality = "0"; 55 | $PostFXManager::Settings::SSAO::sDepthMax = "1"; 56 | $PostFXManager::Settings::SSAO::sDepthMin = "0.1"; 57 | $PostFXManager::Settings::SSAO::sDepthPow = "1"; 58 | $PostFXManager::Settings::SSAO::sNormalPow = "1"; 59 | $PostFXManager::Settings::SSAO::sNormalTol = "0"; 60 | $PostFXManager::Settings::SSAO::sRadius = "0.1"; 61 | $PostFXManager::Settings::SSAO::sStrength = "6"; 62 | $PostFXManager::Settings::ColorCorrectionRamp = "core/scripts/client/postFx/null_color_ramp.png"; -------------------------------------------------------------------------------- /game/core/scripts/gui/messageBoxes/messageBoxYesNoCancel.ed.gui: -------------------------------------------------------------------------------- 1 | //--- OBJECT WRITE BEGIN --- 2 | %guiContent = new GuiControl(MessageBoxYesNoCancelDlg) { 3 | canSaveDynamicFields = "0"; 4 | Profile = "GuiOverlayProfile"; 5 | HorizSizing = "width"; 6 | VertSizing = "height"; 7 | position = "0 0"; 8 | Extent = "800 600"; 9 | MinExtent = "8 8"; 10 | canSave = "1"; 11 | Visible = "1"; 12 | hovertime = "1000"; 13 | 14 | new GuiWindowCtrl(MBYesNoCancelFrame) { 15 | canSaveDynamicFields = "0"; 16 | Profile = "GuiWindowProfile"; 17 | HorizSizing = "center"; 18 | VertSizing = "center"; 19 | position = "250 235"; 20 | Extent = "300 102"; 21 | MinExtent = "48 92"; 22 | canSave = "1"; 23 | Visible = "1"; 24 | hovertime = "1000"; 25 | maxLength = "255"; 26 | resizeWidth = "1"; 27 | resizeHeight = "1"; 28 | canMove = "1"; 29 | canClose = "1"; 30 | canMinimize = "0"; 31 | canMaximize = "0"; 32 | minSize = "50 50"; 33 | text = ""; 34 | closeCommand="MessageCallback(MessageBoxYesNoCancelDlg,MessageBoxYesNoCancelDlg.cancelCallback);"; 35 | 36 | new GuiMLTextCtrl(MBYesNoCancelText) { 37 | canSaveDynamicFields = "0"; 38 | Profile = "GuiMLTextProfile"; 39 | HorizSizing = "center"; 40 | VertSizing = "bottom"; 41 | position = "7 38"; 42 | Extent = "286 14"; 43 | MinExtent = "8 8"; 44 | canSave = "1"; 45 | Visible = "1"; 46 | hovertime = "1000"; 47 | lineSpacing = "2"; 48 | allowColorChars = "0"; 49 | maxChars = "-1"; 50 | }; 51 | new GuiButtonCtrl() { 52 | canSaveDynamicFields = "0"; 53 | Profile = "GuiButtonProfile"; 54 | HorizSizing = "right"; 55 | VertSizing = "top"; 56 | position = "7 71"; 57 | Extent = "80 22"; 58 | MinExtent = "8 8"; 59 | canSave = "1"; 60 | Visible = "1"; 61 | Command = "MessageCallback(MessageBoxYesNoCancelDlg,MessageBoxYesNoCancelDlg.yesCallback);"; 62 | Accelerator = "return"; 63 | hovertime = "1000"; 64 | text = "Yes"; 65 | groupNum = "-1"; 66 | buttonType = "PushButton"; 67 | }; 68 | new GuiButtonCtrl() { 69 | canSaveDynamicFields = "0"; 70 | Profile = "GuiButtonProfile"; 71 | HorizSizing = "right"; 72 | VertSizing = "top"; 73 | position = "92 71"; 74 | Extent = "80 22"; 75 | MinExtent = "8 8"; 76 | canSave = "1"; 77 | Visible = "1"; 78 | Command = "MessageCallback(MessageBoxYesNoCancelDlg,MessageBoxYesNoCancelDlg.noCallback);"; 79 | hovertime = "1000"; 80 | text = "No"; 81 | groupNum = "-1"; 82 | buttonType = "PushButton"; 83 | }; 84 | new GuiButtonCtrl() { 85 | canSaveDynamicFields = "0"; 86 | Profile = "GuiButtonProfile"; 87 | HorizSizing = "right"; 88 | VertSizing = "top"; 89 | position = "213 71"; 90 | Extent = "80 22"; 91 | MinExtent = "8 8"; 92 | canSave = "1"; 93 | Visible = "1"; 94 | Command = "MessageCallback(MessageBoxYesNoCancelDlg,MessageBoxYesNoCancelDlg.cancelCallback);"; 95 | Accelerator = "escape"; 96 | hovertime = "1000"; 97 | text = "Cancel"; 98 | groupNum = "-1"; 99 | buttonType = "PushButton"; 100 | }; 101 | }; 102 | }; 103 | //--- OBJECT WRITE END --- 104 | -------------------------------------------------------------------------------- /game/core/scripts/client/centerPrint.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | $centerPrintActive = 0; 24 | $bottomPrintActive = 0; 25 | 26 | // Selectable window sizes 27 | $CenterPrintSizes[1] = 20; 28 | $CenterPrintSizes[2] = 36; 29 | $CenterPrintSizes[3] = 56; 30 | 31 | // time is specified in seconds 32 | function clientCmdCenterPrint( %message, %time, %size ) 33 | { 34 | // if centerprint already visible, reset text and time. 35 | if ($centerPrintActive) { 36 | if (centerPrintDlg.removePrint !$= "") 37 | cancel(centerPrintDlg.removePrint); 38 | } 39 | else { 40 | CenterPrintDlg.visible = 1; 41 | $centerPrintActive = 1; 42 | } 43 | 44 | CenterPrintText.setText( "" @ %message ); 45 | CenterPrintDlg.extent = firstWord(CenterPrintDlg.extent) @ " " @ $CenterPrintSizes[%size]; 46 | 47 | if (%time > 0) 48 | centerPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearCenterPrint" ); 49 | } 50 | 51 | // time is specified in seconds 52 | function clientCmdBottomPrint( %message, %time, %size ) 53 | { 54 | // if bottomprint already visible, reset text and time. 55 | if ($bottomPrintActive) { 56 | if( bottomPrintDlg.removePrint !$= "") 57 | cancel(bottomPrintDlg.removePrint); 58 | } 59 | else { 60 | bottomPrintDlg.setVisible(true); 61 | $bottomPrintActive = 1; 62 | } 63 | 64 | bottomPrintText.setText( "" @ %message ); 65 | bottomPrintDlg.extent = firstWord(bottomPrintDlg.extent) @ " " @ $CenterPrintSizes[%size]; 66 | 67 | if (%time > 0) 68 | bottomPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearbottomPrint" ); 69 | } 70 | 71 | function BottomPrintText::onResize(%this, %width, %height) 72 | { 73 | %this.position = "0 0"; 74 | } 75 | 76 | function CenterPrintText::onResize(%this, %width, %height) 77 | { 78 | %this.position = "0 0"; 79 | } 80 | 81 | //------------------------------------------------------------------------------------------------------- 82 | 83 | function clientCmdClearCenterPrint() 84 | { 85 | $centerPrintActive = 0; 86 | CenterPrintDlg.visible = 0; 87 | CenterPrintDlg.removePrint = ""; 88 | } 89 | 90 | function clientCmdClearBottomPrint() 91 | { 92 | $bottomPrintActive = 0; 93 | BottomPrintDlg.visible = 0; 94 | BottomPrintDlg.removePrint = ""; 95 | } 96 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/lightRay.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | $LightRayPostFX::brightScalar = 0.75; 25 | $LightRayPostFX::numSamples = 40; 26 | $LightRayPostFX::density = 0.94; 27 | $LightRayPostFX::weight = 5.65; 28 | $LightRayPostFX::decay = 1.0; 29 | $LightRayPostFX::exposure = 0.0005; 30 | $LightRayPostFX::resolutionScale = 1.0; 31 | 32 | 33 | singleton ShaderData( LightRayOccludeShader ) 34 | { 35 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 36 | DXPixelShaderFile = "shaders/common/postFx/lightRay/lightRayOccludeP.hlsl"; 37 | 38 | pixVersion = 3.0; 39 | }; 40 | 41 | singleton ShaderData( LightRayShader ) 42 | { 43 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 44 | DXPixelShaderFile = "shaders/common/postFx/lightRay/lightRayP.hlsl"; 45 | 46 | pixVersion = 3.0; 47 | }; 48 | 49 | singleton GFXStateBlockData( LightRayStateBlock : PFX_DefaultStateBlock ) 50 | { 51 | samplersDefined = true; 52 | samplerStates[0] = SamplerClampLinear; 53 | samplerStates[1] = SamplerClampLinear; 54 | }; 55 | 56 | singleton PostEffect( LightRayPostFX ) 57 | { 58 | isEnabled = false; 59 | allowReflectPass = false; 60 | 61 | renderTime = "PFXBeforeBin"; 62 | renderBin = "EditorBin"; 63 | renderPriority = 10; 64 | 65 | shader = LightRayOccludeShader; 66 | stateBlock = LightRayStateBlock; 67 | texture[0] = "$backBuffer"; 68 | texture[1] = "#prepass"; 69 | target = "$outTex"; 70 | targetFormat = "GFXFormatR16G16B16A16F"; 71 | 72 | new PostEffect() 73 | { 74 | shader = LightRayShader; 75 | stateBlock = LightRayStateBlock; 76 | internalName = "final"; 77 | texture[0] = "$inTex"; 78 | texture[1] = "$backBuffer"; 79 | target = "$backBuffer"; 80 | }; 81 | }; 82 | 83 | function LightRayPostFX::preProcess( %this ) 84 | { 85 | %this.targetScale = $LightRayPostFX::resolutionScale SPC $LightRayPostFX::resolutionScale; 86 | } 87 | 88 | function LightRayPostFX::setShaderConsts( %this ) 89 | { 90 | %this.setShaderConst( "$brightScalar", $LightRayPostFX::brightScalar ); 91 | 92 | %pfx = %this-->final; 93 | %pfx.setShaderConst( "$numSamples", $LightRayPostFX::numSamples ); 94 | %pfx.setShaderConst( "$density", $LightRayPostFX::density ); 95 | %pfx.setShaderConst( "$weight", $LightRayPostFX::weight ); 96 | %pfx.setShaderConst( "$decay", $LightRayPostFX::decay ); 97 | %pfx.setShaderConst( "$exposure", $LightRayPostFX::exposure ); 98 | } 99 | -------------------------------------------------------------------------------- /game/core/scripts/client/lighting.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | //--------------------------------------------------------------------------------------------- 25 | 26 | function initLightingSystems() 27 | { 28 | echo( "\n--------- Initializing Lighting Systems ---------" ); 29 | 30 | // First exec the scripts for the different light managers 31 | // in the lighting folder. 32 | 33 | %pattern = "./lighting/*/init.cs"; 34 | %file = findFirstFile( %pattern ); 35 | if ( %file $= "" ) 36 | { 37 | // Try for DSOs next. 38 | %pattern = "./lighting/*/init.cs.dso"; 39 | %file = findFirstFile( %pattern ); 40 | } 41 | 42 | while( %file !$= "" ) 43 | { 44 | exec( %file ); 45 | %file = findNextFile( %pattern ); 46 | } 47 | 48 | // Try the perfered one first. 49 | %success = setLightManager( $pref::lightManager ); 50 | if ( !%success ) 51 | { 52 | // The perfered one fell thru... so go thru the default 53 | // light managers until we find one that works. 54 | %lmCount = getFieldCount( $lightManager::defaults ); 55 | for ( %i = 0; %i < %lmCount; %i++ ) 56 | { 57 | %lmName = getField( $lightManager::defaults, %i ); 58 | %success = setLightManager( %lmName ); 59 | if ( %success ) 60 | break; 61 | } 62 | } 63 | 64 | // Did we completely fail to initialize a light manager? 65 | if ( !%success ) 66 | { 67 | // If we completely failed to initialize a light 68 | // manager then the 3d scene cannot be rendered. 69 | quitWithErrorMessage( "Failed to set a light manager!" ); 70 | } 71 | 72 | echo( "\n" ); 73 | } 74 | 75 | //--------------------------------------------------------------------------------------------- 76 | 77 | function onLightManagerActivate( %lmName ) 78 | { 79 | $pref::lightManager = %lmName; 80 | echo( "Using " @ $pref::lightManager ); 81 | 82 | // Call activation callbacks. 83 | 84 | %activateNewFn = "onActivate" @ getWord( %lmName, 0 ) @ "LM"; 85 | if( isFunction( %activateNewFn ) ) 86 | eval( %activateNewFn @ "();" ); 87 | } 88 | 89 | //--------------------------------------------------------------------------------------------- 90 | 91 | function onLightManagerDeactivate( %lmName ) 92 | { 93 | // Call deactivation callback. 94 | 95 | %deactivateOldFn = "onDeactivate" @ getWord( %lmName, 0 ) @ "LM"; 96 | if( isFunction( %deactivateOldFn ) ) 97 | eval( %deactivateOldFn @ "();" ); 98 | } 99 | -------------------------------------------------------------------------------- /game/core/scripts/server/centerPrint.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | function centerPrintAll( %message, %time, %lines ) 24 | { 25 | if( %lines $= "" || ((%lines > 3) || (%lines < 1)) ) 26 | %lines = 1; 27 | 28 | %count = ClientGroup.getCount(); 29 | for (%i = 0; %i < %count; %i++) 30 | { 31 | %cl = ClientGroup.getObject(%i); 32 | if( !%cl.isAIControlled() ) 33 | commandToClient( %cl, 'centerPrint', %message, %time, %lines ); 34 | } 35 | } 36 | 37 | function bottomPrintAll( %message, %time, %lines ) 38 | { 39 | if( %lines $= "" || ((%lines > 3) || (%lines < 1)) ) 40 | %lines = 1; 41 | 42 | %count = ClientGroup.getCount(); 43 | for (%i = 0; %i < %count; %i++) 44 | { 45 | %cl = ClientGroup.getObject(%i); 46 | if( !%cl.isAIControlled() ) 47 | commandToClient( %cl, 'bottomPrint', %message, %time, %lines ); 48 | } 49 | } 50 | 51 | //------------------------------------------------------------------------------------------------------- 52 | 53 | function centerPrint( %client, %message, %time, %lines ) 54 | { 55 | if( %lines $= "" || ((%lines > 3) || (%lines < 1)) ) 56 | %lines = 1; 57 | 58 | 59 | commandToClient( %client, 'CenterPrint', %message, %time, %lines ); 60 | } 61 | 62 | function bottomPrint( %client, %message, %time, %lines ) 63 | { 64 | if( %lines $= "" || ((%lines > 3) || (%lines < 1)) ) 65 | %lines = 1; 66 | 67 | commandToClient( %client, 'BottomPrint', %message, %time, %lines ); 68 | } 69 | 70 | //------------------------------------------------------------------------------------------------------- 71 | 72 | function clearCenterPrint( %client ) 73 | { 74 | commandToClient( %client, 'ClearCenterPrint'); 75 | } 76 | 77 | function clearBottomPrint( %client ) 78 | { 79 | commandToClient( %client, 'ClearBottomPrint'); 80 | } 81 | 82 | //------------------------------------------------------------------------------------------------------- 83 | 84 | function clearCenterPrintAll() 85 | { 86 | %count = ClientGroup.getCount(); 87 | for (%i = 0; %i < %count; %i++) 88 | { 89 | %cl = ClientGroup.getObject(%i); 90 | if( !%cl.isAIControlled() ) 91 | commandToClient( %cl, 'ClearCenterPrint'); 92 | } 93 | } 94 | 95 | function clearBottomPrintAll() 96 | { 97 | %count = ClientGroup.getCount(); 98 | for (%i = 0; %i < %count; %i++) 99 | { 100 | %cl = ClientGroup.getObject(%i); 101 | if( !%cl.isAIControlled() ) 102 | commandToClient( %cl, 'ClearBottomPrint'); 103 | } 104 | } -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/glow.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | singleton ShaderData( PFX_GlowBlurVertShader ) 25 | { 26 | DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl"; 27 | DXPixelShaderFile = "shaders/common/postFx/glowBlurP.hlsl"; 28 | 29 | // OGLVertexShaderFile = "shaders/common/postFx/glowBlurV.glsl"; 30 | // OGLPixelShaderFile = "shaders/common/postFx/glowBlurP.glsl"; 31 | 32 | defines = "BLUR_DIR=float2(0.0,1.0)"; 33 | 34 | samplerNames[0] = "$diffuseMap"; 35 | 36 | pixVersion = 2.0; 37 | }; 38 | 39 | 40 | singleton ShaderData( PFX_GlowBlurHorzShader : PFX_GlowBlurVertShader ) 41 | { 42 | defines = "BLUR_DIR=float2(1.0,0.0)"; 43 | }; 44 | 45 | 46 | singleton GFXStateBlockData( PFX_GlowCombineStateBlock : PFX_DefaultStateBlock ) 47 | { 48 | // Use alpha test to save some fillrate 49 | // on the non-glowing areas of the scene. 50 | alphaDefined = true; 51 | alphaTestEnable = true; 52 | alphaTestRef = 1; 53 | alphaTestFunc = GFXCmpGreaterEqual; 54 | 55 | // Do a one to one blend. 56 | blendDefined = true; 57 | blendEnable = true; 58 | blendSrc = GFXBlendOne; 59 | blendDest = GFXBlendOne; 60 | }; 61 | 62 | 63 | singleton PostEffect( GlowPostFx ) 64 | { 65 | // Do not allow the glow effect to work in reflection 66 | // passes by default so we don't do the extra drawing. 67 | allowReflectPass = false; 68 | 69 | renderTime = "PFXAfterBin"; 70 | renderBin = "GlowBin"; 71 | renderPriority = 1; 72 | 73 | // First we down sample the glow buffer. 74 | shader = PFX_PassthruShader; 75 | stateBlock = PFX_DefaultStateBlock; 76 | texture[0] = "#glowbuffer"; 77 | target = "$outTex"; 78 | targetScale = "0.5 0.5"; 79 | 80 | isEnabled = true; 81 | 82 | // Blur vertically 83 | new PostEffect() 84 | { 85 | shader = PFX_GlowBlurVertShader; 86 | stateBlock = PFX_DefaultStateBlock; 87 | texture[0] = "$inTex"; 88 | target = "$outTex"; 89 | }; 90 | 91 | // Blur horizontally 92 | new PostEffect() 93 | { 94 | shader = PFX_GlowBlurHorzShader; 95 | stateBlock = PFX_DefaultStateBlock; 96 | texture[0] = "$inTex"; 97 | target = "$outTex"; 98 | }; 99 | 100 | // Upsample and combine with the back buffer. 101 | new PostEffect() 102 | { 103 | shader = PFX_PassthruShader; 104 | stateBlock = PFX_GlowCombineStateBlock; 105 | texture[0] = "$inTex"; 106 | target = "$backBuffer"; 107 | }; 108 | }; 109 | -------------------------------------------------------------------------------- /game/core/scripts/client/shaders.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | // This file contains shader data necessary for various engine utility functions 25 | //----------------------------------------------------------------------------- 26 | 27 | 28 | singleton ShaderData( ParticlesShaderData ) 29 | { 30 | DXVertexShaderFile = "shaders/common/particlesV.hlsl"; 31 | DXPixelShaderFile = "shaders/common/particlesP.hlsl"; 32 | 33 | OGLVertexShaderFile = "shaders/common/gl/particlesV.glsl"; 34 | OGLPixelShaderFile = "shaders/common/gl/particlesP.glsl"; 35 | 36 | pixVersion = 2.0; 37 | }; 38 | 39 | singleton ShaderData( OffscreenParticleCompositeShaderData ) 40 | { 41 | DXVertexShaderFile = "shaders/common/particleCompositeV.hlsl"; 42 | DXPixelShaderFile = "shaders/common/particleCompositeP.hlsl"; 43 | 44 | OGLVertexShaderFile = "shaders/common/gl/particleCompositeV.glsl"; 45 | OGLPixelShaderFile = "shaders/common/gl/particleCompositeP.glsl"; 46 | 47 | pixVersion = 2.0; 48 | }; 49 | 50 | //----------------------------------------------------------------------------- 51 | // Planar Reflection 52 | //----------------------------------------------------------------------------- 53 | new ShaderData( ReflectBump ) 54 | { 55 | DXVertexShaderFile = "shaders/common/planarReflectBumpV.hlsl"; 56 | DXPixelShaderFile = "shaders/common/planarReflectBumpP.hlsl"; 57 | 58 | OGLVertexShaderFile = "shaders/common/gl/planarReflectBumpV.glsl"; 59 | OGLPixelShaderFile = "shaders/common/gl/planarReflectBumpP.glsl"; 60 | 61 | samplerNames[0] = "$diffuseMap"; 62 | samplerNames[1] = "$refractMap"; 63 | samplerNames[2] = "$bumpMap"; 64 | 65 | pixVersion = 2.0; 66 | }; 67 | 68 | new ShaderData( Reflect ) 69 | { 70 | DXVertexShaderFile = "shaders/common/planarReflectV.hlsl"; 71 | DXPixelShaderFile = "shaders/common/planarReflectP.hlsl"; 72 | 73 | OGLVertexShaderFile = "shaders/common/gl/planarReflectV.glsl"; 74 | OGLPixelShaderFile = "shaders/common/gl/planarReflectP.glsl"; 75 | 76 | samplerNames[0] = "$diffuseMap"; 77 | samplerNames[1] = "$refractMap"; 78 | 79 | pixVersion = 1.4; 80 | }; 81 | 82 | //----------------------------------------------------------------------------- 83 | // fxFoliageReplicator 84 | //----------------------------------------------------------------------------- 85 | new ShaderData( fxFoliageReplicatorShader ) 86 | { 87 | DXVertexShaderFile = "shaders/common/fxFoliageReplicatorV.hlsl"; 88 | DXPixelShaderFile = "shaders/common/fxFoliageReplicatorP.hlsl"; 89 | 90 | OGLVertexShaderFile = "shaders/common/gl/fxFoliageReplicatorV.glsl"; 91 | OGLPixelShaderFile = "shaders/common/gl/fxFoliageReplicatorP.glsl"; 92 | 93 | samplerNames[0] = "$diffuseMap"; 94 | samplerNames[1] = "$alphaMap"; 95 | 96 | pixVersion = 1.4; 97 | }; -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/edgeAA.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | singleton GFXStateBlockData( PFX_DefaultEdgeAAStateBlock ) 25 | { 26 | zDefined = true; 27 | zEnable = false; 28 | zWriteEnable = false; 29 | 30 | samplersDefined = true; 31 | samplerStates[0] = SamplerClampPoint; 32 | //samplerStates[1] = SamplerWrapPoint; 33 | }; 34 | 35 | singleton ShaderData( PFX_EdgeAADetectShader ) 36 | { 37 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 38 | DXPixelShaderFile = "shaders/common/postFx/edgeaa/edgeDetectP.hlsl"; 39 | 40 | //OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl"; 41 | //OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl"; 42 | 43 | samplerNames[0] = "$inputTex"; 44 | 45 | pixVersion = 3.0; 46 | }; 47 | 48 | singleton ShaderData( PFX_EdgeAAShader ) 49 | { 50 | DXVertexShaderFile = "shaders/common/postFx/edgeaa/edgeAAV.hlsl"; 51 | DXPixelShaderFile = "shaders/common/postFx/edgeaa/edgeAAP.hlsl"; 52 | 53 | //OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl"; 54 | //OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl"; 55 | 56 | samplerNames[0] = "$inputTex"; 57 | 58 | pixVersion = 3.0; 59 | }; 60 | 61 | singleton ShaderData( PFX_EdgeAADebugShader ) 62 | { 63 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 64 | DXPixelShaderFile = "shaders/common/postFx/edgeaa/dbgEdgeDisplayP.hlsl"; 65 | 66 | //OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl"; 67 | //OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl"; 68 | 69 | samplerNames[0] = "$inputTex"; 70 | 71 | pixVersion = 3.0; 72 | }; 73 | 74 | singleton PostEffect( EdgeDetectPostEffect ) 75 | { 76 | renderTime = "PFXBeforeBin"; 77 | renderBin = "ObjTranslucentBin"; 78 | //renderPriority = 0.1; 79 | targetScale = "0.5 0.5"; 80 | 81 | shader = PFX_EdgeAADetectShader; 82 | stateBlock = PFX_DefaultEdgeAAStateBlock; 83 | texture[0] = "#prepass"; 84 | target = "#edge"; 85 | 86 | isEnabled = false; 87 | }; 88 | 89 | singleton PostEffect( EdgeAAPostEffect ) 90 | { 91 | renderTime = "PFXAfterDiffuse"; 92 | //renderBin = "ObjTranslucentBin"; 93 | //renderPriority = 0.1; 94 | 95 | shader = PFX_EdgeAAShader; 96 | stateBlock = PFX_DefaultEdgeAAStateBlock; 97 | texture[0] = "#edge"; 98 | texture[1] = "$backBuffer"; 99 | target = "$backBuffer"; 100 | }; 101 | 102 | singleton PostEffect( Debug_EdgeAAPostEffect ) 103 | { 104 | renderTime = "PFXAfterDiffuse"; 105 | //renderBin = "ObjTranslucentBin"; 106 | //renderPriority = 0.1; 107 | 108 | shader = PFX_EdgeAADebugShader; 109 | stateBlock = PFX_DefaultEdgeAAStateBlock; 110 | texture[0] = "#edge"; 111 | target = "$backBuffer"; 112 | }; -------------------------------------------------------------------------------- /game/core/scripts/client/lighting/advanced/shadowViz.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | new ShaderData( AL_ShadowVisualizeShader ) 24 | { 25 | DXVertexShaderFile = "shaders/common/guiMaterialV.hlsl"; 26 | DXPixelShaderFile = "shaders/common/lighting/advanced/dbgShadowVisualizeP.hlsl"; 27 | 28 | OGLVertexShaderFile = "shaders/common/gl/guiMaterialV.glsl"; 29 | OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgShadowVisualizeP.glsl"; 30 | 31 | pixVersion = 2.0; 32 | }; 33 | 34 | new CustomMaterial( AL_ShadowVisualizeMaterial ) 35 | { 36 | shader = AL_ShadowVisualizeShader; 37 | stateBlock = AL_DepthVisualizeState; 38 | 39 | sampler["shadowMap"] = "#AL_ShadowVizTexture"; 40 | sampler["depthViz"] = "depthviz"; 41 | 42 | pixVersion = 2.0; 43 | }; 44 | 45 | singleton GuiControlProfile( AL_ShadowLabelTextProfile ) 46 | { 47 | fontColor = "0 0 0"; 48 | autoSizeWidth = true; 49 | autoSizeHeight = true; 50 | justify = "left"; 51 | fontSize = 14; 52 | }; 53 | 54 | /// Toggles the visualization of the pre-pass lighting buffer. 55 | function toggleShadowViz() 56 | { 57 | if ( AL_ShadowVizOverlayCtrl.isAwake() ) 58 | { 59 | setShadowVizLight( 0 ); 60 | Canvas.popDialog( AL_ShadowVizOverlayCtrl ); 61 | } 62 | else 63 | { 64 | Canvas.pushDialog( AL_ShadowVizOverlayCtrl, 100 ); 65 | _setShadowVizLight( EWorldEditor.getSelectedObject( 0 ) ); 66 | } 67 | } 68 | 69 | /// Called from the WorldEditor when an object is selected. 70 | function _setShadowVizLight( %light, %force ) 71 | { 72 | if ( !AL_ShadowVizOverlayCtrl.isAwake() ) 73 | return; 74 | 75 | if ( AL_ShadowVizOverlayCtrl.isLocked && !%force ) 76 | return; 77 | 78 | // Resolve the object to the client side. 79 | if ( isObject( %light ) ) 80 | { 81 | %clientLight = serverToClientObject( %light ); 82 | %sizeAndAspect = setShadowVizLight( %clientLight ); 83 | } 84 | 85 | AL_ShadowVizOverlayCtrl-->MatCtrl.setMaterial( "AL_ShadowVisualizeMaterial" ); 86 | 87 | %text = "ShadowViz"; 88 | if ( isObject( %light ) ) 89 | %text = %text @ " : " @ getWord( %sizeAndAspect, 0 ) @ " x " @ getWord( %sizeAndAspect, 1 ); 90 | 91 | AL_ShadowVizOverlayCtrl-->WindowCtrl.text = %text; 92 | } 93 | 94 | /// For convenience, push the viz dialog and set the light manually from the console. 95 | function showShadowVizForLight( %light ) 96 | { 97 | if ( !AL_ShadowVizOverlayCtrl.isAwake() ) 98 | Canvas.pushDialog( AL_ShadowVizOverlayCtrl, 100 ); 99 | _setShadowVizLight( %light, true ); 100 | } 101 | 102 | // Prevent shadowViz from changing lights in response to editor selection 103 | // events until unlock is called. The only way a vis light will change while locked 104 | // is if showShadowVizForLight is explicitly called by the user. 105 | function lockShadowViz() 106 | { 107 | AL_ShadowVizOverlayCtrl.islocked = true; 108 | } 109 | 110 | function unlockShadowViz() 111 | { 112 | AL_ShadowVizOverlayCtrl.islocked = false; 113 | } -------------------------------------------------------------------------------- /game/core/scripts/client/cursor.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //--------------------------------------------------------------------------------------------- 24 | // Cursor toggle functions. 25 | //--------------------------------------------------------------------------------------------- 26 | $cursorControlled = true; 27 | function showCursor() 28 | { 29 | if ($cursorControlled) 30 | lockMouse(false); 31 | Canvas.cursorOn(); 32 | } 33 | 34 | function hideCursor() 35 | { 36 | if ($cursorControlled) 37 | lockMouse(true); 38 | Canvas.cursorOff(); 39 | } 40 | 41 | //--------------------------------------------------------------------------------------------- 42 | // In the CanvasCursor package we add some additional functionality to the built-in GuiCanvas 43 | // class, of which the global Canvas object is an instance. In this case, the behavior we want 44 | // is for the cursor to automatically display, except when the only guis visible want no 45 | // cursor - usually the in game interface. 46 | //--------------------------------------------------------------------------------------------- 47 | package CanvasCursorPackage 48 | { 49 | 50 | //--------------------------------------------------------------------------------------------- 51 | // checkCursor 52 | // The checkCursor method iterates through all the root controls on the canvas checking each 53 | // ones noCursor property. If the noCursor property exists as anything other than false or an 54 | // empty string on every control, the cursor will be hidden. 55 | //--------------------------------------------------------------------------------------------- 56 | function GuiCanvas::checkCursor(%this) 57 | { 58 | %count = %this.getCount(); 59 | for(%i = 0; %i < %count; %i++) 60 | { 61 | %control = %this.getObject(%i); 62 | if ((%control.noCursor $= "") || !%control.noCursor) 63 | { 64 | showCursor(); 65 | return; 66 | } 67 | } 68 | // If we get here, every control requested a hidden cursor, so we oblige. 69 | hideCursor(); 70 | } 71 | 72 | //--------------------------------------------------------------------------------------------- 73 | // The following functions override the GuiCanvas defaults that involve changing the content 74 | // of the Canvas. Basically, all we are doing is adding a call to checkCursor to each one. 75 | //--------------------------------------------------------------------------------------------- 76 | function GuiCanvas::setContent(%this, %ctrl) 77 | { 78 | Parent::setContent(%this, %ctrl); 79 | %this.checkCursor(); 80 | } 81 | 82 | function GuiCanvas::pushDialog(%this, %ctrl, %layer, %center) 83 | { 84 | Parent::pushDialog(%this, %ctrl, %layer, %center); 85 | %this.checkCursor(); 86 | } 87 | 88 | function GuiCanvas::popDialog(%this, %ctrl) 89 | { 90 | Parent::popDialog(%this, %ctrl); 91 | %this.checkCursor(); 92 | } 93 | 94 | function GuiCanvas::popLayer(%this, %layer) 95 | { 96 | Parent::popLayer(%this, %layer); 97 | %this.checkCursor(); 98 | } 99 | 100 | }; 101 | 102 | activatePackage(CanvasCursorPackage); 103 | -------------------------------------------------------------------------------- /game/scripts/server/init.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | 25 | // Variables used by server scripts & code. The ones marked with (c) 26 | // are accessed from code. Variables preceeded by Pref:: are server 27 | // preferences and stored automatically in the ServerPrefs.cs file 28 | // in between server sessions. 29 | // 30 | // (c) Server::ServerType {SinglePlayer, MultiPlayer} 31 | // (c) Server::GameType Unique game name 32 | // (c) Server::Dedicated Bool 33 | // ( ) Server::MissionFile Mission .mis file name 34 | // (c) Server::MissionName DisplayName from .mis file 35 | // (c) Server::MissionType Not used 36 | // (c) Server::PlayerCount Current player count 37 | // (c) Server::GuidList Player GUID (record list?) 38 | // (c) Server::Status Current server status 39 | // 40 | // (c) Pref::Server::Name Server Name 41 | // (c) Pref::Server::Password Password for client connections 42 | // ( ) Pref::Server::AdminPassword Password for client admins 43 | // (c) Pref::Server::Info Server description 44 | // (c) Pref::Server::MaxPlayers Max allowed players 45 | // (c) Pref::Server::RegionMask Registers this mask with master server 46 | // ( ) Pref::Server::BanTime Duration of a player ban 47 | // ( ) Pref::Server::KickBanTime Duration of a player kick & ban 48 | // ( ) Pref::Server::MaxChatLen Max chat message len 49 | // ( ) Pref::Server::FloodProtectionEnabled Bool 50 | 51 | //----------------------------------------------------------------------------- 52 | 53 | 54 | //----------------------------------------------------------------------------- 55 | 56 | function initServer() 57 | { 58 | echo("\n--------- Initializing " @ $appName @ ": Server Scripts ---------"); 59 | 60 | // Server::Status is returned in the Game Info Query and represents the 61 | // current status of the server. This string sould be very short. 62 | $Server::Status = "Unknown"; 63 | 64 | // Turn on testing/debug script functions 65 | $Server::TestCheats = false; 66 | 67 | // Specify where the mission files are. 68 | $Server::MissionFileSpec = "levels/*.mis"; 69 | 70 | // The common module provides the basic server functionality 71 | initBaseServer(); 72 | 73 | // Load up game server support scripts 74 | exec("./commands.cs"); 75 | exec("./game.cs"); 76 | } 77 | 78 | 79 | //----------------------------------------------------------------------------- 80 | 81 | function initDedicated() 82 | { 83 | enableWinConsole(true); 84 | echo("\n--------- Starting Dedicated Server ---------"); 85 | 86 | // Make sure this variable reflects the correct state. 87 | $Server::Dedicated = true; 88 | 89 | // The server isn't started unless a mission has been specified. 90 | if ($missionArg !$= "") { 91 | createServer("MultiPlayer", $missionArg); 92 | } 93 | else 94 | echo("No mission specified (use -mission filename)"); 95 | } 96 | 97 | -------------------------------------------------------------------------------- /game/core/scripts/server/levelInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //------------------------------------------------------------------------------ 24 | // Loading info is text displayed on the client side while the mission 25 | // is being loaded. This information is extracted from the mission file 26 | // and sent to each the client as it joins. 27 | //------------------------------------------------------------------------------ 28 | 29 | //------------------------------------------------------------------------------ 30 | // clearLoadInfo 31 | // 32 | // Clears the mission info stored 33 | //------------------------------------------------------------------------------ 34 | function clearLoadInfo() { 35 | if (isObject(theLevelInfo)) 36 | theLevelInfo.delete(); 37 | } 38 | 39 | //------------------------------------------------------------------------------ 40 | // buildLoadInfo 41 | // 42 | // Extract the map description from the .mis file 43 | //------------------------------------------------------------------------------ 44 | function buildLoadInfo( %mission ) { 45 | clearLoadInfo(); 46 | 47 | %infoObject = ""; 48 | %file = new FileObject(); 49 | 50 | if ( %file.openForRead( %mission ) ) { 51 | %inInfoBlock = false; 52 | 53 | while ( !%file.isEOF() ) { 54 | %line = %file.readLine(); 55 | %line = trim( %line ); 56 | 57 | if( %line $= "new ScriptObject(MissionInfo) {" ) 58 | %inInfoBlock = true; 59 | else if( %line $= "new LevelInfo(theLevelInfo) {" ) 60 | %inInfoBlock = true; 61 | else if( %inInfoBlock && %line $= "};" ) { 62 | %inInfoBlock = false; 63 | %infoObject = %infoObject @ %line; 64 | break; 65 | } 66 | 67 | if( %inInfoBlock ) 68 | %infoObject = %infoObject @ %line @ " "; 69 | } 70 | 71 | %file.close(); 72 | } 73 | else 74 | error("Level file " @ %mission @ " not found."); 75 | 76 | // Will create the object "MissionInfo" 77 | eval( %infoObject ); 78 | %file.delete(); 79 | } 80 | 81 | //------------------------------------------------------------------------------ 82 | // dumpLoadInfo 83 | // 84 | // Echo the mission information to the console 85 | //------------------------------------------------------------------------------ 86 | function dumpLoadInfo() 87 | { 88 | echo( "Level Name: " @ theLevelInfo.name ); 89 | echo( "Level Description:" ); 90 | 91 | for( %i = 0; theLevelInfo.desc[%i] !$= ""; %i++ ) 92 | echo (" " @ theLevelInfo.desc[%i]); 93 | } 94 | 95 | //------------------------------------------------------------------------------ 96 | // sendLoadInfoToClient 97 | // 98 | // Sends mission description to the client 99 | //------------------------------------------------------------------------------ 100 | function sendLoadInfoToClient( %client ) 101 | { 102 | messageClient( %client, 'MsgLoadInfo', "", theLevelInfo.levelName ); 103 | 104 | // Send Mission Description a line at a time 105 | for( %i = 0; theLevelInfo.desc[%i] !$= ""; %i++ ) 106 | messageClient( %client, 'MsgLoadDescripition', "", theLevelInfo.desc[%i] ); 107 | 108 | messageClient( %client, 'MsgLoadInfoDone' ); 109 | } 110 | -------------------------------------------------------------------------------- /game/core/scripts/client/postFx/fog.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //------------------------------------------------------------------------------ 24 | // Fog 25 | //------------------------------------------------------------------------------ 26 | 27 | singleton ShaderData( FogPassShader ) 28 | { 29 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 30 | DXPixelShaderFile = "shaders/common/postFx/fogP.hlsl"; 31 | 32 | // OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl"; 33 | // OGLPixelShaderFile = "shaders/common/postFx/gl/fogP.glsl"; 34 | 35 | samplerNames[0] = "$prepassTex"; 36 | 37 | pixVersion = 2.0; 38 | }; 39 | 40 | 41 | singleton GFXStateBlockData( FogPassStateBlock : PFX_DefaultStateBlock ) 42 | { 43 | blendDefined = true; 44 | blendEnable = true; 45 | blendSrc = GFXBlendSrcAlpha; 46 | blendDest = GFXBlendInvSrcAlpha; 47 | }; 48 | 49 | 50 | singleton PostEffect( FogPostFx ) 51 | { 52 | // We forward render the reflection pass 53 | // so it does its own fogging. 54 | allowReflectPass = false; 55 | 56 | renderTime = "PFXBeforeBin"; 57 | renderBin = "ObjTranslucentBin"; 58 | 59 | shader = FogPassShader; 60 | stateBlock = FogPassStateBlock; 61 | texture[0] = "#prepass"; 62 | 63 | renderPriority = 5; 64 | 65 | isEnabled = true; 66 | }; 67 | 68 | 69 | //------------------------------------------------------------------------------ 70 | // UnderwaterFog 71 | //------------------------------------------------------------------------------ 72 | 73 | singleton ShaderData( UnderwaterFogPassShader ) 74 | { 75 | DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; 76 | DXPixelShaderFile = "shaders/common/postFx/underwaterFogP.hlsl"; 77 | 78 | // OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl"; 79 | // OGLPixelShaderFile = "shaders/common/postFx/gl/fogP.glsl"; 80 | 81 | samplerNames[0] = "$prepassTex"; 82 | 83 | pixVersion = 2.0; 84 | }; 85 | 86 | 87 | singleton GFXStateBlockData( UnderwaterFogPassStateBlock : PFX_DefaultStateBlock ) 88 | { 89 | samplersDefined = true; 90 | samplerStates[0] = SamplerClampPoint; 91 | samplerStates[1] = SamplerClampPoint; 92 | samplerStates[2] = SamplerClampLinear; 93 | }; 94 | 95 | 96 | singleton PostEffect( UnderwaterFogPostFx ) 97 | { 98 | oneFrameOnly = true; 99 | onThisFrame = false; 100 | 101 | // Let the fog effect render during the 102 | // reflection pass. 103 | allowReflectPass = true; 104 | 105 | renderTime = "PFXBeforeBin"; 106 | renderBin = "ObjTranslucentBin"; 107 | 108 | shader = UnderwaterFogPassShader; 109 | stateBlock = UnderwaterFogPassStateBlock; 110 | texture[0] = "#prepass"; 111 | texture[1] = "$backBuffer"; 112 | texture[2] = "#waterDepthGradMap"; 113 | 114 | // Needs to happen after the FogPostFx 115 | renderPriority = 4; 116 | 117 | isEnabled = true; 118 | }; 119 | 120 | function UnderwaterFogPostFx::onEnabled( %this ) 121 | { 122 | TurbulenceFx.enable(); 123 | CausticsPFX.enable(); 124 | return true; 125 | } 126 | 127 | function UnderwaterFogPostFx::onDisabled( %this ) 128 | { 129 | TurbulenceFx.disable(); 130 | CausticsPFX.disable(); 131 | return false; 132 | } 133 | -------------------------------------------------------------------------------- /game/core/scripts/gui/messageBoxes/MessageBoxOKCancelDetailsDlg.ed.gui: -------------------------------------------------------------------------------- 1 | //--- OBJECT WRITE BEGIN --- 2 | %guiContent = new GuiControl(MessageBoxOKCancelDetailsDlg) { 3 | canSaveDynamicFields = "0"; 4 | Profile = "GuiOverlayProfile"; 5 | HorizSizing = "width"; 6 | VertSizing = "height"; 7 | position = "0 0"; 8 | Extent = "1024 768"; 9 | MinExtent = "8 8"; 10 | canSave = "1"; 11 | Visible = "1"; 12 | hovertime = "1000"; 13 | 14 | new GuiWindowCtrl(MBOKCancelDetailsFrame) { 15 | canSaveDynamicFields = "0"; 16 | Profile = "GuiWindowProfile"; 17 | HorizSizing = "center"; 18 | VertSizing = "center"; 19 | position = "362 219"; 20 | Extent = "300 330"; 21 | MinExtent = "48 92"; 22 | canSave = "1"; 23 | Visible = "1"; 24 | hovertime = "1000"; 25 | maxLength = "255"; 26 | resizeWidth = "1"; 27 | resizeHeight = "1"; 28 | canMove = "1"; 29 | canClose = "0"; 30 | canMinimize = "0"; 31 | canMaximize = "0"; 32 | minSize = "50 50"; 33 | text = ""; 34 | 35 | new GuiMLTextCtrl(MBOKCancelDetailsText) { 36 | canSaveDynamicFields = "0"; 37 | Profile = "GuiMLTextProfile"; 38 | HorizSizing = "center"; 39 | VertSizing = "bottom"; 40 | position = "32 39"; 41 | Extent = "236 70"; 42 | MinExtent = "8 8"; 43 | canSave = "1"; 44 | Visible = "1"; 45 | hovertime = "1000"; 46 | lineSpacing = "2"; 47 | allowColorChars = "0"; 48 | maxChars = "-1"; 49 | }; 50 | new GuiButtonCtrl() { 51 | canSaveDynamicFields = "0"; 52 | Profile = "GuiButtonProfile"; 53 | HorizSizing = "right"; 54 | VertSizing = "top"; 55 | position = "158 273"; 56 | Extent = "110 23"; 57 | MinExtent = "8 8"; 58 | canSave = "1"; 59 | Visible = "1"; 60 | Command = "MessageCallback(MessageBoxOKCancelDetailsDlg,MessageBoxOKCancelDetailsDlg.callback);"; 61 | Accelerator = "return"; 62 | hovertime = "1000"; 63 | text = "OK"; 64 | groupNum = "-1"; 65 | buttonType = "PushButton"; 66 | }; 67 | new GuiButtonCtrl() { 68 | canSaveDynamicFields = "0"; 69 | Profile = "GuiButtonProfile"; 70 | HorizSizing = "right"; 71 | VertSizing = "top"; 72 | position = "30 273"; 73 | Extent = "110 23"; 74 | MinExtent = "8 8"; 75 | canSave = "1"; 76 | Visible = "1"; 77 | Command = "MessageCallback(MessageBoxOKCancelDetailsDlg,MessageBoxOKCancelDetailsDlg.cancelCallback);"; 78 | Accelerator = "escape"; 79 | hovertime = "1000"; 80 | text = "CANCEL"; 81 | groupNum = "-1"; 82 | buttonType = "PushButton"; 83 | }; 84 | new GuiButtonCtrl(MBOKCancelDetailsButton) { 85 | canSaveDynamicFields = "0"; 86 | Profile = "GuiButtonProfile"; 87 | HorizSizing = "right"; 88 | VertSizing = "top"; 89 | position = "9 302"; 90 | Extent = "86 17"; 91 | MinExtent = "8 8"; 92 | canSave = "1"; 93 | Visible = "1"; 94 | Command = "MBOKCancelDetailsToggleInfoFrame();"; 95 | hovertime = "1000"; 96 | text = "Details"; 97 | groupNum = "-1"; 98 | buttonType = "PushButton"; 99 | }; 100 | new GuiScrollCtrl(MBOKCancelDetailsScroll) { 101 | canSaveDynamicFields = "0"; 102 | Profile = "GuiScrollProfile"; 103 | HorizSizing = "right"; 104 | VertSizing = "bottom"; 105 | position = "8 115"; 106 | Extent = "281 138"; 107 | MinExtent = "8 2"; 108 | canSave = "1"; 109 | Visible = "1"; 110 | hovertime = "1000"; 111 | willFirstRespond = "1"; 112 | hScrollBar = "alwaysOff"; 113 | vScrollBar = "dynamic"; 114 | lockHorizScroll = "true"; 115 | lockVertScroll = "false"; 116 | constantThumbHeight = "0"; 117 | childMargin = "0 0"; 118 | 119 | new GuiMLTextCtrl(MBOKCancelDetailsInfoText) { 120 | canSaveDynamicFields = "0"; 121 | Profile = "GuiMLTextProfile"; 122 | HorizSizing = "right"; 123 | VertSizing = "bottom"; 124 | position = "2 2"; 125 | Extent = "259 56"; 126 | MinExtent = "8 2"; 127 | canSave = "1"; 128 | Visible = "1"; 129 | hovertime = "1000"; 130 | lineSpacing = "2"; 131 | allowColorChars = "0"; 132 | maxChars = "-1"; 133 | }; 134 | }; 135 | }; 136 | }; 137 | //--- OBJECT WRITE END --- 138 | -------------------------------------------------------------------------------- /game/core/scripts/client/message.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | //----------------------------------------------------------------------------- 25 | // Functions that process commands sent from the server. 26 | 27 | 28 | // This function is for chat messages only; it is invoked on the client when 29 | // the server does a commandToClient with the tag ChatMessage. (Cf. the 30 | // functions chatMessage* in core/scripts/server/message.cs.) 31 | 32 | // This just invokes onChatMessage, which the mod code must define. 33 | 34 | function clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10) 35 | { 36 | onChatMessage(detag(%msgString), %voice, %pitch); 37 | } 38 | 39 | 40 | // Game event descriptions, which may or may not include text messages, can be 41 | // sent using the message* functions in core/scripts/server/message.cs. Those 42 | // functions do commandToClient with the tag ServerMessage, which invokes the 43 | // function below. 44 | 45 | // For ServerMessage messages, the client can install callbacks that will be 46 | // run, according to the "type" of the message. 47 | 48 | function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10) 49 | { 50 | // Get the message type; terminates at any whitespace. 51 | %tag = getWord(%msgType, 0); 52 | 53 | // First see if there is a callback installed that doesn't have a type; 54 | // if so, that callback is always executed when a message arrives. 55 | for (%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++) { 56 | call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); 57 | } 58 | 59 | // Next look for a callback for this particular type of ServerMessage. 60 | if (%tag !$= "") { 61 | for (%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++) { 62 | call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10); 63 | } 64 | } 65 | } 66 | 67 | // Called by the client to install a callback for a particular type of 68 | // ServerMessage. 69 | function addMessageCallback(%msgType, %func) 70 | { 71 | for (%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++) { 72 | // If it already exists as a callback for this type, 73 | // nothing to do. 74 | if (%afunc $= %func) { 75 | return; 76 | } 77 | } 78 | // Set it up. 79 | $MSGCB[%msgType, %i] = %func; 80 | } 81 | 82 | 83 | 84 | // The following is the callback that will be executed for every ServerMessage, 85 | // because we're going to install it without a specified type. Any type- 86 | // specific callbacks will be executed afterward. 87 | 88 | // This just invokes onServerMessage, which can be overridden by the game 89 | function onServerMessage(%a, %b, %c, %d, %e, %f, %g, %h, %i) 90 | { 91 | echo("onServerMessage: "); 92 | if(%a !$= "") echo(" +- a: " @ %a); 93 | if(%b !$= "") echo(" +- b: " @ %b); 94 | if(%c !$= "") echo(" +- c: " @ %c); 95 | if(%d !$= "") echo(" +- d: " @ %d); 96 | if(%e !$= "") echo(" +- e: " @ %e); 97 | if(%f !$= "") echo(" +- f: " @ %f); 98 | if(%g !$= "") echo(" +- g: " @ %g); 99 | if(%h !$= "") echo(" +- h: " @ %h); 100 | if(%i !$= "") echo(" +- i: " @ %i); 101 | } 102 | 103 | function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10) 104 | { 105 | onServerMessage(detag(%msgString)); 106 | } 107 | 108 | // Register that default message handler now. 109 | addMessageCallback("", defaultMessageCallback); 110 | -------------------------------------------------------------------------------- /game/core/scripts/client/recordings.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //----------------------------------------------------------------------------- 24 | // RecordingsGui is the main TSControl through which the a demo game recording 25 | // is viewed. 26 | //----------------------------------------------------------------------------- 27 | 28 | function recordingsDlg::onWake() 29 | { 30 | RecordingsDlgList.clear(); 31 | %i = 0; 32 | %filespec = $currentMod @ "/recordings/*.rec"; 33 | echo(%filespec); 34 | for(%file = findFirstFile(%filespec); %file !$= ""; %file = findNextFile(%filespec)) 35 | RecordingsDlgList.addRow(%i++, fileBase(%file)); 36 | RecordingsDlgList.sort(0); 37 | RecordingsDlgList.setSelectedRow(0); 38 | RecordingsDlgList.scrollVisible(0); 39 | } 40 | 41 | function StartSelectedDemo() 42 | { 43 | // first unit is filename 44 | %sel = RecordingsDlgList.getSelectedId(); 45 | %rowText = RecordingsDlgList.getRowTextById(%sel); 46 | 47 | %file = $currentMod @ "/recordings/" @ getField(%rowText, 0) @ ".rec"; 48 | 49 | new GameConnection(ServerConnection); 50 | RootGroup.add(ServerConnection); 51 | 52 | // Start up important client-side stuff, such as the group 53 | // for particle emitters. This doesn't get launched during a demo 54 | // as we short circuit the whole mission loading sequence. 55 | clientStartMission(); 56 | 57 | if(ServerConnection.playDemo(%file)) 58 | { 59 | Canvas.setContent(PlayGui); 60 | Canvas.popDialog(RecordingsDlg); 61 | ServerConnection.prepDemoPlayback(); 62 | } 63 | else 64 | { 65 | MessageBoxOK("Playback Failed", "Demo playback failed for file '" @ %file @ "'."); 66 | if (isObject(ServerConnection)) { 67 | ServerConnection.delete(); 68 | } 69 | } 70 | } 71 | 72 | function startDemoRecord() 73 | { 74 | // make sure that current recording stream is stopped 75 | ServerConnection.stopRecording(); 76 | 77 | // make sure we aren't playing a demo 78 | if(ServerConnection.isDemoPlaying()) 79 | return; 80 | 81 | for(%i = 0; %i < 1000; %i++) 82 | { 83 | %num = %i; 84 | if(%num < 10) 85 | %num = "0" @ %num; 86 | if(%num < 100) 87 | %num = "0" @ %num; 88 | 89 | %file = $currentMod @ "/recordings/demo" @ %num @ ".rec"; 90 | if(!isfile(%file)) 91 | break; 92 | } 93 | if(%i == 1000) 94 | return; 95 | 96 | $DemoFileName = %file; 97 | 98 | ChatHud.AddLine( "\c4Recording to file [\c2" @ $DemoFileName @ "\cr]."); 99 | 100 | ServerConnection.prepDemoRecord(); 101 | ServerConnection.startRecording($DemoFileName); 102 | 103 | // make sure start worked 104 | if(!ServerConnection.isDemoRecording()) 105 | { 106 | deleteFile($DemoFileName); 107 | ChatHud.AddLine( "\c3 *** Failed to record to file [\c2" @ $DemoFileName @ "\cr]."); 108 | $DemoFileName = ""; 109 | } 110 | } 111 | 112 | function stopDemoRecord() 113 | { 114 | // make sure we are recording 115 | if(ServerConnection.isDemoRecording()) 116 | { 117 | ChatHud.AddLine( "\c4Recording file [\c2" @ $DemoFileName @ "\cr] finished."); 118 | ServerConnection.stopRecording(); 119 | } 120 | } 121 | 122 | function demoPlaybackComplete() 123 | { 124 | disconnect(); 125 | 126 | // Clean up important client-side stuff, such as the group 127 | // for particle emitters and the decal manager. This doesn't get 128 | // launched during a demo as we short circuit the whole mission 129 | // handling functionality. 130 | clientEndMission(); 131 | 132 | if (isObject( MainMenuGui )) 133 | Canvas.setContent( MainMenuGui ); 134 | 135 | Canvas.pushDialog(RecordingsDlg); 136 | } 137 | -------------------------------------------------------------------------------- /game/scripts/main.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // Load up core script base 24 | loadDir("core"); // Should be loaded at a higher level, but for now leave -- SRZ 11/29/07 25 | 26 | //----------------------------------------------------------------------------- 27 | // Package overrides to initialize the mod. 28 | package fps { 29 | 30 | function displayHelp() { 31 | Parent::displayHelp(); 32 | error( 33 | "Fps Mod options:\n"@ 34 | " -dedicated Start as dedicated server\n"@ 35 | " -connect
For non-dedicated: Connect to a game at
\n" @ 36 | " -mission For dedicated: Load the mission\n" 37 | ); 38 | } 39 | 40 | function parseArgs() 41 | { 42 | // Call the parent 43 | Parent::parseArgs(); 44 | 45 | // Arguments, which override everything else. 46 | for (%i = 1; %i < $Game::argc ; %i++) 47 | { 48 | %arg = $Game::argv[%i]; 49 | %nextArg = $Game::argv[%i+1]; 50 | %hasNextArg = $Game::argc - %i > 1; 51 | 52 | switch$ (%arg) 53 | { 54 | //-------------------- 55 | case "-dedicated": 56 | $Server::Dedicated = true; 57 | enableWinConsole(true); 58 | $argUsed[%i]++; 59 | 60 | //-------------------- 61 | case "-mission": 62 | $argUsed[%i]++; 63 | if (%hasNextArg) { 64 | $missionArg = %nextArg; 65 | $argUsed[%i+1]++; 66 | %i++; 67 | } 68 | else 69 | error("Error: Missing Command Line argument. Usage: -mission "); 70 | 71 | //-------------------- 72 | case "-connect": 73 | $argUsed[%i]++; 74 | if (%hasNextArg) { 75 | $JoinGameAddress = %nextArg; 76 | $argUsed[%i+1]++; 77 | %i++; 78 | } 79 | else 80 | error("Error: Missing Command Line argument. Usage: -connect "); 81 | } 82 | } 83 | } 84 | 85 | function onStart() 86 | { 87 | // The core does initialization which requires some of 88 | // the preferences to loaded... so do that first. 89 | exec( "./client/defaults.cs" ); 90 | exec( "./server/defaults.cs" ); 91 | 92 | Parent::onStart(); 93 | echo("\n--------- Initializing Directory: scripts ---------"); 94 | 95 | // Load the scripts that start it all... 96 | exec("./client/init.cs"); 97 | exec("./server/init.cs"); 98 | 99 | // Init the physics plugin. 100 | physicsInit(); 101 | 102 | // Start up the audio system. 103 | sfxStartup(); 104 | 105 | // Server gets loaded for all sessions, since clients 106 | // can host in-game servers. 107 | initServer(); 108 | 109 | // Start up in either client, or dedicated server mode 110 | if ($Server::Dedicated) 111 | initDedicated(); 112 | else 113 | initClient(); 114 | } 115 | 116 | function onExit() 117 | { 118 | // Ensure that we are disconnected and/or the server is destroyed. 119 | // This prevents crashes due to the SceneGraph being deleted before 120 | // the objects it contains. 121 | if ($Server::Dedicated) 122 | destroyServer(); 123 | else 124 | disconnect(); 125 | 126 | // Destroy the physics plugin. 127 | physicsDestroy(); 128 | 129 | echo("Exporting client prefs"); 130 | export("$pref::*", "./client/prefs.cs", False); 131 | 132 | echo("Exporting server prefs"); 133 | export("$Pref::Server::*", "./server/prefs.cs", False); 134 | BanList::Export("./server/banlist.cs"); 135 | 136 | Parent::onExit(); 137 | } 138 | 139 | }; // package fps 140 | 141 | // Activate the game package. 142 | activatePackage(fps); 143 | -------------------------------------------------------------------------------- /game/core/scripts/client/audioDescriptions.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // Always declare SFXDescription's (the type of sound) before SFXProfile's (the 24 | // sound itself) when creating new ones 25 | 26 | //----------------------------------------------------------------------------- 27 | // 3D Sounds 28 | //----------------------------------------------------------------------------- 29 | 30 | //----------------------------------------------------------------------------- 31 | // Single shot sounds 32 | //----------------------------------------------------------------------------- 33 | 34 | singleton SFXDescription( AudioDefault3D : AudioEffect ) 35 | { 36 | is3D = true; 37 | ReferenceDistance = 20.0; 38 | MaxDistance = 100.0; 39 | }; 40 | 41 | singleton SFXDescription( AudioSoft3D : AudioEffect ) 42 | { 43 | is3D = true; 44 | ReferenceDistance = 20.0; 45 | MaxDistance = 100.0; 46 | volume = 0.4; 47 | }; 48 | 49 | singleton SFXDescription( AudioClose3D : AudioEffect ) 50 | { 51 | is3D = true; 52 | ReferenceDistance = 10.0; 53 | MaxDistance = 60.0; 54 | }; 55 | 56 | singleton SFXDescription( AudioClosest3D : AudioEffect ) 57 | { 58 | is3D = true; 59 | ReferenceDistance = 5.0; 60 | MaxDistance = 10.0; 61 | }; 62 | 63 | //----------------------------------------------------------------------------- 64 | // Looping sounds 65 | //----------------------------------------------------------------------------- 66 | 67 | singleton SFXDescription( AudioDefaultLoop3D : AudioEffect ) 68 | { 69 | isLooping = true; 70 | is3D = true; 71 | ReferenceDistance = 20.0; 72 | MaxDistance = 100.0; 73 | }; 74 | 75 | singleton SFXDescription( AudioCloseLoop3D : AudioEffect ) 76 | { 77 | isLooping = true; 78 | is3D = true; 79 | ReferenceDistance = 18.0; 80 | MaxDistance = 25.0; 81 | }; 82 | 83 | singleton SFXDescription( AudioClosestLoop3D : AudioEffect ) 84 | { 85 | isLooping = true; 86 | is3D = true; 87 | ReferenceDistance = 5.0; 88 | MaxDistance = 10.0; 89 | }; 90 | 91 | //----------------------------------------------------------------------------- 92 | // 2d sounds 93 | //----------------------------------------------------------------------------- 94 | 95 | // Used for non-looping environmental sounds (like power on, power off) 96 | singleton SFXDescription( Audio2D : AudioEffect ) 97 | { 98 | isLooping = false; 99 | }; 100 | 101 | // Used for Looping Environmental Sounds 102 | singleton SFXDescription( AudioLoop2D : AudioEffect ) 103 | { 104 | isLooping = true; 105 | }; 106 | 107 | singleton SFXDescription( AudioStream2D : AudioEffect ) 108 | { 109 | isStreaming = true; 110 | }; 111 | singleton SFXDescription( AudioStreamLoop2D : AudioEffect ) 112 | { 113 | isLooping = true; 114 | isStreaming = true; 115 | }; 116 | 117 | //----------------------------------------------------------------------------- 118 | // Music 119 | //----------------------------------------------------------------------------- 120 | 121 | singleton SFXDescription( AudioMusic2D : AudioMusic ) 122 | { 123 | isStreaming = true; 124 | }; 125 | 126 | singleton SFXDescription( AudioMusicLoop2D : AudioMusic ) 127 | { 128 | isLooping = true; 129 | isStreaming = true; 130 | }; 131 | 132 | singleton SFXDescription( AudioMusic3D : AudioMusic ) 133 | { 134 | isStreaming = true; 135 | is3D = true; 136 | }; 137 | 138 | singleton SFXDescription( AudioMusicLoop3D : AudioMusic ) 139 | { 140 | isStreaming = true; 141 | is3D = true; 142 | isLooping = true; 143 | }; 144 | -------------------------------------------------------------------------------- /game/core/scripts/client/mission.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | // Whether the local client is currently running a mission. 25 | $Client::missionRunning = false; 26 | 27 | // Sequence number for currently running mission. 28 | $Client::missionSeq = -1; 29 | 30 | 31 | // Called when mission is started. 32 | function clientStartMission() 33 | { 34 | // The client recieves a mission start right before 35 | // being dropped into the game. 36 | physicsStartSimulation( "client" ); 37 | 38 | // Start game audio effects channels. 39 | 40 | AudioChannelEffects.play(); 41 | 42 | // Create client mission cleanup group. 43 | 44 | new SimGroup( ClientMissionCleanup ); 45 | 46 | // Done. 47 | 48 | $Client::missionRunning = true; 49 | } 50 | 51 | // Called when mission is ended (either through disconnect or 52 | // mission end client command). 53 | function clientEndMission() 54 | { 55 | // Stop physics simulation on client. 56 | physicsStopSimulation( "client" ); 57 | 58 | // Stop game audio effects channels. 59 | 60 | AudioChannelEffects.stop(); 61 | 62 | // Delete all the decals. 63 | decalManagerClear(); 64 | 65 | // Delete client mission cleanup group. 66 | if( isObject( ClientMissionCleanup ) ) 67 | ClientMissionCleanup.delete(); 68 | 69 | clearClientPaths(); 70 | 71 | // Done. 72 | $Client::missionRunning = false; 73 | } 74 | 75 | //---------------------------------------------------------------------------- 76 | // Mission start / end events sent from the server 77 | //---------------------------------------------------------------------------- 78 | 79 | function clientCmdMissionStart(%seq) 80 | { 81 | clientStartMission(); 82 | $Client::missionSeq = %seq; 83 | } 84 | 85 | function clientCmdMissionEnd( %seq ) 86 | { 87 | if( $Client::missionRunning && $Client::missionSeq == %seq ) 88 | { 89 | clientEndMission(); 90 | $Client::missionSeq = -1; 91 | } 92 | } 93 | 94 | /// Expands the name of a mission into the full 95 | /// mission path and extension. 96 | function expandMissionFileName( %missionFile ) 97 | { 98 | // Expand any escapes in it. 99 | %missionFile = expandFilename( %missionFile ); 100 | 101 | // If the mission file doesn't exist... try to fix up the string. 102 | if ( !isFile( %missionFile ) ) 103 | { 104 | // Does it need a .mis? 105 | if ( strStr( %missionFile, ".mis" ) == -1 ) 106 | %newMission = %missionFile @ ".mis"; 107 | 108 | if ( !isFile( %newMission ) ) 109 | { 110 | // Attach a path to it. 111 | %newMission = expandFilename( "levels/" @ %newMission ); 112 | if ( !isFile( %newMission ) ) 113 | { 114 | warn( "The mission file '" @ %missionFile @ "' was not found!" ); 115 | return ""; 116 | } 117 | } 118 | 119 | %missionFile = %newMission; 120 | } 121 | 122 | return %missionFile; 123 | } 124 | 125 | /// Load a single player level on the local server. 126 | function loadLevel( %missionNameOrFile ) 127 | { 128 | // Expand the mission name... this allows you to enter 129 | // just the name and not the full path and extension. 130 | %missionFile = expandMissionFileName( %missionNameOrFile ); 131 | if ( %missionFile $= "" ) 132 | return false; 133 | 134 | // Show the loading screen immediately. 135 | if ( isObject( LoadingGui ) ) 136 | { 137 | Canvas.setContent("LoadingGui"); 138 | LoadingProgress.setValue(1); 139 | LoadingProgressTxt.setValue("LOADING MISSION FILE"); 140 | Canvas.repaint(); 141 | } 142 | 143 | // Prepare and launch the server. 144 | return createAndConnectToLocalServer( "SinglePlayer", %missionFile ); 145 | } 146 | -------------------------------------------------------------------------------- /game/core/scripts/client/audioStates.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | // Some state presets. 24 | 25 | 26 | /// Return the first active SFXState in the given SimSet/SimGroup. 27 | function sfxGetActiveStateInGroup( %group ) 28 | { 29 | %count = %group.getCount(); 30 | for( %i = 0; %i < %count; %i ++ ) 31 | { 32 | %obj = %group.getObject( %i ); 33 | if( !%obj.isMemberOfClass( "SFXState" ) ) 34 | continue; 35 | 36 | if( %obj.isActive() ) 37 | return %obj; 38 | } 39 | 40 | return 0; 41 | } 42 | 43 | 44 | //----------------------------------------------------------------------------- 45 | // Special audio state that will always and only be active when no other 46 | // state is active. Useful for letting slots apply specifically when no 47 | // other slot in a list applies. 48 | 49 | singleton SFXState( AudioStateNone ) {}; 50 | 51 | AudioStateNone.activate(); 52 | 53 | function SFXState::onActivate( %this ) 54 | { 55 | if( %this.getId() != AudioStateNone.getId() ) 56 | AudioStateNone.disable(); 57 | } 58 | 59 | function SFXState::onDeactivate( %this ) 60 | { 61 | if( %this.getId() != AudioStateNone.getId() ) 62 | AudioStateNone.enable(); 63 | } 64 | 65 | //----------------------------------------------------------------------------- 66 | // AudioStateExclusive class. 67 | // 68 | // Automatically deactivates sibling SFXStates in its parent SimGroup 69 | // when activated. 70 | 71 | function AudioStateExclusive::onActivate( %this ) 72 | { 73 | Parent::onActivate( %this ); 74 | 75 | %group = %this.parentGroup; 76 | %count = %group.getCount(); 77 | 78 | for( %i = 0; %i < %count; %i ++ ) 79 | { 80 | %obj = %group.getObject( %i ); 81 | 82 | if( %obj != %this && %obj.isMemberOfClass( "SFXState" ) && %obj.isActive() ) 83 | %obj.deactivate(); 84 | } 85 | } 86 | 87 | //----------------------------------------------------------------------------- 88 | // Location-dependent states. 89 | 90 | singleton SimGroup( AudioLocation ); 91 | 92 | /// State when the listener is outside. 93 | singleton SFXState( AudioLocationOutside ) 94 | { 95 | parentGroup = AudioLocation; 96 | className = "AudioStateExclusive"; 97 | }; 98 | 99 | /// State when the listener is submerged. 100 | singleton SFXState( AudioLocationUnderwater ) 101 | { 102 | parentGroup = AudioLocation; 103 | className = "AudioStateExclusive"; 104 | }; 105 | 106 | /// State when the listener is indoors. 107 | singleton SFXState( AudioLocationInside ) 108 | { 109 | parentGroup = AudioLocation; 110 | className = "AudioStateExclusive"; 111 | }; 112 | 113 | /// Return the currently active SFXState in AudioLocation. 114 | function sfxGetLocation() 115 | { 116 | return sfxGetActiveStateInGroup( AudioLocation ); 117 | } 118 | 119 | //----------------------------------------------------------------------------- 120 | // Mood-dependent states. 121 | 122 | singleton SimGroup( AudioMood ); 123 | 124 | singleton SFXState( AudioMoodNeutral ) 125 | { 126 | parentGroup = AudioMood; 127 | className = "AudioStateExclusive"; 128 | }; 129 | 130 | singleton SFXState( AudioMoodAggressive ) 131 | { 132 | parentGroup = AudioMood; 133 | className = "AudioStateExclusive"; 134 | }; 135 | 136 | singleton SFXState( AudioMoodTense ) 137 | { 138 | parentGroup = AudioMood; 139 | className = "AudioStateExclusive"; 140 | }; 141 | 142 | singleton SFXState( AudioMoodVictory ) 143 | { 144 | parentGroup = AudioMood; 145 | className = "AudioStateExclusive"; 146 | }; 147 | 148 | singleton SFXState( AudioMoodCalm ) 149 | { 150 | parentGroup = AudioMood; 151 | className = "AudioStateExclusive"; 152 | }; 153 | 154 | /// Return the currently active SFXState in AudioMood. 155 | function sfxGetMood() 156 | { 157 | return sfxGetActiveStateInGroup( AudioMood ); 158 | } 159 | -------------------------------------------------------------------------------- /game/core/scripts/client/screenshot.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Copyright (c) 2012 GarageGames, LLC 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to 6 | // deal in the Software without restriction, including without limitation the 7 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | // sell copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | // IN THE SOFTWARE. 21 | //----------------------------------------------------------------------------- 22 | 23 | //--------------------------------------------------------------------------------------------- 24 | // formatImageNumber 25 | // Preceeds a number with zeros to make it 6 digits long. 26 | //--------------------------------------------------------------------------------------------- 27 | function formatImageNumber(%number) 28 | { 29 | if(%number < 10) 30 | %number = "0" @ %number; 31 | if(%number < 100) 32 | %number = "0" @ %number; 33 | if(%number < 1000) 34 | %number = "0" @ %number; 35 | if(%number < 10000) 36 | %number = "0" @ %number; 37 | return %number; 38 | } 39 | 40 | //--------------------------------------------------------------------------------------------- 41 | // formatSessionNumber 42 | // Preceeds a number with zeros to make it 4 digits long. 43 | //--------------------------------------------------------------------------------------------- 44 | function formatSessionNumber(%number) 45 | { 46 | if(%number < 10) 47 | %number = "0" @ %number; 48 | if(%number < 100) 49 | %number = "0" @ %number; 50 | return %number; 51 | } 52 | 53 | //--------------------------------------------------------------------------------------------- 54 | // recordMovie 55 | // Records a movie file from the Canvas content using the specified fps. 56 | // Possible encoder values are "PNG" and "THEORA" (default). 57 | //--------------------------------------------------------------------------------------------- 58 | function recordMovie(%movieName, %fps, %encoder) 59 | { 60 | // If the canvas doesn't exist yet, setup a flag so it'll 61 | // start capturing as soon as it's created 62 | if (!isObject(Canvas)) 63 | return; 64 | 65 | if (%encoder $= "") 66 | %encoder = "THEORA"; 67 | %resolution = Canvas.getVideoMode(); 68 | startVideoCapture(Canvas, %movieName, %encoder, %fps); 69 | } 70 | 71 | function stopMovie() 72 | { 73 | stopVideoCapture(); 74 | } 75 | 76 | /// This is bound in initializeCommon() to take 77 | /// a screenshot on a keypress. 78 | function doScreenShot( %val ) 79 | { 80 | // This can be bound, so skip key up events. 81 | if ( %val == 0 ) 82 | return; 83 | 84 | _screenShot( 1 ); 85 | } 86 | 87 | /// A counter for screen shots used by _screenShot(). 88 | $screenshotNumber = 0; 89 | 90 | /// Internal function which generates unique filename 91 | /// and triggers a screenshot capture. 92 | function _screenShot( %tiles, %overlap ) 93 | { 94 | if ( $pref::Video::screenShotSession $= "" ) 95 | $pref::Video::screenShotSession = 0; 96 | 97 | if ( $screenshotNumber == 0 ) 98 | $pref::Video::screenShotSession++; 99 | 100 | if ( $pref::Video::screenShotSession > 999 ) 101 | $pref::Video::screenShotSession = 1; 102 | 103 | %name = "screenshot_" @ formatSessionNumber($pref::Video::screenShotSession) @ "-" @ 104 | formatImageNumber($screenshotNumber); 105 | %name = expandFileName( %name ); 106 | 107 | $screenshotNumber++; 108 | 109 | if ( ( $pref::Video::screenShotFormat $= "JPEG" ) || 110 | ( $pref::video::screenShotFormat $= "JPG" ) ) 111 | screenShot( %name, "JPEG", %tiles, %overlap ); 112 | else 113 | screenShot( %name, "PNG", %tiles, %overlap ); 114 | } 115 | 116 | /// This will close the console and take a large format 117 | /// screenshot by tiling the current backbuffer and save 118 | /// it to the root game folder. 119 | /// 120 | /// For instance a tile setting of 4 with a window set to 121 | /// 800x600 will output a 3200x2400 screenshot. 122 | function tiledScreenShot( %tiles, %overlap ) 123 | { 124 | // Pop the console off before we take the shot. 125 | Canvas.popDialog( ConsoleDlg ); 126 | 127 | _screenShot( %tiles, %overlap ); 128 | } 129 | --------------------------------------------------------------------------------