diff --git a/Engine/source/gfx/gfxCardProfile.cpp b/Engine/source/gfx/gfxCardProfile.cpp index c223aca11..066dd3b3a 100644 --- a/Engine/source/gfx/gfxCardProfile.cpp +++ b/Engine/source/gfx/gfxCardProfile.cpp @@ -41,17 +41,22 @@ void GFXCardProfiler::loadProfileScript(const char* aScriptName) void *data = NULL; U32 dataSize = 0; + Torque::FS::ReadFile( scriptName.c_str(), data, dataSize, true ); if(data == NULL) { +#if TORQUE_DEBUG Con::warnf(" - No card profile %s exists", scriptName.c_str()); +#endif return; } const char *script = static_cast(data); +#if TORQUE_DEBUG Con::printf(" - Loaded card profile %s", scriptName.c_str()); +#endif Con::evaluate(script, false, NULL); delete[] script; diff --git a/Engine/source/gui/controls/guiSliderCtrl.cpp b/Engine/source/gui/controls/guiSliderCtrl.cpp index ad9316216..d84d6311b 100644 --- a/Engine/source/gui/controls/guiSliderCtrl.cpp +++ b/Engine/source/gui/controls/guiSliderCtrl.cpp @@ -89,6 +89,7 @@ IMPLEMENT_CALLBACK( GuiSliderCtrl, onMouseDragged, void, (), (), GuiSliderCtrl::GuiSliderCtrl() : mRange( 0., 1.f ), mTicks( 10 ), + mRenderTicks(true), mSnap( false ), mValue( 0.5f ), mThumbSize( 8, 20 ), @@ -98,7 +99,9 @@ GuiSliderCtrl::GuiSliderCtrl() mDisplayValue( false ), mMouseOver( false ), mDepressed( false ), - mMouseDragged( false ) + mMouseDragged( false ), + mUseFillBar(false), + mFillBarColor(ColorI(255,255,255)) { } @@ -117,6 +120,12 @@ void GuiSliderCtrl::initPersistFields() addProtectedField( "value", TypeF32, Offset( mValue, GuiSliderCtrl ), _setValue, defaultProtectedGetFn, "The value corresponding to the current slider position." ); + addField("useFillBar", TypeBool, Offset(mUseFillBar, GuiSliderCtrl), + "Whether to render the tick marks."); + addField("fillBarColor", TypeColorI, Offset(mFillBarColor, GuiSliderCtrl), + "Whether to render the tick marks."); + addField("renderTicks", TypeBool, Offset(mRenderTicks, GuiSliderCtrl), + "Whether to render the tick marks."); endGroup( "Slider" ); @@ -365,9 +374,18 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect) GFXDrawUtil* drawUtil = GFX->getDrawUtil(); + if (mUseFillBar) + { + + drawUtil->drawRectFill(RectI(offset.x, offset.y, getWidth() * mValue, getHeight()), mFillBarColor); + + renderChildControls(offset, updateRect); + return; + } + if( mHasTexture ) { - if(mTicks > 0) + if(mTicks > 0 && mRenderTicks) { // TODO: tick marks should be positioned based on the bitmap dimensions. Point2I mid(ext.x, ext.y/2); @@ -443,11 +461,14 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect) PrimBuild::vertex2i( pos.x + mid.x, pos.y + mid.y ); // tick marks - for( U32 t = 0; t <= ( mTicks + 1 ); t++ ) + if (mRenderTicks) { - S32 x = (S32)( F32( mid.x - 1 ) / F32( mTicks + 1 ) * F32( t ) ); - PrimBuild::vertex2i( pos.x + x, pos.y + mid.y - mShiftPoint ); - PrimBuild::vertex2i( pos.x + x, pos.y + mid.y + mShiftPoint ); + for (U32 t = 0; t <= (mTicks + 1); t++) + { + S32 x = (S32)(F32(mid.x - 1) / F32(mTicks + 1) * F32(t)); + PrimBuild::vertex2i(pos.x + x, pos.y + mid.y - mShiftPoint); + PrimBuild::vertex2i(pos.x + x, pos.y + mid.y + mShiftPoint); + } } PrimBuild::end(); } @@ -462,11 +483,14 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect) PrimBuild::vertex2i( pos.x + mid.x, pos.y + mid.y ); // tick marks - for( U32 t = 0; t <= ( mTicks + 1 ); t++ ) + if (mRenderTicks) { - S32 y = (S32)( F32( mid.y - 1 ) / F32( mTicks + 1 ) * F32( t ) ); - PrimBuild::vertex2i( pos.x + mid.x - mShiftPoint, pos.y + y ); - PrimBuild::vertex2i( pos.x + mid.x + mShiftPoint, pos.y + y ); + for (U32 t = 0; t <= (mTicks + 1); t++) + { + S32 y = (S32)(F32(mid.y - 1) / F32(mTicks + 1) * F32(t)); + PrimBuild::vertex2i(pos.x + mid.x - mShiftPoint, pos.y + y); + PrimBuild::vertex2i(pos.x + mid.x + mShiftPoint, pos.y + y); + } } PrimBuild::end(); mDisplayValue = false; diff --git a/Engine/source/gui/controls/guiSliderCtrl.h b/Engine/source/gui/controls/guiSliderCtrl.h index 9a70c512e..a8f8b667c 100644 --- a/Engine/source/gui/controls/guiSliderCtrl.h +++ b/Engine/source/gui/controls/guiSliderCtrl.h @@ -39,6 +39,7 @@ class GuiSliderCtrl : public GuiControl Point2F mRange; U32 mTicks; + bool mRenderTicks; bool mSnap; F32 mValue; RectI mThumb; @@ -51,6 +52,8 @@ class GuiSliderCtrl : public GuiControl bool mMouseOver; bool mMouseDragged; bool mHasTexture; + bool mUseFillBar; + ColorI mFillBarColor; enum { diff --git a/Engine/source/gui/controls/guiTextEditCtrl.cpp b/Engine/source/gui/controls/guiTextEditCtrl.cpp index 65bb331a6..076eddc90 100644 --- a/Engine/source/gui/controls/guiTextEditCtrl.cpp +++ b/Engine/source/gui/controls/guiTextEditCtrl.cpp @@ -1246,7 +1246,7 @@ void GuiTextEditCtrl::onLoseFirstResponder() //execute the validate command if( mValidateCommand.isNotEmpty() ) - evaluate( mValidateCommand ); + evaluate( mValidateCommand.c_str() ); onValidate_callback(); diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp index 9aef352ca..2c9765f09 100644 --- a/Engine/source/gui/editor/popupMenu.cpp +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -286,7 +286,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) Sim::findObject("PopUpMenuControl", backgroundCtrl); GuiControlProfile* profile; - Sim::findObject("GuiMenubarProfile", profile); + Sim::findObject("ToolsGuiMenuBarProfile", profile); if (!profile) return; diff --git a/Engine/source/postFx/postEffect.cpp b/Engine/source/postFx/postEffect.cpp index 2d1285102..3209192d4 100644 --- a/Engine/source/postFx/postEffect.cpp +++ b/Engine/source/postFx/postEffect.cpp @@ -1703,7 +1703,7 @@ void PostEffect::setShaderConst(const String &name, const F32 &val) void PostEffect::setShaderConst(const String& name, const int& val) { - PROFILE_SCOPE(PostEffect_SetShaderConst_Float); + PROFILE_SCOPE(PostEffect_SetShaderConst_Int); EffectConstTable::Iterator iter = mEffectConsts.find(name); if (iter == mEffectConsts.end()) diff --git a/Templates/BaseGame/game/core/Core.cs b/Templates/BaseGame/game/core/Core.cs index 99efdd706..af6f97b8a 100644 --- a/Templates/BaseGame/game/core/Core.cs +++ b/Templates/BaseGame/game/core/Core.cs @@ -27,6 +27,9 @@ function CoreModule::onCreate(%this) ModuleDatabase.LoadExplicit( "Core_GameObjects" ); ModuleDatabase.LoadExplicit( "Core_ClientServer" ); + new Settings(ProjectSettings) { file = "core/settings.xml"; }; + ProjectSettings.read(); + %prefPath = getPrefpath(); if ( isFile( %prefPath @ "/clientPrefs.cs" ) ) exec( %prefPath @ "/clientPrefs.cs" ); diff --git a/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs index c7d357bb8..b34da6d84 100644 --- a/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs +++ b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs @@ -47,18 +47,12 @@ function onActivateAdvancedLM() // Enable the offscreen target so that AL will work // with MSAA back buffers and for HDR rendering. AL_FormatToken.enable(); - - // Activate Deferred Shading - AL_DeferredShading.enable(); } function onDeactivateAdvancedLM() { // Disable the offscreen render target. AL_FormatToken.disable(); - - // Deactivate Deferred Shading - AL_DeferredShading.disable(); } function setAdvancedLighting() diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeP.glsl new file mode 100644 index 000000000..fee0b8783 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeP.glsl @@ -0,0 +1,162 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "farFrustumQuad.glsl" +#include "../../../gl/torque.glsl" +#include "../../../gl/lighting.glsl" +#line 27 + +in vec4 pos; +in vec4 wsEyeDir; +in vec4 ssPos; +in vec4 vsEyeDir; + +uniform sampler2D deferredBuffer; +uniform sampler2D colorBuffer; +uniform sampler2D matInfoBuffer; +uniform samplerCube cubeMap; +uniform samplerCube irradianceCubemap; +uniform sampler2D BRDFTexture; +uniform float cubeMips; + +uniform vec4 rtParams0; + +uniform vec3 probeWSPos; +uniform vec3 probeLSPos; +uniform vec4 vsFarPlane; + +uniform float radius; +uniform vec2 attenuation; + +uniform mat4 worldToObj; +uniform mat4 cameraToWorld; + +uniform vec3 eyePosWorld; +uniform vec3 bbMin; +uniform vec3 bbMax; + +uniform float useSphereMode; + +// Box Projected IBL Lighting +// Based on: http://www.gamedev.net/topic/568829-box-projected-cubemap-environment-mapping/ +// and https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/ +vec3 boxProject(vec3 wsPosition, vec3 reflectDir, vec3 boxWSPos, vec3 boxMin, vec3 boxMax) +{ + vec3 nrdir = reflectDir; + vec3 offset = wsPosition; + vec3 plane1vec = (boxMax - offset) / nrdir; + vec3 plane2vec = (boxMin - offset) / nrdir; + + vec3 furthestPlane = max(plane1vec, plane2vec); + float dist = min(min(furthestPlane.x, furthestPlane.y), furthestPlane.z); + vec3 posonbox = offset + nrdir * dist; + + return posonbox - boxWSPos; +} + +vec3 iblBoxSpecular(vec3 normal, vec3 wsPos, float roughness, vec3 surfToEye, + sampler2D brdfTexture, + samplerCube radianceCube, + vec3 boxPos, + vec3 boxMin, + vec3 boxMax) +{ + float ndotv = clamp(dot(normal, surfToEye), 0.0, 1.0); + + // BRDF + vec2 brdf = textureLod(brdfTexture, vec2(roughness, ndotv),0).xy; + + // Radiance (Specular) + float maxmip = pow(cubeMips+1,2); + float lod = roughness*maxmip; + vec3 r = reflect(surfToEye, normal); + vec3 cubeR = normalize(r); + cubeR = boxProject(wsPos, cubeR, boxPos, boxMin, boxMax); + + vec3 radiance = textureLod(radianceCube, cubeR, lod).xyz * (brdf.x + brdf.y); + + return radiance; +} + +float defineBoxSpaceInfluence(vec3 surfPosWS, vec3 probePos, float radius, float atten) +{ + vec3 surfPosLS = tMul( worldToObj, vec4(surfPosWS,1.0)).xyz; + + vec3 boxMinLS = probePos-(vec3(1,1,1)*radius); + vec3 boxMaxLS = probePos+(vec3(1,1,1)*radius); + + float boxOuterRange = length(boxMaxLS - boxMinLS); + float boxInnerRange = boxOuterRange / atten; + + vec3 localDir = vec3(abs(surfPosLS.x), abs(surfPosLS.y), abs(surfPosLS.z)); + localDir = (localDir - boxInnerRange) / (boxOuterRange - boxInnerRange); + + return max(localDir.x, max(localDir.y, localDir.z)) * -1; +} +out vec4 OUT_col; + +void main() +{ + + // Compute scene UV + vec2 uvScene = getUVFromSSPos( ssPos.xyz/ssPos.w, rtParams0 ); + + //eye ray WS/LS + vec3 vsEyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane ); + vec3 wsEyeRay = tMul(cameraToWorld, vec4(vsEyeRay, 0)).xyz; + + //unpack normal and linear depth + vec4 normDepth = deferredUncondition(deferredBuffer, uvScene); + + //create surface + Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer, + uvScene, eyePosWorld, wsEyeRay, cameraToWorld); + float blendVal = 1.0; + if(useSphereMode>0) + { + vec3 L = probeWSPos - surface.P; + blendVal = 1.0-length(L)/radius; + clip(blendVal); + } + else + { + float tempAttenVal = 3.5; + blendVal = defineBoxSpaceInfluence(surface.P, probeWSPos, radius, tempAttenVal); + clip(blendVal); + float compression = 0.05; + blendVal=(1.0-compression)+blendVal*compression; + } + //render into the bound space defined above + vec3 surfToEye = normalize(surface.P - eyePosWorld); + vec3 irradiance = textureLod(irradianceCubemap, surface.N,0).xyz; + vec3 specular = iblBoxSpecular(surface.N, surface.P, surface.roughness, surfToEye, BRDFTexture, cubeMap, probeWSPos, bbMin, bbMax); + vec3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness); + specular *= F; + //energy conservation + vec3 kD = vec3(1.0) - F; + kD *= 1.0 - surface.metalness; + //final diffuse color + vec3 diffuse = kD * irradiance * surface.baseColor.rgb; + + OUT_col = vec4(diffuse + specular * surface.ao, blendVal); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeV.glsl new file mode 100644 index 000000000..5d48e6613 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/reflectionProbeV.glsl @@ -0,0 +1,32 @@ +#include "shadergen:/autogenConditioners.h" +#include "../../torque.hlsl" + +// This is the shader input +struct Vert +{ + float4 position : POSITION; + float2 uv0 : TEXCOORD0; + float3 wsEyeRay : TEXCOORD1; +}; + +// This is the shader output data. +struct Conn +{ + float4 position : POSITION; + float2 uv0 : TEXCOORD0; + float3 wsEyeRay : TEXCOORD1; +}; + +// Render Target Paramaters +float4 rtParams0; + +Conn main(Vert IN, + uniform float4x4 modelView : register(C0)) +{ + Conn OUT; + OUT.position = IN.position; + OUT.uv0 = viewportCoordToRenderTarget( IN.uv0, rtParams0 ); + OUT.wsEyeRay = IN.wsEyeRay; + return OUT; +} + diff --git a/Templates/BaseGame/game/core/settings.xml b/Templates/BaseGame/game/core/settings.xml new file mode 100644 index 000000000..7e6bf5e0b --- /dev/null +++ b/Templates/BaseGame/game/core/settings.xml @@ -0,0 +1,13 @@ + + + + + core/ + + + + + a + + + diff --git a/Templates/BaseGame/game/data/pbr/levels/PbrMatTest.postfxpreset.cs b/Templates/BaseGame/game/data/pbr/levels/PbrMatTest.postfxpreset.cs new file mode 100644 index 000000000..e9c5e50fc --- /dev/null +++ b/Templates/BaseGame/game/data/pbr/levels/PbrMatTest.postfxpreset.cs @@ -0,0 +1,53 @@ +$PostFXManager::Settings::ColorCorrectionRamp = "core/postFX/images/null_color_ramp.png"; +$PostFXManager::Settings::DOF::BlurCurveFar = "35.2804"; +$PostFXManager::Settings::DOF::BlurCurveNear = "15.3488"; +$PostFXManager::Settings::DOF::BlurMax = "0.897196"; +$PostFXManager::Settings::DOF::BlurMin = "0.261682"; +$PostFXManager::Settings::DOF::EnableAutoFocus = "1"; +$PostFXManager::Settings::DOF::EnableDOF = ""; +$PostFXManager::Settings::DOF::FocusRangeMax = "200.943"; +$PostFXManager::Settings::DOF::FocusRangeMin = "60.7571"; +$PostFXManager::Settings::EnableDOF = "1"; +$PostFXManager::Settings::EnabledSSAO = "1"; +$PostFXManager::Settings::EnableHDR = "1"; +$PostFXManager::Settings::EnableLightRays = "0"; +$PostFXManager::Settings::EnablePostFX = "1"; +$PostFXManager::Settings::EnableSSAO = "1"; +$PostFXManager::Settings::EnableVignette = "1"; +$PostFXManager::Settings::HDR::adaptRate = "2.08"; +$PostFXManager::Settings::HDR::blueShiftColor = "1.05 0.97 1.27"; +$PostFXManager::Settings::HDR::brightPassThreshold = "0.842105"; +$PostFXManager::Settings::HDR::enableBloom = 1; +$PostFXManager::Settings::HDR::enableBlueShift = 0; +$PostFXManager::Settings::HDR::enableToneMapping = "0"; +$PostFXManager::Settings::HDR::gaussMean = "0.378947"; +$PostFXManager::Settings::HDR::gaussMultiplier = "0.0529101"; +$PostFXManager::Settings::HDR::gaussStdDev = "0.380952"; +$PostFXManager::Settings::HDR::keyValue = "0.423469"; +$PostFXManager::Settings::HDR::minLuminace = "0.0204082"; +$PostFXManager::Settings::HDR::whiteCutoff = "0.30102"; +$PostFXManager::Settings::LightRays::brightScalar = 0.75; +$PostFXManager::Settings::LightRays::decay = 1; +$PostFXManager::Settings::LightRays::density = 0.94; +$PostFXManager::Settings::LightRays::numSamples = 40; +$PostFXManager::Settings::LightRays::weight = 5.65; +$PostFXManager::Settings::SSAO::blurDepthTol = 0.001; +$PostFXManager::Settings::SSAO::blurNormalTol = 0.95; +$PostFXManager::Settings::SSAO::lDepthMax = 2; +$PostFXManager::Settings::SSAO::lDepthMin = 0.2; +$PostFXManager::Settings::SSAO::lDepthPow = 0.2; +$PostFXManager::Settings::SSAO::lNormalPow = 2; +$PostFXManager::Settings::SSAO::lNormalTol = -0.5; +$PostFXManager::Settings::SSAO::lRadius = 1; +$PostFXManager::Settings::SSAO::lStrength = 10; +$PostFXManager::Settings::SSAO::overallStrength = 2; +$PostFXManager::Settings::SSAO::quality = "2"; +$PostFXManager::Settings::SSAO::sDepthMax = 1; +$PostFXManager::Settings::SSAO::sDepthMin = 0.1; +$PostFXManager::Settings::SSAO::sDepthPow = 1; +$PostFXManager::Settings::SSAO::sNormalPow = 1; +$PostFXManager::Settings::SSAO::sNormalTol = 0; +$PostFXManager::Settings::SSAO::sRadius = 0.1; +$PostFXManager::Settings::SSAO::sStrength = 6; +$PostFXManager::Settings::Vignette::VMax = 0.85391; +$PostFXManager::Settings::Vignette::VMin = 0.2; diff --git a/Templates/BaseGame/game/data/ui/art/optionsMenuSliderBitmapArray.png b/Templates/BaseGame/game/data/ui/art/optionsMenuSliderBitmapArray.png new file mode 100644 index 000000000..bd41c15b7 Binary files /dev/null and b/Templates/BaseGame/game/data/ui/art/optionsMenuSliderBitmapArray.png differ diff --git a/Templates/BaseGame/game/data/ui/art/slider - Copy.png b/Templates/BaseGame/game/data/ui/art/slider - Copy.png new file mode 100644 index 000000000..92fee1e9c Binary files /dev/null and b/Templates/BaseGame/game/data/ui/art/slider - Copy.png differ diff --git a/Templates/BaseGame/game/data/ui/scripts/guis/graphicsMenuSettingsSlider.taml b/Templates/BaseGame/game/data/ui/scripts/guis/graphicsMenuSettingsSlider.taml index 4bbc1c982..74a428114 100644 --- a/Templates/BaseGame/game/data/ui/scripts/guis/graphicsMenuSettingsSlider.taml +++ b/Templates/BaseGame/game/data/ui/scripts/guis/graphicsMenuSettingsSlider.taml @@ -89,7 +89,9 @@ isContainer="false" internalName="slider" canSave="true" - canSaveDynamicFields="false" /> + canSaveDynamicFields="false" + renderTicks="false" + useFillBar="true" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui index 48f049782..20500af05 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui @@ -323,7 +323,7 @@ minExtent = "64 64"; horizSizing = "relative"; vertSizing = "height"; - profile = "GuiDefaultProfile"; + profile = "ToolsGuiDefaultProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -345,7 +345,7 @@ minExtent = "16 16"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiDefaultProfile"; + profile = "ToolsGuiDefaultProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -414,7 +414,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiDefaultProfile"; + profile = "ToolsGuiDefaultProfile"; visible = "1"; active = "1"; command = "AssetBrowser.showFilterPopup();"; @@ -530,7 +530,7 @@ minExtent = "16 16"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiDefaultProfile"; + profile = "ToolsGuiDefaultProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -657,7 +657,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiDefaultProfile"; + profile = "ToolsGuiDefaultProfile"; visible = "1"; active = "1"; command = "AssetBrowser.toggleTagFilterPopup();"; @@ -798,7 +798,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiDefaultProfile"; + profile = "ToolsGuiDefaultProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui index f337c946f..d7e82723c 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui @@ -85,7 +85,7 @@ minExtent = "8 2"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiScrollProfile"; + profile = "ToolsGuiScrollProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -243,7 +243,7 @@ minExtent = "8 2"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiScrollProfile"; + profile = "ToolsGuiScrollProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -574,7 +574,7 @@ minExtent = "8 2"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiScrollProfile"; + profile = "ToolsGuiScrollProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui index 45d411f20..483fe0d80 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui @@ -66,7 +66,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiScrollProfile"; + profile = "Tools"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui index 90ff639dd..dbe060f62 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui @@ -66,7 +66,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiScrollProfile"; + profile = "ToolsGuiScrollProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui index 09fcb997d..379d6a521 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui @@ -196,7 +196,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiScrollProfile"; + profile = "ToolsGuiScrollProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/main.cs b/Templates/BaseGame/game/tools/assetBrowser/main.cs index c5272e44a..394cd47f6 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/main.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/main.cs @@ -22,6 +22,7 @@ if( !isObject( ToolsGuiDefaultNonModalProfile ) ) new GuiControlProfile (ToolsGuiDefaultNonModalProfile : ToolsGuiDefaultProfile) { + opaque = false; modal = false; }; diff --git a/Templates/BaseGame/game/tools/convexEditor/convexEditorToolbar.ed.gui b/Templates/BaseGame/game/tools/convexEditor/convexEditorToolbar.ed.gui index bd76a265e..2e737c942 100644 --- a/Templates/BaseGame/game/tools/convexEditor/convexEditorToolbar.ed.gui +++ b/Templates/BaseGame/game/tools/convexEditor/convexEditorToolbar.ed.gui @@ -114,7 +114,7 @@ canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "1"; - Profile = "menubarProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "width"; VertSizing = "bottom"; Position = "195 0"; diff --git a/Templates/BaseGame/game/tools/editorClasses/gui/images/rollout.png b/Templates/BaseGame/game/tools/editorClasses/gui/images/rollout.png index 8ce3f635f..39f7caa7e 100644 Binary files a/Templates/BaseGame/game/tools/editorClasses/gui/images/rollout.png and b/Templates/BaseGame/game/tools/editorClasses/gui/images/rollout.png differ diff --git a/Templates/BaseGame/game/tools/editorClasses/gui/panels/navPanelProfiles.ed.cs b/Templates/BaseGame/game/tools/editorClasses/gui/panels/navPanelProfiles.ed.cs index 4f7b12867..2b690ff79 100644 --- a/Templates/BaseGame/game/tools/editorClasses/gui/panels/navPanelProfiles.ed.cs +++ b/Templates/BaseGame/game/tools/editorClasses/gui/panels/navPanelProfiles.ed.cs @@ -28,7 +28,6 @@ singleton GuiControlProfile (NavPanelProfile) category = "Editor"; }; - singleton GuiControlProfile (NavPanel : NavPanelProfile) { bitmap = "./navPanel"; @@ -64,53 +63,3 @@ singleton GuiControlProfile (NavPanelYellow : NavPanelProfile) bitmap = "./navPanel_yellow"; category = "Editor"; }; -singleton GuiControlProfile (menubarProfile : NavPanelProfile) -{ - bitmap = "./menubar"; - category = "Editor"; - - fillColor = "48 48 48"; - fontColor = "215 215 215"; - fontColorHL = "150 150 150"; - borderColor = "34 34 34"; -}; -singleton GuiControlProfile (editorMenubarProfile : NavPanelProfile) -{ - bitmap = "./editor-menubar"; - category = "Editor"; -}; -singleton GuiControlProfile (editorMenu_wBorderProfile : NavPanelProfile) -{ - bitmap = "./menu-fullborder"; - category = "Editor"; -}; -singleton GuiControlProfile (inspectorStyleRolloutProfile : NavPanelProfile) -{ - bitmap = "./inspector-style-rollout"; - category = "Editor"; -}; -singleton GuiControlProfile (inspectorStyleRolloutListProfile : NavPanelProfile) -{ - bitmap = "./inspector-style-rollout-list"; - category = "Editor"; -}; -singleton GuiControlProfile (inspectorStyleRolloutDarkProfile : NavPanelProfile) -{ - bitmap = "./inspector-style-rollout-dark"; - category = "Editor"; -}; -singleton GuiControlProfile (inspectorStyleRolloutInnerProfile : NavPanelProfile) -{ - bitmap = "./inspector-style-rollout_inner"; - category = "Editor"; -}; -singleton GuiControlProfile (inspectorStyleRolloutNoHeaderProfile : NavPanelProfile) -{ - bitmap = "./inspector-style-rollout-noheader"; - category = "Editor"; -}; -singleton GuiControlProfile (IconDropdownProfile : NavPanelProfile) -{ - bitmap = "./icon-dropdownbar"; - category = "Editor"; -}; diff --git a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs index 373739be3..ba15100ee 100644 --- a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs +++ b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs @@ -22,19 +22,31 @@ function ESettingsWindow::startup( %this ) { + new ArrayObject(EditorSettingsPageList); + new ArrayObject(GameSettingsPageList); + + %this.addEditorSettingsPage("Axis", "Axis Gizmo"); + %this.addEditorSettingsPage("General", "General Settings"); + %this.addEditorSettingsPage("Camera", "Camera Settings"); + %this.addEditorSettingsPage("SceneEditor", "Scene Editor"); + %this.addEditorSettingsPage("ShapeEditor", "Shape Editor"); + %this.addEditorSettingsPage("NavEditor", "Navigation Editor"); + %this.addEditorSettingsPage("Theme", "Theme"); + + %this.addGameSettingsPage("GameGeneral", "General"); + %this.addGameSettingsPage("Gameplay", "Gameplay"); + %this.addGameSettingsPage("Paths", "Paths"); + %this.addGameSettingsPage("UI", "UI"); + %this.addGameSettingsPage("LevelDefaults", "Level Defaults"); + %this.addGameSettingsPage("GameOptions", "Game Options"); + %this.addGameSettingsPage("AssetManagement", "Asset Management"); + + %this.mode = "Editor"; } function ESettingsWindow::onWake( %this ) { - new ArrayObject(SettingsPageList); - %this.addSettingsPage("Axis", "Axis Gizmo"); - %this.addSettingsPage("General", "General Settings"); - %this.addSettingsPage("Camera", "Camera Settings"); - %this.addSettingsPage("SceneEditor", "Scene Editor"); - %this.addSettingsPage("ShapeEditor", "Shape Editor"); - %this.addSettingsPage("NavEditor", "Navigation Editor"); - ESettingsWindowList.setSelectedById( 1 ); } function ESettingsWindow::hideDialog( %this ) @@ -47,7 +59,6 @@ function ESettingsWindow::ToggleVisibility() if ( ESettingsWindow.visible ) { ESettingsWindow.setVisible(false); - EditorSettings.write(); } else { @@ -59,19 +70,50 @@ function ESettingsWindow::ToggleVisibility() ESettingsWindowList.setSelectedById( 1 ); } -/*function ESettingsWindow::addTabPage( %this, %page ) +function ESettingsWindow::toggleProjectSettings(%this) { - ESettingsWindowTabBook.add( %page ); - ESettingsWindowList.addRow( ESettingsWindowTabBook.getSelectedPage(), %page.text ); - ESettingsWindowList.sort(0); -}*/ - -function ESettingsWindow::addSettingsPage(%this, %settingsPageName, %settingsPageText) -{ - SettingsPageList.add(%settingsPageName, %settingsPageText); + %this.ToggleVisibility(); - ESettingsWindowList.addRow( SettingsPageList.count(), %settingsPageText ); + %count = GameSettingsPageList.count(); + for(%i=0; %i < %count; %i++) + { + %settingsPageText = GameSettingsPageList.getValue(%i); + ESettingsWindowList.addRow( %i, %settingsPageText ); + } ESettingsWindowList.sort(0); + + ESettingsWindowList.setSelectedById( 1 ); + + %this.mode = "Project"; + ESettingsWindow.text = "Game Project Settings"; +} + +function ESettingsWindow::toggleEditorSettings(%this) +{ + %this.ToggleVisibility(); + + %count = EditorSettingsPageList.count(); + for(%i=0; %i < %count; %i++) + { + %settingsPageText = EditorSettingsPageList.getValue(%i); + ESettingsWindowList.addRow( %i, %settingsPageText ); + } + ESettingsWindowList.sort(0); + + ESettingsWindowList.setSelectedById( 1 ); + + %this.mode = "Editor"; + ESettingsWindow.text = "Editor Settings"; +} + +function ESettingsWindow::addEditorSettingsPage(%this, %settingsPageName, %settingsPageText) +{ + EditorSettingsPageList.add(%settingsPageName, %settingsPageText); +} + +function ESettingsWindow::addGameSettingsPage(%this, %settingsPageName, %settingsPageText) +{ + GameSettingsPageList.add(%settingsPageName, %settingsPageText); } //----------------------------------------------------------------------------- @@ -79,10 +121,49 @@ function ESettingsWindow::addSettingsPage(%this, %settingsPageName, %settingsPag function ESettingsWindowList::onSelect( %this, %id, %text ) { SettingsInspector.clearFields(); - %pageName = SettingsPageList.getKey(SettingsPageList.getIndexFromValue(%text)); + + if(ESettingsWindow.mode $= "Editor") + %pageName = EditorSettingsPageList.getKey(EditorSettingsPageList.getIndexFromValue(%text)); + else + %pageName = GameSettingsPageList.getKey(GameSettingsPageList.getIndexFromValue(%text)); + eval("ESettingsWindow.get" @ %pageName @ "Settings();"); } +//Read/write field functions +function SettingsInspector::addSettingsField(%this, %settingsFieldName, %labelText, %fieldType, %tooltip, %fieldData) +{ + %moddedSettingsFieldName = strreplace(%settingsFieldName, "/", "-"); + + if(ESettingsWindow.mode $= "Editor") + %this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", EditorSettings.value(%settingsFieldName), %fieldData, "changeEditorSetting"); + else + %this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", ProjectSettings.value(%settingsFieldName), %fieldData, "changeEditorSetting"); +} + +function SettingsInspector::changeEditorSetting(%this, %varName, %value) +{ + %varName = strreplace(%varName, "-", "/"); + + echo("Set " @ %varName @ " to be " @ %value); + + if(ESettingsWindow.mode $= "Editor") + EditorSettings.setValue(%varName, %value); + else + ProjectSettings.setValue(%varName, %value); + + //%id = ESettingsWindowList.getSelectedRow(); + //ESettingsWindowList.setSelectedRow(%id); + + if(ESettingsWindow.mode $= "Editor") + %success = EditorSettings.write(); + else + %success = ProjectSettings.write(); +} + +// +// COMMON EDITOR SETTINGS +// function ESettingsWindow::getAxisSettings(%this) { SettingsInspector.startGroup("Gizmo"); @@ -182,21 +263,89 @@ function ESettingsWindow::getShapeEditorSettings(%this) SettingsInspector.endGroup(); } -//Read/write field functions -function SettingsInspector::addSettingsField(%this, %settingsFieldName, %labelText, %fieldType, %tooltip, %fieldData) +function ESettingsWindow::getThemeSettings(%this) { - %moddedSettingsFieldName = strreplace(%settingsFieldName, "/", "-"); - %this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", EditorSettings.value(%settingsFieldName), %fieldData, "changeEditorSetting"); -} + SettingsInspector.startGroup("Colors"); + SettingsInspector.addSettingsField("Theme/headerColor", "Headerbar Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/windowBackgroundColor", "Window Background Color", "ColorI", ""); + + SettingsInspector.addSettingsField("Theme/tabsColor", "Tabs Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/tabsHLColor", "Tabs Highlight Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/tabsSELColor", "Tabs Selected Color", "ColorI", ""); + + SettingsInspector.addSettingsField("Theme/dividerDarkColor", "Divider Dark Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/dividerMidColor", "Divider Mid Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/dividerLightColor", "Divider Light Color", "ColorI", ""); + + SettingsInspector.addSettingsField("Theme/headerTextColor", "Header Text Color", "ColorI", ""); + + SettingsInspector.addSettingsField("Theme/fieldTextColor", "Field Text Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/fieldTextHLColor", "Field Text Highlight Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/fieldTextSELColor", "Field Text Selected Color", "ColorI", ""); + + SettingsInspector.addSettingsField("Theme/fieldBGColor", "Field Background Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/fieldBGHLColor", "Field Background Highlight Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/fieldBGSELColor", "Field Background Selected Color", "ColorI", ""); + + SettingsInspector.addSettingsField("Theme/tooltipBGColor", "Tooltip Background Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/tooltipTextColor", "Tooltip Text Highlight Color", "ColorI", ""); + SettingsInspector.addSettingsField("Theme/tooltipDivColor", "Tooltip Divider Color", "ColorI", ""); + SettingsInspector.endGroup(); +} +// +// COMMON GAME SETTINGS +// +function ESettingsWindow::getGameGeneralSettings(%this) +{ + SettingsInspector.startGroup("General"); + SettingsInspector.addSettingsField("General/ProjectName", "Project Name", "string", ""); + SettingsInspector.endGroup(); +} -function SettingsInspector::changeEditorSetting(%this, %varName, %value) +function ESettingsWindow::getPathsSettings(%this) { - %varName = strreplace(%varName, "-", "/"); + SettingsInspector.startGroup("Paths"); + SettingsInspector.addSettingsField("Paths/splashImagePath", "Splash Image", "filename", ""); + SettingsInspector.addSettingsField("Paths/iconImagePath", "Icon Image", "filename", ""); + SettingsInspector.addSettingsField("Paths/missingTexturePath", "Missing Texture Image", "filename", ""); + SettingsInspector.addSettingsField("Paths/noMaterialPath", "No Material Image", "filename", ""); + SettingsInspector.addSettingsField("Paths/errorMaterialMath", "Error Material Image", "filename", ""); + SettingsInspector.endGroup(); +} + +function ESettingsWindow::getUISettings(%this) +{ + SettingsInspector.startGroup("UI"); + SettingsInspector.addSettingsField("UI/playGUIName", "Play GUI Name", "string", ""); + SettingsInspector.addSettingsField("UI/mainMenuName", "Main Menu GUI Name", "string", ""); + SettingsInspector.endGroup(); +} + +function ESettingsWindow::getAssetManagementSettings(%this) +{ + SettingsInspector.startGroup("Modules"); + SettingsInspector.addSettingsField("AssetManagement/Modules/coreModulePath", "Core Module Path", "string", ""); + SettingsInspector.addSettingsField("AssetManagement/Modules/gameDataModulePath", "Game Data Module Path", "string", ""); + SettingsInspector.addSettingsField("AssetManagement/Modules/moduleExtension", "Module Extension", "string", ""); + SettingsInspector.endGroup(); - echo("Set " @ %varName @ " to be " @ %value); - - EditorSettings.setValue(%varName, %value); - - %id = ESettingsWindowList.getSelectedRow(); - ESettingsWindowList.setSelectedRow(%id); -} \ No newline at end of file + SettingsInspector.startGroup("Assets"); + SettingsInspector.addSettingsField("AssetManagement/Assets/assetExtension", "Asset Extension", "string", ""); + SettingsInspector.addSettingsField("AssetManagement/Assets/datablockCaching", "Cache Datablocks", "bool", ""); + //SettingsInspector.addSettingsField("AssetManagement/Assets/moduleExtension", "Module Extension", "string", ""); + SettingsInspector.endGroup(); +} + +function ESettingsWindow::getGameplaySettings(%this) +{ + SettingsInspector.startGroup("Game Modes"); + SettingsInspector.addSettingsField("Gameplay/GameModes/defaultModeName", "Default Gamemode Name", "string", ""); + SettingsInspector.endGroup(); +} + +function ESettingsWindow::getGameOptionsSettings(%this) +{ + SettingsInspector.startGroup("Game Modes"); + SettingsInspector.addSettingsField("Gameplay/GameModes/defaultModeName", "Default Gamemode Name", "string", ""); + SettingsInspector.endGroup(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/gui/images/button.png b/Templates/BaseGame/game/tools/gui/images/button.png index 1c7361e25..79c3e391b 100644 Binary files a/Templates/BaseGame/game/tools/gui/images/button.png and b/Templates/BaseGame/game/tools/gui/images/button.png differ diff --git a/Templates/BaseGame/game/tools/gui/images/tab.png b/Templates/BaseGame/game/tools/gui/images/tab.png index 76080d74d..b7b7c9871 100644 Binary files a/Templates/BaseGame/game/tools/gui/images/tab.png and b/Templates/BaseGame/game/tools/gui/images/tab.png differ diff --git a/Templates/BaseGame/game/tools/gui/images/window.png b/Templates/BaseGame/game/tools/gui/images/window.png index 4d264bb24..9aff5d276 100644 Binary files a/Templates/BaseGame/game/tools/gui/images/window.png and b/Templates/BaseGame/game/tools/gui/images/window.png differ diff --git a/Templates/BaseGame/game/tools/gui/messageBoxes/messageBoxOKCancelDetailsDlg.ed.gui b/Templates/BaseGame/game/tools/gui/messageBoxes/messageBoxOKCancelDetailsDlg.ed.gui index bf746ea09..c6c95a821 100644 --- a/Templates/BaseGame/game/tools/gui/messageBoxes/messageBoxOKCancelDetailsDlg.ed.gui +++ b/Templates/BaseGame/game/tools/gui/messageBoxes/messageBoxOKCancelDetailsDlg.ed.gui @@ -99,7 +99,7 @@ }; new GuiScrollCtrl(MBOKCancelDetailsScroll) { canSaveDynamicFields = "0"; - Profile = "GuiScrollProfile"; + Profile = "ToolsGuiScrollProfile"; HorizSizing = "right"; VertSizing = "bottom"; position = "8 115"; diff --git a/Templates/BaseGame/game/tools/gui/profiles.ed.cs b/Templates/BaseGame/game/tools/gui/profiles.ed.cs index 16e5f4194..18bbabf42 100644 --- a/Templates/BaseGame/game/tools/gui/profiles.ed.cs +++ b/Templates/BaseGame/game/tools/gui/profiles.ed.cs @@ -37,27 +37,27 @@ new GuiControlProfile (ToolsGuiDefaultProfile) mouseOverSelected = false; // fill color - opaque = false; - fillColor = "50 50 50"; - fillColorHL = "91 101 116"; - fillColorSEL = "91 101 116"; - fillColorNA = "255 0 255 "; + opaque = true; + fillColor = EditorSettings.value("Theme/tabsColor"); + fillColorHL = EditorSettings.value("Theme/tabsGLColor"); + fillColorSEL = EditorSettings.value("Theme/tabsSELColor"); + fillColorNA = EditorSettings.value("Theme/tabsSELColor"); // border color border = 0; - borderColor = "34 34 34"; - borderColorHL = "91 101 116"; - borderColorNA = "32 32 32"; + borderColor = EditorSettings.value("Theme/dividerDarkColor"); + borderColorHL = EditorSettings.value("Theme/dividerMidColor"); + borderColorNA = EditorSettings.value("Theme/dividerLightColor"); // font fontType = "Noto Sans"; fontSize = 14; fontCharset = ANSI; - fontColor = "215 215 215"; - fontColorHL = "215 215 215"; - fontColorNA = "215 215 215"; - fontColorSEL= "255 255 255"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); + fontColorSEL= EditorSettings.value("Theme/fieldTextSELColor"); // bitmap information bitmap = ""; @@ -118,15 +118,15 @@ if( !isObject( ToolsGuiToolTipProfile ) ) new GuiControlProfile (ToolsGuiToolTipProfile) { // fill color - fillColor = "255 255 255"; + fillColor = EditorSettings.value("Theme/tooltipBGColor"); // border color - borderColor = "0 0 0"; + borderColor = EditorSettings.value("Theme/tooltipDivColor"); // font fontType = "Noto Sans"; fontSize = 14; - fontColor = "24 24 24"; + fontColor = EditorSettings.value("Theme/tooltipTextColor"); category = "Tools"; }; @@ -141,7 +141,7 @@ new GuiControlProfile( ToolsGuiModelessDialogProfile ) if( !isObject( ToolsGuiFrameSetProfile ) ) new GuiControlProfile (ToolsGuiFrameSetProfile) { - fillColor = "48 48 48"; + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); borderColor = "246 245 244"; border = 1; opaque = true; @@ -154,11 +154,11 @@ new GuiControlProfile (ToolsGuiWindowProfile) { opaque = false; border = 1; - fillColor = EditorSettings.value("WorldEditor/Theme/windowTitleBGColor"); - fillColorHL = EditorSettings.value("WorldEditor/Theme/windowTitleBGHLColor"); - fillColorNA = EditorSettings.value("WorldEditor/Theme/windowTitleBGNAColor"); - fontColor = EditorSettings.value("WorldEditor/Theme/windowTitleFontColor"); - fontColorHL = EditorSettings.value("WorldEditor/Theme/windowTitleFontHLColor"); + fillColor = EditorSettings.value("Theme/tabsColor"); + fillColorHL = EditorSettings.value("Theme/tabsColor"); + fillColorNA = EditorSettings.value("Theme/tabsColor"); + fontColor = EditorSettings.value("Theme/headerTextColor"); + fontColorHL = EditorSettings.value("Theme/headerTextColor"); bevelColorHL = "255 255 255"; bevelColorLL = "0 0 0"; text = "untitled"; @@ -186,15 +186,16 @@ new GuiControlProfile (ToolsGuiWindowCollapseProfile : ToolsGuiWindowProfile) if( !isObject( ToolsGuiTextProfile ) ) new GuiControlProfile (ToolsGuiTextProfile) { + opaque = true; justify = "left"; - fontColor = "185 185 185"; + fontColor = EditorSettings.value("Theme/headerTextColor"); category = "Tools"; }; if( !isObject( ToolsGuiTextBoldCenterProfile ) ) new GuiControlProfile (ToolsGuiTextBoldCenterProfile : ToolsGuiTextProfile) { - fontColor = "165 165 165"; + fontColor = EditorSettings.value("Theme/headerTextColor"); fontType = "Noto Sans Bold"; fontSize = 16; justify = "center"; @@ -218,7 +219,7 @@ new GuiControlProfile (ToolsGuiTextCenterProfile : ToolsGuiTextProfile) if( !isObject( ToolsGuiInspectorTitleTextProfile ) ) new GuiControlProfile (ToolsGuiInspectorTitleTextProfile) { - fontColor = "100 100 100"; + fontColor = EditorSettings.value("Theme/headerTextColor"); category = "Tools"; }; @@ -245,12 +246,12 @@ new GuiControlProfile( ToolsGuiMLTextProfile ) if( !isObject( ToolsGuiTextArrayProfile ) ) new GuiControlProfile( ToolsGuiTextArrayProfile : ToolsGuiTextProfile ) { - fontColor = "165 165 165"; - fontColorHL = "215 215 215"; - fontColorSEL = "215 215 215"; - fillColor = "200 200 200"; - fillColorHL = "228 228 235"; - fillColorSEL = "200 200 200"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor"); + fillColor = EditorSettings.value("Theme/fieldBGColor"); + fillColorHL = EditorSettings.value("Theme/fieldBGHLColor"); + fillColorSEL = EditorSettings.value("Theme/fieldBGSELColor"); border = false; category = "Tools"; }; @@ -272,11 +273,11 @@ new GuiControlProfile( ToolsGuiTextEditProfile ) border = -2; // fix to display textEdit img //borderWidth = "1"; // fix to display textEdit img //borderColor = "100 100 100"; - fillColor = "42 42 42 0"; - fillColorHL = "91 101 116"; - fontColor = "215 215 215"; - fontColorHL = "115 115 115"; - fontColorSEL = "98 100 137"; + fillColor = EditorSettings.value("Theme/fieldBGColor"); + fillColorHL = EditorSettings.value("Theme/fieldBGHLColor"); + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor"); fontColorNA = "200 200 200"; textOffset = "4 2"; autoSizeWidth = false; @@ -325,9 +326,9 @@ new GuiControlProfile( ToolsGuiButtonProfile ) { opaque = true; border = true; - fontColor = "165 165 165"; - fontColorHL = "215 215 215"; - fontColorNA = "200 200 200"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); fixedExtent = false; justify = "center"; canKeyFocus = false; @@ -348,9 +349,9 @@ new GuiControlProfile( ToolsGuiIconButtonProfile ) { opaque = true; border = true; - fontColor = "165 165 165"; - fontColorHL = "215 215 215"; - fontColorNA = "200 200 200"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); fixedExtent = false; justify = "center"; canKeyFocus = false; @@ -371,10 +372,10 @@ new GuiControlProfile(ToolsGuiEditorTabPage) { opaque = true; border = false; - fillColor = "48 48 48"; - fontColor = "215 215 215"; - fontColorHL = "150 150 150"; - borderColor = "34 34 34"; + fillColor = EditorSettings.value("Theme/tabsColor"); + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + borderColor = EditorSettings.value("Theme/dividerDarkColor"); fixedExtent = false; justify = "left"; canKeyFocus = false; @@ -387,13 +388,13 @@ if( !isObject( ToolsGuiCheckBoxProfile ) ) new GuiControlProfile( ToolsGuiCheckBoxProfile ) { opaque = false; - fillColor = "232 232 232"; + fillColor = EditorSettings.value("Theme/fieldBGColor"); border = false; - borderColor = "100 100 100"; + borderColor = EditorSettings.value("Theme/dividerDarkColor"); fontSize = 14; - fontColor = "185 185 185"; - fontColorHL = "80 80 80"; - fontColorNA = "200 200 200"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); fixedExtent = true; justify = "left"; bitmap = "./images/checkbox"; @@ -417,7 +418,7 @@ new GuiControlProfile( ToolsGuiCheckBoxListFlipedProfile : ToolsGuiCheckBoxProfi if( !isObject( ToolsGuiInspectorCheckBoxTitleProfile ) ) new GuiControlProfile( ToolsGuiInspectorCheckBoxTitleProfile : ToolsGuiCheckBoxProfile ){ - fontColor = "100 100 100"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); category = "Tools"; }; @@ -425,9 +426,9 @@ if( !isObject( ToolsGuiRadioProfile ) ) new GuiControlProfile( ToolsGuiRadioProfile ) { fontSize = 14; - fillColor = "232 232 232"; - fontColor = "185 185 185"; - fontColorHL = "80 80 80"; + fillColor = EditorSettings.value("Theme/fieldBGColor"); + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); fixedExtent = true; bitmap = "./images/radioButton"; hasBitmapArray = true; @@ -438,10 +439,10 @@ if( !isObject( ToolsGuiScrollProfile ) ) new GuiControlProfile( ToolsGuiScrollProfile ) { opaque = true; - fillColor = "48 48 48"; - fontColor = "215 215 215"; - fontColorHL = "150 150 150"; - borderColor = "34 34 34"; + fillColor = EditorSettings.value("Theme/tabsColor"); + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + borderColor = EditorSettings.value("Theme/dividerDarkColor"); border = true; bitmap = "./images/scrollBar"; hasBitmapArray = true; @@ -452,10 +453,9 @@ if( !isObject( ToolsGuiOverlayProfile ) ) new GuiControlProfile( ToolsGuiOverlayProfile ) { opaque = true; - fillColor = "48 48 48"; - fontColor = "215 215 215"; - fontColorHL = "255 255 255"; - fillColor = "0 0 0 100"; + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextGLColor"); category = "Tools"; }; @@ -478,9 +478,9 @@ new GuiControlProfile( ToolsGuiPopupMenuItemBorder : ToolsGuiButtonProfile ) { opaque = true; border = true; - fontColor = "215 215 215"; - fontColorHL = "215 215 215"; - fontColorNA = "255 255 255"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextGLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); fixedExtent = false; justify = "center"; canKeyFocus = false; @@ -500,13 +500,14 @@ new GuiControlProfile( ToolsGuiPopUpMenuDefault : ToolsGuiDefaultProfile ) bitmap = "./images/scrollbar"; hasBitmapArray = true; profileForChildren = ToolsGuiPopupMenuItemBorder; - fillColor = "48 48 48";//"255 255 255";//100 - fillColorHL = "228 228 235 ";//"91 101 116"; - fillColorSEL = "98 100 137 ";//"91 101 116"; + fillColor = EditorSettings.value("Theme/fieldBGColor");//"255 255 255";//100 + fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");//"91 101 116"; + fillColorSEL = EditorSettings.value("Theme/fieldBGSELColor");//"91 101 116"; // font color is black - fontColorHL = "215 215 215 ";//"215 215 215"; - fontColorSEL = "255 255 255";//"215 215 215"; - borderColor = "100 100 100"; + fontColor = EditorSettings.value("Theme/fieldTextColor");//"215 215 215"; + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor");//"215 215 215"; + fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor");//"215 215 215"; + borderColor = EditorSettings.value("Theme/dividerDarkColor"); category = "Tools"; }; @@ -548,11 +549,11 @@ new GuiControlProfile( ToolsGuiPopUpMenuEditProfile : ToolsGuiPopUpMenuDefault ) if( !isObject( ToolsGuiListBoxProfile ) ) new GuiControlProfile( ToolsGuiListBoxProfile ) { - fillColorHL = "100 100 100"; - fillColorNA = "150 150 150"; - fontColor = "215 215 215"; - fontColorHL = "215 215 215"; - fontColorNA = "50 50 50"; + fillColorHL = EditorSettings.value("Theme/windowBackgroundColor"); + fillColorNA = EditorSettings.value("Theme/windowBackgroundColor"); + fontColor = EditorSettings.value("Theme/headerTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); tab = true; canKeyFocus = true; @@ -562,11 +563,11 @@ new GuiControlProfile( ToolsGuiListBoxProfile ) if( !isObject( ToolsGuiTabBookProfile ) ) new GuiControlProfile( ToolsGuiTabBookProfile ) { - fillColorHL = "100 100 100"; - fillColorNA = "150 150 150"; - fontColor = "215 215 215"; - fontColorHL = "215 215 215"; - fontColorNA = "50 50 50"; + fillColorHL = EditorSettings.value("Theme/windowBackgroundColor"); + fillColorNA = EditorSettings.value("Theme/windowBackgroundColor"); + fontColor = EditorSettings.value("Theme/headerTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); fontType = "Noto Sans"; fontSize = 14; justify = "center"; @@ -606,7 +607,7 @@ new GuiControlProfile( ToolsGuiTreeViewProfile ) bitmap = "./images/treeView"; autoSizeHeight = true; canKeyFocus = true; - fillColor = "48 48 48"; + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); fillColorHL = "116 116 116"; fillColorSEL = "91 101 116"; fillColorNA = "40 40 40"; @@ -632,7 +633,7 @@ new GuiControlProfile( ToolsGuiTextPadProfile ) // Deviate from the Default opaque=true; - fillColor = "48 48 48"; + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); border = 0; category = "Tools"; }; @@ -686,7 +687,7 @@ singleton GuiControlProfile( GuiBackFillProfile ) singleton GuiControlProfile( GuiControlListPopupProfile ) { opaque = true; - fillColor = "48 48 48"; + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); fillColorHL = "91 101 116"; border = false; //borderColor = "0 0 0"; @@ -719,10 +720,10 @@ singleton GuiControlProfile( GuiInspectorButtonProfile : ToolsGuiButtonProfile ) singleton GuiControlProfile( GuiInspectorSwatchButtonProfile ) { - borderColor = "100 100 100 255"; - borderColorNA = "200 200 200 255"; - fillColorNA = "255 255 255 0"; - borderColorHL = "0 0 0 255"; + borderColor = EditorSettings.value("Theme/dividerDarkColor"); + borderColorNA = EditorSettings.value("Theme/dividerMidColor"); + fillColorNA = EditorSettings.value("Theme/fieldBGColor"); + borderColorHL = EditorSettings.value("Theme/dividerLightColor"); category = "Editor"; }; @@ -730,8 +731,8 @@ singleton GuiControlProfile( GuiInspectorTextEditProfile ) { // Transparent Background opaque = true; - fillColor = "0 0 0 0"; - fillColorHL = "91 101 116"; + fillColor = EditorSettings.value("Theme/fieldBGColor"); + fillColorHL = EditorSettings.value("Theme/fieldBGHLColor"); // No Border (Rendered by field control) border = false; @@ -743,10 +744,10 @@ singleton GuiControlProfile( GuiInspectorTextEditProfile ) fontType = "Noto Sans"; fontSize = 14; - fontColor = "215 215 215"; - fontColorSEL = "0 140 220"; - fontColorHL = "240 240 240"; - fontColorNA = "100 100 100"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorSEL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextSELColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); category = "Editor"; }; singleton GuiControlProfile( GuiDropdownTextEditProfile : ToolsGuiTextEditProfile ) @@ -765,9 +766,9 @@ singleton GuiControlProfile( GuiInspectorGroupProfile ) fontType = "Noto Sans"; fontSize = "14"; - fontColor = "215 215 215 150"; - fontColorHL = "215 215 215 220"; - fontColorNA = "128 128 128"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); justify = "left"; opaque = false; @@ -783,16 +784,16 @@ singleton GuiControlProfile( GuiInspectorGroupProfile ) singleton GuiControlProfile( GuiInspectorFieldProfile) { // fill color - opaque = false; - fillColor = "48 48 48"; - fillColorHL = "91 101 116"; - fillColorNA = "244 244 244"; + opaque = true; + fillColor = EditorSettings.value("Theme/fieldBGColor"); + fillColorHL = EditorSettings.value("Theme/fieldBGHLColor"); + fillColorNA = EditorSettings.value("Theme/fieldBGSELColor"); // border color border = false; - borderColor = "190 190 190"; - borderColorHL = "156 156 156"; - borderColorNA = "200 200 200"; + borderColor = EditorSettings.value("Theme/dividerDarkColor"); + borderColorHL = EditorSettings.value("Theme/dividerMidColor"); + borderColorNA = EditorSettings.value("Theme/dividerLightColor"); //bevelColorHL = "255 255 255"; //bevelColorLL = "0 0 0"; @@ -801,9 +802,9 @@ singleton GuiControlProfile( GuiInspectorFieldProfile) fontType = "Noto Sans"; fontSize = 14; - fontColor = "240 240 240"; - fontColorHL = "240 240 240"; - fontColorNA = "190 190 190"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); textOffset = "10 0"; tab = true; @@ -822,15 +823,15 @@ singleton GuiControlProfile( GuiInspectorMultiFieldProfile : GuiInspectorFieldPr singleton GuiControlProfile( GuiInspectorMultiFieldDifferentProfile : GuiInspectorFieldProfile ) { border = true; - borderColor = "190 100 100"; + borderColor = EditorSettings.value("Theme/dividerMidColor"); }; singleton GuiControlProfile( GuiInspectorDynamicFieldProfile : GuiInspectorFieldProfile ) { // Transparent Background opaque = true; - fillColor = "0 0 0 0"; - fillColorHL = "91 101 116"; + fillColor = EditorSettings.value("Theme/fieldBGColor"); + fillColorHL = EditorSettings.value("Theme/fieldBGHLColor"); // No Border (Rendered by field control) border = false; @@ -842,21 +843,21 @@ singleton GuiControlProfile( GuiInspectorDynamicFieldProfile : GuiInspectorField fontType = "Noto Sans"; fontSize = 14; - fontColor = "215 215 215"; - fontColorSEL = "0 140 220"; - fontColorHL = "240 240 240"; - fontColorNA = "100 100 100"; + fontColor = EditorSettings.value("Theme/headerTextColor"); + fontColorSEL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextSELColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); category = "Editor"; }; singleton GuiControlProfile( GuiRolloutProfile ) { border = 0; - borderColor = "200 200 200"; + borderColor = EditorSettings.value("Theme/dividerLightColor"); - fontColor = "240 240 240"; - fontColorHL = "240 240 240"; - fontColorNA = "190 190 190"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); hasBitmapArray = true; bitmap = "tools/editorClasses/gui/images/rollout"; @@ -894,12 +895,19 @@ singleton GuiControlProfile( GuiInspectorStackProfile ) opaque = false; border = false; category = "Editor"; + + fillColor = EditorSettings.value("Theme/tabsColor"); + fillColorHL = EditorSettings.value("Theme/tabsHLColor"); + + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); }; singleton GuiControlProfile( GuiInspectorProfile : GuiInspectorFieldProfile ) { opaque = true; - fillColor = "42 42 42 255"; + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); border = 0; cankeyfocus = true; tab = true; @@ -908,7 +916,7 @@ singleton GuiControlProfile( GuiInspectorProfile : GuiInspectorFieldProfile ) singleton GuiControlProfile( GuiInspectorInfoProfile : GuiInspectorFieldProfile ) { opaque = true; - fillColor = "48 48 48"; + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); border = 0; cankeyfocus = true; tab = true; @@ -945,7 +953,7 @@ singleton GuiControlProfile( GuiInspectorTypeFileNameProfile ) fontColorHL = "240 240 240"; fontColorNA = "215 215 215"; - fillColor = "48 48 48"; + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); fillColorHL = "91 101 116"; fillColorNA = "244 244 244"; @@ -987,7 +995,7 @@ singleton GuiControlProfile( InspectorTypeCheckboxProfile : GuiInspectorFieldPro singleton GuiControlProfile( GuiToolboxButtonProfile : ToolsGuiButtonProfile ) { justify = "center"; - fontColor = "215 215 215"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); border = 0; textOffset = "0 0"; category = "Editor"; @@ -995,10 +1003,10 @@ singleton GuiControlProfile( GuiToolboxButtonProfile : ToolsGuiButtonProfile ) singleton GuiControlProfile( GuiDirectoryTreeProfile : ToolsGuiTreeViewProfile ) { - fontColor = "240 240 240"; - fontColorSEL= "250 250 250 175"; - fillColorHL = "0 60 150"; - fontColorNA = "240 240 240"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorSEL= EditorSettings.value("Theme/fieldTextSELColor"); + fillColorHL = EditorSettings.value("Theme/fieldBGColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); fontType = "Noto Sans"; fontSize = 14; category = "Editor"; @@ -1006,10 +1014,10 @@ singleton GuiControlProfile( GuiDirectoryTreeProfile : ToolsGuiTreeViewProfile ) singleton GuiControlProfile( GuiDirectoryFileListProfile ) { - fontColor = "240 240 240"; - fontColorSEL= "250 250 250 175"; - fillColorHL = "0 60 150"; - fontColorNA = "240 240 240"; + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorSEL= EditorSettings.value("Theme/fieldTextSELColor"); + fillColorHL = EditorSettings.value("Theme/fieldBGColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); fontType = "Noto Sans"; fontSize = 14; category = "Editor"; @@ -1035,13 +1043,17 @@ singleton GuiControlProfile( GuiInspectorFieldInfoMLTextProfile : ToolsGuiMLText border = 0; textOffset = "5 0"; category = "Editor"; + + fontColor = EditorSettings.value("Theme/fieldTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor"); }; singleton GuiControlProfile( GuiEditorScrollProfile ) { opaque = true; - fillcolor = GuiInspectorBackgroundProfile.fillColor; - borderColor = ToolsGuiDefaultProfile.borderColor; + fillcolor = EditorSettings.value("Theme/windowBackgroundColor"); + borderColor = EditorSettings.value("Theme/dividerDarkColor"); border = 1; bitmap = "tools/gui/images/scrollBar"; hasBitmapArray = true; @@ -1077,16 +1089,16 @@ singleton GuiControlProfile( GuiCreatorIconButtonProfile ) category = "Editor"; }; -singleton GuiControlProfile( GuiMenuBarProfile ) +singleton GuiControlProfile( ToolsGuiMenuBarProfile ) { - fillColor = "48 48 48"; - fillcolorHL = "42 42 42"; - borderColor = "30 30 30 255"; - borderColorHL = "30 30 30 255"; - fontColor = "215 215 215"; - fontColorSEL = "43 107 206"; - fontColorHL = "244 244 244"; - fontColorNA = "100 100 100"; + fillColor = EditorSettings.value("Theme/headerColor"); + fillcolorHL = EditorSettings.value("Theme/tabsSELColor"); + borderColor = EditorSettings.value("Theme/dividerDarkColor"); + borderColorHL = EditorSettings.value("Theme/dividerMidColor"); + fontColor = EditorSettings.value("Theme/headerTextColor"); + fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + fontColorNA = EditorSettings.value("Theme/fieldTextSELColor"); border = 0; borderThickness = 1; opaque = true; @@ -1094,3 +1106,90 @@ singleton GuiControlProfile( GuiMenuBarProfile ) category = "Editor"; bitmap = "tools/gui/images/checkbox-menubar"; }; + +singleton GuiControlProfile( ToolsMenubarProfile : ToolsGuiDefaultProfile ) +{ + bitmap = "./menubar"; + category = "Editor"; + + fillColor = EditorSettings.value("Theme/headerColor"); + fontColor = EditorSettings.value("Theme/headerTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + borderColor = EditorSettings.value("Theme/dividerDarkColor"); +}; + +singleton GuiControlProfile (menubarProfile) +{ + opaque = false; + border = -2; + category = "Editor"; + + bitmap = "./menubar"; + category = "Editor"; + + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); + fontColor = EditorSettings.value("Theme/headerTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + borderColor = EditorSettings.value("Theme/dividerDarkColor"); +}; + +singleton GuiControlProfile (editorMenubarProfile) +{ + border = -2; + category = "Editor"; + bitmap = "./editor-menubar"; + category = "Editor"; +}; +singleton GuiControlProfile (editorMenu_wBorderProfile) +{ + border = -2; + category = "Editor"; + bitmap = "./menu-fullborder"; + category = "Editor"; +}; +singleton GuiControlProfile (inspectorStyleRolloutProfile) +{ + border = -2; + category = "Editor"; + bitmap = "./inspector-style-rollout"; + category = "Editor"; +}; +singleton GuiControlProfile (inspectorStyleRolloutListProfile) +{ + border = -2; + category = "Editor"; + bitmap = "./inspector-style-rollout-list"; + category = "Editor"; +}; +singleton GuiControlProfile (inspectorStyleRolloutDarkProfile) +{ + border = -2; + category = "Editor"; + bitmap = "./inspector-style-rollout-dark"; + + fillColor = EditorSettings.value("Theme/windowBackgroundColor"); + fontColor = EditorSettings.value("Theme/headerTextColor"); + fontColorHL = EditorSettings.value("Theme/fieldTextHLColor"); + borderColor = EditorSettings.value("Theme/dividerDarkColor"); +}; +singleton GuiControlProfile (inspectorStyleRolloutInnerProfile) +{ + border = -2; + category = "Editor"; + bitmap = "./inspector-style-rollout_inner"; + category = "Editor"; +}; +singleton GuiControlProfile (inspectorStyleRolloutNoHeaderProfile) +{ + border = -2; + category = "Editor"; + bitmap = "./inspector-style-rollout-noheader"; + category = "Editor"; +}; +singleton GuiControlProfile (IconDropdownProfile) +{ + border = -2; + category = "Editor"; + bitmap = "./icon-dropdownbar"; + category = "Editor"; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui b/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui index cc03cbd07..173589e79 100644 --- a/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui +++ b/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui @@ -58,7 +58,7 @@ anchorLeft = "1"; anchorRight = "0"; isContainer = "1"; - profile = "menubarProfile"; + profile = "ToolsMenubarProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "0 0"; @@ -755,7 +755,7 @@ }; new GuiControl(GuiEditorSidebar) { isContainer = "1"; - Profile = "menubarProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "width"; VertSizing = "height"; position = "798 0"; @@ -1503,7 +1503,7 @@ canSave = "1"; visible = "1"; isContainer = "1"; - profile = "menubarProfile"; + profile = "ToolsMenubarProfile"; new GuiTextCtrl( GuiEditorStatusBar ) { profile = "ToolsGuiTextProfile"; diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs index 83317d0d8..aa0c4686f 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs @@ -72,7 +72,7 @@ function GuiEditCanvas::onCreateMenu(%this) extent = "1024 20"; minExtent = "320 20"; horizSizing = "width"; - profile = "GuiMenuBarProfile"; + profile = "ToolsGuiMenuBarProfile"; new PopupMenu() { diff --git a/Templates/BaseGame/game/tools/navEditor/NavEditorSettingsTab.gui b/Templates/BaseGame/game/tools/navEditor/NavEditorSettingsTab.gui index 8611ca3d1..2c3f6d22b 100644 --- a/Templates/BaseGame/game/tools/navEditor/NavEditorSettingsTab.gui +++ b/Templates/BaseGame/game/tools/navEditor/NavEditorSettingsTab.gui @@ -43,7 +43,7 @@ minExtent = "8 2"; horizSizing = "width"; vertSizing = "height"; - profile = "GuiScrollProfile"; + profile = "ToolsGuiScrollProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index be6fd5412..42ff2e063 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -1,7 +1,145 @@ - - Grid_512_Orange + + 72 70 68 255 + 234 232 230 255 + 100 98 96 255 + 96 94 92 255 + 59 58 57 255 + 50 49 48 255 + 72 70 68 255 + 50 49 48 255 + 240 240 240 255 + 59 58 57 255 + 236 234 232 255 + 50 49 48 255 + 37 36 35 255 + 178 175 172 255 + 43 43 43 255 + 17 16 15 255 + 255 255 255 255 + 32 31 30 255 + + + tools/gui + 1024 768 + + http://www.garagegames.com/products/torque-3d/documentation/user + ../../../Documentation/Torque 3D - Script Manual.chm + ../../../Documentation/Official Documentation.html + + + 1 + 2 + 8 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + + + 0 + 0 + 0 + + + Categorized + + + 0 + + + + 0 + 1 + 0.8 + 100 + 0.8 + 15 + 0 + + 0 + 0 + 0 + 500 + 10 10 10 + 255 255 255 20 + + + + 0 + 50 + AssetWork_Debug.exe + 40 + screenCenter + 6 + 1 + WorldEditorInspectorPlugin + + 255 255 0 255 + 255 0 0 255 + 255 255 255 255 + 255 255 0 255 + 0 0 255 255 + 0 255 0 255 + 100 100 100 255 + + + 1 + 100 + 0 + 0 + 0 + 1 + 2 + + + 1 + 0 + 255 + 20 + 8 + + + 50 50 50 255 + 215 215 215 255 + 48 48 48 255 + 255 255 255 255 + 180 180 180 255 + + + tools/worldEditor/images/DefaultHandle + tools/worldEditor/images/SelectHandle + tools/worldEditor/images/LockedHandle + + + 1 + 1 + 1 + 1 + 1 + + + 51 51 51 100 + 0 + 255 255 255 100 + 1 + 102 102 102 100 + + + ../../../Documentation/Official Documentation.html + ../../../Documentation/Torque 3D - Script Manual.chm + http://www.garagegames.com/products/torque-3d/documentation/user + http://www.garagegames.com/products/torque-3d/forums + + + + AIPlayer data/FPSGameplay/levels @@ -14,125 +152,7 @@ - - screenCenter - 0 - WorldEditorInspectorPlugin - 1 - 40 - AssetWork_Debug.exe - 6 - 50 - - 255 255 255 255 - 100 100 100 255 - 255 255 0 255 - 255 255 0 255 - 0 0 255 255 - 255 0 0 255 - 0 255 0 255 - - - 48 48 48 255 - 255 255 255 255 - 215 215 215 255 - 180 180 180 255 - 50 50 50 255 - - - 100 - 0 - 0 - 0 - 1 - 2 - 1 - - - 51 51 51 100 - 102 102 102 100 - 1 - 255 255 255 100 - 0 - - - tools/worldEditor/images/DefaultHandle - tools/worldEditor/images/SelectHandle - tools/worldEditor/images/LockedHandle - - - http://www.garagegames.com/products/torque-3d/forums - ../../../Documentation/Official Documentation.html - ../../../Documentation/Torque 3D - Script Manual.chm - http://www.garagegames.com/products/torque-3d/documentation/user - - - 1 - 0 - 255 - 20 - 8 - - - 1 - 1 - 1 - 1 - 1 - - - - 0.8 - 100 - 0.8 - 15 - 0 - 0 - 1 - - 0 - 255 255 255 20 - 0 - 10 10 10 - 0 - 500 - - - - tools/gui - 1024 768 - - 0 - 0 - 0 - - - http://www.garagegames.com/products/torque-3d/documentation/user - ../../../Documentation/Torque 3D - Script Manual.chm - ../../../Documentation/Official Documentation.html - - - 1 - 1 - 8 - 1 - 1 - 2 - 1 - 0 - - - 0 - - - 1 - 1 - - - Categorized - - - - AIPlayer + + Grid_512_Orange diff --git a/Templates/BaseGame/game/tools/shapeEditor/gui/ShapeEditorToolbar.ed.gui b/Templates/BaseGame/game/tools/shapeEditor/gui/ShapeEditorToolbar.ed.gui index 0435e3837..ccaaf03fb 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/gui/ShapeEditorToolbar.ed.gui +++ b/Templates/BaseGame/game/tools/shapeEditor/gui/ShapeEditorToolbar.ed.gui @@ -25,7 +25,7 @@ canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "1"; - Profile = "menubarProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "width"; VertSizing = "bottom"; Position = "0 0"; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui index f860bdd42..33433fa68 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/EditorGui.ed.gui @@ -23,7 +23,7 @@ canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "1"; - Profile = "menubarProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "width"; VertSizing = "bottom"; Position = "0 0"; @@ -313,7 +313,7 @@ canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "1"; - Profile = "menubarProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "width"; VertSizing = "top"; Position = "0 578"; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/ToolsToolbar.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/ToolsToolbar.ed.gui index f57c39be7..1f15e5310 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/ToolsToolbar.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/ToolsToolbar.ed.gui @@ -4,7 +4,7 @@ Enabled = "0"; internalName = "ToolsToolbar"; isContainer = "1"; - Profile = "editorMenubarProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "right"; VertSizing = "bottom"; Position = "0 31"; @@ -20,7 +20,7 @@ canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "1"; - Profile = "ToolsGuiDefaultProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "width"; VertSizing = "bottom"; position = "4 3"; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui index 79f34211d..95e48baaf 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui @@ -4,7 +4,7 @@ internalName = "WorldEditorToolbar"; Enabled = "1"; isContainer = "1"; - Profile = "ToolsGuiDefaultProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "right"; VertSizing = "bottom"; Position = "306 0"; @@ -21,7 +21,7 @@ canSaveDynamicFields = "0"; Enabled = "1"; isContainer = "1"; - Profile = "ToolsGuiDefaultProfile"; + Profile = "ToolsMenubarProfile"; HorizSizing = "width"; VertSizing = "bottom"; Position = "0 3"; @@ -83,7 +83,7 @@ new GuiControl(SnapToBar){ isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; + profile = "ToolsMenubarProfile"; Position = "116 3"; Extent = "123 27"; Padding = "4"; @@ -296,7 +296,7 @@ new GuiControl(ToggleButtonBar){ isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; + profile = "ToolsMenubarProfile"; Position = "313 3"; Extent = "65 27"; @@ -377,7 +377,7 @@ new GuiControl(ToggleNodeBar){ isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; + profile = "ToolsMenubarProfile"; Position = "386 3"; Extent = "63 27"; @@ -441,7 +441,7 @@ new GuiControl(PrefabBar){ isContainer = "1"; - profile = "ToolsGuiDefaultProfile"; + profile = "ToolsMenubarProfile"; Position = "386 3"; Extent = "63 27"; visible = true; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui index cae52e378..92966857f 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui @@ -274,6 +274,7 @@ canSave = "1"; Visible = "1"; tooltipprofile = "ToolsGuiToolTipProfile"; + profile = "ToolsGuiScrollProfile"; hovertime = "1000"; Docking = "Client"; Margin = "0 0 0 0"; diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/guiWorldEditorCreatorWindow.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/guiWorldEditorCreatorWindow.ed.gui index 03a3d6d8a..31652d293 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/guiWorldEditorCreatorWindow.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/guiWorldEditorCreatorWindow.ed.gui @@ -79,6 +79,7 @@ canSave = "1"; Visible = "1"; tooltipprofile = "ToolsGuiToolTipProfile"; + profile = "ToolsGuiScrollProfile"; hovertime = "1000"; Docking = "Client"; Margin = "0 0 0 0"; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs index 574063460..1b2e5de3d 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/lightViz.cs @@ -51,13 +51,11 @@ function toggleColorBufferViz( %enable ) } else if ( %enable ) { - AL_DeferredShading.disable(); AL_ColorBufferVisualize.enable(); } else if ( !%enable ) { AL_ColorBufferVisualize.disable(); - AL_DeferredShading.enable(); } } @@ -360,12 +358,7 @@ function toggleBackbufferViz( %enable ) if ( %enable $= "" ) { $AL_BackbufferVisualizeVar = AL_DeferredShading.isEnabled() ? true : false; - AL_DeferredShading.toggle(); } - else if ( %enable ) - AL_DeferredShading.disable(); - else if ( !%enable ) - AL_DeferredShading.enable(); } function toggleColorBlindnessViz( %enable ) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs index 7f87df251..43bb65ea4 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs @@ -116,7 +116,7 @@ function EditorGui::buildMenus(%this) extent = Canvas.extent.x SPC "20"; minExtent = "320 20"; horizSizing = "width"; - profile = "GuiMenuBarProfile"; + profile = "ToolsGuiMenuBarProfile"; }; // File Menu @@ -185,11 +185,12 @@ function EditorGui::buildMenus(%this) Item[9] = "Select..." TAB "" TAB "EditorGui.toggleObjectSelectionsWindow();"; item[10] = "-"; item[11] = "Audio Parameters..." TAB "" TAB "EditorGui.toggleSFXParametersWindow();"; - item[12] = "Editor Settings..." TAB "" TAB "ESettingsWindow.ToggleVisibility();"; - item[13] = "Snap Options..." TAB "" TAB "ESnapOptions.ToggleVisibility();"; - item[14] = "-"; - item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);"; - item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);"; + item[12] = "Editor Settings..." TAB "" TAB "ESettingsWindow.toggleEditorSettings();"; + item[13] = "Game Settings..." TAB "" TAB "ESettingsWindow.toggleProjectSettings();"; + item[14] = "Snap Options..." TAB "" TAB "ESnapOptions.ToggleVisibility();"; + item[15] = "-"; + item[16] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);"; + item[17] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);"; }; %this.menuBar.insert(%editMenu); diff --git a/Templates/Modules/AI_Guard/AI_Guard.cs b/Templates/Modules/AI_Guard/AI_Guard.cs new file mode 100644 index 000000000..abbf83314 --- /dev/null +++ b/Templates/Modules/AI_Guard/AI_Guard.cs @@ -0,0 +1,16 @@ +function AI_Guard::onCreate(%this) +{ + exec("./Scripts/aiPlayer.cs"); + exec("./Scripts/guardTrigger.cs"); + + if(isObject(DatablockFilesList)) + { + DatablockFilesList.add( "data/AI_Guard/Datablocks/aiPlayerDatablocks.cs" ); + DatablockFilesList.add( "data/AI_Guard/Datablocks/aiPlayerMarker.cs" ); + } +} + +function AI_Guard::onDestroy(%this) +{ +} + diff --git a/Templates/Modules/AI_Guard/AI_Guard.module b/Templates/Modules/AI_Guard/AI_Guard.module new file mode 100644 index 000000000..dab279ed2 --- /dev/null +++ b/Templates/Modules/AI_Guard/AI_Guard.module @@ -0,0 +1,15 @@ + + + diff --git a/Templates/Modules/AI_Guard/Datablocks/aiPlayerDatablocks.cs b/Templates/Modules/AI_Guard/Datablocks/aiPlayerDatablocks.cs new file mode 100644 index 000000000..d998140db --- /dev/null +++ b/Templates/Modules/AI_Guard/Datablocks/aiPlayerDatablocks.cs @@ -0,0 +1,53 @@ +// aiPlayerDatablocks.cs +// breaks out the datablocks for aiguard.cs to make them easier to edit. +// also manages the trigger controller + +////////////////////////////////////// +// +// TRIGGER CONTROLLER +// This code handles the placing and behavior of aiSoldierTriggers +///////////////////////////////////////// + +datablock TriggerData(guardTrigger) +{ + tickPeriodMS = 100; +}; + +//////////////////////////////////////// +//This is the default datablock for the Guard. +//I changed the stock datablock name from those used in AIPLAYER.CS +//I did this to allow me to create different classes of bots with their own +//thinking and reaction routines for each class. +/////////////////////////////////// +// +//You can specifiy as many datablocks as you have characters. +//The first variable after PlayerData must be a unique name. The second variable (after the semicolon) +//must be a valid body type. + +datablock PlayerData(DemoPlayer : DefaultPlayerData) +{ + maxDamage = 100; + + maxForwardSpeed = 14; + maxBackwardSpeed = 13; + maxSideSpeed = 13; + + //The art used by this datablock + shapeFile = "data/Soldier/Shapes/soldier_Rigged.DAE";//"art/shapes/actors/Soldier/soldier_rigged.DAE"; + + //Set the bot's inventory so it can use different weapons + maxInv[Rifle] = 1; + maxInv[BulletAmmo] = 1000; + maxInv[RocketLauncher] = 1; + maxInv[RocketLauncherAmmo] = 1000; + maxInv[GrenadeLauncher] = 1; + maxInv[GrenadeLauncherAmmo] = 1000; + + maxInvRifle = "1"; + maxInvBulletAmmo = "1000"; + maxInvGrenadeLauncher = "1"; + maxInvGrenadeLauncherAmmo = "1000"; + maxInvRocketLauncher = "1"; + maxInvRocketLauncherAmmo = "1000"; +}; + diff --git a/Templates/Modules/AI_Guard/Datablocks/aiPlayerMarker.cs b/Templates/Modules/AI_Guard/Datablocks/aiPlayerMarker.cs new file mode 100644 index 000000000..71014097b --- /dev/null +++ b/Templates/Modules/AI_Guard/Datablocks/aiPlayerMarker.cs @@ -0,0 +1,16 @@ +//The AIPlayer marker is placed in the map during edit mode. When the map is loaded the +//marker is replaced by a guard player. (Assuming that the $AI_GUARD_ENABLED variable is set +//to true.) The marker is hidden or not depending on the value set in $AI_GUARD_MARKER_HIDE. +//The AIPlayer marker can use a dynamic variable - set during map creation - called 'respawn' +//Creating and setting the 'respawn' variable will override the default value set in +//$AI_GUARD_DEFAULTRESPAWN. This allows more freedom in determining which bots respawn and which do not. + +datablock StaticShapeData(AIPlayerMarker) +{ + // Mission editor category, this datablock will show up in the + // specified category under the "shapes" root category. + category = "AIMarker"; + + // Basic Item properties + shapeFile = "data/Soldier/Shapes/soldier_Rigged.DAE";//"art/shapes/actors/Soldier/soldier_rigged.DAE"; +}; \ No newline at end of file diff --git a/Templates/Modules/AI_Guard/Scripts/aiPlayer.cs b/Templates/Modules/AI_Guard/Scripts/aiPlayer.cs new file mode 100644 index 000000000..1a9adad3a --- /dev/null +++ b/Templates/Modules/AI_Guard/Scripts/aiPlayer.cs @@ -0,0 +1,1639 @@ +//The aiPlayer.cs file creates a guard-style bot that can also be pathed. +//The guard uses a simple state machine to control it's actions. + +//The bots actions are as follows: +//Dead: The bot stops all activity and is dead. +//Guarding: When guarding the bot scans for new targets, and when one is found it switches to 'Attacking' +//Attacking: The guard tries to close with the target while firing and checking for target updates. +//Holding: When the bot loses a target it will go into a holding pattern. While holding the bot's FOV +// is enhanced. The bot holds for a set number of cycles before changing it's action state to +// 'Returning' +//Returning: The bot tries to return to it's original position. While returning the guard looks for new targets +// and checks it motion relattive to it's last movement to determine if it is stuck. +// If it is stuck the bot tries to move is a random direction to try and clear the obstacle. +// (Not always a foolproof solution, but in a simple environment it works well enough.) +//Defending: When a bot takes damage it's status is set to defending. The bot sidesteps and then +// goes into a holding pattern. This does two things. It enhances the bots FOV and it scans for +// targets. Plus it will have the bot return to it's original position if there is no +// perceivable threat in range. +//NoTarget This is set when the bot loses sight or perception of it's targets. This is used to help +// clear the bots aim and other housekeeping functions + +//The following are global variables used to set the guards basic settings. +$AI_GUARD_ENABLED = true; //Whether Guard bots are loaded during mission loading. +$AI_GUARD_MARKER_HIDE = true; //Turns marker hiding on or off - useful when editing maps. +$AI_GUARD_WEAPON = "Lurker"; //Which weapon do you want the guard to use +$AI_GUARD_ENDLESS_AMMO = true; //When set to true the guard will replenish its ammo perpetually +$AI_GUARD_WEAPON_USES_AMMO = true; //Set this to false for energy weapons that do not use ammo +$AI_GUARD_SIDESTEP = 20; //This value helps determine how far a bot sidesteps when he is stuck. + //The computer picks a random number between 1 and $AI_GUARD_SIDESTEP + //The value is then subtracted by half it's value to create a left/right + //and forward/back component. So the effective range is really -10 to +10 + //with the default setting of 20 +$AI_GUARD_DETECT_ITEM_RANGE = 50; //Sets how far around itself a bot will look for items to pick up +$AI_GUARD_HOLDCNT_MAX = 10; //The number of think cycles that the bot will 'hold' for before trying to + //return to his post. +$AI_GUARD_FIREDELAY = 1000; //How long the bot waits between firing bursts. +$AI_GUARD_ENHANCED_FOV_TIME = 2000; //How long the bots field of vision is enhanced to 360 for. +$AI_GUARD_FOV = 200; //The guards field of vision +$AI_GUARD_ENHANCED_DEFENDING_TIME = 5000; //How long the bot gets a 360 FOV and a longer detect distance for after being sniped. +$AI_GUARD_ENHANCED_DEFENDING_DISTANCE = 100; //Detect distance after being sniped. +$AI_GUARD_DETECT_DISTANCE = 50; //The range at which a guardbot will start reacting to a client target +$AI_GUARD_IGNORE_DISTANCE = 40; //The range at which the bot ignores a client and will not fire on it. +$AI_GUARD_MAX_DISTANCE = 5; //The bot will stop and try to stay at this distance or less from the player. +$AI_GUARD_RANGED_MAX_DISTANCE = 15; //Bots flagged as ranged will stop and try to stay at this distance or less from the player. +$AI_GUARD_MAX_PACE = 12; //The maximum range the mobs pace away from their guard point. (works like AI_GUARD_SIDESTEP) +$AI_GUARD_MIN_PACE = 1.5; //The minimum range the mobs pace away from their guard point. +$AI_GUARD_PACE_SPEED = 0.5; //Set the speed of the mob while pacing (1.0 is 100%, 0.5 is 50%) +$AI_GUARD_PACE_TIME = 4; //Sets how many think cycles the bot has to travel to it's location (or stand at + //it's location if it's already there) before getting another one to move to, random between 1 and this number. +$AI_GUARD_LOS_TIME = 100; //The amount of time after the bot loses sight of player that it will get their position. + //This helps the bot turn sharp corners. Set it to 1 or 0 if you don't want the bot to cheat. +$AI_GUARD_LOS_BYPASS = 3; //The distance at which positions will not have line of sight tests done on them. + //This is needed because the bot can not see the area around its feet. +$AI_GUARD_CORNERING = 0.8; //How close the bot will attempt to take corners. If the bot is having problems with corners, + //adjust this value, $AI_GUARD_LOS_TIME and $AI_GUARD_LOS_BYPASS as needed (will vary based on run speed). +$AI_GUARD_SCANTIME = 500; //The quickest time between think cycles. +$AI_GUARD_MAX_ATTENTION = 10; //This number and $AI_GUARD_SCANTIME are multiplied to set the delay in the + //thinking loop. Used to free up processor time on bots out of the mix. +$AI_GUARD_CREATION_DELAY = 3000; //How long a bot waits after creation before his think cycles are controlled by + //his attention rate. (Used to help free up think cycles on bots while misison + //finishes loading. +$AI_GUARD_TRIGGER_DOWN = 100; //How long the bot holds down the trigger when firing. Use longer pulses for + //pray and spray type weapons. +$AI_GUARD_DEFAULTRESPAWN = true; //Controls whether guards respawn automatically or not if their marker does not have + //dynamic 'respawn' variable set in it. +$AI_GUARD_RESPAWN_DELAY = 18000; //Determines how long a bot goes in between death and respawning. +$AI_GUARD_ENHANCEFOV_CHANCE = 25; //There is a 1 in x chance that guard will see 360 deg vision to prevent it + //from being snuck up on. +$AI_GUARD_SEEK_HEALTH_LVL = 65; //This sets at what damage level a bot will attempt to look for a health pack nearby. +$AI_GUARD_CHAR_TYPE = DemoPlayer; //This is the default datablock that is spawned as the bot unless another is specified on the node + +//The onReachDestination function is responsible for setting the bots 'action' +//state to the appropriate setting depending on what action the bot was following +//to reach the destination. +function DemoPlayer::onReachDestination(%this, %obj) +{ + //Picks an appropriate set of actions based on the bots 'action' variable + switch$(%obj.action) + { + //If the bot is attacking when it reaches it's target it will go into a hold. + case "Attacking": + %obj.action="Holding"; + //If the bot is returning it has two possible scenarios for reaching a destination + //The first case is the the bot sidestepped and has reached it's sidestep location. + //If that is the case, then the bot goes into a quick hold. (Which sets the bot to + //only hold for 1 cycle before returning to his post.) + //The other alternative is that the bot has returned as is back at it's original position. + //If this is the case, then the bot's transform is set to match that of it's marker's + //transformation. + //This will cause a snapping into position - but it ensures that your guard always faces the + //direction you want it to when it returns to it's post. + //(It also helps to make sure that your markers are set as close to the ground as possible. + //Otherwise your bots will hop up and drop from the sky when they return to post.) + case "Returning": + //If the bot is pathed have it move to the next node on its path + if (%obj.path !$= "") + { + //Check if the bot's guarding + if (%obj.doesGuard $= "guard") + { + if (%obj.returningPos == %obj.marker.getposition()) + { + %obj.moveToNextNode(%this.returningPath); + } + else + { + %obj.path = ""; + %obj.doesGuard = ""; + } + } + else + %obj.moveToNextNode(%this.returningPath); + } + else + { + if (%obj.doesGuard $= "guard") + %basedist = vectorDist(%obj.getposition(), %obj.marker.getposition()); + else + %basedist = vectorDist(%obj.getposition(), %obj.returningPos); + //if the bot is close to his original position then set it's action to + //Guarding and set it to it's original facing and position. + if(%basedist < 1.0) + { + %obj.action = "Guarding"; + //Set the bots returning position to its marker if it's guarding + if (%obj.doesGuard $= "guard") + %obj.settransform(%obj.marker.gettransform()); + else + %obj.settransform(%obj.returningTrans); + %obj.clearaim(); + } + //if the bot is away from his post, then he must have gotten here + //as a result of sidestepping so set him to do a quick hold to scan + //for targets then return to post. + else + { + //Sets holdcnt to 1 less than the max. Ensures that the bot only holds for 1 cycle. + //before trying to return. + %obj.holdcnt=$AI_GUARD_HOLDCNT_MAX-1; + %obj.action="Holding"; + } + } + //The bot was defending and sidestepped. So set him to 'hold' to check for targets + //and to prepare to return to post if no targets are found. + case "Defending": + %obj.action = "Holding"; + + case "RetrievingItem": + %obj.holdcnt=$AI_GUARD_HOLDCNT_MAX-1; + %obj.action="Holding"; + } +} + +//The OnDamage function sets the bots action to 'Dead' and starts the respawn process +//if called for. +function DemoPlayer::OnDamage(%this, %obj, %delta) +{ + if (%obj.action !$="GetHealth") + { + if (%obj.action !$= "Attacking" && %obj.action !$= "Defending" && %obj.getstate() !$="Dead") + { + %obj.enhancedefending(%obj); + } + %obj.action = "Defending"; + } + + if(%obj.getstate() $="Dead") + %obj.action="Dead"; + + if(%obj.getState() $= "Dead" && %obj.respawn == true) + { + //%obj.delaybeforerespawn(%obj.botname, %obj.marker); + %this.player = 0; + } +} + +//The delay before respawn function is set to wait a specified duration before +//respawning an AIPlayer +function AIPlayer::DelayBeforeRespawn(%this, %name, %marker) +{ + %this.respawntrigger = %this.schedule($AI_GUARD_RESPAWN_DELAY,"spawn", %name, %marker); +} + +//The LoadEntities function replaces the markers placed in the map with the AI bots during the +//mission loading. +function AIPlayer::LoadEntities() +{ + //Check to see if the AIPlayers are to be loaded. + if ($AI_GUARD_ENABLED == true) + { + echo("Loading Guard entities..."); + //This performs a search for all items within the radius from the starting point. + //All of the items that match "AIPlayerMarker" trigger a bot to be placed at the + //position of the marker found. + %position = "0 0 0"; + %radius = 100000.0; + InitContainerRadiusSearch(%position, %radius, $TypeMasks::StaticObjectType); + %i=0; + while ((%targetObject = containerSearchNext()) != 0) + { + if(%targetobject.getclassname() $= "StaticShape") + { + if (%targetobject.getDataBlock().getName() $= "AIPlayerMarker") + { + %i++; + + // Let's check to see if the marker specifies a datablock. + // if so, we spawn that datablock model instead of the default + if (%targetObject.block $= "") + { + %block = $AI_GUARD_CHAR_TYPE; + } + else + { + %block = %targetObject.block; + } + %player = AIPlayer::spawnAtMarker("Guard" @ %i, %targetobject, %block); + } + } + } + } + else + { + echo("Guard entities disabled..."); + } + + //This determines whether to hide or not hide the markers during mission loading. + //It's helpful to have the markers visible when editing the map and fine tuning the bot + //placement. + //This search is identical to the one above, only it hides the markers if found. + if ($AI_GUARD_MARKER_HIDE == true) + { + echo("Hiding Guard markers..."); + %position = "0 0 0"; + %radius = 100000.0; + InitContainerRadiusSearch(%position, %radius, $TypeMasks::StaticObjectType); + while ((%targetObject = containerSearchNext()) != 0) + { + if(%targetobject.getclassname() $= "StaticShape") + { + if (%targetobject.getDataBlock().getName() $= "AIPlayerMarker") + %targetobject.setAllMeshesHidden(true); + } + } + } +} + +function AIPlayer::spawnByGroup(%spawnGroup) +{ + echo ("spawning group " @ %spawnGroup); + + //echo("Loading soldiers!"); + + //This performs a search for all items within the radius from the starting point. + //All of the items that match "AIPlayerMarker" trigger a bot to be placed at the + //position of the marker found. + + %position = "0 0 0"; + %radius = 100000.0; + InitContainerRadiusSearch(%position, %radius, $TypeMasks::StaticObjectType); + %i=0; + while ((%targetObject = containerSearchNext()) != 0) + { + if(%targetobject.getclassname() $= "StaticShape") + { + if (%targetobject.getDataBlock().getName() $= "AIPlayerMarker") + { + %i++; + echo("target's spawn is " @ %targetObject.spawnGroup); + if (%targetObject.spawnGroup $= %spawnGroup) + { + // we're in the correct spawn group! + + // Let's check to see if the marker specifies a datablock. + // if so, we spawn that datablock model instead of the default + if (%targetObject.block $= "") + { + %block = $AI_GUARD_CHAR_TYPE; + } + else + { + %block = %targetObject.block; + } + + // let's spawn some bad guys! + %player = AIPlayer::spawnAtMarker("Guard" @ %i, %targetobject, %block); + } + } + } + } + //This determines whether to hide or not hide the markers during mission loading. + //It's helpful to have the markers visible when editing the map and fine tuning the bot + //placement. + //This search is identical to the one above, only it hides the markers if found. + if ($AI_GUARD_MARKER_HIDE == true) + { + echo("Hiding Guard markers..."); + %position = "0 0 0"; + %radius = 100000.0; + InitContainerRadiusSearch(%position, %radius, $TypeMasks::StaticObjectType); + while ((%targetObject = containerSearchNext()) != 0) + { + if(%targetobject.getclassname() $= "StaticShape") + { + if (%targetobject.getDataBlock().getName() $= "AIPlayerMarker") + { + if (%targetObject.spawnGroup $= %spawnGroup) + %targetobject.setAllMeshesHidden(true); + } + } + } + } +} + +//This function sets the bots aim to the current target, and 'pulls' the trigger +//of the weapon of the bot to begin the firing sequence. +function AIPlayer::openfire(%this, %obj, %tgt) +{ + //If the bot is dead or the target is dead then let's bail out of here. + if (%obj.getState() $= "Dead" || %tgt.player.getstate() $="Dead") + { + %obj.firing = false; + %obj.NoTarget(); + } + else + { + //We've got two live ones. So let's kill something. + //The firing variable is set while firing and is cleared at the end of the delay cycle. + //This is done to allow the use of a firing delay - and prevent a bot from firing again + //prematurely. + if(!%obj.firing) + { + //Gets the range to target - rtt + %rtt=vectorDist(%obj.getposition(), %tgt.player.getposition()); + + //If the target is within our ignore distance then we will attack. + if(%rtt < $AI_GUARD_IGNORE_DISTANCE) + { + if(%obj.fireLater <= 0 && %obj.getAimLocation() != %tgt.player.getposition()) //Fix for premature firing + { + %obj.fireLater++; + return; + } + //Sets the firing variable to true + %obj.firing = true; + + if($AI_GUARD_WEAPON_USES_AMMO) + { + if($AI_GUARD_ENDLESS_AMMO == true) + { + %obj.incinventory(%obj.botWeapon @"Ammo",100); + } + } + + //'Pulls' the trigger on the bot gun. + %obj.setImageTrigger(0,true); + //This sets a delay of $AI_GUARD_TRIGGER_DOWN length to hold the trigger down for. + %this.trigger = %this.schedule($AI_GUARD_TRIGGER_DOWN,"ceasefire", %obj); + } + else + { + //There was a target when openfire was called, but now they're out of range so + //we have no target. Call NoTarget to clear the bots aim. + %obj.NoTarget(%obj); + } + } + } +} + +//This simply clears the bots aim to have it look forward relative to it's movement. +function AIPlayer::NoTarget(%this, %obj) +{ + %obj.clearaim(); +} + +//Ceasefire is called by the openfire function after the set delay to +//hold the trigger down is met. +function AIPlayer::ceasefire(%this, %obj) +{ + //Turns off the trigger, or lets off of it. + %obj.setImageTrigger(0,false); + //This sets the delay between when we let off the trigger and how soon it will + //be before we allow the bot to fire again. + %this.ceasefiretrigger = %this.schedule($AI_GUARD_FIREDELAY,"delayfire", %obj); +} + +//delayfire is called to clear the firing variable. Clearing this allows +//the bot to fire again in the openfire function. +function AIPlayer::delayfire(%this, %obj) +{ + //this is the end of the firing cycle + %obj.firing = false; +} + + +//----------------------------------------------------------------------------- +// AIPlayer static functions +//----------------------------------------------------------------------------- + +//This is the spawn function for the bot. +function AIPlayer::spawn(%this, %name, %obj, %block) +{ + if (%obj.block $= "") + { + %block = $AI_GUARD_CHAR_TYPE; + } + else + { + %block = %obj.block; + } + + // Create the demo player object + %player = new AIPlayer() { + dataBlock = %block; + + //The marker is the AIPlayer marker object that the guard is associated with. + //The marker object is kept with the player data because it's location, and + //dynamic variable values are used in several functions. This also allows the addition + //of future dynamic variables without having to change the spawn/respawn functions to + //access them. + marker = %obj; + botname = %name; + //Sets the bot's field of vision + fov = $AI_GUARD_FOV; + //Sets the bot's detect distance + detdis = $AI_GUARD_DETECT_DISTANCE; + //Sets the bot's returning position and transform + returningPos = %obj.getposition(); + returningTrans = %obj.gettransform(); + //Sets the bot not to return to a path as soon as it is loaded + //The pathed bots will go to there paths at another point + returningPath = 0; + //Fix for premature firing + fireLater = 0; + //Sets the bot's pacing + pace = $AI_GUARD_PACE_TIME; + //The pathname variable is a dynamic variable set during map editing. + //This allows the designer to attach each bot to a seperate path + path = %obj.pathname; + //Is the bot using a ranged weapon + weapRange = %obj.range; + //Does the bot return to its spawn point + doesGuard = %obj.doesReturn; + //Sets whether the bot is AI or not + isbot=true; + //Thinking variables + //Firing tells whether or not we're in the midst of a firing sequence. + firing = false; + //The 'action' variable holds the state of the bot - which controls how it + //thinks. + holdcnt = $AI_GUARD_HOLDCNT_MAX-1; + action = "Holding"; + //The bots starting attention level is set to half of it's range. + attentionlevel = $AI_GUARD_MAX_ATTENTION/2; + + //Oldpos holds the position of the bot at the end of it's last 'think' cycle + //This is used to help determine if a bot is stuck or not. + oldpos = %obj.getposition(); + //Added for bots use different weapons + botWeapon = $AI_GUARD_WEAPON; + }; + + MissionCleanup.add(%player); + + // if the field is not blank, set the weapon variable to the weapon + // otherwise, use default. + if (%obj.Weapon !$= "") + { + %player.botWeapon = %obj.Weapon; + } + + //Sets the name displayed in the hud above the bot. Commented out be default. + //%player.setShapeName(%name); + //is called to set the bots beginning inventory. + %player.EquipBot(%player); + //Sets the bot's initial position to that of it's marker. + %player.setTransform(%obj.gettransform()); + + //The following cluster of if-thens sets whether the bot will respawn or not + //based on it's markers dynamic variable - or the default respawn variable setting. + if (%obj.respawn $= "" ) + { + %player.respawn=$AI_GUARD_DEFAULTRESPAWN; + } + else + { + if (%obj.respawn == true) + %player.respawn=true; + else + %player.respawn=false; + } + + if (%obj.pathname !$= "") + { + %player.schedule($AI_GUARD_CREATION_DELAY,"followPath", %obj.pathname, -1); + } + + //Sets the bot to begin thinking after waiting the length of $AI_GUARD_CREATION_DELAY + %player.schedule($AI_GUARD_CREATION_DELAY,"Think", %player); + + return %player; +} + +//This sets the bots beginning equipment and inventory +function AIPlayer::EquipBot(%this, %obj) +{ + echo("equipingBot"); + //This adds a weapon to the bots inventory. + %obj.incinventory(%obj.botWeapon,1); + //This mounts the weapon on the bot. + %obj.mountImage(%obj.botWeapon @ "Image",0); + echo(%obj.botWeapon); + %obj.use(%obj.botWeapon); + if($AI_GUARD_WEAPON_USES_AMMO == true) + { + //This sets the bots beginning inventory of ammo. + %obj.setInventory(%obj.botWeapon @ "Ammo",100); + } +} + +//The EnhanceFOV function temporarily gives the bot a 360 degree field of vision +//This is used to emulate the bot looking around at different times. Namely when +//'Holding'. +function AIPlayer::EnhanceFOV(%this, %obj) +{ + //Is the botFOV already 360 degrees? If not then we'll set it, and set the schedule to + //turn it back off. + if (%obj.fov != 360) + { + //Sets the field of vision to 360 deg. + %obj.fov = 360; + //Starts the timer to disable the enhanced FOV + %this.fovtrigger = %this.schedule($AI_GUARD_ENHANCED_FOV_TIME, "restorefov", %obj); +} +} + +//Restore FOV sets the bot's FOV back to it's regular default setting. +function AIPlayer::restoreFOV(%this, %obj) +{ + %obj.fov = $AI_GUARD_FOV; +} + +//Enhances the defending mob's FOV and detect distance after being hit. +function AIPlayer::EnhanceDefending(%this, %obj) +{ + if (%obj.detdis == $AI_GUARD_DETECT_DISTANCE) + { + %obj.detdis = $AI_GUARD_ENHANCED_DEFENDING_DISTANCE; + %this.distancetrigger = %this.schedule($AI_GUARD_ENHANCED_DEFENDING_TIME, "restoreDefending", %obj); + } + + %obj.fov = 360; + %this.fovtrigger = %this.schedule($AI_GUARD_ENHANCED_DEFENDING_TIME, "restorefov", %obj); +} + +//Restores the defending mob's detect distance. +function AIPlayer::restoreDefending(%this, %obj) +{ + %obj.detdis = $AI_GUARD_DETECT_DISTANCE; +} + +//Spawn at marker is called by LoadEntities, and calls the spawn function to +//create the bots and place them at their starting positions. +function AIPlayer::spawnAtMarker(%name, %obj, %block) +{ + if (!isObject(%obj)) + return; + %player = AIPlayer::spawn(%this, %name, %obj, %block); + return %player; +} + +//AITargeting + +//Return the angle of a vector in relation to world origin +function AIPlayer::getAngleofVector(%this, %vec) +{ + %vector = VectorNormalize(%vec); + %vecx = getWord(%vector,0); + %vecy = getWord(%vector,1); + if(%vecx >= 0 && %vecy >= 0) + %quad = 1; + else + if(%vecx >= 0 && %vecy < 0) + %quad = 2; + else + if(%vecx < 0 && %vecy < 0) + %quad = 3; + else + %quad = 4; + %angle = mATan(%vecy/%vecx, -1); + %degangle = mRadToDeg(%angle); + switch(%quad) + { + case 1: + %angle = %degangle-90; + case 2: + %angle = %degangle+270; + case 3: + %angle = %degangle+90; + case 4: + %angle = %degangle+450; + } + if (%angle < 0) %angle = %angle + 360; + return %angle; +} + +//This is another function taken from code off of garagegames. +//The only mods I made to it was to add the extra check to ensure that the +//angle is within the 0-360 range. +function AIPlayer::check2DAngletoItem(%this, %obj, %item) +{ + %eyeVec = VectorNormalize(%this.getEyeVector()); + %eyeangle = %this.getAngleofVector(%eyeVec); + %posVec = VectorSub(%item.getPosition(), %obj.getPosition()); + %posangle = %this.getAngleofVector(%posVec); + %angle = %posangle - %eyeAngle; + %angle = %angle ? %angle : %angle * -1; + if (%angle < 0) %angle = %angle + 360; + return %angle; +} + +//This is another function taken from code off of garagegames. +//The only mods I made to it was to add the extra check to ensure that the +//angle is within the 0-360 range. +function AIPlayer::check2DAngletoTarget(%this, %obj, %tgt) +{ + %eyeVec = VectorNormalize(%this.getEyeVector()); + %eyeangle = %this.getAngleofVector(%eyeVec); + %posVec = VectorSub(%tgt.player.getPosition(), %obj.getPosition()); + %posangle = %this.getAngleofVector(%posVec); + %angle = %posangle - %eyeAngle; + %angle = %angle ? %angle : %angle * -1; + if (%angle < 0) %angle = %angle + 360; + return %angle; +} + +//The 'Think' function is the brains of the bot. +//The bot performs certain actions based on what it's current 'action' state is. +//The bot thinks on a scheduled basis. How fast the bot 'thinks' is determined by +//the bots attention level and its default scan time. (There are a few cases in the think +//function below where the schedule is shortened - but only to make the 'thinking' more +//realistic and to cut down on duplicating chunks of code. + +function AIPlayer::Think(%this, %obj) +{ + //This cancels the current schedule - just to make sure that things are kept neat and tidy. + cancel(%this.ailoop); + + //If the bot is dead, then there's no need to think or do anything. So let's bail out. + if (!%obj || %obj.getstate() $="Dead") + return; + + %prevaction=%obj.action; + + if (%obj.action !$="RetrievingItem" && %obj.action !$="Dead") + { + if (%obj.getdamagelevel() > $AI_GUARD_SEEK_HEALTH_LVL) + { + %this.enhancefov(%obj); + %hlth= %this.getclosestiteminsightandrange(%obj, "HealthPatch"); + + if(%hlth > 0) + { + %obj.action="GetHealth"; + } + + if($AI_GUARD_WEAPON_USES_AMMO == true) + { + if(%obj.getInventory(%obj.botWeapon @ "Ammo") == 0) + { + %this.enhancefov(%obj); + %ammostr = %obj.botWeapon @ "Ammo"; + %i_ammo= %this.getclosestiteminsightandrange(%obj, %ammostr ); + if(%i_ammo > 0) + { + %obj.action="GetAmmo"; + } + } + } + } + + //The switch$ takes the value of the bots action variable and then chooses what code to run + //according to what value it is. + switch$(%obj.action) + { + //The bot is 'dead' so lets clear his aim, and turn off his firing variable. + case "Dead": + %obj.clearaim(); + %obj.firing = false; + + //This is the bots default position. While guarding the bot will only do 2 things. + //The first is that the bot will run a random check to see if it can enhance it's fov. + //This is thrown in to prevent bots from having a perpetual blind spot, but still limits + //their field of vision for the majority of the time. + //The other thing the bot does is to check for nearby targets. If found the bot goes into attack mode. + case "Guarding": + //The bot will enhance it's FOV if it picks a 1 from a range of 1 to $AI_GUARD_ENHANCEFOV_CHANCE + %chance = getRandom(($AI_GUARD_ENHANCEFOV_CHANCE-1)) +1; + if (%chance == 1 ) + %this.enhancefov(%obj); + + %obj.fireLater = 0; + %obj.lostest = 0; + + //The bot checks for the nearest valid target if any. + %tgtid = %this.GetClosestHumanInSightandRange(%obj); + //If %tgtid >= 0 then a target is in sight and range. + if(%tgtid >= 0) + { + //Set the bots action to 'Attacking' and set it to attack quickly. + %obj.action = "Attacking"; + //This is one instance where the bots thinking is sped up to enable the bot + //to react more quickly as seems appropriate. + %this.ailoop=%this.schedule(100,"Think" , %obj); + } + else + { + //Check if the bot's pathed and if not, pace if it's time to pace + if (%obj.path $= "") + { + if(%obj.pace == 0) + { + %obj.pace = getRandom(($AI_GUARD_PACE_TIME-1)) +1; + %this.pacing(%obj); + } + else + { + %obj.pace--; + } + } + //There are no targets so continue guarding and call the scheduler to have the bot think + //at it's regular interval + %this.ailoop=%this.schedule($AI_GUARD_SCANTIME * %obj.attentionlevel ,"Think" , %obj); + } + + //The bot has been told that there is a target in sight and range and is set to attack it. + //While attacking the bot's attention level is kept at it's lowest value (Quickest thinking) + //The bot looks for the nearest target in sight. If the target is found the bot will aim at the + //target, set it's move destination to the position of the target, and then openfire on the target. + case "Attacking": + //Set the bot's move speed back to normal + %obj.setMoveSpeed(1.0); + //Maintain a low attention value to keep the bot thinking quickly while attacking. + %obj.attentionlevel=1; + //Get the id of the nearest valid target + %tgtid = %this.GetClosestHumanInSightandRange(%obj); + //If %tgtid>0 then there is a valid target + if(%tgtid >=0) + { + //Make sure that we keep ourself in attack mode since we have a target in sight. + %obj.action = "Attacking"; + //Get the current player object from the client value set in %tgtid + %tgt = ClientGroup.getobject(%tgtid); + //Set the bot to aim at the target. + //(The code uses the VectorAdd to adjust the aim of the bot to correct for the + //bot trying to shoot at the targets feet.) + %obj.setAimObject(%tgt.player, "0 0 1"); + + %dest = %tgt.player.getposition(); + + %basedist = vectorDist(%obj.getposition(), %dest); + + //Check if the bot is flagged as using a ranged weapon, then check if the bot is already close + //enough to the target or needs to be closer + if (%obj.weapRange $= "ranged") + { + if(%basedist > $AI_GUARD_RANGED_MAX_DISTANCE) + { + %this.moveDestinationA = %dest; + %this.dontMoveAlongTheWall(%obj); + } + } + //Check if the bot is already close enough to the target or needs to be closer + else + { + if(%basedist > $AI_GUARD_MAX_DISTANCE) + { + %this.moveDestinationA = %dest; + %this.dontMoveAlongTheWall(%obj); + } + } + //Tells the bot to start shooting the target. + %obj.openfire(%obj, %tgt); + //Tells the scheduler to have us think again + %this.ailoop=%this.schedule($AI_GUARD_SCANTIME * %obj.attentionlevel ,"Think" , %obj); + } + else + { + //There was no target found, so set our action to NoTarget. + %obj.action="NoTarget"; + //Again this sets the scheduler to have us think quickly to have the bot + //react to the loss of it's attack target + %this.ailoop=%this.schedule(100 ,"Think" , %obj); + } + + //When a bot loses it's target, or when the bot reaches it's destination as the result of + //a sidestep the bot will go into a 'hold' + //During a hold the bot will have enhanced FOV (to emulate scanning around for targets.) + //The bot will look for targets in range and attack if found. + //If no target is found the bot will increase it's holdcnt by 1. When the bot reaches it's + //maximum holdcnt value it will attempt to return to it's base position. + case "Holding": + //Set the bot's move speed back to normal + %obj.setMoveSpeed(1.0); + //Enhance the bot's FOV + %this.enhancefov(%obj); + //Checks for targets - (See the above code for full details of this section of code) + %tgtid = %this.GetClosestHumanInSightandRange(%obj); + if(%tgtid >=0) + { + %obj.holdcnt=0; + %obj.action = "Attacking"; + %this.ailoop=%this.schedule(100,"Think" , %obj); + } + else + { + //There was no target found, so we need to have the bot continue to 'hold' + //for a little bit before doing anything else. + + //Increase the holdcnt variable by one + %obj.holdcnt++; + %obj.fireLater = 0; + + %basedist = vectorDist(%this.getposition(), %this.moveDestinationA); + if (%basedist > 0.5) + %this.dontMoveAlongTheWall(%obj); + + //Check to see if we've passed our threshold of waiting + if (%obj.holdcnt > $AI_GUARD_HOLDCNT_MAX) + { + //Set holdcnt back to 0 for the next time we need it. + %obj.holdcnt=0; + + //Set the bot to return to where it last saw the player if it's not pathed + if (%obj.path $= "") + { + //Reset returning positions for guard bots + if (%obj.doesGuard $= "guard") + { + %obj.returningPos = %obj.marker.getposition(); + %obj.returningTrans = %obj.marker.gettransform(); + } + + %this.moveDestinationA = %obj.returningPos; + %this.dontMoveAlongTheWall(%obj); + } + //Set the bot to return to its path since it is pathed + else + { + if (%obj.returningPath != 0) + { + if (%obj.doesGuard $= "guard") + { + %this.moveDestinationA = %obj.returningPos; + %this.dontMoveAlongTheWall(%obj); + } + else + { + %this.movtrigg = %this.schedule(100, "followPath", %obj.path, -1); + } + } + else + { + %obj.returningPath = 1; + } + } + + //Set the bot action to 'Returning' + %obj.action="Returning"; + //Sets the bots oldpos to that of the position it's returning to + //This is done this way due to the fact that we've been holding + //and our position hasn't been changing. So we want to be sure that + //our bot doesn't think that it's stuck as soon as it tries to return. + %obj.oldpos = %obj.returningPos; + //We've waited long enough, so let's quickthink and go into 'Return' mode + %this.ailoop=%this.schedule(100, "Think" , %obj); + } + else + { + //Start the bot moving to its return point while it's still in holding mode + %this.moveDestinationA = %obj.returningPos; + %this.dontMoveAlongTheWall(%obj); + + %obj.clearaim(); + %this.ailoop=%this.schedule($AI_GUARD_SCANTIME * %obj.attentionlevel ,"Think" , %obj); + } + } + + //In Return mode the bot will do the following. + //It looks for the nearest target in sight and will attack it. + //It does not check for people sneaking up behind it, nor does it enhance it's FOV. + //If a target is found the bot will attack. + //If no target is found, the bot is still in the process of returning so we check to see + //if the bot is stuck. Stuck in the case means that the bot hase moved a distance of less than + //1 unit since the last time it thought. + //If the bot is stuck, sidestep is called to have the bot try to move a different direction + //The bot is then set to go into 'Holding' but with it's holdcnt set to 1 less than it's maximum. + //This essentially means that the bot will sidestep, and go into hold for one cycle in which to check + //targets and then try to return again if there is nothing to attack. + //If the bot is not stuck and there are no targets, then the bots aim is set to point towards it's + //destination of it's spawn point. (This is done to prevent the bot from pointing to the position + //of it's last sidestep while returning.) + case "Returning": + //Set the bot's move speed back to normal + %obj.setMoveSpeed(1.0); + //The next line can be commented out if desired. I chose to put it in so that the + //bots would try to return in a timely manner rather than having them wait too long + //between thinks to see if they were stuck. + %obj.attentionlevel=$AI_GUARD_MAX_ATTENTION/2; + + //The next few lines again have the bot check for a target and attack if need be. + %tgtid = %this.GetClosestHumanInSightandRange(%obj); + if(%tgtid >=0) + { + %obj.action = "Attacking"; + %this.ailoop=%this.schedule(100,"Think" , %obj); + } + else + { + //There was no target so we're still returning. So now check for a pathed or stuck bot + //This gets a value depicting the distance from the bots last known move point + %movedist=vectorDist(%obj.getposition(), %obj.oldpos); + //If the bot hasn't moved more than 1 unit we're probably stuck. + //Remember - this is only checked for while returning - not guarding + if (%movedist <1.0) + { + //Set our holdcnt to 1 less than the maximum so we only hold for 1 cycle + %obj.holdcnt=$AI_GUARD_HOLDCNT_MAX-1; + //Call sidestep to pick a new move destination near the bot + %this.sidestep(%obj); + } + else + { + //Check to make sure the bot is not pathed + if (%obj.path $= "") + { + //We're returning and we're not stuck. So make sure we're looking the direction we're running. + //Check if the bot is guarding + if (%obj.doesGuard $= "guard") + { + %obj.setAimLocation(%obj.marker.getposition()); + } + else + { + %obj.setAimLocation(%obj.returningPos); + } + } + } + } + //Set our oldpos to match our current position so that next time we cycle through + //we'll know if we're going anywhere or not + %obj.oldpos = %obj.getposition(); + //Scedhule ourselves to think at our regular interval + %this.ailoop = %this.schedule($AI_GUARD_SCANTIME * %obj.attentionlevel, "Think", %obj); + + //When a bot takes damage his state is set to defending. + //A bot that is defending will have it's attention set to it's lowest level + //It will sidestep to try to avoid the danger, and to throw some randomness into it's + //movement. The bot will then go into a quick hold of 1 count. + case "Defending": + //Set the bot's move speed back to normal + %obj.setMoveSpeed(1.0); + //Set the hldcnt to 1 less than the max + %obj.holdcnt=$AI_GUARD_HOLDCNT_MAX-1; + //Set the bot to it's highest awareness + %obj.attentionlevel=1; + //Sidestep to a random position + %this.sidestep(%obj); + //Set our action to 'Holding' + %obj.action="Holding"; + //Set a quick think schedule to start us looking for targets quickly. + %this.ailoop=%this.schedule(100 ,"Think" , %obj); + + //NoTarget is set when a bot loses it's target while attacking. + //It causes a bot's firing variable to be reset, sets the holdcnt to 0 + //so that when we go into a hold we will do so for the full duration + case "NoTarget": + //Clear the firing variable + %obj.firing = false; + //Clear holdcnt + %obj.holdcnt=0; + //Set our action to 'Holding' + %obj.action = "Holding"; + //Quick think to start us looking for our lost target. + %this.ailoop=%this.schedule(100 ,"Think" , %obj); + + case "GetHealth": + %hlth= %this.getclosestiteminsightandrange(%obj, "HealthPatch"); + if(%hlth > 0) + { + %obj.action="RetrievingItem"; + %dest=%hlth.getposition(); + %obj.setmovedestination(%dest); + %this.enhancefov(%obj); + } + else + { + %obj.action=%prevaction; + } + %this.ailoop=%this.schedule(100 ,"Think" , %obj); + + case "GetAmmo": + %ammostr = %obj.botWeapon @"Ammo"; + %i_ammo= %this.getclosestiteminsightandrange(%obj, %ammostr ); + if(%i_ammo > 0) + { + %obj.action="RetrievingItem"; + %dest=%i_ammo.getposition(); + %obj.setmovedestination(%dest); + %this.enhancefov(%obj); + } + else + { + %obj.action=%prevaction; + } + + %this.ailoop=%this.schedule(100 ,"Think" , %obj); + + case "RetrievingItem": + %obj.setMoveSpeed(1.0); + %obj.attentionlevel=$AI_GUARD_MAX_ATTENTION/2; + %tgtid = %this.GetClosestHumanInSightandRange(%obj); + if(%tgtid >=0) + { + %obj.action = "RetrievingItem"; + %obj.attentionlevel=1; + %tgtid = %this.GetClosestHumanInSightandRange(%obj); + if(%tgtid >=0) + { + %tgt = ClientGroup.getobject(%tgtid); + %obj.setAimObject(%tgt.player, "0 0 1"); + %obj.openfire(%obj, %tgt); + } + else + { + %obj.firing = false; + } + } + else + { + %movedist=vectorDist(%obj.getposition(), %obj.oldpos); + if (%movedist <1.0) + { + %obj.holdcnt=$AI_GUARD_HOLDCNT_MAX-1; + + %this.sidestep(%obj); + } + else + { + %obj.setaimlocation(%obj.getmovedestination()); + } + } + %obj.oldpos=%obj.getposition(); + %this.ailoop=%this.schedule($AI_GUARD_SCANTIME * %obj.attentionlevel ,"Think" , %obj); + + default: + %obj.action="Holding"; + %this.ailoop=%this.schedule(100 ,"Think" , %obj); + } + } + //If you want to see the bots thinking processes in action then uncomment the + //line below. It will then set the hud above the bot to show it's current + //action/attention level/damage/ammo + //(Used during testing, but kind of fun to watch when you have + //several bots on the map at a time to see how things are working out.) + + //%objname= %obj.action @ ":"@ %this.attentionlevel @ ":" @ %obj.getdamagelevel() @ ":" @ %obj.getInventory(%obj.botWeapon @ "Ammo") ; + //%obj.setshapename(%objname); + + //Clear aim if attention hits max. + if (%this.attentionlevel == $AI_GUARD_MAX_ATTENTION) + %obj.clearaim(); +} + +//Causes AIPlayer to slowly pace around their current location +function AIPlayer::Pacing(%this, %obj) +{ + //%xrand and %yrand are set to be a random number that is equal to -1/2$AI_GUARD_MAX_PACE and +1/2$AI_GUARD_MAX_PACE + %xrand = getRandom(1,$AI_GUARD_MAX_PACE)-$AI_GUARD_MAX_PACE/2; + %yrand = getRandom(1,$AI_GUARD_MAX_PACE)-$AI_GUARD_MAX_PACE/2; + + while(%xrand > -$AI_GUARD_MIN_PACE && %xrand < $AI_GUARD_MIN_PACE) + { + %xrand = getRandom(1,$AI_GUARD_MAX_PACE)-$AI_GUARD_MAX_PACE/2; + } + while(%yrand > -$AI_GUARD_MIN_PACE && %yrand < $AI_GUARD_MIN_PACE) + { + %yrand = getRandom(1,$AI_GUARD_MAX_PACE)-$AI_GUARD_MAX_PACE/2; + } + + //%newloc is first set to the bots current position + %newLoc = %obj.getTransform(); + + //Set the bots returning position to its marker if it's guarding + if (%obj.doesGuard $= "guard") + %obj.returningPos = %obj.marker.getposition(); + + //If the is away from its returning position, go back to it so it doesn't wander too far away + %basedist = vectorDist(%obj.getposition(), %obj.returningPos); + if(%basedist > $AI_GUARD_MIN_PACE) + { + %newLoc = %obj.returningTrans; + } + else + { + //Word(0) of %newloc (which is the x value) is set to equal it's original value plus the value + //of %xrand. The -/+ aspect of this equivalates to a left/right direction. + %newLoc = setWord(%newLoc, 0, (getWord(%newLoc, 0) + (%xrand))); + //Word(1) of %newloc (which is the y value) is set to equal it's original value plus the value + //of %yrand. The -/+ aspect of this equivalates to a forward/back direction. + %newLoc = setWord(%newLoc, 1, (getWord(%newLoc, 1) + (%yrand))); + + %basedist = vectorDist(%obj.getposition(), %newLoc); + //If the target location is very close, don't preform a line of sight test + if(%basedist > $AI_GUARD_LOS_BYPASS) + { + //Line of sight test for the position the bot wants to pace to + %eyeTrans = %obj.getEyeTransform(); + %eyeEnd = %newLoc; + %searchResult = containerRayCast(%eyeTrans, %eyeEnd, $TypeMasks::PlayerObjectType | $TypeMasks::StaticTSObjectType | + $TypeMasks::TerrainObjectType | $TypeMasks::ItemObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType, %obj); + %foundObject = getword(%searchResult,0); + + if (%foundObject > 0) + { + %this.pacing(%obj); + return; + } + } + } + //Set the bot to move at a different speed than normal while pacing + %obj.setMoveSpeed($AI_GUARD_PACE_SPEED); + //Set the bot to look in the direction that it is moving. + %obj.setaimlocation(%newLoc); + //Set the bot to move towards the new position. + %obj.setMoveDestination(%newLoc); +} + +//Sidestep is used to find a random spot near the bot and attempt to have them move towards it. +function AIPlayer::SideStep(%this, %obj) +{ + //%xrand and %yrand are set to be a random number that is equal to -1/2$AI_GUARD_SIDESTEP and +1/2$AI_GUARD_SIDESTEP + %xrand = getRandom(1,$AI_GUARD_SIDESTEP)-$AI_GUARD_SIDESTEP/2; + %yrand = getRandom(1,$AI_GUARD_SIDESTEP)-$AI_GUARD_SIDESTEP/2; + //%newloc is first set to the bots current position + %newLoc = %obj.getTransform(); + //Word(0) of %newloc (which is the x value) is set to equal it's original value plus the value + //of %xrand. The -/+ aspect of this equivalates to a left/right direction. + %newLoc = setWord(%newLoc, 0, (getWord(%newLoc, 0) + (%xrand))); + //Word(1) of %newloc (which is the y value) is set to equal it's original value plus the value + //of %yrand. The -/+ aspect of this equivalates to a forward/back direction. + %newLoc = setWord(%newLoc, 1, (getWord(%newLoc, 1) + (%yrand))); + + //If the bot is pathed, get ready to move to the correct node + if (%obj.path !$= "") + { + if (%this.returningPath == 1) + { + %this.returningPath = 2; + } + } + + //If there's a target, keep aiming at it while sidestepping + %tgtid = %this.GetClosestHumanInSightandRange(%obj); + if(%tgtid >= 0) + { + %tgt = ClientGroup.getobject(%tgtid); + %obj.setAimObject(%tgt.player, "0 0 1"); + + %basedist = vectorDist(%obj.getposition(), %newLoc); + //If the target location is very close and we have a target player, don't preform a line of sight test + if(%basedist > $AI_GUARD_LOS_BYPASS) + { + //Line of sight test for the position the bot wants to sidestep to + %eyeTrans = %obj.getEyeTransform(); + %eyeEnd = %newLoc; + %searchResult = containerRayCast(%eyeTrans, %eyeEnd, $TypeMasks::PlayerObjectType | $TypeMasks::StaticTSObjectType | + $TypeMasks::TerrainObjectType | $TypeMasks::ItemObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType, %obj); + %foundObject = getword(%searchResult,0); + + if (%foundObject > 0) + { + %this.sidestep(%obj); + return; + } + } + } + //There is no target + else + { + //Line of sight test for the position the bot wants to sidstep to + %eyeTrans = %obj.getEyeTransform(); + %eyeEnd = %newLoc; + %searchResult = containerRayCast(%eyeTrans, %eyeEnd, $TypeMasks::PlayerObjectType | $TypeMasks::StaticTSObjectType | + $TypeMasks::TerrainObjectType | $TypeMasks::ItemObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType, %obj); + %foundObject = getword(%searchResult,0); + + if (%foundObject > 0) + { + %this.sidestep(%obj); + return; + } + //Set the bot to look in the direction that it is moving. + else + { + %obj.setaimlocation(%newloc); + } + } + //Set the bot to move towards the new position. + %obj.setMoveDestination(%newLoc); +} + +function AIPlayer::CheckLOStoItem(%this, %obj, %item) +{ + %basedist = vectorDist(%obj.getposition(), %item.getposition()); + //If the target item is very close, don't preform a line of sight test + if(%basedist > $AI_GUARD_LOS_BYPASS) + { + %eyeTrans = %obj.getEyeTransform(); + //%eyeEnd = %item.getposition(); + %eyeEnd = %item.getWorldBoxCenter(); + %searchResult = containerRayCast(%eyeTrans, %eyeEnd, $TypeMasks::TerrainObjectType | + $TypeMasks::InteriorObjectType | $TypeMasks::ItemObjectType | $TypeMasks::PlayerObjectType | + $TypeMasks::StaticTSObjectType | $TypeMasks::StaticObjectType , %obj); + %foundObject = getword(%searchResult,0); + + if(%foundObject == %item) + { + return true; + } + else + { + return false; + } + } + else + { + return true; + } +} + +//This is another function taken from code found on garagegames. +//It checks to see if there are any static objects blocking the view +//from the AIPlayer to the target. +function AIPlayer::CheckLOS(%this, %obj, %tgt) +{ + %eyeTrans = %obj.getEyeTransform(); + %eyeEnd = %tgt.player.getEyeTransform(); + %searchResult = containerRayCast(%eyeTrans, %eyeEnd, $TypeMasks::PlayerObjectType | $TypeMasks::StaticTSObjectType | + $TypeMasks::TerrainObjectType | $TypeMasks::ItemObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType, %obj); + %foundObject = getword(%searchResult,0); + + if (%foundObject > 0) + { + if(%foundObject.getType() & $TypeMasks::PlayerObjectType) + { + //Get the target's location and set it as the bot's return point + %obj.returningPos = %tgt.player.getposition(); + %obj.returningTrans = %tgt.player.gettransform(); + %obj.lostest = 1; + return true; + } + else + { + //If the bot just lost sight of the player, get the player's position a short time after that + if(%obj.lostest == 1) + { + %obj.lostest = 0; + %this.lostrigger = %this.schedule($AI_GUARD_LOS_TIME,"getnewguardposition", %obj, %tgt); + } + return false; + } + } +} + +//Get the player's position a short time after sight is lost +function AIPlayer::GetNewGuardPosition(%this, %obj, %tgt) +{ + %obj.returningPos = %tgt.player.getposition(); + %obj.returningTrans = %tgt.player.gettransform(); +} + +function AIPlayer::GetClosestHumanInSightandRange(%this, %obj) +{ + %dist=0; + %index = -1; //sets the initial index value to -1 The index is the id number of the nearest + //human target found + %botpos = %this.getposition(); //The bots current position + %count = ClientGroup.getCount(); //The number of clients to check + + //The for-next loop cycles through all of the valid clients + for(%i=0; %i < %count; %i++) + { + %client = ClientGroup.getobject(%i); //Get the client info for the client at index %i + + //If the client is invalid then the function bails out returning a -1 value, for no target found. + if (%client.player !$= "" && %client.player > 0) + { + //The following line just changes the %client to %tgt to make it easier to follow the code below + %tgt = %client; + + %playpos = %client.player.getposition(); //Assigns the player position to a variable + + %tempdist = vectorDist(%playpos, %botpos); //Determine the distance from the bot to the target + + //The first test we perform is to see if the target is within the bots range + //Is target in range? If not bail out of checking to see if its in view. + if (%tempdist <= %obj.detdis) + { + + //Lower attentionlevel to increase response time... + %this.attentionlevel--; + + //Prevent the attention level from dropping below 1 + if(%this.attentionlevel < 1) %this.attentionlevel = 1; + + //The second check is to see if the target is within the FOV of the bot. + //Is the target within the fov field of vision of the bot? + if(%this.Istargetinview(%obj, %tgt, %obj.fov)) + { + + //Lower attentionlevel to increase response time... + %this.attentionlevel--; + + //Prevent the attention level from dropping below 1 + if(%this.attentionlevel < 1) %this.attentionlevel = 1; + + //The third check we run is to see if there is anything blocking the + //target from the bot. + if(%this.CheckLOS(%obj, %tgt)) + { + //We lower the bots attention level again, to further increase it's + //response time, this effectively means that the bot will respnd faster to + //objects that are both in range and in plain sight. + %this.attentionlevel--; + + //Prevent the attention level from dropping below 1 + if(%this.attentionlevel < 1) %this.attentionlevel = 1; + + //If there is a current target, then check the distance to the new target as + //compared to the current set target. If the new target is closest, then set + //the index and tempdistance to the new target. + if(%tempdist < %dist || %dist == 0) + { + %dist = %tempdist; + %index = %i; + } + } + } + } + } + else + { + //If there are no targets in view, then the bots attention will slowly lapse and increase + //This will slow down how fast the bot thinks and how often it checks for threats. + %this.attentionlevel = %this.attentionlevel + 0.5; + if(%this.attentionlevel > $AI_GUARD_MAX_ATTENTION) %this.attentionlevel = $AI_GUARD_MAX_ATTENTION; + } + } + + return %index; +} + +function AIPlayer::GetClosestItemInSightandRange(%this, %obj, %itemname) +{ + %dist=0; + %index = -1; + %botpos = %this.getposition(); + InitContainerRadiusSearch(%botpos, $AI_GUARD_DETECT_ITEM_RANGE, $TypeMasks::ItemObjectType); + while ((%item = containerSearchNext()) != 0) + { + if (%item.getDataBlock().getName() $= %itemname) + { + %itempos = %item.getposition(); + %tempdist = vectorDist(%itempos, %botpos); + + if(%this.IsIteminview(%obj, %item, %obj.fov)) + { + if(%this.CheckLOStoItem(%obj, %item)) + { + if(%tempdist < %dist || %dist == 0) + { + %dist = %tempdist; + %index = %item; + } + } + } + } + } + return %index; +} + +//This function checks to see if the target supplied is within the bots FOV +function AIPlayer::IsItemInView(%this, %obj, %item, %fov) +{ + %ang = %this.check2dangletoitem(%obj, %item); + %visleft = 360 - (%fov/2); + %visright = %fov/2; + if (%ang > %visleft || %ang < %visright) + { + return true; + } + else + { + return false; + } +} + +//This function checks to see if the target supplied is within the bots FOV +function AIPlayer::IsTargetInView(%this, %obj, %tgt, %fov) +{ + %ang = %this.check2dangletotarget(%obj, %tgt); + %visleft = 360 - (%fov/2); + %visright = %fov/2; + if (%ang > %visleft || %ang < %visright) + { + return true; + } + else + { + return false; + } +} + +//Check if the location the bot is moving to is in sight. +//And if it's not, move somwhere that is in sight (if there's a better place). +function AIPlayer::dontMoveAlongTheWall(%this, %obj) +{ + //Save the original destination to another variable for later use + %this.moveDestinationB = %this.moveDestinationA; + + if (%this.checkMovementLos(%obj)) + { + return; + } + else + { + //Word(0) of %this.moveDestinationB (which is the x value) is set to equal the value of %this.moveDestinationA's Word(0). + %this.moveDestinationB = setWord(%this.moveDestinationB, 0, (getWord(%this.moveDestinationA, 0))); + //Word(1) of %this.moveDestinationB (which is the y value) is set to equal the value of %this.getposition()'s Word(1). + %this.moveDestinationB = setWord(%this.moveDestinationB, 1, (getWord(%this.getposition(), 1))); + + if (%this.checkMovementLos(%obj)) + { + //Add AI_GUARD_CORNERING's value to the destination's value + %this.moveDestinationB = setWord(%this.moveDestinationB, 0, (getWord(%this.moveDestinationA, 0) + $AI_GUARD_CORNERING)); + %this.moveDestinationB = setWord(%this.moveDestinationB, 1, (getWord(%this.getposition(), 1) + $AI_GUARD_CORNERING)); + + if (%this.checkMovementLos(%obj)) + { + return; + } + else + { + //Or else subtracts AI_GUARD_CORNERING's value from the destination's value + %this.moveDestinationB = setWord(%this.moveDestinationB, 0, (getWord(%this.moveDestinationA, 0) - $AI_GUARD_CORNERING)); + %this.moveDestinationB = setWord(%this.moveDestinationB, 1, (getWord(%this.getposition(), 1) - $AI_GUARD_CORNERING)); + %obj.setmovedestination(%this.moveDestinationB); + } + } + else + { + //Word(0) of %this.moveDestinationB (which is the x value) is set to equal the value of %this.getposition()'s Word(0). + %this.moveDestinationB = setWord(%this.moveDestinationB, 0, (getWord(%this.getposition(), 0))); + //Word(1) of %this.moveDestinationB (which is the y value) is set to equal the value of %this.moveDestinationA's Word(1). + %this.moveDestinationB = setWord(%this.moveDestinationB, 1, (getWord(%this.moveDestinationA, 1))); + + if (%this.checkMovementLos(%obj)) + { + //Add AI_GUARD_CORNERING's value to the destination's value + %this.moveDestinationB = setWord(%this.moveDestinationB, 0, (getWord(%this.getposition(), 0) + $AI_GUARD_CORNERING)); + %this.moveDestinationB = setWord(%this.moveDestinationB, 1, (getWord(%this.moveDestinationA, 1) + $AI_GUARD_CORNERING)); + + if (%this.checkMovementLos(%obj)) + { + return; + } + else + { + //Or else subtracts AI_GUARD_CORNERING's value from the destination's value + %this.moveDestinationB = setWord(%this.moveDestinationB, 0, (getWord(%this.getposition(), 0) - $AI_GUARD_CORNERING)); + %this.moveDestinationB = setWord(%this.moveDestinationB, 1, (getWord(%this.moveDestinationA, 1) - $AI_GUARD_CORNERING)); + %obj.setmovedestination(%this.moveDestinationB); + } + } + else + { + %obj.setmovedestination(%this.moveDestinationA); + } + } + } +} + +//Line of sight test for the position the bot wants to move to +function AIPlayer::checkMovementLos(%this, %obj) +{ + %eyeTrans = %obj.getEyeTransform(); + %eyeEnd = %this.moveDestinationB; + %searchResult = containerRayCast(%eyeTrans, %eyeEnd, $TypeMasks::StaticTSObjectType | $TypeMasks::TerrainObjectType | + $TypeMasks::ItemObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType, %obj); + %foundObject = getword(%searchResult,0); + + if (%foundObject == 0) + { + //Check to make sure the bot isn't already extremly close to its dstination + %basedist = vectorDist(%obj.getposition(), %this.moveDestinationB); + + if (%basedist > 0.5) + { + %obj.setmovedestination(%this.moveDestinationB); + return true; + } + else + { + return false; + } + } + + else + { + return false; + } +} + +// Gets the closest player to object. Used by the trigger to determine if a player triggered it. +function AIPlayer::GetClosestPlayer(%this, %obj) +{ + %dist=0; + %index = -1; //sets the initial index value to -1 The index is the id number of the nearest + //human target found + %botpos = %this.getposition(); //The bots current position + %count = ClientGroup.getCount(); //The number of clients to check + + //The for-next loop cycles through all of the valid clients + for(%i=0; %i < %count; %i++) + { + %client = ClientGroup.getobject(%i); //Get the client info for the client at index %i + + //If the client is invalid then the function bails out returning a -1 value, for no + //target found. + if (%client.player !$= "" && %client.player > 0) + { + %index = %client.player; + } + } +} + +//----------------------------------------------------------------------------- +// Pathed AI Functions +//----------------------------------------------------------------------------- + +//Start the bot following a path +function AIPlayer::followPath(%this, %path, %node, %obj) +{ + //Check if the bot is pathed + if (!isObject(%path)) + { + %this.path = ""; + return; + } + + %dist = 0; + %tempdist = 0; + %index = -1; + %botpos = %this.getposition(); + %count = %path.getCount(); + //Cycle through all nodes on this path and set the closest node as the bot's current location + while ((%node = %count) != 0) + { + %nodepos = %this.path.getObject(%count - 1).getposition(); + %tempdist = vectorDist(%nodepos, %botpos); + + if(%tempdist < %dist || %dist == 0) + { + %dist = %tempdist; + %index = %node; + } + %count--; + } + %index = %index - 1; + %this.moveToNode(%index); + + if (%index > %path.getCount() - 1) + { + %this.targetNode = %path.getCount() - 1; + } + else + { + %this.targetNode = %index; + } +} + +function AIPlayer::moveToNextNode(%this, %obj) +{ + //See if the bot just sidesteped + if (%this.returningPath == 2) + { + //Set returningPath back to 1 for other functions + %this.returningPath = 1; + %this.moveToNode(%this.currentNode); + return; + } + + //See where the bot is and where it should be going + if (%this.targetNode < 0 || %this.currentNode < %this.targetNode) + { + if (%this.currentNode < %this.path.getCount() - 1) + { + %this.moveToNode(%this.currentNode + 1); + } + else + { + %this.moveToNode(0); + } + } + else + { + if (%this.currentNode == 0) + { + %this.moveToNode(%this.path.getCount() - 1); + } + else + { + %this.moveToNode(%this.currentNode - 1); + } + } +} + +function AIPlayer::moveToNode(%this, %index, %obj) +{ + //Move to the given path node index + %this.currentNode = %index; + %node = %this.path.getObject(%index); + %this.setMoveDestination(%node.getTransform()); + %this.targetNode = %this.currentNode + 1; + + //Make the bot face the node it's moving to + %this.setAimLocation(%this.path.getObject(%this.currentNode).getposition()); +} diff --git a/Templates/Modules/AI_Guard/Scripts/guardTrigger.cs b/Templates/Modules/AI_Guard/Scripts/guardTrigger.cs new file mode 100644 index 000000000..e72de4a20 --- /dev/null +++ b/Templates/Modules/AI_Guard/Scripts/guardTrigger.cs @@ -0,0 +1,34 @@ + +function guardTrigger::onEnterTrigger(%this, %trigger, %obj) +{ + echo(%trigger @ " has been triggered!"); + // we've been triggered. Now check to see if the player triggered the trigger + // we don't want other enemies to keep spawing more enemies! + %tgtid = AIPlayer::GetClosestPlayer(%trigger); + //echo("nearest human is " @ %tgtid); + // check to see if the player triggered this. + if (%tgtid == %obj) + { + // if triggerMany is set, then we shouldn't do anything. (or do something different.) + // if you want a trigger to always spawn an enemy, set the trigger's triggerMany value to "true" + // default behavior is to trigger once. + if (!%trigger.triggerMany && !%trigger.doneOnce) + { + + // set the spawnGroup variable to pass on to the spawn function + %spawnGroup = %trigger.spawnGroup; + + // let the game know we've already been triggered once. + %trigger.doneOnce = true; + + // spawn the group + AIPlayer::spawnByGroup(%spawnGroup); + + } + else + { + // we've been triggered before. Don't do anything + // If you wanted to do something different, this is where you would put it. + } + } +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/PostFXPack.cs b/Templates/Modules/PostFXPack/PostFXPack.cs new file mode 100644 index 000000000..0e3b875fc --- /dev/null +++ b/Templates/Modules/PostFXPack/PostFXPack.cs @@ -0,0 +1,9 @@ +function PostFXPack::onCreate(%this) +{ + exec("./Scripts/postFXPack.cs"); +} + +function PostFXPack::onDestroy(%this) +{ +} + diff --git a/Templates/Modules/PostFXPack/PostFXPack.module b/Templates/Modules/PostFXPack/PostFXPack.module new file mode 100644 index 000000000..d783cd18d --- /dev/null +++ b/Templates/Modules/PostFXPack/PostFXPack.module @@ -0,0 +1,15 @@ + + + diff --git a/Templates/Modules/PostFXPack/Scripts/postFX.cs b/Templates/Modules/PostFXPack/Scripts/postFX.cs new file mode 100644 index 000000000..317845636 --- /dev/null +++ b/Templates/Modules/PostFXPack/Scripts/postFX.cs @@ -0,0 +1,25 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Shaders ( For Custom Materials ) +//***************************************************************************** diff --git a/Templates/Modules/PostFXPack/Scripts/postFXPack.cs b/Templates/Modules/PostFXPack/Scripts/postFXPack.cs new file mode 100644 index 000000000..ad1a22e72 --- /dev/null +++ b/Templates/Modules/PostFXPack/Scripts/postFXPack.cs @@ -0,0 +1,351 @@ +// PIXELATE +$Pixelate::PixelWidth = 10.0; +$Pixelate::PixelHeight = 10.0; +singleton ShaderData( PixelateShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/pixelateP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( PixelatePostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = PixelateShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function PixelatePostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$pixel_w", $Pixelate::PixelWidth); + %this.setShaderConst("$pixel_h", $Pixelate::PixelHeight); + %this.setShaderConst("$sizeX",getWord($pref::Video::mode, 0)); + %this.setShaderConst("$sizeY",getWord($pref::Video::mode, 1)); +} + +// BLURRED VISION +$BlurredVisionIntensity = 1.0; +singleton ShaderData( BlurredVisionShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/blurredVisionP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( BlurredVisionPostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = BlurredVisionShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function BlurredVisionPostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$BlurredVisionIntensity", $BlurredVisionIntensity); +} + +// DREAM VIEW +$DreamViewIntensity = 1.0; +singleton ShaderData( DreamViewShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/dreamviewP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( DreamViewPostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = DreamViewShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function DreamViewPostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$DreamViewIntensity", $DreamViewIntensity); +} + +// CROSS STITCH +$CrossStichPostEffect::StitchingSize = 6.0; +$CrossStichPostEffect::Invert = 0; +singleton ShaderData( CrossStitchShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/crossStitchP.hlsl"; + pixVersion = 3.0; +}; + +singleton PostEffect( CrossStitchPostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = CrossStitchShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function CrossStitchPostEffect::setShaderConsts(%this) +{ + %this.setShaderConst( "$time", ($Sim::time - %this.timeStart) ); + %this.setShaderConst("$sizeX",getWord($pref::Video::mode, 0)); + %this.setShaderConst("$sizeY",getWord($pref::Video::mode, 1)); + %this.setShaderConst("$stitching_size", $CrossStichPostEffect::StitchingSize); + %this.setShaderConst("$invert", $CrossStichPostEffect::Invert); +} + +// POSTERISATION +$PosterisationPostEffect::Gamma = 0.6; +$PosterisationPostEffect::NumColors = 4.0; +singleton ShaderData( PosterisationShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/posterisationP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( PosterisationPostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = PosterisationShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function PosterisationPostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$gamma", $PosterisationPostEffect::Gamma); + %this.setShaderConst("$numColors", $PosterisationPostEffect::NumColors); +} + +// NIGHT VISION 2 +$NightVisionPostEffect::LuminanceThreshold = 0.2; +$NightVisionPostEffect::ColorAmplification = 4.0; + +singleton ShaderData( NightVision2Shader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/nightVision2P.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( NightVision2Fx ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = NightVision2Shader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function NightVision2Fx::setShaderConsts(%this) +{ + %this.setShaderConst("$luminanceThreshold", $NightVisionPostEffect::LuminanceThreshold); + %this.setShaderConst("$colorAmplification", $NightVisionPostEffect::ColorAmplification); +} + +// LENS CIRCLE +$LensCirclePostEffect::RadiusX = 0.6; +$LensCirclePostEffect::RadiusY = 0.2; + +singleton ShaderData( LensCircleShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/lensCircleP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( LensCirclePostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = LensCircleShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function LensCirclePostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$radiusX", $LensCirclePostEffect::RadiusX); + %this.setShaderConst("$radiusY", $LensCirclePostEffect::RadiusY); +} + +// CHROMATIC ABERRATION +$ChromaticAberrationPostEffect::Intensity = 0.3; +singleton ShaderData( ChromaticAberrationShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/chromaticAberrationP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( ChromaticAberrationPostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = ChromaticAberrationShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function ChromaticAberrationPostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$intensity", $ChromaticAberrationPostEffect::Intensity); +} + +// RGB +$RGBPostEffect::RedLevel = 1.0; +$RGBPostEffect::GreenLevel = 1.0; +$RGBPostEffect::BlueLevel = 1.0; +singleton ShaderData( RGBShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/rgbP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( RGBPostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = RGBShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function RGBPostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$redLevel", $RGBPostEffect::RedLevel); + %this.setShaderConst("$greenLevel", $RGBPostEffect::GreenLevel); + %this.setShaderConst("$blueLevel", $RGBPostEffect::BlueLevel); +} + +// ZOOM BLUR +$ZoomBlur::Amount = 0.99; +$ZoomBlur::Samples = 6; + +singleton ShaderData( ZoomBlurShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/zoomBlurP.hlsl"; + samplerNames[0] = "$inputTex"; + pixVersion = 3.0; +}; + +singleton PostEffect( ZoomBlurPostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + shader = ZoomBlurShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; +}; + +function ZoomBlurPostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$amount", $ZoomBlur::Amount); + %this.setShaderConst("$samples", $ZoomBlur::Samples); +} + +// NEGATIVE +singleton ShaderData( NegativeShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/negativeP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( NegativePostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + shader = NegativeShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; +}; + +// BLACK AND WHITE +singleton ShaderData( BlackAndWhiteShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/blackAndWhiteP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( BlackAndWhitePostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + shader = BlackAndWhiteShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; +}; + +// MONOCHROME +singleton ShaderData( MonochromeShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/monochromeP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( MonochromePostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + shader = MonochromeShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; +}; + +// EDGE DETECTION +$EdgeDetection::Threshold = 0.01; + +singleton ShaderData( EdgeDetectionShader ) +{ + DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; + DXPixelShaderFile = "shaders/common/postFx/Library/edgeDetectionP.hlsl"; + pixVersion = 2.0; +}; + +singleton PostEffect( EdgeDetectionPostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + shader = EdgeDetectionShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; +}; + +function EdgeDetectionPostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$threshold", $EdgeDetection::Threshold); +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/blackAndWhiteP.hlsl b/Templates/Modules/PostFXPack/Shaders/blackAndWhiteP.hlsl new file mode 100644 index 000000000..a4f57579d --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/blackAndWhiteP.hlsl @@ -0,0 +1,21 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "../../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + base.a = 1.0f; + + base.rgb = (base.r + base.g + base.b) / 3.0f; + + if (base.r < 0.5) + base.r = 0.0f; + else + base.r = 1.0f; + + base.gb = base.r; + + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/blurredVisionP.hlsl b/Templates/Modules/PostFXPack/Shaders/blurredVisionP.hlsl new file mode 100644 index 000000000..01015dad2 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/blurredVisionP.hlsl @@ -0,0 +1,29 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" +#include "../../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float BlurredVisionIntensity; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.001 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.003 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.005 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.007 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.009 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.011 * BlurredVisionIntensity)); + + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.001 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.003 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.005 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.007 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.009 * BlurredVisionIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.011 * BlurredVisionIntensity)); + + base = base / 15.0; // 9.5 + + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/chromaticAberrationP.hlsl b/Templates/Modules/PostFXPack/Shaders/chromaticAberrationP.hlsl new file mode 100644 index 000000000..7515c4295 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/chromaticAberrationP.hlsl @@ -0,0 +1,24 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +uniform float accumTime; +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float intensity; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float2 coords = IN.uv0; + float2 uv = IN.uv0; + + coords = (coords - 0.5) * 2.0; + + float coordDot = dot(coords, coords); + + float2 uvG = uv - TORQUE_TEX2D(backBuffer, IN.uv0).xy * intensity * coords * coordDot; + + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + + base.g = TORQUE_TEX2D(backBuffer, uvG).g; + + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/crossStitchP.hlsl b/Templates/Modules/PostFXPack/Shaders/crossStitchP.hlsl new file mode 100644 index 000000000..857a109d4 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/crossStitchP.hlsl @@ -0,0 +1,39 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float time; +uniform float sizeX; // rt_w +uniform float sizeY; // rt_h +uniform float stitching_size = 6.0; +uniform int invert = 0; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = float4(0.0, 0.0, 0.0, 0.0); + float size = stitching_size; + float2 cPos = IN.uv0 * float2(sizeX, sizeY); + float2 tlPos = floor(cPos / float2(size, size)); + tlPos *= size; + int remX = int(cPos.x % size); + int remY = int(cPos.y % size); + if (remX == 0 && remY == 0) + tlPos = cPos; + float2 blPos = tlPos; + blPos.y += (size - 1.0); + if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y))))) + { + if (invert == 1) + base = float4(0.2, 0.15, 0.05, 1.0); + else + base = TORQUE_TEX2D(backBuffer, tlPos * float2(1.0/sizeX, 1.0/sizeY)) * 1.4; + } + else + { + if (invert == 1) + base = TORQUE_TEX2D(backBuffer, tlPos * float2(1.0/sizeX, 1.0/sizeY)) * 1.4; + else + base = float4(0.0, 0.0, 0.0, 1.0); + } + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/dreamviewP.hlsl b/Templates/Modules/PostFXPack/Shaders/dreamviewP.hlsl new file mode 100644 index 000000000..7fc201571 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/dreamviewP.hlsl @@ -0,0 +1,30 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" +#include "../../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float DreamViewIntensity; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.001 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.003 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.005 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.007 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.009 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0+(0.011 * DreamViewIntensity)); + + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.001 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.003 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.005 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.007 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.009 * DreamViewIntensity)); + base += TORQUE_TEX2D(backBuffer, IN.uv0-(0.011 * DreamViewIntensity)); + + base.rgb = (base.r + base.g + base.b)/3.0; + base = base / 9.5; + + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/edgeDetectionP.hlsl b/Templates/Modules/PostFXPack/Shaders/edgeDetectionP.hlsl new file mode 100644 index 000000000..f871526b3 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/edgeDetectionP.hlsl @@ -0,0 +1,48 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "../../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float threshold; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + + const int NUM = 9; + + const float2 c[NUM] = + { + float2(-0.0078125, 0.0078125), + float2( 0.00 , 0.0078125), + float2( 0.0078125, 0.0078125), + float2(-0.0078125, 0.00 ), + float2( 0.0, 0.0), + float2( 0.0078125, 0.007 ), + float2(-0.0078125,-0.0078125), + float2( 0.00 , -0.0078125), + float2( 0.0078125,-0.0078125), + }; + + int i; + float3 col[NUM]; + + for (i=0; i < NUM; i++) + { + col[i] = TORQUE_TEX2D(backBuffer, IN.uv0 + 0.2*c[i]); + } + + float3 rgb2lum = float3(0.30, 0.59, 0.11); + float lum[NUM]; + for (i = 0; i < NUM; i++) + { + lum[i] = dot(col[i].xyz, rgb2lum); + } + + float x = lum[2]+ lum[8]+2*lum[5]-lum[0]-2*lum[3]-lum[6]; + float y = lum[6]+2*lum[7]+ lum[8]-lum[0]-2*lum[1]-lum[2]; + float edge =(x*x + y*y < threshold)? 1.0:0.0; + + base.rgb *= edge; + + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/lensCircleP.hlsl b/Templates/Modules/PostFXPack/Shaders/lensCircleP.hlsl new file mode 100644 index 000000000..6729b9833 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/lensCircleP.hlsl @@ -0,0 +1,14 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float radiusX; +uniform float radiusY; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + float dist = distance(IN.uv0, float2(0.5,0.5)); + base.rgb *= smoothstep(radiusX, radiusY, dist); + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/monochromeP.hlsl b/Templates/Modules/PostFXPack/Shaders/monochromeP.hlsl new file mode 100644 index 000000000..6332c6cd8 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/monochromeP.hlsl @@ -0,0 +1,13 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "../../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + + base.rgb = (base.r + base.g + base.b) / 3.0f; + + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/negativeP.hlsl b/Templates/Modules/PostFXPack/Shaders/negativeP.hlsl new file mode 100644 index 000000000..c16aeb50d --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/negativeP.hlsl @@ -0,0 +1,11 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "../../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + base.a = 0; + return float4(1.0f, 1.0f, 1.0f, 1.0f) - base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/nightVision2P.hlsl b/Templates/Modules/PostFXPack/Shaders/nightVision2P.hlsl new file mode 100644 index 000000000..1a863b6b0 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/nightVision2P.hlsl @@ -0,0 +1,48 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +uniform float accumTime; +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float luminanceThreshold; // 0.2 +uniform float colorAmplification; // 4.0 + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float speed = 100; + float Yres = 1024; + float brightness = 0.2; + + float4 finalColor = float4(1.0, 1.0, 1.0, 1.0); + + float2 uv; + uv.x = 0.4 * sin(accumTime * 50.0); + uv.y = 0.4 * cos(accumTime * 50.0); + //float m = TORQUE_TEX2D(maskTex, gl_TexCoord[0].st).r; + //vec3 n = texture2D(noiseTex, (gl_TexCoord[0].st*3.5) + uv).rgb; + float3 c = TORQUE_TEX2D(backBuffer, IN.uv0).rgb; + + float lum = dot(float3(0.30, 0.59, 0.11), c); + if (lum < luminanceThreshold) + c *= colorAmplification; + + float3 visionColor = float3(0.1, 0.95, 0.2); + finalColor.rgb = c * visionColor; + + // add noise + float noise = IN.uv0.x * IN.uv0.y * accumTime * speed; + noise = fmod(noise, 10) * fmod(noise, 100); + noise = fmod(noise, 0.01); + + float3 color = finalColor.rgb; + color = color + color * saturate(noise.xxx * 200); + + // add banding + float sin,cos; + sincos(IN.uv0.y * Yres, sin, cos); + color += color * float3(sin, cos, sin) * brightness; + + finalColor.rgb = color; + + return finalColor; + +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/pixelateP.hlsl b/Templates/Modules/PostFXPack/Shaders/pixelateP.hlsl new file mode 100644 index 000000000..7a4d8bb84 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/pixelateP.hlsl @@ -0,0 +1,21 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float pixel_w; +uniform float pixel_h; +uniform float sizeX; +uniform float sizeY; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float2 uv = IN.uv0; + + float3 base = float3(1.0, 0.0, 0.0); + float dx = pixel_w * (1.0 / sizeX); + float dy = pixel_h * (1.0 / sizeY); + float2 coord = float2(dx*floor(uv.x/dx), dy*floor(uv.y/dy)); + base = TORQUE_TEX2D(backBuffer, coord).rgb; + + return float4(base, 1.0); +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/posterisationP.hlsl b/Templates/Modules/PostFXPack/Shaders/posterisationP.hlsl new file mode 100644 index 000000000..8235b5d38 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/posterisationP.hlsl @@ -0,0 +1,17 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float gamma; +uniform float numColors; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float3 base = TORQUE_TEX2D(backBuffer, IN.uv0).rgb; + base = pow(base, float3(gamma, gamma, gamma)); + base = base * numColors; + base = floor(base); + base = base / numColors; + base = pow(base, float3(1.0/gamma, 1.0/gamma, 1.0/gamma)); + return float4(base, 1.0); +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/rgbP.hlsl b/Templates/Modules/PostFXPack/Shaders/rgbP.hlsl new file mode 100644 index 000000000..1dc2b33d7 --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/rgbP.hlsl @@ -0,0 +1,16 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "shadergen:/autogenConditioners.h" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float redLevel; +uniform float greenLevel; +uniform float blueLevel; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + base.r *= redLevel; + base.g *= greenLevel; + base.b *= blueLevel; + return base; +} \ No newline at end of file diff --git a/Templates/Modules/PostFXPack/Shaders/zoomBlurP.hlsl b/Templates/Modules/PostFXPack/Shaders/zoomBlurP.hlsl new file mode 100644 index 000000000..9a7211c4b --- /dev/null +++ b/Templates/Modules/PostFXPack/Shaders/zoomBlurP.hlsl @@ -0,0 +1,25 @@ +#include "shaders/common/postFx/postFx.hlsl" +#include "../../torque.hlsl" + +uniform float amount; +uniform float samples; +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float b = 0; + + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + float2 uv = IN.uv0; + + [loop] for (int i = 1; i <= samples; i++) + { + uv -= b; + uv *= amount; + b = (1-(1*pow(abs(amount), i))) / 2; + uv += b; + base += TORQUE_TEX2DLOD(backBuffer, float4(uv.x, uv.y, 0, 0)); + } + + return base / (samples + 1); +} \ No newline at end of file diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/defaults.cs b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/defaults.cs new file mode 100644 index 000000000..70e31c0fb --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/defaults.cs @@ -0,0 +1,5 @@ +$RPGDialogEditorPref::ActionPath = "art/dialogs/dla/"; +$RPGDialogEditorPref::QuestionPath = "art/dialogs/dlq/"; +$RPGDialogEditorPref::PortraitsPath = "art/dialogs/portraits/"; +$RPGDialogEditorPref::mainMod="art"; +$RPGDialogEditorPref::MaxOptions = 100; diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/editorMain.cs b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/editorMain.cs new file mode 100644 index 000000000..28ffbecb7 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/editorMain.cs @@ -0,0 +1,1378 @@ +function QuestionText::onURL(%this, %url) +{ + if(firstword(%url)!$="RPGDialog" && firstword(%url)!$="RPGDialogLink") + { + gotoWebPage( %url ); + } + else if(firstword(%url)$="RPGDialogLink") + { + editQuestionLink(restwords(%url)); + } +} + +function initSaveAsPhase1() +{ + getSaveFilename("*.dlq", initSaveAsPhase2,$RPGDialog::currentDLQ); +} + +function initSaveAsPhase2(%QuestionFile) +{ + if(strPos(strlwr(%QuestionFile),".dlq")>=0) + { + $RPGDialog::SaveAsDLQ=%QuestionFile; + if(!isFile(%QuestionFile)) + { + schedule(20,0,"getSaveFilename","*.dla",initSaveAsPhase3,$RPGDialog::currentDLA); + } + else + { + MessageBoxYesNo("Warning","File already exists, overwrite?","schedule(20,0,getSaveFilename,\"*.dla\",initSaveAsPhase3,$RPGDialog::currentDLA);","schedule(20,0,getSaveFilename,\"*.dlq\",initSaveAsPhase2,$RPGDialog::currentDLQ);"); + } + } + else + { + MessageBoxOK("Error","File must have .dlq extension"); + } +} + +function initSaveAsPhase3(%ActionFile) +{ + %testFileName=$RPGDialog::SaveAsDLQ; + while(%i<=20) + { + %nextPos=strPos(%testFileName,"/"); + if(%nextPos<0) + { + %testFileName=getSubStr(%testFileName,0,strPos(%testFileName,".dlq"))@".dla"; + %i=21; + } + else + { + %testFileName=getSubStr(%testFileName,%nextPos+1,strLen(%testFileName)); + } + %i++; + } + + if(strPos(strlwr(%ActionFile),".dla")>=0) + { + if(strPos(%ActionFile,%testFileName)>=0) + { + $RPGDialog::SaveAsDLA=%ActionFile; + if(!isFile(%ActionFile)) + { + initSaveAsPhase4(); + } + else + { + MessageBoxYesNo("Warning","File already exists, overwrite?","initSaveAsPhase4();","schedule(20,0,getSaveFilename,\"*.dla\",initSaveAsPhase3,$RPGDialog::currentDLA);"); + } + } + else + { + MessageBoxOK("Error","Dla and Dlq filenames must be equal, but may be stored in different folders."); + } + } + else + { + MessageBoxOK("Error","File must have .dla extension"); + } +} + +function initSaveAsPhase4() +{ + $RPGDialog::currentDLQ=$RPGDialog::SaveAsDLQ; + $RPGDialog::currentDLA=$RPGDialog::SaveAsDLA; + saveScript(); +} + +function initNewScript() +{ + NewScriptQuestion.setvalue($RPGDialogEditorPref::QuestionPath@"new.dlq"); + NewScriptAction.setvalue($RPGDialogEditorPref::ActionPath@"new.dla"); + Canvas.pushDialog(NewScriptPopup); +} + +function newScript() +{ + %QuestionFile=NewScriptQuestion.getvalue(); + %ActionFile=NewScriptAction.getvalue(); + + %testFileName=%QuestionFile; + while(%i<=20) + { + %nextPos=strPos(%testFileName,"/"); + if(%nextPos<0) + { + %testFileName=getSubStr(%testFileName,0,strPos(%testFileName,".dlq"))@".dla"; + %i=21; + } + else + { + %testFileName=getSubStr(%testFileName,%nextPos+1,strLen(%testFileName)); + } + %i++; + } + + if(strPos(%ActionFile,%testFileName)>=0) + { + %extensionCheck=strPos(%QuestionFile,".dlq"); + if(%extensionCheck<0) + { + %QuestionFile=%QuestionFile@".dlq"; + } + + %extensionCheck=strPos(%ActionFile,".dla"); + if(%extensionCheck<0) + { + %ActionFile=%ActionFile@".dla"; + } + + if(!isFile(%QuestionFile)) + { + if(!isFile(%ActionFile)) + { + Canvas.popDialog(NewScriptPopup); + + if(TextScript.getvalue()!$="Current Q. Script:") + { + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + (Answer@%i).delete(); + (Action@%i).delete(); + (editAnswer@%i@Button).delete(); + (moveAnswer@%i@UpButton).delete(); + (moveAnswer@%i@DownButton).delete(); + } + } + + deleteVariables("$RPGDialog::*");//delete all obsolete globals and reset the 2 that are needed. + $RPGDialog::currentDLQ=%QuestionFile; + $RPGDialog::currentDLA=%ActionFile; + TextScript.settext("Current Q. Script: "@$RPGDialog::currentDLQ); + TextScript2.settext("Current A. Script: "@$RPGDialog::currentDLA); + TextQuestionNumber.settext("Question: 0/0"); + QuestionText.settext(""); + Canvas.setContent(MainEditorScreenGui); + } + else + MessageBoxOK("Error","Cannot create question script file"); + } + else + { + MessageBoxOK("Error","Cannot create action script file"); + } + } + else + { + MessageBoxOK("Error","Dla and Dlq filenames must be equal, but may be stored in different folders."); + } +} + +function LoadScript(%qScriptName) +{ + $RPGDialog::currentDLQ=%qScriptName; + %aScriptName=strReplace(%qScriptName,".dlq",".dla"); + $RPGDialog::currentDLA=%aScriptName; + if(!isFile(%aScriptName)) + { + %path=%qScriptName; + while(%i<=20) + { + %nextPos=strPos(%path,"/"); + if(%nextPos<0) + { + %aScriptFileName=getSubStr(%path,0,strPos(%path,".dlq"))@".dla"; + %i=21; + } + else + { + %path=getSubStr(%path,%nextPos+1,strLen(%path)); + } + %i++; + } + %aScriptName=$RPGDialogEditorPref::ActionPath@%aScriptFileName; + $RPGDialog::currentDLA=%aScriptName; + if(!isFile(%aScriptName)) + { + MessageBoxOK("Error","Couldn't find "@%aScriptFileName@" on the default dla folder nor on the same directory as the dlq."); + } + } + if(TextScript.getvalue()!$="Current Q. Script:") + { + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + (Answer@%i).delete(); + (Action@%i).delete(); + (editAnswer@%i@Button).delete(); + (moveAnswer@%i@UpButton).delete(); + (moveAnswer@%i@DownButton).delete(); + } + } + + deleteVariables("$RPGDialog::*");//delete all obsolete globals and reset the 2 that are needed. + $RPGDialog::currentDLQ=%qScriptName; + $RPGDialog::currentDLA=%aScriptName; + + %file = new FileObject(); + if(isfile(%qScriptName) && %file.openForRead(%qScriptName)) + { + while(!%file.isEOF()) + { + $RPGDialog::Questions++; + + %line=%file.readLine(); + %answerStart=strPos(%line,""); + %question=getSubStr(%line,0,%answerStart); + %soundStart=strPos(%question, "~Sound:"); + if(%soundStart>=0) + { + $RPGDialog::QuestionSound[$RPGDialog::Questions]=getSubStr(%question,%soundStart+7,strLen(%question)); + %question=getSubStr(%question, 0, %soundStart); + } + $RPGDialog::Question[$RPGDialog::Questions]=%question; + + %lineLinks=%line; + %i=1; + while(%i<=$RPGDialogEditorPref::MaxOptions) + { + %QuestionLinkHeaderSize=strlen(""); + %QuestionLinkStart=strpos(%lineLinks,""); + %lineLinks=getSubStr(%lineLinks,%QuestionLinkStart+%QuestionLinkHeaderSize,strlen(%lineLinks)); + %QuestionLinkEnd=strpos(%lineLinks,""); + + if(%QuestionLinkStart<0||%QuestionLinkEnd<0) + { + %i=$RPGDialogEditorPref::MaxOptions+1; + } + else + { + $RPGDialog::QuestionLink[$RPGDialog::Questions,%i]=getSubStr(%lineLinks,0,%QuestionLinkEnd); + $RPGDialog::QuestionLink[$RPGDialog::Questions,0]=%i;//use this to store how many answers are avaible for this question link. + %i++; + } + } + + %i=1; + while(%i<=$RPGDialogEditorPref::MaxOptions) + { + %AnswerHeaderSize=strlen(""); + %AnswerStart=strpos(%line,""); + %line=getSubStr(%line,%AnswerStart+%AnswerHeaderSize,strlen(%line)); + %AnswerEnd=strpos(%line,""); + + if(%AnswerStart<0||%AnswerEnd<0) + { + %i=$RPGDialogEditorPref::MaxOptions+1; + } + else + { + $RPGDialog::Answer[$RPGDialog::Questions,%i]=getSubStr(%line,0,%AnswerEnd); + $RPGDialog::Answer[$RPGDialog::Questions,0]=%i;//use this to store how many answers are avaible for this question. + %i++; + } + } + + } + } + %file.close(); + if(isfile(%aScriptName) && %file.openForRead(%aScriptName)) + { + while(!%file.isEOF()) + { + %Actions++; + %line=%line2=%file.readLine(); + + %i=1; + while(%i<=$RPGDialogEditorPref::MaxOptions) + { + %ActionHeaderSize=strlen(""); + %ActionStart=strpos(%line,""); + %line=getSubStr(%line,%ActionStart+%ActionHeaderSize,strlen(%line)); + %ActionEnd=strpos(%line,"")+5; + + if(%ActionStart<0||%ActionEnd<0) + { + %i=$RPGDialogEditorPref::MaxOptions+1; + } + else + { + $RPGDialog::QuestionLinkAction[%Actions,%i]=getSubStr(%line,0,%ActionEnd); + $RPGDialog::QuestionLinkAction[%Actions,0]=%i;//use this to store how many actions are avaible for this question. + %i++; + } + } + + %i=1; + while(%i<=$RPGDialogEditorPref::MaxOptions) + { + %ActionHeaderSize=strlen("<"@%i@">"); + %ActionStart=strpos(%line2,"<"@%i@">"); + %line2=getSubStr(%line2,%ActionStart+%ActionHeaderSize,strlen(%line2)); + %ActionEnd=strpos(%line2,"")+5; + + if(%ActionStart<0||%ActionEnd<0) + { + %i=$RPGDialogEditorPref::MaxOptions+1; + } + else + { + $RPGDialog::Action[%Actions,%i]=getSubStr(%line2,0,%ActionEnd); + $RPGDialog::Action[%Actions,0]=%i;//use this to store how many actions are avaible for this question. + %i++; + } + } + } + if($RPGDialog::Questions>0) + { + $RPGDialog::CurrentQuestion=1; + TextQuestionNumber.settext("Question: 1/"@$RPGDialog::Questions); + QuestionText.settext($RPGDialog::Question[1]); + } + else + { + $RPGDialog::CurrentQuestion=0; + TextQuestionNumber.settext("Question: 0/0"); + QuestionText.settext(""); + } + TextScript.settext("Current Q. Script: "@$RPGDialog::currentDLQ); + TextScript2.settext("Current A. Script: "@$RPGDialog::currentDLA); + + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + OptionsControl.add(new GuiMLTextCtrl(Answer@%i) + { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "2 2"; + extent = "390 40"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }); + + OptionsControl.add(new GuiMLTextCtrl(Action@%i) + { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "400 2"; + extent = "300 14"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }); + + OptionsControl.add(new GuiButtonCtrl(editAnswer@%i@Button) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "700 2"; + extent = "54 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Edit A."@%i; + groupNum = "-1"; + buttonType = "PushButton"; + command = "EditAnswer("@%i@");"; + }); + OptionsControl.add(new GuiButtonCtrl(moveAnswer@%i@UpButton) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "700 17"; + extent = "21 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Up"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MoveAnswerUp("@%i@");"; + }); + if(%i==1) + (moveAnswer@%i@UpButton).setvisible(0); + else + (moveAnswer@%i@UpButton).setvisible(1); + OptionsControl.add(new GuiButtonCtrl(moveAnswer@%i@DownButton) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "721 17"; + extent = "33 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Down"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MoveAnswerDown("@%i@");"; + }); + if(%i==$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]) + (moveAnswer@%i@DownButton).setvisible(0); + else + (moveAnswer@%i@DownButton).setvisible(1); + + (Answer@%i).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%i]); + (Action@%i).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,%i]); + } + Canvas.setContent(MainEditorScreenGui); + RefreshOptions(); + } + %file.close(); + %file.delete(); +} + +function SaveScript() +{ + %qScriptName=$RPGDialog::currentDLQ; + %aScriptName=$RPGDialog::currentDLA; + + %file = new FileObject(); + if(%file.openForWrite(%qScriptName)) + { + for(%i=1;%i<=$RPGDialog::Questions;%i++) + { + if($RPGDialog::QuestionSound[%i]!$="") + { + %line=$RPGDialog::Question[%i]@"~Sound:"@$RPGDialog::QuestionSound[%i]@""; + } + else + { + %line=$RPGDialog::Question[%i]@""; + } + + for(%f=1;%f<=$RPGDialog::Answer[%i,0];%f++) + { + %line=%line@""@$RPGDialog::Answer[%i,%f]@"
"; + } + %file.writeLine(%line); + } + } + %file.close(); + if(%file.openForWrite(%aScriptName)) + { + for(%i=1;%i<=$RPGDialog::Questions;%i++) + { + %line=""; + for(%f=1;%f<=$RPGDialog::QuestionLinkAction[%i,0];%f++) + { + %line=%line@""@$RPGDialog::QuestionLinkAction[%i,%f]; + } + + for(%f=1;%f<=$RPGDialog::Action[%i,0];%f++) + { + %line=%line@"<"@%f@">"@$RPGDialog::Action[%i,%f]; + } + %file.writeLine(%line); + } + } + %file.close(); + %file.delete(); +} + +function NextQuestion() +{ + if($RPGDialog::CurrentQuestion<$RPGDialog::Questions) + { + $RPGDialog::CurrentQuestion++; + QuestionText.settext($RPGDialog::Question[$RPGDialog::CurrentQuestion]); + TextQuestionNumber.settext("Question: "@$RPGDialog::CurrentQuestion@"/"@$RPGDialog::Questions); + + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion-1,0];%i++) + { + (Answer@%i).delete(); + (Action@%i).delete(); + (editAnswer@%i@Button).delete(); + (moveAnswer@%i@UpButton).delete(); + (moveAnswer@%i@DownButton).delete(); + } + + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + OptionsControl.add(new GuiMLTextCtrl(Answer@%i) + { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "2 2"; + extent = "390 40"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }); + + OptionsControl.add(new GuiMLTextCtrl(Action@%i) + { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "400 2"; + extent = "300 40"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }); + + OptionsControl.add(new GuiButtonCtrl(editAnswer@%i@Button) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "700 2"; + extent = "54 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Edit A."@%i; + groupNum = "-1"; + buttonType = "PushButton"; + command = "EditAnswer("@%i@");"; + }); + OptionsControl.add(new GuiButtonCtrl(moveAnswer@%i@UpButton) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "700 17"; + extent = "21 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Up"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MoveAnswerUp("@%i@");"; + }); + if(%i==1) + (moveAnswer@%i@UpButton).setvisible(0); + else + (moveAnswer@%i@UpButton).setvisible(1); + OptionsControl.add(new GuiButtonCtrl(moveAnswer@%i@DownButton) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "721 17"; + extent = "33 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Down"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MoveAnswerDown("@%i@");"; + }); + if(%i==$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]) + (moveAnswer@%i@DownButton).setvisible(0); + else + (moveAnswer@%i@DownButton).setvisible(1); + + (Answer@%i).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%i]); + (Action@%i).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,%i]); + } + RefreshOptions(); + } +} + +function PreviousQuestion() +{ + if($RPGDialog::CurrentQuestion>1) + { + $RPGDialog::CurrentQuestion--; + QuestionText.settext($RPGDialog::Question[$RPGDialog::CurrentQuestion]); + TextQuestionNumber.settext("Question: "@$RPGDialog::CurrentQuestion@"/"@$RPGDialog::Questions); + + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion+1,0];%i++) + { + (Answer@%i).delete(); + (Action@%i).delete(); + (editAnswer@%i@Button).delete(); + (moveAnswer@%i@UpButton).delete(); + (moveAnswer@%i@DownButton).delete(); + } + + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + OptionsControl.add(new GuiMLTextCtrl(Answer@%i) + { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "2 2"; + extent = "390 40"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }); + + OptionsControl.add(new GuiMLTextCtrl(Action@%i) + { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "400 2"; + extent = "300 40"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }); + + OptionsControl.add(new GuiButtonCtrl(editAnswer@%i@Button) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "700 2"; + extent = "54 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Edit A."@%i; + groupNum = "-1"; + buttonType = "PushButton"; + command = "EditAnswer("@%i@");"; + }); + OptionsControl.add(new GuiButtonCtrl(moveAnswer@%i@UpButton) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "700 17"; + extent = "21 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Up"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MoveAnswerUp("@%i@");"; + }); + if(%i==1) + (moveAnswer@%i@UpButton).setvisible(0); + else + (moveAnswer@%i@UpButton).setvisible(1); + OptionsControl.add(new GuiButtonCtrl(moveAnswer@%i@DownButton) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "721 17"; + extent = "33 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Down"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MoveAnswerDown("@%i@");"; + }); + if(%i==$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]) + (moveAnswer@%i@DownButton).setvisible(0); + else + (moveAnswer@%i@DownButton).setvisible(1); + + (Answer@%i).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%i]); + (Action@%i).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,%i]); + } + RefreshOptions(); + } +} + +function GotoQuestion(%Question) +{ + if(%Question<=$RPGDialog::Questions && %Question>0) + { + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + if((Answer@%i).extent!$="") + (Answer@%i).delete(); + if((Action@%i).extent!$="") + (Action@%i).delete(); + if((editAnswer@%i@Button).extent!$="") + (editAnswer@%i@Button).delete(); + if((moveAnswer@%i@UpButton).extent!$="") + (moveAnswer@%i@UpButton).delete(); + if((moveAnswer@%i@DownButton).extent!$="") + (moveAnswer@%i@DownButton).delete(); + } + + $RPGDialog::CurrentQuestion=%Question; + QuestionText.settext($RPGDialog::Question[$RPGDialog::CurrentQuestion]); + TextQuestionNumber.settext("Question: "@$RPGDialog::CurrentQuestion@"/"@$RPGDialog::Questions); + + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + OptionsControl.add(new GuiMLTextCtrl(Answer@%i) + { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "2 2"; + extent = "390 40"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }); + + OptionsControl.add(new GuiMLTextCtrl(Action@%i) + { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "400 2"; + extent = "300 40"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }); + + OptionsControl.add(new GuiButtonCtrl(editAnswer@%i@Button) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "700 2"; + extent = "54 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Edit A."@%i; + groupNum = "-1"; + buttonType = "PushButton"; + command = "EditAnswer("@%i@");"; + }); + OptionsControl.add(new GuiButtonCtrl(moveAnswer@%i@UpButton) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "700 17"; + extent = "21 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Up"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MoveAnswerUp("@%i@");"; + }); + if(%i==1) + (moveAnswer@%i@UpButton).setvisible(0); + else + (moveAnswer@%i@UpButton).setvisible(1); + OptionsControl.add(new GuiButtonCtrl(moveAnswer@%i@DownButton) + { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "721 17"; + extent = "33 15"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Down"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MoveAnswerDown("@%i@");"; + }); + if(%i==$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]) + (moveAnswer@%i@DownButton).setvisible(0); + else + (moveAnswer@%i@DownButton).setvisible(1); + + (Answer@%i).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%i]); + (Action@%i).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,%i]); + } + RefreshOptions(); + } +} + +function RefreshOptions() +{ + for(%i=1;%i<=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + %ActionText=(Action1).gettext(); + %ActionText=strReplace(%ActionText,"",""); + Action1.settext(%ActionText); + if(%i>1) + { + (Answer@%i).resize(2, + 2+(restWords((Answer@(%i-1)).getPosition()))+42, + firstWord((Answer@%i).getExtent()), + restWords((Answer@%i).getExtent())); + %ActionText=(Action@%i).gettext(); + %ActionText=strReplace(%ActionText,"",""); + (Action@%i).settext(%ActionText); + (Action@%i).resize(400, + restWords((Answer@%i).getPosition()), + firstWord((Action@%i).getExtent()), + restWords((Action@%i).getExtent())); + + (editAnswer@%i@Button).resize(700, + restWords((Answer@%i).getPosition()), + firstWord((editAnswer@%i@Button).getExtent()), + restWords((editAnswer@%i@Button).getExtent())); + + (moveAnswer@%i@UpButton).resize(700, + restWords((Answer@%i).getPosition())+17, + firstWord((moveAnswer@%i@UpButton).getExtent()), + restWords((moveAnswer@%i@UpButton).getExtent())); + + (moveAnswer@%i@DownButton).resize(721, + restWords((Answer@%i).getPosition())+17, + firstWord((moveAnswer@%i@DownButton).getExtent()), + restWords((moveAnswer@%i@DownButton).getExtent())); + } + + OptionsControl.resize(firstWord(OptionsControl.getPosition()), + restWords(OptionsControl.getPosition()), + firstWord(OptionsControl.getExtent()), + restWords((moveAnswer@%i@DownButton).getPosition())+restWords((moveAnswer@%i@DownButton).GetExtent())); + } + (moveAnswer@$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]@DownButton).setvisible(0); +} + +function setDefaultQuestionPath(%Path) +{ + $RPGDialogEditorPref::QuestionPath=%path; +} + +function setDefaultActionPath(%Path) +{ + $RPGDialogEditorPref::ActionPath=%path; +} + +function savePrefs() +{ + echo("Exporting editor prefs"); + export("$RPGDialogEditorPref::*", "~/prefs.cs", False); +} + +function editQuestion() +{ + if($RPGDialog::Questions>0) + { + QuestionEdit.settext($RPGDialog::Question[$RPGDialog::CurrentQuestion]); + $RPGDialog::NewQuestion=false; + PopulateSoundList($RPGDialog::QuestionSound[$RPGDialog::CurrentQuestion]); + Canvas.setContent(EditQuestionGui); + } +} + +function newQuestion() +{ + QuestionEdit.settext(""); + $RPGDialog::NewQuestion=true; + PopulateSoundList($RPGDialog::QuestionSound[$RPGDialog::CurrentQuestion]); + Canvas.setContent(EditQuestionGui); +} + +function newAnswer() +{ + if($RPGDialog::Questions>0) + { + AnswerEdit.settext(""); + ActionEdit.settext(""); + $RPGDialog::NewAnswer=true; + Canvas.setContent(EditAnswerGui); + } +} + +function confirmQuestionEdit() +{ + if(!$RPGDialog::NewQuestion) + { + $RPGDialog::Question[$RPGDialog::CurrentQuestion]=QuestionEdit.gettext(); + QuestionText.settext($RPGDialog::Question[$RPGDialog::CurrentQuestion]); + + $RPGDialog::QuestionSound[$RPGDialog::CurrentQuestion]=QuestionEditSound.getValue(); + + Canvas.setContent(MainEditorScreenGui); + } + else + { + $RPGDialog::Questions++; + + $RPGDialog::Question[$RPGDialog::Questions]=QuestionEdit.gettext(); + + $RPGDialog::Answer[$RPGDialog::Questions,0]=1; + $RPGDialog::Action[$RPGDialog::Questions,0]=1; + + $RPGDialog::Answer[$RPGDialog::Questions,1]="Continue..."; + $RPGDialog::Action[$RPGDialog::Questions,1]="CloseQuestion()"; + + $RPGDialog::QuestionSound[$RPGDialog::CurrentQuestion]=QuestionEditSound.getValue(); + + GotoQuestion($RPGDialog::Questions); + Canvas.setContent(MainEditorScreenGui); + } + $RPGDialog::NewQuestion=false; +} + +function cancelQuestionEdit() +{ + for(%i=1;%i<=$RPGDialog::QuestionLink[$RPGDialog::Questions+1,0];%i++) + { + $RPGDialog::QuestionLink[$RPGDialog::Questions+1,%i]=""; + $RPGDialog::QuestionLinkAction[$RPGDialog::Questions+1,%i]=""; + } + $RPGDialog::QuestionLink[$RPGDialog::Questions+1,0]=0; + $RPGDialog::QuestionLinkAction[$RPGDialog::Questions+1,0]=0; + $RPGDialog::NewQuestion=false; + Canvas.setContent(MainEditorScreenGui); +} + +function deleteQuestion() +{ + if($RPGDialog::Questions>0) + { + $RPGDialog::Messages=""; + while($RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]!=0) + { + deleteAnswer(1); + } + + for(%i=1;%i<$RPGDialog::CurrentQuestion;%i++) //Process actions that are before the question being deleted and update them as necessary + { + for(%f=1;%f<=$RPGDialog::QuestionLink[%i,0];%f++) + { + $RPGDialog::QuestionLinkAction[%i,%f]=updateAction($RPGDialog::QuestionLinkAction[%i,%f],%i,"Question Link "@%f); + } + + for(%f=1;%f<=$RPGDialog::Answer[%i,0];%f++) + { + $RPGDialog::Action[%i,%f]=updateAction($RPGDialog::Action[%i,%f],%i,"Answer "@%f); + } + } + + for(%i=$RPGDialog::CurrentQuestion;%i<$RPGDialog::Questions;%i++) //Now process the questions, answer and actions that are after the question being deleted, moving them to their new place and updating the actions as necessary. + { + $RPGDialog::Question[%i]=$RPGDialog::Question[%i+1]; + $RPGDialog::QuestionSound[%i]=$RPGDialog::QuestionSound[%i+1]; + $RPGDialog::QuestionLink[%i,0]=$RPGDialog::QuestionLink[%i+1]; + $RPGDialog::QuestionLinkAction[%i,0]=$RPGDialog::QuestionLink[%i+1]; + $RPGDialog::Answer[%i,0]=$RPGDialog::Answer[%i+1,0]; + $RPGDialog::Action[%i,0]=$RPGDialog::Action[%i+1,0]; + + for(%f=1;%f<=$RPGDialog::Answer[%i,0];%f++) + { + $RPGDialog::Answer[%i,%f]=$RPGDialog::Answer[%i+1,%f]; + $RPGDialog::Action[%i,%f]=updateAction($RPGDialog::Action[%i+1,%f],%i,"Answer "@%f); + } + + for(%f=1;%f<=$RPGDialog::QuestionLink[%i,0];%f++) + { + $RPGDialog::QuestionLink[%i,%f]=$RPGDialog::QuestionLink[%i+1,%f]; + $RPGDialog::QuestionLinkAction[%i,%f]=updateAction($RPGDialog::QuestionLinkAction[%i+1,%f],%i,"Question Link "@%f); + } + } + $RPGDialog::Questions--; + + if($RPGDialog::CurrentQuestion>$RPGDialog::Questions) + $RPGDialog::CurrentQuestion--; + + if($RPGDialog::Messages!$="") + MessageBoxOK("Warning",$RPGDialog::Messages); + + GotoQuestion($RPGDialog::CurrentQuestion); + } +} + +function updateAction(%action,%currentQuestion,%currentAnswer) +{ + %command=getSubStr(%action,0,strPos(%action,"(")); + %args=getSubStr(%action,strPos(%action,"(")+1,strLen(%action)); + + %i=1; + while(%i<=1000) //just a max number of args to prevent the program from going into an infinite loop if something goes wrong. + { + if(strPos(%args,",")>=0) + { + %arg[%i]=getSubStr(%args,0,strPos(%args,",")); + %args=getSubStr(%args,strPos(%args,",")+1,strLen(%args)); + } + else + { + %arg[%i]=getSubStr(%args,0,strPos(%args,")")); + %arg[0]=%i; //use arg[0] to store how many args are avaible + %i=1001; + } + %i++; + } + + switch$(%command) + { + case "GotoQuestion": + if(%arg[1]==$RPGDialog::CurrentQuestion) + { + %arg[1]="QUESTION DELETED"; + warn("Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!"); + $RPGDialog::Messages=$RPGDialog::Messages@"Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!\n"; + } + else if(%arg[1]>%currentQuestion) + %arg[1]--; + + case "ChangeStartQuestion": + if(%arg[1]==$RPGDialog::CurrentQuestion) + { + %arg[1]="QUESTION DELETED"; + warn("Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!"); + $RPGDialog::Messages=$RPGDialog::Messages@"Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!\n"; + } + else if(%arg[1]>%currentQuestion) + %arg[1]--; + + case "ChangeStartQuestionAndOpen": + if(%arg[1]==$RPGDialog::CurrentQuestion) + { + %arg[1]="QUESTION DELETED"; + warn("Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!"); + $RPGDialog::Messages=$RPGDialog::Messages@"Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!\n"; + } + else if(%arg[1]>%currentQuestion) + %arg[1]--; + + case "ChangeStartQuestionAndGoto": + if(%arg[1]==$RPGDialog::CurrentQuestion) + { + %arg[1]="QUESTION DELETED"; + warn("Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!"); + $RPGDialog::Messages=$RPGDialog::Messages@"Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!\n"; + } + else if(%arg[1]>%currentQuestion) + %arg[1]--; + + if(%arg[2]==$RPGDialog::CurrentQuestion) + { + %arg[2]="QUESTION DELETED"; + warn("Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!"); + $RPGDialog::Messages=$RPGDialog::Messages@"Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!\n"; + } + else if(%arg[2]>%currentQuestion) + %arg[2]--; + + case "ChangePortraitAndGoto": + if(%arg[2]==$RPGDialog::CurrentQuestion) + { + %arg[2]="QUESTION DELETED"; + warn("Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!"); + $RPGDialog::Messages=$RPGDialog::Messages@"Question "@%currentQuestion@"/"@%currentAnswer@" needs updating!\n"; + } + else if(%arg[2]>%currentQuestion) + %arg[2]--; + } + + if(%arg[0]>0) + { + %args=%arg[1]; + for(%i=2;%i<=%arg[0];%i++) + { + %args=%args@","@%arg[%i]; + } + } + else + %args=""; + + return(%command@"("@%args@")"); +} + +function editAnswer(%answerNumber) +{ + %ActionText=$RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber]; + %ActionText=strReplace(%ActionText,"",""); + AnswerEdit.settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber]); + ActionEdit.settext(%ActionText); + $RPGDialog::EditAnswerNumber=%answerNumber; + Canvas.setContent(EditAnswerGui); +} + +function moveAnswerUp(%answerNumber) +{ + if(%answerNumber>1 && $RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]>1) + { + %tempAnswer=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber]; + %tempAction=$RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber]; + + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber]=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber-1]; + $RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber]=$RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber-1]; + + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber-1]=%tempAnswer; + $RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber-1]=%tempAction; + + (Answer@%answerNumber).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber]); + (Action@%answerNumber).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber]); + (Answer@%answerNumber-1).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber-1]); + (Action@%answerNumber-1).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber-1]); + RefreshOptions(); + } +} + +function moveAnswerDown(%answerNumber) +{ + if(%answerNumber<$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0] && $RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]>1) + { + %tempAnswer=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber]; + %tempAction=$RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber]; + + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber]=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber+1]; + $RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber]=$RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber+1]; + + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber+1]=%tempAnswer; + $RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber+1]=%tempAction; + + (Answer@%answerNumber).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber]); + (Action@%answerNumber).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber]); + (Answer@%answerNumber+1).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,%answerNumber+1]); + (Action@%answerNumber+1).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,%answerNumber+1]); + RefreshOptions(); + } +} + +function editQuestionLink(%questionLinkNumber) +{ + AnswerEdit.settext($RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,%questionLinkNumber]); + ActionEdit.settext($RPGDialog::QuestionLinkAction[$RPGDialog::CurrentQuestion,%questionLinkNumber]); + $RPGDialog::EditAnswerNumber="QL"@%questionLinkNumber; + + Canvas.setContent(EditAnswerGui); +} + +function confirmAnswerEdit() +{ + %QuestionLinkCheck=getSubStr($RPGDialog::EditAnswerNumber,0,2); + if(%QuestionLinkCheck$="QL") + { + if(AnswerEdit.gettext()!$="") + { + %QuestionLinkNumber=getSubStr($RPGDialog::EditAnswerNumber,2,strLen($RPGDialog::EditAnswerNumber)); + %questionText=strReplace(QuestionText.gettext(),$RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,%questionLinkNumber],AnswerEdit.gettext()); + $RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,%QuestionLinkNumber]=AnswerEdit.gettext(); + %ActionText=ActionEdit.getvalue(); + %ActionText=%ActionText@""; + $RPGDialog::QuestionLinkAction[$RPGDialog::CurrentQuestion,%QuestionLinkNumber]=%ActionText; + $RPGDialog::Question[$RPGDialog::CurrentQuestion]=%questionText; + QuestionText.setText(%questionText); + GotoQuestion($RPGDialog::CurrentQuestion); + Canvas.setContent(MainEditorScreenGui); + } + else //if new value is blank then delete question link + { + MessageBoxYesNo( "Delete Question Link", "Do you really want to delete this question link?", "deleteAnswer("@$RPGDialog::EditAnswerNumber@");", ""); + } + } + else + { + if(!$RPGDialog::NewAnswer) + { + if(AnswerEdit.gettext()!$="") + { + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,$RPGDialog::EditAnswerNumber]=AnswerEdit.gettext(); + %ActionText=ActionEdit.getvalue(); + %ActionText=%ActionText@""; + $RPGDialog::Action[$RPGDialog::CurrentQuestion,$RPGDialog::EditAnswerNumber]=%ActionText; + (Answer@$RPGDialog::EditAnswerNumber).settext($RPGDialog::Answer[$RPGDialog::CurrentQuestion,$RPGDialog::EditAnswerNumber]); + (Action@$RPGDialog::EditAnswerNumber).settext($RPGDialog::Action[$RPGDialog::CurrentQuestion,$RPGDialog::EditAnswerNumber]); + + RefreshOptions(); + Canvas.setContent(MainEditorScreenGui); + } + else //if new value is blank then delete answer + { + MessageBoxYesNo( "Delete Answer", "Do you really want to delete this answer?", "deleteAnswer("@$RPGDialog::EditAnswerNumber@");", ""); + } + } + else + { + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]++; + $RPGDialog::Action[$RPGDialog::CurrentQuestion,0]++; + + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]]=AnswerEdit.gettext(); + $RPGDialog::Action[$RPGDialog::CurrentQuestion,$RPGDialog::Action[$RPGDialog::CurrentQuestion,0]]=ActionEdit.getvalue(); + + $RPGDialog::NewAnswer=false; + + GotoQuestion($RPGDialog::CurrentQuestion); + Canvas.setContent(MainEditorScreenGui); + } + } + $RPGDialog::EditAnswerNumber=0; +} + +function deleteAnswer(%AnswerNumber) +{ + %QuestionLinkCheck=getSubStr(%AnswerNumber,0,2); + if(%QuestionLinkCheck$="QL") + { + %QuestionLinkNumber=getSubStr(%AnswerNumber,2,strLen(%AnswerNumber)); + %QuestionLink=$RPGDialog::Question[$RPGDialog::CurrentQuestion]; + %QuestionLinkStart=strpos(%QuestionLink,""); + %QuestionLink=getSubStr(%QuestionLink,%QuestionLinkStart,strlen(%QuestionLink)); + %QuestionLinkEnd=strpos(%QuestionLink,"")+4; + + %Answer=getSubStr(%QuestionLink,0,%QuestionLinkEnd); + %Question=strReplace($RPGDialog::Question[$RPGDialog::CurrentQuestion],%Answer,""); + + for(%i=%QuestionLinkNumber;%i<=$RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,0];%i++) + { + $RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,%i]=$RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,%i+1]; + $RPGDialog::QuestionLinkAction[$RPGDialog::CurrentQuestion,%i]=$RPGDialog::QuestionLinkAction[$RPGDialog::CurrentQuestion,%i+1]; + %Question=strReplace(%Question,"",""); + } + + $RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,0]--; + $RPGDialog::QuestionLinkAction[$RPGDialog::CurrentQuestion,0]--; + $RPGDialog::Question[$RPGDialog::CurrentQuestion]=%Question; + } + else + { + for(%i=%answerNumber;%i<$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0];%i++) + { + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,%i]=$RPGDialog::Answer[$RPGDialog::CurrentQuestion,%i+1]; + $RPGDialog::Action[$RPGDialog::CurrentQuestion,%i]=$RPGDialog::Action[$RPGDialog::CurrentQuestion,%i+1]; + } + + (Answer@$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]).delete(); + (Action@$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]).delete(); + (editAnswer@$RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]@Button).delete(); + + $RPGDialog::Answer[$RPGDialog::CurrentQuestion,0]--; + $RPGDialog::Action[$RPGDialog::CurrentQuestion,0]--; + } + RefreshOptions(); + Canvas.setContent(MainEditorScreenGui); +} + +function PopulateActionList() +{ + %file = new FileObject(); + if(isfile($RPGDialogEditorPref::MainMod@"/server/scripts/core/RPGDialog.cs") && %file.openForRead($RPGDialogEditorPref::MainMod@"/server/scripts/core/RPGDialog.cs")) + { + while(!%file.isEOF()) + { + %i++; + %line=%file.readLine(); + if(strPos(%line,"//")>=0) + { + ActionList.addrow(%i,getSubStr(%line,14,strLen(%line)),%i); + } + } + } + %file.close(); + %file.delete(); +} + +function PopulateQuestionOptionsList() +{ + QuestionOptionsList.addrow(1,"New Question Link",1); + QuestionOptionsList.addrow(2,"<>",2); + QuestionOptionsList.addrow(3,"<>",3); +} + +function PopulateSoundList(%value) +{ + QuestionEditSound.clear(); + QuestionEditSound.add(%value,1); + QuestionEditSound.setSelected(1); + %file = new FileObject(); + if(isfile($RPGDialogEditorPref::MainMod@"/client/scripts/RPGDialogAudioProfiles.cs") && %file.openForRead($RPGDialogEditorPref::MainMod@"/client/scripts/RPGDialogAudioProfiles.cs")) + { + %i=2; + while(!%file.isEOF()) + { + %line=%file.readLine(); + if(strPos(%line,"new AudioProfile(")>=0) + { + %start=strPos(%line,"(")+1; + %end=strPos(%line,")")-%start; + QuestionEditSound.add(getSubStr(%line,%start,%end),%i); + } + %i++; + } + } + %file.close(); + %file.delete(); +} + + +function ActionList::onSelect(%this) +{ + %text=ActionEdit.getvalue()@%this.getRowTextById(%this.getSelectedID()); + ActionEdit.settext(%text); +} + +function QuestionOptionsList::onSelect(%this) +{ + if(%this.getSelectedID()==1) + { + %text=%this.getRowTextById(%this.getSelectedID()); + if($RPGDialog::NewQuestion) + { + $RPGDialog::QuestionLink[$RPGDialog::Questions+1,0]++; + $RPGDialog::QuestionLinkAction[$RPGDialog::Questions+1,0]++; + $RPGDialog::QuestionLink[$RPGDialog::Questions+1,$RPGDialog::QuestionLink[$RPGDialog::Questions+1,0]]="New Question Link"; + $RPGDialog::QuestionLinkAction[$RPGDialog::Questions+1,$RPGDialog::QuestionLinkAction[$RPGDialog::Questions+1,0]]="CloseDialog()"; + %text=strReplace(%text,"#",$RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion+1,0]); + } + else + { + $RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,0]++; + $RPGDialog::QuestionLinkAction[$RPGDialog::CurrentQuestion,0]++; + $RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,$RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,0]]="New Question Link"; + $RPGDialog::QuestionLinkAction[$RPGDialog::CurrentQuestion,$RPGDialog::QuestionLinkAction[$RPGDialog::CurrentQuestion,0]]="CloseDialog()"; + %text=strReplace(%text,"#",$RPGDialog::QuestionLink[$RPGDialog::CurrentQuestion,0]); + } + QuestionEdit.addtext(%text@" ",true); + return; + } + %text=%this.getRowTextById(%this.getSelectedID()); + QuestionEdit.addtext(%text,true); +} + +function initSetPaths() +{ + MainMod.setValue($RPGDialogEditorPref::mainMod); + QuestionScriptPath.setValue($RPGDialogEditorPref::QuestionPath); + ActionScriptPath.setValue($RPGDialogEditorPref::ActionPath); + PortraitsPath.setValue($RPGDialogEditorPref::PortraitsPath); + Canvas.pushDialog(SetPathsPopup); +} + +function SetPaths() +{ + $RPGDialogEditorPref::mainMod=MainMod.getValue(); + $RPGDialogEditorPref::QuestionPath=QuestionScriptPath.getValue(); + $RPGDialogEditorPref::ActionPath=ActionScriptPath.getValue(); + $RPGDialogEditorPref::PortraitsPath=PortraitsPath.getValue(); + echo("Exporting RPGDialog editor prefs"); + export("$RPGDialogEditorPref::*", "~/RPGDialogEditor/prefs.cs", False); + Canvas.popDialog(SetPathsPopup); +} diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ingameRPGDialogEditor.cs b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ingameRPGDialogEditor.cs new file mode 100644 index 000000000..a5179c75b --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ingameRPGDialogEditor.cs @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Torque Game Engine +// +// Copyright (c) 2001 GarageGames.Com +// Portions Copyright (c) 2001 by Sierra Online, Inc. +//----------------------------------------------------------------------------- + +function initRPGDialogEditor() +{ + exec("~/scripts/RPGDialogEditor/ui/MainEditorScreenGui.gui"); + exec("~/scripts/RPGDialogEditor/ui/EditQuestionGui.gui"); + exec("~/scripts/RPGDialogEditor/ui/EditAnswerGui.gui"); + exec("~/scripts/RPGDialogEditor/ui/NewScriptPopup.gui"); + exec("~/scripts/RPGDialogEditor/ui/SetPathsPopup.gui"); + exec("~/scripts/RPGDialogEditor/ui/EditorOpeningGui.gui"); + + exec("~/scripts/RPGDialogEditor/defaults.cs"); + exec("~/scripts/RPGDialogEditor/prefs.cs"); + exec("~/scripts/RPGDialogEditor/editorMain.cs"); + + PopulateActionList(); + PopulateQuestionOptionsList(); + GlobalActionMap.bind(keyboard, "f5", toggleRPGDialogEditor); +} + +function openRPGDialogEditor() +{ + $GuiBeforeRPGDialogEditor=Canvas.getContent(); + if(TextScript.getvalue()$="Current Q. Script:") + Canvas.setContent(EditorOpeningGui); + else + Canvas.setContent(MainEditorScreenGui); + Canvas.setCursor("DefaultCursor"); +} + +function closeRPGDialogEditor() +{ + Canvas.setContent($GuiBeforeRPGDialogEditor); + Canvas.setCursor("DefaultCursor"); +} + + +function toggleRPGDialogEditor(%val) +{ + if (%val) + { + if (Canvas.getContent() == MainEditorScreenGui.getId() || + Canvas.getContent() == EditQuestionGui.getId() || + Canvas.getContent() == EditAnswerGui.getId() || + Canvas.getContent() == EditorOpeningGui.getId()) + closeRPGDialogEditor(); + else + openRPGDialogEditor(); + } +} + + diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/main.cs b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/main.cs new file mode 100644 index 000000000..902794676 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/main.cs @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------------- +// Torque Game Engine +// +// Copyright (c) 2001 GarageGames.Com +// Portions Copyright (c) 2001 by Sierra Online, Inc. +//----------------------------------------------------------------------------- + +function initEditor() +{ + exec("~/scripts/RPGDialogEditor/ui/MainEditorScreenGui.gui"); + exec("~/scripts/RPGDialogEditor/ui/EditQuestionGui.gui"); + exec("~/scripts/RPGDialogEditor/ui/EditAnswerGui.gui"); + exec("~/scripts/RPGDialogEditor/ui/NewScriptPopup.gui"); + exec("~/scripts/RPGDialogEditor/ui/SetPathsPopup.gui"); + exec("~/scripts/RPGDialogEditor/ui/EditorOpeningGui.gui"); + + exec("~/scripts/RPGDialogEditor/defaults.cs"); + exec("~/scripts/RPGDialogEditor/prefs.cs"); + exec("~/scripts/RPGDialogEditor/editorMain.cs"); +} + +function startEditor() +{ + // The client mod has already set it's own content, but we'll + // just load something new. + Canvas.setContent(EditorOpeningGui); + Canvas.setCursor("DefaultCursor"); + PopulateActionList(); + PopulateQuestionOptionsList(); +} + + +//----------------------------------------------------------------------------- +// Package overrides to initialize the mod. +// This module currently loads on top of the client mod, but it probably +// doesn't need to. Should look into having disabling the client and +// doing our own canvas init. + +package RPGDialogEditor { + +function onStart() +{ + Parent::onStart(); + echo("\n--------- Initializing MOD: RPGDialogEditor ---------"); + + if (!isObject(Canvas)) { + // If the parent onStart didn't open a canvas, then we're + // probably not running as a mod. We'll have to do the work + // ourselves. + initCanvas("RPGDialog Editor"); + } + initEditor(); + startEditor(); +} + +function onExit() +{ + echo("Exporting RPGDialog editor prefs"); + export("$RPGDialogEditorPref::*", "~/prefs.cs", False); + + if(isEventPending($RPGDialog::RefreshSchedule)) + cancel($RPGDialog::RefreshSchedule); + + Parent::onExit(); +} + +}; // package end. +activatePackage(RPGDialogEditor); diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/prefs.cs b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/prefs.cs new file mode 100644 index 000000000..2b24ab4d1 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/prefs.cs @@ -0,0 +1,5 @@ +$RPGDialogEditorPref::ActionPath = "art/dialogs/dla/"; +$RPGDialogEditorPref::mainMod = "art"; +$RPGDialogEditorPref::MaxOptions = 100; +$RPGDialogEditorPref::PortraitsPath = "art/dialogs/portraits/"; +$RPGDialogEditorPref::QuestionPath = "art/dialogs/dlq/"; diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditAnswerGui.gui b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditAnswerGui.gui new file mode 100644 index 000000000..f407f11bc --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditAnswerGui.gui @@ -0,0 +1,131 @@ +new GuiChunkedBitmapCtrl(EditAnswerGui) { + profile = "GuiContentProfile"; + horizSizing = "width"; + vertSizing = "height"; + position = "0 0"; + extent = "640 480"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + bitmap = "./background"; + useVariable = "0"; + tile = "0"; + + new GuiScrollCtrl(AnswerEditScroll) { + profile = "GuiScrollProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "40 50"; + extent = "480 500"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + constantThumbHeight = "0"; + childMargin = "2 2"; + + new GuiMLTextEditCtrl(AnswerEdit) { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "0 2"; + extent = "450 500"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }; + }; + + new GuiTextEditCtrl(ActionEdit) { + profile = "GuiTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "40 20"; + extent = "711 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "0"; + maxChars = "-1"; + }; + + new GuiButtonCtrl(AnswerEditConfirmButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "523 530"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "OK"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "confirmAnswerEdit();"; + }; + new GuiButtonCtrl(AnswerEditCancelButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "598 530"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "Canvas.setContent(MainEditorScreenGui);"; + }; + new GuiButtonCtrl(AnswerEditDeleteButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "673 530"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Delete"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MessageBoxYesNo( \"Delete Answer\", \"Do you really want to delete this answer?\", \"deleteAnswer(\"@$RPGDialog::EditAnswerNumber@\");\", \"\");"; + }; + new GuiScrollCtrl(ActionListScroll) { + profile = "GuiScrollProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "521 50"; + extent = "230 476"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + constantThumbHeight = "0"; + childMargin = "2 2"; + + new GuiTextListCtrl(ActionList) { + profile = "GuiTextListProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "0 0"; + extent = "196 401"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + enumerate = "0"; + resizeCell = "1"; + columns = "0"; + fitParentWidth = "0"; + clipColumnText = "0"; + }; + }; +}; diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditQuestionGui.gui b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditQuestionGui.gui new file mode 100644 index 000000000..5b333050a --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditQuestionGui.gui @@ -0,0 +1,161 @@ +new GuiChunkedBitmapCtrl(EditQuestionGui) { + profile = "GuiContentProfile"; + horizSizing = "width"; + vertSizing = "height"; + position = "0 0"; + extent = "640 480"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + bitmap = "./background"; + useVariable = "0"; + tile = "0"; + + new GuiScrollCtrl(QuestionEditScroll) { + profile = "GuiScrollProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "40 50"; + extent = "480 500"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + constantThumbHeight = "0"; + childMargin = "2 2"; + + new GuiMLTextEditCtrl(QuestionEdit) { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "0 2"; + extent = "450 500"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }; + }; + new GuiButtonCtrl(QuestionEditConfirmButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "523 530"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "OK"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "confirmQuestionEdit();"; + }; + new GuiButtonCtrl(QuestionEditCancelButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "598 530"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "cancelQuestionEdit();"; + }; + new GuiButtonCtrl(QuestionEditClearButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "673 530"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Clear"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "QuestionEdit.settext(\"\");QuestionEditSound.setValue(\"\");"; + }; + new GuiScrollCtrl(QuestionOptionsScroll) { + profile = "GuiScrollProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "521 83"; + extent = "230 443"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + constantThumbHeight = "0"; + childMargin = "2 2"; + + new GuiTextListCtrl(QuestionOptionsList) { + profile = "GuiTextListProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "0 0"; + extent = "196 401"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + enumerate = "0"; + resizeCell = "1"; + columns = "0"; + fitParentWidth = "0"; + clipColumnText = "0"; + }; + }; + new GuiTextCtrl() { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "524 46"; + extent = "50 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Sound Profile:"; + maxLength = "255"; + }; + new GuiPopUpMenuCtrl(QuestionEditSound) { + profile = "GuiPopUpMenuProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "521 62"; + extent = "135 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + maxLength = "255"; + historySize = "0"; + password = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + maxPopupHeight = "500"; + }; + + new GuiButtonCtrl(QuestionEditRemoveSound) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "660 62"; + extent = "90 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Remove Sound"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "QuestionEditSound.setValue(\"\");"; + }; + + +}; diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditorOpeningGui.gui b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditorOpeningGui.gui new file mode 100644 index 000000000..961a92000 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/EditorOpeningGui.gui @@ -0,0 +1,108 @@ +//--- OBJECT WRITE BEGIN --- +new GuiChunkedBitmapCtrl(EditorOpeningGui) { + profile = "GuiContentProfile"; + horizSizing = "width"; + vertSizing = "height"; + position = "0 0"; + extent = "640 480"; + minExtent = "8 8"; + visible = "1"; + bitmap = "./background"; + useVariable = "0"; + tile = "0"; + helpTag = "0"; + + new GuiBitmapCtrl() { + profile = "GuiDefaultProfile"; + horizSizing = "center"; + vertSizing = "bottom"; + position = "78 10"; + extent = "484 160"; + minExtent = "8 2"; + visible = "1"; + bitmap = "./title"; + wrap = "0"; + helpTag = "0"; + }; + new GuiBitmapCtrl() { + profile = "GuiDefaultProfile"; + horizSizing = "center"; + vertSizing = "center"; + position = "248 147"; + extent = "143 186"; + minExtent = "8 2"; + visible = "1"; + bitmap = "./box"; + wrap = "0"; + helpTag = "0"; + + new GuiButtonCtrl(NewScriptButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "36 47"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + command = "initNewScript();"; + text = "New Script"; + groupNum = "-1"; + buttonType = "PushButton"; + helpTag = "0"; + }; + new GuiButtonCtrl(LoadScriptButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "36 66"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + command = "getLoadFilename(\"*.dlq\", LoadScript);"; + text = "Load Script..."; + groupNum = "-1"; + buttonType = "PushButton"; + helpTag = "0"; + }; + new GuiButtonCtrl(SetPathsButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "36 85"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + command = "initSetPaths();"; + text = "Set Paths..."; + groupNum = "-1"; + buttonType = "PushButton"; + helpTag = "0"; + }; + new GuiButtonCtrl(QuitButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "36 117"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + command = "MessageBoxYesNo( \"Quit Editor\", \"Do you really want to quit the editor?\", \"if($GuiBeforeRPGDialogEditor==0)quit();else closeRPGDialogEditor();\", \"\");"; + text = "Quit"; + groupNum = "-1"; + buttonType = "PushButton"; + helpTag = "0"; + }; + new GuiTextCtrl(Version) { + profile = "GuiTextProfile"; + horizSizing = "center"; + vertSizing = "bottom"; + position = "58 18"; + extent = "26 18"; + minExtent = "8 2"; + visible = "1"; + text = "V.1.3"; + maxLength = "255"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/MainEditorScreenGui.gui b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/MainEditorScreenGui.gui new file mode 100644 index 000000000..9f8d900b0 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/MainEditorScreenGui.gui @@ -0,0 +1,265 @@ +//--- OBJECT WRITE BEGIN --- +new GuiChunkedBitmapCtrl(MainEditorScreenGui) { + profile = "GuiContentProfile"; + horizSizing = "width"; + vertSizing = "height"; + position = "0 0"; + extent = "640 480"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + bitmap = "./background"; + useVariable = "0"; + tile = "0"; + + new GuiTextCtrl(TextScript) { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "162 21"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Current Q. Script:"; + maxLength = "255"; + }; + + new GuiTextCtrl(TextScript2) { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "162 33"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Current A. Script:"; + maxLength = "255"; + }; + + new GuiTextCtrl(TextQuestionNumber) { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "162 208"; + extent = "46 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Question: 0/0"; + maxLength = "255"; + }; + new GuiButtonCtrl(NewScriptButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "85 52"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "New Script"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "initNewScript();"; + }; + new GuiButtonCtrl(LoadScriptButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "85 71"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Load Script..."; + groupNum = "-1"; + buttonType = "PushButton"; + command = "getLoadFilename(\"*.dlq\", LoadScript);"; + }; + new GuiButtonCtrl(NextQuestionButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "610 212"; + extent = "29 16"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Next"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "NextQuestion();"; + }; + new GuiButtonCtrl(PreviousQuestionButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "579 212"; + extent = "29 16"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Prev."; + groupNum = "-1"; + buttonType = "PushButton"; + command = "PreviousQuestion();"; + }; + + new GuiScrollCtrl(QuestionScroll) { + profile = "GuiScrollProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "160 50"; + extent = "480 160"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + constantThumbHeight = "0"; + childMargin = "4 2"; + + new GuiMLTextCtrl(QuestionText) { + profile = "GuiMLTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "4 2"; + extent = "478 116"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "1"; + maxChars = "-1"; + }; + }; + new GuiScrollCtrl(OptionsScroll) { + profile = "GuiScrollProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "10 250"; + extent = "780 300"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "alwaysOn"; + constantThumbHeight = "0"; + childMargin = "2 2"; + + new GuiControl(OptionsControl) { + profile = "GuiDefaultProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "4 2"; + extent = "770 290"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + }; + }; + new GuiButtonCtrl(editQuestionButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "642 123"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Edit Question"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "EditQuestion();"; + }; + new GuiButtonCtrl(newQuestionButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "642 51"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "New Question"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "newQuestion();"; + }; + new GuiButtonCtrl(newAnswerButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "715 230"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "New Answer"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "newAnswer();"; + }; + new GuiButtonCtrl(DeleteQuestionButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "642 76"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Del. Question"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "if($RPGDialog::Questions>0) MessageBoxYesNo( \"Delete Question\", \"Do you really want to delete this question?\", \"deleteQuestion();\", \"\");"; + }; + new GuiButtonCtrl(QuitButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "85 192"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Quit"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "MessageBoxYesNo( \"Quit Editor\", \"Do you really want to quit the editor?\", \"if($GuiBeforeRPGDialogEditor==0)quit();else closeRPGDialogEditor();\", \"\");"; + }; + new GuiButtonCtrl(SaveScriptButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "85 103"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Save Script"; + groupNum = "-1"; + buttonType = "PushButton"; + command = "SaveScript();"; + }; + new GuiButtonCtrl(SaveScriptAsButton) { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "85 122"; + extent = "73 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Save As..."; + groupNum = "-1"; + buttonType = "PushButton"; + command = "InitSaveAsPhase1();"; + }; + +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/NewScriptPopup.gui b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/NewScriptPopup.gui new file mode 100644 index 000000000..37b269141 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/NewScriptPopup.gui @@ -0,0 +1,115 @@ +//--- OBJECT WRITE BEGIN --- +new GuiControl(NewScriptPopup) { + profile = "GuiDefaultProfile"; + horizSizing = "center"; + vertSizing = "center"; + position = "0 0"; + extent = "640 480"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + + new GuiWindowCtrl() { + profile = "GuiWindowProfile"; + horizSizing = "center"; + vertSizing = "center"; + position = "220 146"; + extent = "200 188"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "New Dialog Script"; + maxLength = "255"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "0"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + minSize = "50 50"; + + new GuiTextCtrl() { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 28"; + extent = "50 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Question Script:"; + maxLength = "255"; + }; + new GuiTextEditCtrl(NewScriptQuestion) { + profile = "GuiTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 44"; + extent = "160 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + maxLength = "255"; + historySize = "0"; + password = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + }; + new GuiTextCtrl() { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 68"; + extent = "30 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Action Script:"; + maxLength = "255"; + }; + new GuiTextEditCtrl(NewScriptAction) { + profile = "GuiTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 84"; + extent = "160 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + maxLength = "255"; + historySize = "0"; + password = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + }; + new GuiButtonCtrl() { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "56 156"; + extent = "40 16"; + minExtent = "8 2"; + visible = "1"; + command = "NewScript();"; + helpTag = "0"; + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + }; + new GuiButtonCtrl() { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "104 156"; + extent = "40 16"; + minExtent = "8 2"; + visible = "1"; + command = "Canvas.popDialog(NewScriptPopup);"; + helpTag = "0"; + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/SetPathsPopup.gui b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/SetPathsPopup.gui new file mode 100644 index 000000000..549bc6a8e --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/SetPathsPopup.gui @@ -0,0 +1,169 @@ +//--- OBJECT WRITE BEGIN --- +new GuiControl(SetPathsPopup) { + profile = "GuiDefaultProfile"; + horizSizing = "center"; + vertSizing = "center"; + position = "0 0"; + extent = "640 480"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + + new GuiWindowCtrl() { + profile = "GuiWindowProfile"; + horizSizing = "center"; + vertSizing = "center"; + position = "220 146"; + extent = "200 228"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Paths"; + maxLength = "255"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "0"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + minSize = "50 50"; + + new GuiTextCtrl() { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 24"; + extent = "67 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Main Mod Folder:"; + maxLength = "255"; + }; + new GuiTextEditCtrl(MainMod) { + profile = "GuiTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 40"; + extent = "160 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + maxLength = "255"; + historySize = "0"; + password = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + }; + new GuiTextCtrl() { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 64"; + extent = "101 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Question Script Path:"; + maxLength = "255"; + }; + new GuiTextEditCtrl(QuestionScriptPath) { + profile = "GuiTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 80"; + extent = "160 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + maxLength = "255"; + historySize = "0"; + password = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + }; + new GuiTextCtrl() { + profile = "GuiDefaultProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 104"; + extent = "89 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Action Script Path:"; + maxLength = "255"; + }; + new GuiTextEditCtrl(ActionScriptPath) { + profile = "GuiTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 120"; + extent = "160 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + maxLength = "255"; + historySize = "0"; + password = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + }; + new GuiTextCtrl() { + profile = "GuiTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 144"; + extent = "67 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + text = "Portraits Path:"; + maxLength = "255"; + }; + new GuiTextEditCtrl(PortraitsPath) { + profile = "GuiTextEditProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "20 160"; + extent = "160 18"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + maxLength = "255"; + historySize = "0"; + password = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + }; + new GuiButtonCtrl() { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "56 192"; + extent = "40 16"; + minExtent = "8 2"; + visible = "1"; + command = "SetPaths();"; + helpTag = "0"; + text = "Set"; + groupNum = "-1"; + buttonType = "PushButton"; + }; + new GuiButtonCtrl() { + profile = "GuiButtonProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "104 192"; + extent = "40 16"; + minExtent = "8 2"; + visible = "1"; + command = "Canvas.popDialog(SetPathsPopup);"; + helpTag = "0"; + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/background.jpg b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/background.jpg new file mode 100644 index 000000000..ca263137c Binary files /dev/null and b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/background.jpg differ diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/box.png b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/box.png new file mode 100644 index 000000000..d358d77ab Binary files /dev/null and b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/box.png differ diff --git a/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/title.png b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/title.png new file mode 100644 index 000000000..0947ba52f Binary files /dev/null and b/Templates/Modules/RPGDialog/Scripts/RPGDialogEditor/ui/title.png differ diff --git a/Templates/Modules/RPGDialog/Scripts/client/RPGDialog.cs b/Templates/Modules/RPGDialog/Scripts/client/RPGDialog.cs new file mode 100644 index 000000000..126018334 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/client/RPGDialog.cs @@ -0,0 +1,205 @@ +//----------------------------------------------------------------------------- +// RPGDialog - Presents the player with a question and several answers to select from +// Created by Nelson A. K. Gonsalves +//----------------------------------------------------------------------------- + +if($RPGDialogEditorPref::MaxOptions>0) + $Pref::RPGDialog::MaxOptions=$RPGDialogEditorPref::MaxOptions; + +function getQuestion(%questionFile,%questionNumber) +{ + %file = new FileObject(); + if(isFile($Pref::RPGDialog::Client::QuestionPath@%questionFile@".dlq") && %file.openForRead($Pref::RPGDialog::Client::QuestionPath@%questionFile@".dlq")) + { + for(%i=1;%i<%questionNumber;%i++) + { + %file.readLine(); + if(%file.isEOF()) + return ""; + } + %question=%file.readLine(); + } + else if(isFile($RPGDialogEditorPref::QuestionPath@%questionFile@".dlq") && %file.openForRead($RPGDialogEditorPref::QuestionPath@%questionFile@".dlq")) + { + for(%i=1;%i<%questionNumber;%i++) + { + %file.readLine(); + if(%file.isEOF()) + return ""; + } + %question=%file.readLine(); + } + %file.close(); + %file.delete(); + return %question; +} + +function clientCmdCloseRPGDialog() +{ + Canvas.popDialog(RPGDialog); + RPGDialogQuestion.settext(""); + RPGDialogAnswer.settext(""); +} + +function clientCmdRPGDialogMessage(%sender,%senderName,%portrait,%npcFile,%questionNumber,%playerName) +{ + $RPGDialog::Sender=%sender; + $RPGDialog::questionNumber=%questionNumber; + onRPGDialogMessage(%npcFile,%questionNumber,%senderName,%portrait,%playerName); +} + +function onRPGDialogMessage(%npcFile,%questionNumber,%senderName,%portrait,%playerName) +{ + if(%portrait!$="" && isFile($RPGDialogEditorPref::PortraitsPath@%portrait)) + { + RPGDialogPortrait.setbitmap($RPGDialogEditorPref::PortraitsPath@%portrait); + } + else + { + RPGDialogPortrait.setbitmap($RPGDialogEditorPref::PortraitsPath@"unknown.png"); + } + + if(%npcFile!$="") + { + %QuestionAnswer=GetQuestion(%npcfile,%questionNumber); + + if(%QuestionAnswer!$="") + { + %AnswerStart=strPos(%QuestionAnswer,""); + %question=getSubStr(%QuestionAnswer,0,%AnswerStart); + %answer=getSubStr(%QuestionAnswer,%AnswerStart+13,strLen(%QuestionAnswer)); + } + else + { + %question="ERROR::Invalid Question!!\nnpcFile = "@%npcFile@"\nquestionNumber = "@%questionNumber; + } + } + + if (%question!$="") + { + %question=strreplace(%question,"<>",%senderName); + %question=strreplace(%question,"<>",%playerName); + + + if ((%soundStart = playRPGDialogSound(%question)) != -1) + %question = getSubStr(%question, 0, %soundStart); + + RPGDialogQuestion.settext(%question); + ChatHud.addLine($Pref::RPGDialog::ChatHudQuestionColor@%senderName@": "@StripMLControlChars(%question)); + } + + if (%answer!$="") + { + %answer=strReplace(%answer,"<>",%senderName); + %answer=strReplace(%answer,"<>",%playerName); + %answer=strReplace(%answer,"
","\n"); + + %line=%answer; + %i=1; + while(%i<=$Pref::RPGDialog::MaxOptions) //lets number the options + { + %Start=strpos(%line,""); + + if(%Start<0) + { + %i=$Pref::RPGDialog::MaxOptions+1; + } + else + { + %line=getSubStr(%line,%Start,strlen(%line)); + %End=strpos(%line,"")+4; + %line=getSubStr(%line,%End,strlen(%line)); + %answer=strReplace(%answer,""," "@%i@" - "); + %i++; + } + } + + + RPGDialogAnswer.settext(%answer); + } + else + { + RPGDialogAnswer.settext("Continue..."); + } + RPGDialogAnswer.Visible=true; + + Canvas.pushDialog(RPGDialog); +} + +function RPGDialogAnswer::onURL(%this, %url) +{ +//same as RPGDialogQuestion::onURL, so just forward the call +RPGDialogQuestion::onURL(%this, %url); +} + +function RPGDialogQuestion::onURL(%this, %url) +{ + if(firstword(%url)!$="RPGDialog" && firstword(%url)!$="RPGDialogLink" && firstword(%url)!$="RPGDialogNoAnswer") + { + gotoWebPage( %url ); + } + else if(firstword(%url)$="RPGDialogLink") + { + %Answers=%this.gettext(); + %AnswerHeaderSize=strlen(""); + %AnswerStart=strpos(%Answers,"")+%AnswerHeaderSize; + %Answers=getSubStr(%Answers,%AnswerStart,strLen(%Answers)); + %AnswerEnd=strPos(%Answers,"")+4; + + ChatHud.addLine($Pref::RPGDialog::ChatHudAnswerColor@"You: "@StripMLControlChars(getSubStr(%Answers,0,%AnswerEnd))); + + CommandToServer('RPGDialogAnswer', $RPGDialog::Sender, $RPGDialog::questionNumber, "QL"@restwords(%url)); + + Canvas.popDialog(RPGDialog); + RPGDialogQuestion.settext(""); + RPGDialogAnswer.settext(""); + } + else if(firstword(%url)$="RPGDialogNoAnswer") + { + Canvas.popDialog(RPGDialog); + RPGDialogQuestion.settext(""); + RPGDialogAnswer.settext(""); + } + else + { + %Answers=%this.gettext(); + %Answers=strReplace(%Answers,restwords(%url)@" - ",""); + %AnswerHeaderSize=strlen(""); + %AnswerStart=strpos(%Answers,"")+%AnswerHeaderSize; + %Answers=getSubStr(%Answers,%AnswerStart,strLen(%Answers)); + %AnswerEnd=strpos(%Answers,"")+4; + + ChatHud.addLine($Pref::RPGDialog::ChatHudAnswerColor@"You: "@StripMLControlChars(getSubStr(%Answers,0,%AnswerEnd))); + + CommandToServer('RPGDialogAnswer', $RPGDialog::Sender, $RPGDialog::questionNumber, restwords(%url)); + + Canvas.popDialog(RPGDialog); + RPGDialogQuestion.settext(""); + RPGDialogAnswer.settext(""); + } +} + +function playRPGDialogSound(%message) +{ + // Search for wav tag marker. + %soundStart = strstr(%message, "~Sound:"); + if (%soundStart == -1) { + return -1; + } + + if(alxIsPlaying($RPGDialogSoundHandle)) + alxStop($RPGDialogSoundHandle); + + %sound = getSubStr(%message, %soundStart + 7, strLen(%message)); + $RPGDialogSoundHandle = alxPlay(%sound); + + return %soundStart; +} + +function SelectAnswer(%Number) +{ + if(strPos(RPGDialogAnswer.getText(),"")>=0) + RPGDialogAnswer.onURL("RPGDialog "@%Number); + else + OutOfRPGDialogFunction(%Number); +} \ No newline at end of file diff --git a/Templates/Modules/RPGDialog/Scripts/client/RPGDialogAudioProfiles.cs b/Templates/Modules/RPGDialog/Scripts/client/RPGDialogAudioProfiles.cs new file mode 100644 index 000000000..ddace2c60 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/client/RPGDialogAudioProfiles.cs @@ -0,0 +1,21 @@ +new SFXDescription(DialogSound) +{ + volume = 1.2; + isLooping= false; + is3D = false; + type = $MessageAudioType; +}; + +new SFXProfile(test) +{ + filename = "art/dialogs/sounds/test.wav"; + description = "DialogSound"; + preload = false; +}; + +new SFXProfile(test2) +{ + filename = "art/dialogs/sounds/test2.wav"; + description = "DialogSound"; + preload = false; +}; diff --git a/Templates/Modules/RPGDialog/Scripts/server/RPGDialog.cs b/Templates/Modules/RPGDialog/Scripts/server/RPGDialog.cs new file mode 100644 index 000000000..979a22d29 --- /dev/null +++ b/Templates/Modules/RPGDialog/Scripts/server/RPGDialog.cs @@ -0,0 +1,341 @@ +//----------------------------------------------------------------------------- +// RPGDialog - Presents the player with a question and several answers to select from +// Created by Nelson A. K. Gonsalves +//----------------------------------------------------------------------------- + +function getAction(%actionFile,%questionNumber) +{ + %file = new FileObject(); + if(isFile($Pref::Server::RPGDialog::ActionPath@%actionFile@".dla") && %file.openForRead($Pref::Server::RPGDialog::ActionPath@%actionFile@".dla")) + { + for(%i=1;%i<%questionNumber;%i++) + { + %file.readLine(); + if(%file.isEOF()) + return ""; + } + %action=%file.readLine(); + } + else if(isFile($RPGDialogEditorPref::ActionPath@%actionFile@".dla") && %file.openForRead($RPGDialogEditorPref::ActionPath@%actionFile@".dla")) + { + for(%i=1;%i<%questionNumber;%i++) + { + %file.readLine(); + if(%file.isEOF()) + return ""; + } + %action=%file.readLine(); + } + + %file.close(); + %file.delete(); + return %action; +} + +function RPGDialogMessageClient(%client,%sender,%npcFile,%questionNumber) +{ + %senderName=%sender.getshapename(); + %portrait=%sender.RPGDialogPortrait; + %playerName=%client.player.getshapename(); + + %sender.RPGDialogBusy=true; + %sender.RPGDialogTalkingTo=%client; + %sender.setAimObject(%client.player); + + commandToClient(%client,'RPGDialogMessage',%sender,%senderName,%portrait,%npcFile,%questionNumber,%playerName); + + CheckRPGDialogStatus(%client,%sender); +} + +function serverCmdRPGDialogAnswer(%client,%sender,%questionNumber,%answerNumber) +{ + if(%client==%sender.RPGDialogTalkingTo) + { + %npcFile=%sender.RPGDialogScript; + + %Actions=GetAction(%npcFile,%questionNumber); + + if(%Actions!$="") + { + %ActionHeaderSize=strlen("<"@%answerNumber@">"); + %ActionStart=strPos(%Actions,"<"@%answerNumber@">")+%ActionHeaderSize; + %Actions=getSubStr(%Actions,%ActionStart,strlen(%Actions)); + %ActionEnd=strPos(%Actions,""); + + if(%ActionEnd==-1) + return; + + %Actions=getSubStr(%Actions,0,%ActionEnd); + + while(%Actions!$="") + { + %ParamStart=strPos(%Actions,"(")+1; + %ParamEnd=strPos(%Actions,")")-%ParamStart; + %Param=getSubStr(%Actions,%ParamStart,%ParamEnd); + + %Action=getSubStr(%Actions,0,%ParamStart-1); + if(%Param!$="") + { + eval(%Action@"("@%Param@","@%client@","@%sender@",\""@%npcFile@"\");"); + } + else + { + eval(%Action@"("@%client@","@%sender@",\""@%npcFile@"\");"); + } + %Actions=getSubStr(%Actions,strlen(%Action)+%ParamEnd+2,strlen(%Actions)); + } + } + else + { + echo("ERROR::Invalid Question/Answer!!\nnpcFile = "@%npcFile@"\nquestionNumber = "@%questionNumber); + } + } +} + +function serverCmdRPGDialogRay(%client) +{ + %StartPos=%client.player.gettransform(); + %Eye = %client.player.getEyeVector(); + %EndPos = vectorScale(%Eye, -1); + %EndPos = vectorsub(%StartPos,%EndPos); + + InitContainerRadiusSearch(%EndPos, 2.5, $TypeMasks::PlayerObjectType); + + %rayCast=ContainerSearchNext(); + while(%rayCast != 0 ) + { + if(%rayCast.RPGDialogScript!$="") + { + if(!%rayCast.RPGDialogBusy) + { + RPGDialogMessageClient(%client, %rayCast, %rayCast.RPGDialogScript,%rayCast.RPGDialogStartQuestion); //start dialog. + return; + } + else + { + if(IsRPGDialogBusy(%rayCast)) + { + if(%client!=%raycast.RPGDialogTalkingTo) + { + messageClient(%client, '', %rayCast.RPGDialogBusyText, %raycast.RPGDialogTalkingTo.player.getShapeName()); + return; + } + else + return; + } + else + { + RPGDialogMessageClient(%client, %rayCast, %rayCast.RPGDialogScript,%rayCast.RPGDialogStartQuestion); //start dialog. + return; + } + } + } + %rayCast=ContainerSearchNext(); + } +} + +function IsRPGDialogBusy(%AiPlayerID) +{ + InitContainerRadiusSearch(%AiPlayerID.getTransform(), 5, $TypeMasks::PlayerObjectType); + %rayCastBusyCheck=ContainerSearchNext(); + while(%rayCastBusyCheck != 0 ) + { + if(%rayCastBusyCheck==(%AiPlayerID.RPGDialogTalkingTo).player) + { + return(true); + } + %rayCastBusyCheck=ContainerSearchNext(); + } + return(false); +} + +function CheckRPGDialogStatus(%Client,%Sender) //Checks if the player has moved since he started the dialog, moving too far from the sender will cancel the dialog +{ + InitContainerRadiusSearch(%Sender.getTransform(), 5, $TypeMasks::PlayerObjectType); + %rayCast=ContainerSearchNext(); + while(%rayCast != 0 ) + { + if(%rayCast==%Client.player) + { + schedule(1000,0,"CheckRPGDialogStatus",%Client,%Sender); + return; + } + %rayCast=ContainerSearchNext(); + } + CommandToClient(%client,'CloseRPGDialog'); + %Sender.RPGDialogBusy=false; + %Sender.RPGDialogTalkingTo=0; + %Sender.clearAim(); +} + +function SpawnTestNPC() +{ + %player = AIPlayer::spawn("a test NPC","359.973 304.759 217.766"); + %player.RPGDialogScript = "Test"; + %player.RPGDialogPortrait = "Test.png"; + %player.RPGDialogStartQuestion = 1; + %player.RPGDialogBusy = false; + %player.RPGDialogBusyText = 'Sorry but I\'m busy talking to %1 right now.'; + %player.RPGDialogTalkingTo = 0; + + return %player; +} + +function SpawnNPC(%Name,%Script,%Portrait,%startQuestion,%location) +{ + %player = AIPlayer::spawn(%Name,%location); + %player.RPGDialogScript = %Script; + %player.RPGDialogPortrait = %Portrait; + %player.RPGDialogStartQuestion = %startQuestion; + %player.RPGDialogBusy = false; + %player.RPGDialogBusyText = 'Sorry but I\'m busy talking to %1 right now.'; + %player.RPGDialogTalkingTo = 0; + + return %player; +} + +//------------------------------------------------------------------------------ +// RPGDialog Script Functions - functions bellow are made to be used by the +// dialog scripts. +// The commented out lines that start with are used when populating the action +// list on the RPGDialog Editor. +//------------------------------------------------------------------------------ + +//GotoQuestion(QuestionNumber) +function GotoQuestion(%questionNumber,%client,%sender,%npcFile) +{ + RPGDialogMessageClient(%client, %sender, %npcFile, %questionNumber); +} + +//CloseDialog() +function CloseDialog(%client,%sender,%npcFile) +{ + //sendind nothing to the client will close the dialog without anything else happening + %sender.RPGDialogBusy=false; + %sender.RPGDialogTalkingTo=0; +} + +//MoveTo(Position) +function MoveTo(%position,%client,%sender,%npcFile) +{ + %sender.setAimLocation(%position); + %sender.setMoveDestination(%position); + CloseDialog(%client,%sender,%npcFile); +} + +//KillPlayer() +function KillPlayer(%client,%sender,%npcFile) +{ + %client.player.kill("Sudden"); + CloseDialog(%client,%sender,%npcFile); +} + +//KillSender() +function KillSender(%client,%sender,%npcFile) +{ + %sender.kill("Sudden"); + CloseDialog(%client,%sender,%npcFile); +} + +//DamagePlayer(Amount) +function DamagePlayer(%DamageAmount,%client,%sender,%npcFile) +{ + %client.player.damage(0, %sender.getposition(), %damageAmount, "Sudden"); + CloseDialog(%client,%sender,%npcFile); +} + +//DamageSender(Amount) +function DamageSender(%DamageAmount,%client,%sender,%npcFile) +{ + %sender.damage(0, %sender.getposition(), %damageAmount, "Sudden"); + CloseDialog(%client,%sender,%npcFile); +} + +//TeleportPlayer(Position) +function TeleportPlayer(%Pos,%client,%sender,%npcFile) +{ + %client.player.setTransform(%Pos); + CloseDialog(%client,%sender,%npcFile); +} + +//TeleportSender(Position) +function TeleportSender(%Pos,%client,%sender,%npcFile) +{ + %sender.setTransform(%Pos); + CloseDialog(%client,%sender,%npcFile); +} + +//RenamePlayer(NewName) +function RenamePlayer(%NewName,%client,%sender,%npcFile) +{ + messageAllExcept(%client, -1, 'MsgPlayerRenamed', '\c1%1 is now known as %2.',%client.player.getshapeName(),%NewName); + messageClient(%client, 'MsgPlayerRenamed', '\c1You are now known as %1.',%NewName); + %client.player.setshapeName(%NewName); + CloseDialog(%client,%sender,%npcFile); +} + +//RenameSender(NewName) +function RenameSender(%NewName,%client,%sender,%npcFile) +{ + messageAll('MsgAIRenamed','\c1%1 is now known as %2.',%sender.getshapename(),%NewName); + %sender.setshapeName(%NewName); + CloseDialog(%client,%sender,%npcFile); +} + +//ChangeStartQuestion(QuestionNumber) +function ChangeStartQuestion(%NewQuestion,%client,%sender,%npcFile) +{ + %sender.RPGDialogStartQuestion=%NewQuestion; + CloseDialog(%client,%sender,%npcFile); +} + +//ChangeStartQuestionAndOpen(QuestionNumber) +function ChangeStartQuestionAndOpen(%NewQuestion,%client,%sender,%npcFile) +{ + %sender.RPGDialogStartQuestion=%NewQuestion; + RPGDialogMessageClient(%client, %sender, %sender.RPGDialogScript,%NewQuestion); +} + +//ChangeStartQuestionAndGoto(StartQuestion,GotoQuestion) +function ChangeStartQuestionAndGoto(%NewStartQuestion,%GoTo,%client,%sender,%npcFile) +{ + %sender.RPGDialogStartQuestion=%NewQuestion; + RPGDialogMessageClient(%client, %sender, %sender.RPGDialogScript,%GoTo); +} + +//ChangeScript(ScriptName,QuestionNumber) +function ChangeScript(%NewScript,%StartQuestion,%client,%sender,%npcFile) +{ + if(%NewScript!$="" && isFile($RPGDialogEditorPref::ActionPath@%NewScript@".dla")) + { + %sender.RPGDialogScript=%NewScript; + %sender.RPGDialogStartQuestion=%StartQuestion; + CloseDialog(%client,%sender,%npcFile); + } +} + +//ChangeScriptAndOpen(ScriptName,QuestionNumber) +function ChangeScriptAndOpen(%NewScript,%StartQuestion,%client,%sender,%npcFile) +{ + + if(%NewScript!$="" && isFile($RPGDialogEditorPref::ActionPath@%NewScript@".dla")) + { + %sender.RPGDialogScript=%NewScript; + %sender.RPGDialogStartQuestion=%StartQuestion; + RPGDialogMessageClient(%client, %sender, %NewScript,%StartQuestion); + } +} + +//ChangePortrait(NewPortrait) +function ChangePortrait(%NewPortrait,%client,%sender,%npcFile) +{ + %sender.RPGDialogPortrait=%NewPortrait; + CloseDialog(%client,%sender,%npcFile); +} + +//ChangePortraitAndGoto(NewPortrait,QuestionNumber) +function ChangePortraitAndGoto(%NewPortrait,%QuestionNumber,%client,%sender,%npcFile) +{ + %sender.RPGDialogPortrait=%NewPortrait; + RPGDialogMessageClient(%client, %sender, %sender.RPGDialogScript,%QuestionNumber); +} diff --git a/Templates/Modules/RPGDialog/gui/RPGDialog.gui b/Templates/Modules/RPGDialog/gui/RPGDialog.gui new file mode 100644 index 000000000..41ebf9258 --- /dev/null +++ b/Templates/Modules/RPGDialog/gui/RPGDialog.gui @@ -0,0 +1,156 @@ +new GuiControlProfile ("RPGDialogQuestionProfile") +{ + fontType = "Arial Bold"; + fontSize = 16; + fontColor = "44 172 181"; + fontColorLink = "255 96 96"; + fontColorLinkHL = "0 0 255"; + autoSizeWidth = true; + autoSizeHeight = true; +}; + +new GuiControlProfile ("RPGDialogAnswerProfile") +{ + fontType = "Arial Bold"; + fontSize = 16; + fontColor = "44 172 181"; + fontColorLink = "255 96 96"; + fontColorLinkHL = "0 0 255"; + autoSizeWidth = true; + autoSizeHeight = true; +}; + +new GuiControlProfile ("RPGDialogScrollProfile") +{ + opaque = false; + border = false; + borderColor = "0 255 0"; + bitmap = "./demoScroll"; + hasBitmapArray = true; +}; + +new GuiControlProfile ("RPGDialogBorderProfile") +{ + bitmap = "./chatHudBorderArray"; + hasBitmapArray = true; + opaque = false; +}; + +//--- OBJECT WRITE BEGIN --- +new GuiControl(RPGDialog) { + profile = "GuiModelessDialogProfile"; + horizSizing = "width"; + vertSizing = "height"; + position = "0 0"; + extent = "640 480"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + + new GuiControl() { + profile = "GuiDefaultProfile"; + horizSizing = "center"; + vertSizing = "relative"; + position = "120 260"; + extent = "400 220"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + + new GuiBitmapBorderCtrl(RPGDialogBorder) { + profile = "ChatHudBorderProfile"; + horizSizing = "width"; + vertSizing = "height"; + position = "0 0"; + extent = "400 220"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + useVariable = "0"; + tile = "0"; + + new GuiBitmapCtrl(RPGDialogBackground) { + profile = "GuiDefaultProfile"; + horizSizing = "width"; + vertSizing = "height"; + position = "8 8"; + extent = "384 212"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + bitmap = "./hudfill.png"; + wrap = "0"; + }; + new GuiScrollCtrl(RPGDialogScrollQuestion) { + profile = "RPGDialogScrollProfile"; + horizSizing = "width"; + vertSizing = "bottom"; + position = "89 8"; + extent = "303 94"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + constantThumbHeight = "0"; + childMargin = "0 0"; + + new GuiMLTextCtrl(RPGDialogQuestion) { + profile = "RPGDialogQuestionProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "1 1"; + extent = "283 16"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + lineSpacing = "0"; + allowColorChars = "0"; + maxChars = "-1"; + }; + }; + new GuiScrollCtrl(RPGDialogScrollAnswer) { + profile = "RPGDialogScrollProfile"; + horizSizing = "width"; + vertSizing = "height"; + position = "8 100"; + extent = "384 110"; + minExtent = "8 8"; + visible = "1"; + helpTag = "0"; + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + constantThumbHeight = "0"; + childMargin = "0 0"; + + new GuiMLTextCtrl(RPGDialogAnswer) { + profile = "RPGDialogAnswerProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "1 1"; + extent = "364 14"; + minExtent = "8 8"; + visible = "0"; + helpTag = "0"; + lineSpacing = "2"; + allowColorChars = "0"; + maxChars = "-1"; + }; + }; + new GuiBitmapCtrl(RPGDialogPortrait) { + profile = "GuiDefaultProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "8 8"; + extent = "80 94"; + minExtent = "8 2"; + visible = "1"; + helpTag = "0"; + wrap = "0"; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/RPGDialog/gui/dla/test.dla b/Templates/Modules/RPGDialog/gui/dla/test.dla new file mode 100644 index 000000000..749cb5ca6 --- /dev/null +++ b/Templates/Modules/RPGDialog/gui/dla/test.dla @@ -0,0 +1,3 @@ +GotoQuestion(2)<1>KillPlayer()<2>MoveTo("0 0 0")<3>TeleportPlayer("0 0 500")<4>TeleportPlayer("0 0 500")TeleportSender("0 0 600")<5>DamagePlayer(20)<6>GotoQuestion(3)<7>CloseDialog() +<1>RenameSender("Something Else")<2>GotoQuestion(1)<3>RenamePlayer("Something Else") +<1>ChangeStartQuestion(3)<2>ChangePortrait("unknown.png")<3>ChangePortraitAndGoto("unknown.png",3)<4>ChangeScript("test2",1)<5>ChangeScriptAndOpen("test2",1)<6>GotoQuestion(1)<7>ChangeStartQuestionAndOpen(1) diff --git a/Templates/Modules/RPGDialog/gui/dla/test2.dla b/Templates/Modules/RPGDialog/gui/dla/test2.dla new file mode 100644 index 000000000..a1947ca0d --- /dev/null +++ b/Templates/Modules/RPGDialog/gui/dla/test2.dla @@ -0,0 +1 @@ +<1>ChangeScript("test",1)<2>ChangeScriptAndOpen("test",3)<3>CloseDialog() diff --git a/Templates/Modules/RPGDialog/gui/dlq/test.dlq b/Templates/Modules/RPGDialog/gui/dlq/test.dlq new file mode 100644 index 000000000..d187d9e74 --- /dev/null +++ b/Templates/Modules/RPGDialog/gui/dlq/test.dlq @@ -0,0 +1,3 @@ +Hello <>, I'm <>, What do you want me to do? ~Sound:testKill me, please.
Run to the center of the world!
Teleport me!
Teleport us!
Damage me!
Something Else...
Nothing, see ya!
+Yes, I'm <>, do you want me to change my name to something else?Yes, please.
Nope...
Change my name instead!
+...~Sound:test2Change your start question to this question.
Change your portrait!
Change your portrait and come back to this question!
Change your script...
Change your script and open it
Go back to the first question.
Go back to the first question and set it as default.
diff --git a/Templates/Modules/RPGDialog/gui/dlq/test2.dlq b/Templates/Modules/RPGDialog/gui/dlq/test2.dlq new file mode 100644 index 000000000..9038037a1 --- /dev/null +++ b/Templates/Modules/RPGDialog/gui/dlq/test2.dlq @@ -0,0 +1 @@ +Hello <>, I'm <>, and this is the test2 script. What do you want to do?
Go back to the other script, please.
Change your script and open it on the 3rd question.
Nothing, see you later.
diff --git a/Templates/Modules/RPGDialog/gui/portraits/test.png b/Templates/Modules/RPGDialog/gui/portraits/test.png new file mode 100644 index 000000000..763f933a8 Binary files /dev/null and b/Templates/Modules/RPGDialog/gui/portraits/test.png differ diff --git a/Templates/Modules/RPGDialog/gui/portraits/unknown.png b/Templates/Modules/RPGDialog/gui/portraits/unknown.png new file mode 100644 index 000000000..375c2ddc6 Binary files /dev/null and b/Templates/Modules/RPGDialog/gui/portraits/unknown.png differ diff --git a/Templates/Modules/RPGDialog/sounds/test.wav b/Templates/Modules/RPGDialog/sounds/test.wav new file mode 100644 index 000000000..fe0ee4b65 Binary files /dev/null and b/Templates/Modules/RPGDialog/sounds/test.wav differ diff --git a/Templates/Modules/RPGDialog/sounds/test2.wav b/Templates/Modules/RPGDialog/sounds/test2.wav new file mode 100644 index 000000000..353cbd9d5 Binary files /dev/null and b/Templates/Modules/RPGDialog/sounds/test2.wav differ diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeEffectsPackExec.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeEffectsPackExec.cs new file mode 100644 index 000000000..dd55efecd --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeEffectsPackExec.cs @@ -0,0 +1,21 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack Exec File +// +// This file executes all the scripts associated with the pack. +// Thanks for your support! +// +// Copyright Adam deGrandis 2012 +//----------------------------------------------------------------------------- + +exec ("./LifelikeEmitters.cs"); +exec ("./LifelikeExp_ComplexLarge.cs"); +exec ("./LifelikeExp_ComplexSmall.cs"); +exec ("./LifelikeExp_SimpleLarge.cs"); +exec ("./LifelikeExp_SimpleSmall.cs"); +exec ("./LifelikeExp_GroundHitLarge.cs"); +exec ("./LifelikeExp_GroundHitSmall.cs"); +exec ("./LifelikeExp_FirebombLarge.cs"); +exec ("./LifelikeExp_FirebombSmall.cs"); +exec ("./LifelikeExp_Flak.cs"); +exec ("./LifelikeExp_Flashbang.cs"); + diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeEmitters.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeEmitters.cs new file mode 100644 index 000000000..58f37d58f --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeEmitters.cs @@ -0,0 +1,410 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Ambient Particle Emitters +// Copyright Adam deGrandis 2012 +// +// This file houses all the ambient emitters in the Lifelike Effects Pack. +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeEmitters.cs"); + +//----------------------------------------------------------------------------- +// Smoke +//----------------------------------------------------------------------------- + +datablock ParticleData(LifelikeSmokeLargeBlackParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke1"; + + gravityCoefficient = -0.2; + inheritedVelFactor = 0.00; + lifetimeMS = 4000; + lifetimeVarianceMS = 250; + spinRandomMin = -30; + spinRandomMax = 30; + + sizes[0] = 2; + sizes[1] = 4; + sizes[2] = 12; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; + + colors[0] = "0.1 0.1 0 0.1"; + colors[1] = "0.7 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0.0"; + + windCoefficient = 1; + +}; + +datablock ParticleEmitterData(LifelikeSmokeLargeBlackEmitter) +{ + ejectionPeriodMS = 130; + periodVarianceMS = 50; + ejectionVelocity = 1.0; + velocityVariance = 0.0; + thetaMin = 0.0; + thetaMax = 90.0; + phiReferenceVel = 0; + phiVariance = 360; + particles = LifelikeSmokeLargeBlackParticle; + blendStyle = "NORMAL"; + ejectionOffset = 0.5; +}; + + +datablock ParticleData(LifelikeSmokeSmallBlackParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke1"; + + gravityCoefficient = -0.1; + lifetimeMS = 2000; + lifetimeVarianceMS = 500; + spinRandomMin = -30; + spinRandomMax = 30; + + sizes[0] = 1; + sizes[1] = 2; + sizes[2] = 3; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; + + colors[0] = "0.1 0.1 0 0.1"; + colors[1] = "0.7 0.7 0.6 0.5"; + colors[2] = "1 0.9 0.8 0.0"; + + windCoefficient = 1; + +}; + +datablock ParticleEmitterData(LifelikeSmokeSmallBlackEmitter) +{ + ejectionPeriodMS = 150; + periodVarianceMS = 50; + ejectionVelocity = 1.0; + velocityVariance = 0.0; + thetaMin = 0.0; + thetaMax = 50.0; + phiReferenceVel = 0; + phiVariance = 360; + particles = LifelikeSmokeSmallBlackParticle; + blendStyle = "NORMAL"; + ejectionOffset = 0.1; +}; + + + + +datablock ParticleData(LifelikeSmokeLargeWhiteParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke2"; + + gravityCoefficient = -0.2; + inheritedVelFactor = 0.00; + lifetimeMS = 4000; + lifetimeVarianceMS = 250; + spinRandomMin = -30; + spinRandomMax = 30; + + sizes[0] = 2; + sizes[1] = 4; + sizes[2] = 12; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; + + colors[0] = "0.1 0.1 0 0.1"; + colors[1] = "0.7 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0.0"; + + windCoefficient = 1; + +}; + +datablock ParticleEmitterData(LifelikeSmokeLargeWhiteEmitter) +{ + ejectionPeriodMS = 130; + periodVarianceMS = 50; + ejectionVelocity = 1.0; + velocityVariance = 0.0; + thetaMin = 0.0; + thetaMax = 90.0; + phiReferenceVel = 0; + phiVariance = 360; + particles = LifelikeSmokeLargeWhiteParticle; + blendStyle = "NORMAL"; + ejectionOffset = 0.5; +}; + + +datablock ParticleData(LifelikeSmokeSmallWhiteParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke2"; + + gravityCoefficient = -0.1; + lifetimeMS = 2000; + lifetimeVarianceMS = 500; + spinRandomMin = -30; + spinRandomMax = 30; + + sizes[0] = 1; + sizes[1] = 2; + sizes[2] = 3; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; + + colors[0] = "0.1 0.1 0 0.1"; + colors[1] = "0.7 0.7 0.6 0.5"; + colors[2] = "1 0.9 0.8 0.0"; + + windCoefficient = 1; + +}; + +datablock ParticleEmitterData(LifelikeSmokeSmallWhiteEmitter) +{ + ejectionPeriodMS = 150; + periodVarianceMS = 50; + ejectionVelocity = 1.0; + velocityVariance = 0.0; + thetaMin = 0.0; + thetaMax = 70.0; + phiReferenceVel = 0; + phiVariance = 360; + particles = LifelikeSmokeSmallWhiteParticle; + blendStyle = "NORMAL"; + ejectionOffset = 0.1; +}; + + + +//----------------------------------------------------------------------------- +// Fire +//----------------------------------------------------------------------------- + + +datablock ParticleData(LifelikeFireSmallParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = "-0.2"; + lifetimeMS = 1000; + lifetimeVarianceMS = 200; + useInvAlpha = true; + spinRandomMin = -140.0; + spinRandomMax = 140.0; + + sizes[0] = "0.5"; + sizes[1] = "1"; + sizes[2] = "0.7"; + + colors[0] = "0.8 0.6 1 0.5"; + colors[1] = "0.8 0.4 0 1"; + colors[2] = "0.8 0.4 0 0"; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + + +datablock ParticleEmitterData(LifelikeFireSmallEmitter) +{ + ejectionPeriodMS = 70; + periodVarianceMS = 30; + + ejectionVelocity = 0.3; + velocityVariance = 0.2; + + thetaMin = 0.0; + thetaMax = 70.0; + + ejectionOffset = 0.15; + + particles = "LifelikeFireSmallParticle"; + blendStyle = "ADDITIVE"; +}; + + + +datablock ParticleData(LifelikeFireBigParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = "-0.2"; + lifetimeMS = 1400; + lifetimeVarianceMS = 500; + useInvAlpha = true; + spinRandomMin = -140.0; + spinRandomMax = 140.0; + + sizes[0] = "1"; + sizes[1] = "2"; + sizes[2] = "1.5"; + + colors[0] = "0.8 0.6 1 0.5"; + colors[1] = "0.8 0.4 0 0.9"; + colors[2] = "0.8 0.4 0 0"; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFireBigEmitter) +{ + ejectionPeriodMS = 70; + periodVarianceMS = 30; + + ejectionVelocity = 0.5; + velocityVariance = 0.0; + + thetaMin = 0.0; + thetaMax = 70.0; + + ejectionOffset = 0.5; + + particles = LifelikeFireBigParticle; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Embers +//----------------------------------------------------------------------------- + + +datablock ParticleData(LifelikeEmbersSmallParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/ember1"; + gravityCoefficient = "-0.2"; + lifetimeMS = 1500; + lifetimeVarianceMS = 200; + useInvAlpha = true; + spinRandomMin = -140.0; + spinRandomMax = 140.0; + + sizes[0] = "0.5"; + sizes[1] = "1"; + sizes[2] = "0.7"; + + colors[0] = "1 0.9 0.8 0.5"; + colors[1] = "1 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0"; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeEmbersSmallEmitter) +{ + ejectionPeriodMS = 70; + periodVarianceMS = 30; + + ejectionVelocity = 0.3; + velocityVariance = 0.2; + + thetaMin = 0.0; + thetaMax = 70.0; + + ejectionOffset = 0.15; + + particles = LifelikeEmbersSmallParticle; + blendStyle = "ADDITIVE"; +}; + + +datablock ParticleData(LifelikeEmbersBigParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/ember1"; + gravityCoefficient = "-0.2"; + lifetimeMS = 2000; + lifetimeVarianceMS = 500; + useInvAlpha = true; + spinRandomMin = -140.0; + spinRandomMax = 140.0; + + sizes[0] = "1"; + sizes[1] = "2"; + sizes[2] = "1.5"; + + colors[0] = "1 0.9 0.8 0.5"; + colors[1] = "1 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0"; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeEmbersBigEmitter) +{ + ejectionPeriodMS = 70; + periodVarianceMS = 30; + + ejectionVelocity = 0.5; + velocityVariance = 0.0; + + thetaMin = 0.0; + thetaMax = 70.0; + + ejectionOffset = 0.5; + + particles = LifelikeEmbersBigParticle; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Special +//----------------------------------------------------------------------------- + +datablock ParticleData(LifelikeFlareSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke2"; + + gravityCoefficient = -0.2; + inheritedVelFactor = 0.00; + lifetimeMS = 4000; + lifetimeVarianceMS = 250; + spinRandomMin = -30; + spinRandomMax = 30; + + sizes[0] = 2; + sizes[1] = 4; + sizes[2] = 12; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; + + colors[0] = "1 0.1 0.1 0.1"; + colors[1] = "1 0.3 0.3 1"; + colors[2] = "1 0.6 0.6 0.0"; + + windCoefficient = 1; + +}; + +datablock ParticleEmitterData(LifelikeFlareSmokeEmitter) +{ + ejectionPeriodMS = 130; + periodVarianceMS = 50; + ejectionVelocity = 1.0; + velocityVariance = 0.0; + thetaMin = 0.0; + thetaMax = 90.0; + phiReferenceVel = 0; + phiVariance = 360; + particles = LifelikeFlareSmokeParticle; + blendStyle = "NORMAL"; + ejectionOffset = 0.5; +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_ComplexLarge.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_ComplexLarge.cs new file mode 100644 index 000000000..0940da9df --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_ComplexLarge.cs @@ -0,0 +1,238 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Large Complex Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_ComplexLarge.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + +datablock ParticleData(LifelikeComplexLargeSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke1"; + gravityCoefficient = -0.05; + lifetimeMS = 3300; + lifetimeVarianceMS = 200; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.1 0.1 0 1"; + colors[1] = "0.7 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0.0"; + + sizes[0] = 4; + sizes[1] = 8; + sizes[2] = 12; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexLargeSmokeEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 5; + ejectionVelocity = 2; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 2; + particles = "LifelikeComplexLargeSmokeParticle"; + blendStyle = "NORMAL"; +}; + + +datablock ParticleData(LifelikeComplexLargeFireballParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/fireball"; + gravityCoefficient = -0.3; + lifetimeMS = 700; + lifetimeVarianceMS = 100; + spinRandomMin = -100.0; + spinRandomMax = 100.0; + + colors[0] = "1 0.9 0.8 1"; + colors[1] = "0.8 0.4 0.0 1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 1; + sizes[1] = 7; + sizes[2] = 4; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexLargeFireballEmitter) +{ + ejectionPeriodMS = 5; + periodVarianceMS = 3; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 3; + + particles = "LifelikeComplexLargeFireballParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeComplexLargeGlowParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.3; + lifetimeMS = 400; + lifetimeVarianceMS = 100; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + + colors[0] = "0.9 0.8 1 0.4"; + colors[1] = "0.8 0.4 0.0 0.1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 7; + sizes[1] = 11; + sizes[2] = 5; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexLargeGlowEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeComplexLargeGlowParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeComplexLargeSparks2Particle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark2"; + dragCoefficient = 4; + gravityCoefficient = 1; + lifetimeMS = 1500; + lifetimeVarianceMS = 500; + spinRandomMin = -0.0; + spinRandomMax = 0.0; + + colors[0] = "1 1 1 0.0"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.9 0.8 0.7 0"; + + sizes[0] = 4.0; + sizes[1] = 3.0; + sizes[2] = 1.0; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexLargeSparks2Emitter) +{ + ejectionPeriodMS = 2; + periodVarianceMS = 1; + ejectionVelocity = 70.0; + velocityVariance = 10.0; + ejectionOffset = 0; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeComplexLargeSparks2Particle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeComplexLargeSparks1Particle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark3"; + lifetimeMS = 350; + lifetimeVarianceMS = 20; + useInvAlpha = false; + + colors[0] = "1.0 0.9 0.8 1"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0.0"; + + sizes[0] = 2; + sizes[1] = 7; + sizes[2] = 12; + + times[0] = 0.0; + times[1] = 0.5; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexLargeSparks1Emitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 35; + velocityVariance = 10; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeComplexLargeSparks1Particle"; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + +datablock ExplosionData(LifelikeComplexLargeExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 200; + + // Volume + particleEmitter = LifelikeComplexLargeGlowEmitter; + particleDensity = 40; + particleRadius = 2; + + // Point emission + emitter[0] = LifelikeComplexLargeSmokeEmitter; + emitter[1] = LifelikeComplexLargeFireballEmitter; + emitter[2] = LifelikeComplexLargeSparks1Emitter; + emitter[3] = LifelikeComplexLargeSparks2Emitter; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 20.0; + + lightStartRadius = 20.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_ComplexSmall.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_ComplexSmall.cs new file mode 100644 index 000000000..693090c14 --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_ComplexSmall.cs @@ -0,0 +1,238 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Small Complex Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_ComplexSmall.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + +datablock ParticleData(LifelikeComplexSmallSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke1"; + gravityCoefficient = -0.02; + lifetimeMS = 2000; + lifetimeVarianceMS = 200; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.1 0.1 0 1"; + colors[1] = "0.7 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0.0"; + + sizes[0] = 2; + sizes[1] = 4; + sizes[2] = 6; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexSmallSmokeEmitter) +{ + ejectionPeriodMS = 15; + periodVarianceMS = 5; + ejectionVelocity = 1; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0.7; + particles = "LifelikeComplexSmallSmokeParticle"; + blendStyle = "NORMAL"; +}; + + +datablock ParticleData(LifelikeComplexSmallFireballParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/fireball"; + gravityCoefficient = -0.3; + lifetimeMS = 500; + lifetimeVarianceMS = 100; + spinRandomMin = -100.0; + spinRandomMax = 100.0; + + colors[0] = "1 0.9 0.8 1"; + colors[1] = "0.8 0.4 0.0 1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 1; + sizes[1] = 4; + sizes[2] = 2; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexSmallFireballEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 3; + ejectionVelocity = 2; + velocityVariance = 1; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 1.3; + + particles = "LifelikeComplexSmallFireballParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeComplexSmallGlowParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.3; + lifetimeMS = 400; + lifetimeVarianceMS = 100; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + + colors[0] = "0.9 0.8 1 0.4"; + colors[1] = "0.8 0.4 0.0 0.1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 3; + sizes[1] = 6; + sizes[2] = 2; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexSmallGlowEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeComplexSmallGlowParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeComplexSmallSparks2Particle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark2"; + dragCoefficient = 4; + gravityCoefficient = 1; + lifetimeMS = 1000; + lifetimeVarianceMS = 200; + spinRandomMin = -0.0; + spinRandomMax = 0.0; + + colors[0] = "1 1 1 0.5"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.9 0.8 0.7 0"; + + sizes[0] = 2.0; + sizes[1] = 1.5; + sizes[2] = 0.5; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexSmallSparks2Emitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 1; + ejectionVelocity = 40.0; + velocityVariance = 10.0; + ejectionOffset = 0; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeComplexSmallSparks2Particle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeComplexSmallSparks1Particle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark3"; + lifetimeMS = 300; + lifetimeVarianceMS = 20; + useInvAlpha = false; + + colors[0] = "1.0 0.9 0.8 1"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0.0"; + + sizes[0] = 1; + sizes[1] = 3.5; + sizes[2] = 6; + + times[0] = 0.0; + times[1] = 0.5; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeComplexSmallSparks1Emitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 17; + velocityVariance = 5; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeComplexSmallSparks1Particle"; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + +datablock ExplosionData(LifelikeComplexSmallExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 130; + + // Volume + particleEmitter = LifelikeComplexSmallGlowEmitter; + particleDensity = 20; + particleRadius = 1.2; + + // Point emission + emitter[0] = LifelikeComplexSmallSmokeEmitter; + emitter[1] = LifelikeComplexSmallFireballEmitter; + emitter[2] = LifelikeComplexSmallSparks1Emitter; + emitter[3] = LifelikeComplexSmallSparks2Emitter; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 5.0; + + lightStartRadius = 10.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_FirebombLarge.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_FirebombLarge.cs new file mode 100644 index 000000000..3304d5bed --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_FirebombLarge.cs @@ -0,0 +1,319 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Large Firebomb Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_FirebombLarge.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + + +datablock ParticleData(LifelikeFirebombLargeSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke2"; + gravityCoefficient = -0.1; + lifetimeMS = 1500; + lifetimeVarianceMS = 500; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.1 0.1 0.1 1"; + colors[1] = "0.8 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0"; + + sizes[0] = 4; + sizes[1] = 9; + sizes[2] = 12; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombLargeSmokeEmitter) +{ + ejectionPeriodMS = 25; + periodVarianceMS = 5; + ejectionVelocity = 2; + velocityVariance = 1; + thetaMin = 0; + thetaMax = 90; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 2; + particles = "LifelikeFirebombLargeSmokeParticle"; + blendStyle = "NORMAL"; +}; + +datablock ParticleData(LifelikeFirebombLargeFireBlastParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/fireblast"; + lifetimeMS = 250; + lifetimeVarianceMS = 50; + + colors[0] = "1 0.9 0.8 0"; + colors[1] = "0.8 0.4 0 1"; + colors[2] = "0.8 0.4 0 0"; + + sizes[0] = 2; + sizes[1] = 15; + sizes[2] = 2; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombLargeFireBlastEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 2; + ejectionVelocity = 50; + velocityVariance = 10; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeFirebombLargeFireBlastParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeFirebombLargeSparks1Particle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark1"; + lifetimeMS = 300; + lifetimeVarianceMS = 20; + gravityCoefficient = 0; + + colors[0] = "1.0 0.9 0.8 0.4"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0.0"; + + sizes[0] = 6; + sizes[1] = 4; + sizes[2] = 1; + + times[0] = 0.0; + times[1] = 0.5; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombLargeSparks1Emitter) +{ + ejectionPeriodMS = 7; + periodVarianceMS = 2; + ejectionVelocity = 40; + velocityVariance = 30; + thetaMin = 0; + thetaMax = 90; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeFirebombLargeSparks1Particle"; + blendStyle = "ADDITIVE"; +}; + + +datablock ParticleData(LifelikeFirebombLargeGlowParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.3; + lifetimeMS = 400; + lifetimeVarianceMS = 100; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + + colors[0] = "0.9 0.8 1 0.4"; + colors[1] = "0.8 0.4 0.0 0.1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 7; + sizes[1] = 11; + sizes[2] = 5; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombLargeGlowEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + + particles = "LifelikeFirebombLargeGlowParticle"; + blendStyle = "ADDITIVE"; +}; + + +datablock ParticleData(LifelikeFirebombLargeFireballParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.3; + lifetimeMS = 700; + lifetimeVarianceMS = 100; + spinRandomMin = -100.0; + spinRandomMax = 100.0; + + colors[0] = "1 0.9 0.8 1"; + colors[1] = "0.8 0.4 0.0 1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 1; + sizes[1] = 7; + sizes[2] = 4; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombLargeFireballEmitter) +{ + ejectionPeriodMS = 7; + periodVarianceMS = 3; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 3; + + particles = "LifelikeFirebombLargeFireballParticle"; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Debris +//----------------------------------------------------------------------------- + +datablock ParticleData(LifelikeFirebombLargeDebrisTrailParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + + gravityCoefficient = -0.2; + lifetimeMS = 500; + lifetimeVarianceMS = 300; + spinRandomMin = -300; + spinRandomMax = 300; + + sizes[0] = 1; + sizes[1] = 3; + sizes[2] = 1; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; + + colors[0] = "1 0.9 0.8 1"; + colors[1] = "0.8 0.4 0 0.5"; + colors[2] = "0.8 0.4 0 0"; + +}; + +datablock ParticleEmitterData(LifelikeFirebombLargeDebrisTrailEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 10; + ejectionVelocity = 5; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 10; + phiReferenceVel = 0; + phiVariance = 360; + + particles = "LifelikeFirebombLargeDebrisTrailParticle"; + blendStyle = "ADDITIVE"; + ejectionOffset = "2"; +}; + +datablock DebrisData(LifelikeFirebombLargeDebris) +{ + shapeFile = "art/shapes/particles/LifelikeEffectsPack/invisibledebris.dts"; + emitters[0] = LifelikeFirebombLargeDebrisTrailEmitter; + elasticity = 0.4; + friction = 0.25; + numBounces = 1; + bounceVariance = 0; + explodeOnMaxBounce = false; + staticOnMaxBounce = false; + snapOnMaxBounce = false; + minSpinSpeed = 100; + maxSpinSpeed = 200; + render2D = false; + lifetime = 2; + lifetimeVariance = 1; + velocity = 30; + velocityVariance = 10; + fade = false; + useRadiusMass = false; + baseRadius = 0.3; + gravModifier = 3.0; + terminalVelocity = 50; + ignoreWater = false; +}; + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + + +datablock ExplosionData(LifelikeFirebombLargeExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 150; + + // Volume + particleEmitter = LifelikeFirebombLargeGlowEmitter; + particleDensity = 5; + particleRadius = 3; + + // Point emission + emitter[0] = LifelikeFirebombLargeSmokeEmitter; + emitter[1] = LifelikeFirebombLargeFireballEmitter; + emitter[2] = LifelikeFirebombLargeFireBlastEmitter; + emitter[3] = LifelikeFirebombLargeSparks1Emitter; + + // Debris + debris = LifelikeFirebombLargeDebris; + debrisThetaMin = 10; + debrisThetaMax = 60; + debrisNum = 4; + debrisNumVariance = 2; + debrisVelocity = 25; + debrisVelocityVariance = 5; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 20.0; + + lightStartRadius = 20.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_FirebombSmall.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_FirebombSmall.cs new file mode 100644 index 000000000..88493fdc0 --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_FirebombSmall.cs @@ -0,0 +1,319 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Small Firebomb Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_FirebombSmall.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + + +datablock ParticleData(LifelikeFirebombSmallSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke2"; + gravityCoefficient = -0.05; + lifetimeMS = 1500; + lifetimeVarianceMS = 500; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.1 0.1 0.1 1"; + colors[1] = "0.8 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0"; + + sizes[0] = 2; + sizes[1] = 4.5; + sizes[2] = 6; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombSmallSmokeEmitter) +{ + ejectionPeriodMS = 30; + periodVarianceMS = 5; + ejectionVelocity = 2; + velocityVariance = 1; + thetaMin = 0; + thetaMax = 90; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 1; + particles = "LifelikeFirebombSmallSmokeParticle"; + blendStyle = "NORMAL"; +}; + +datablock ParticleData(LifelikeFirebombSmallFireBlastParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/fireblast"; + lifetimeMS = 250; + lifetimeVarianceMS = 50; + + colors[0] = "1 0.9 0.8 0.5"; + colors[1] = "0.8 0.4 0 1"; + colors[2] = "0.8 0.4 0 0"; + + sizes[0] = 1; + sizes[1] = 8; + sizes[2] = 1; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombSmallFireBlastEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 2; + ejectionVelocity = 20; + velocityVariance = 10; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeFirebombSmallFireBlastParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeFirebombSmallSparks1Particle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark1"; + lifetimeMS = 300; + lifetimeVarianceMS = 20; + gravityCoefficient = 0; + + colors[0] = "1.0 0.9 0.8 0.4"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0.0"; + + sizes[0] = 3; + sizes[1] = 2; + sizes[2] = 1; + + times[0] = 0.0; + times[1] = 0.5; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombSmallSparks1Emitter) +{ + ejectionPeriodMS = 12; + periodVarianceMS = 2; + ejectionVelocity = 20; + velocityVariance = 15; + thetaMin = 0; + thetaMax = 90; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeFirebombSmallSparks1Particle"; + blendStyle = "ADDITIVE"; +}; + + +datablock ParticleData(LifelikeFirebombSmallGlowParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.3; + lifetimeMS = 400; + lifetimeVarianceMS = 100; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + + colors[0] = "0.9 0.8 1 0.4"; + colors[1] = "0.8 0.4 0.0 0.1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 3; + sizes[1] = 6; + sizes[2] = 2; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombSmallGlowEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + + particles = "LifelikeFirebombSmallGlowParticle"; + blendStyle = "ADDITIVE"; +}; + + +datablock ParticleData(LifelikeFirebombSmallFireballParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.15; + lifetimeMS = 700; + lifetimeVarianceMS = 100; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + + colors[0] = "1 0.9 0.8 1"; + colors[1] = "0.8 0.4 0.0 1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 1; + sizes[1] = 4; + sizes[2] = 3; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFirebombSmallFireballEmitter) +{ + ejectionPeriodMS = 14; + periodVarianceMS = 3; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 1.5; + + particles = "LifelikeFirebombSmallFireballParticle"; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Debris +//----------------------------------------------------------------------------- + +datablock ParticleData(LifelikeFirebombSmallDebrisTrailParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + + gravityCoefficient = -0.2; + lifetimeMS = 500; + lifetimeVarianceMS = 300; + spinRandomMin = -300; + spinRandomMax = 300; + + sizes[0] = 0.5; + sizes[1] = 1.5; + sizes[2] = 0.5; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; + + colors[0] = "1 0.9 0.8 1"; + colors[1] = "0.8 0.4 0 0.5"; + colors[2] = "0.8 0.4 0 0"; + +}; + +datablock ParticleEmitterData(LifelikeFirebombSmallDebrisTrailEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 10; + ejectionVelocity = 5; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 10; + phiReferenceVel = 0; + phiVariance = 360; + + particles = "LifelikeFirebombSmallDebrisTrailParticle"; + blendStyle = "ADDITIVE"; + ejectionOffset = "1"; +}; + +datablock DebrisData(LifelikeFirebombSmallDebris) +{ + shapeFile = "art/shapes/particles/LifelikeEffectsPack/invisibledebris.dts"; + emitters[0] = LifelikeFirebombSmallDebrisTrailEmitter; + elasticity = 0.4; + friction = 0.25; + numBounces = 1; + bounceVariance = 0; + explodeOnMaxBounce = false; + staticOnMaxBounce = false; + snapOnMaxBounce = false; + minSpinSpeed = 100; + maxSpinSpeed = 200; + render2D = false; + lifetime = 2; + lifetimeVariance = 1; + velocity = 10; + velocityVariance = 4; + fade = false; + useRadiusMass = false; + baseRadius = 0.3; + gravModifier = 3.0; + terminalVelocity = 50; + ignoreWater = false; +}; + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + + +datablock ExplosionData(LifelikeFirebombSmallExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 120; + + // Volume + particleEmitter = LifelikeFirebombSmallGlowEmitter; + particleDensity = 5; + particleRadius = 1.5; + + // Point emission + emitter[0] = LifelikeFirebombSmallSmokeEmitter; + emitter[1] = LifelikeFirebombSmallFireballEmitter; + emitter[2] = LifelikeFirebombSmallFireBlastEmitter; + emitter[3] = LifelikeFirebombSmallSparks1Emitter; + + // Debris + debris = LifelikeFirebombSmallDebris; + debrisThetaMin = 10; + debrisThetaMax = 60; + debrisNum = 4; + debrisNumVariance = 2; + debrisVelocity = 15; + debrisVelocityVariance = 5; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 5.0; + + lightStartRadius = 10.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_Flak.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_Flak.cs new file mode 100644 index 000000000..473c21619 --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_Flak.cs @@ -0,0 +1,196 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Flak Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_Flak.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + + +datablock ParticleData(LifelikeFlakPointBurstParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/PointBurst"; + lifetimeMS = 150; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "1.0 0.9 0.8 1"; + colors[1] = "1 0.6 0.2 1"; + colors[2] = "0.8 0.4 0.0 0.0"; + + sizes[0] = 1; + sizes[1] = 8; + sizes[2] = 2; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlakPointBurstEmitter) +{ + ejectionPeriodMS = 40; + periodVarianceMS = 5; + ejectionVelocity = 0.1; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeFlakPointBurstParticle"; + blendStyle = "ADDITIVE"; +}; + + +datablock ParticleData(LifelikeFlakSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke1"; + lifetimeMS = 3300; + lifetimeVarianceMS = 200; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.5 0.4 0.1 0"; + colors[1] = "0.7 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0.0"; + + sizes[0] = 3; + sizes[1] = 5; + sizes[2] = 6; + + times[0] = 0.0; + times[1] = 0.05; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlakSmokeEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 1; + thetaMin = 0; + thetaMax = 180; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 2; + particles = "LifelikeFlakSmokeParticle"; + blendStyle = "NORMAL"; +}; + + + +datablock ParticleData(LifelikeFlakSparksParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark1"; + lifetimeMS = 100; + lifetimeVarianceMS = 50; + + colors[0] = "1.0 0.9 0.8 1"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0.0"; + + sizes[0] = 1; + sizes[1] = 3; + sizes[2] = 1; + + times[0] = 0.0; + times[1] = 0.5; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlakSparksEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 5; + ejectionVelocity = 35; + velocityVariance = 10; + thetaMin = 0; + thetaMax = 180; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeFlakSparksParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeFlakHazeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + lifetimeMS = 2500; + lifetimeVarianceMS = 500; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.4 0.3 0.1 0"; + colors[1] = "0.1 0.1 0.1 0.7"; + colors[2] = "0.1 0.1 0.1 0"; + + sizes[0] = 2; + sizes[1] = 3; + sizes[2] = 4; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlakHazeEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 0; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 180; + phiReferenceVel = 0; + phiVariance = 360; + ejectionOffset = 1; + + particles = "LifelikeFlakHazeParticle"; + blendStyle = "NORMAL"; +}; + + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + +datablock ExplosionData(LifelikeFlakExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 100; + + // Volume + particleEmitter = LifelikeFlakHazeEmitter; + particleDensity = 30; + particleRadius = 1; + + // Point emission + emitter[0] = LifelikeFlakSmokeEmitter; + emitter[1] = LifelikeFlakPointBurstEmitter; + emitter[2] = LifelikeFlakSparksEmitter; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 10.0; + + lightStartRadius = 10.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_Flashbang.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_Flashbang.cs new file mode 100644 index 000000000..707c79019 --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_Flashbang.cs @@ -0,0 +1,238 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Flashbang Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_Flashbang.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + + +datablock ParticleData(LifelikeFlashbangPointBurstParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/PointBurst"; + lifetimeMS = 350; + lifetimeVarianceMS = 0; + spinRandomMin = -20.0; + spinRandomMax = 20.0; + + colors[0] = "1.0 0.9 0.8 1"; + colors[1] = "1.0 0.9 0.8 0.2"; + colors[2] = "1.0 0.9 0.8 0.0"; + + sizes[0] = 2; + sizes[1] = 5; + sizes[2] = 1; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlashbangPointBurstEmitter) +{ + ejectionPeriodMS = 60; + periodVarianceMS = 5; + ejectionVelocity = 0; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + particles = "LifelikeFlashbangPointBurstParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeFlashbangSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.02; + lifetimeMS = 1500; + lifetimeVarianceMS = 200; + spinRandomMin = -100.0; + spinRandomMax = 100.0; + + colors[0] = "0.5 0.5 0.5 0.5"; + colors[1] = "1 1 1 0.3"; + colors[2] = "1 1 1 0.0"; + + sizes[0] = 2; + sizes[1] = 3; + sizes[2] = 5; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlashbangSmokeEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 2; + ejectionVelocity = 1; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 1; + particles = "LifelikeFlashbangSmokeParticle"; + blendStyle = "NORMAL"; +}; + + + +datablock ParticleData(LifelikeFlashbangGlowParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.3; + lifetimeMS = 400; + lifetimeVarianceMS = 100; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + + colors[0] = "0.9 0.8 1 0.4"; + colors[1] = "0.9 0.8 1 0.1"; + colors[2] = "0.9 0.8 1 0"; + + sizes[0] = 3; + sizes[1] = 6; + sizes[2] = 2; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlashbangGlowEmitter) +{ + ejectionPeriodMS = 30; + periodVarianceMS = 5; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeFlashbangGlowParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeFlashbangSparks2Particle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark2"; + dragCoefficient = 4; + gravityCoefficient = 1; + lifetimeMS = 1000; + lifetimeVarianceMS = 200; + spinRandomMin = -0.0; + spinRandomMax = 0.0; + + colors[0] = "1 1 1 0.5"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.9 0.8 0.7 0"; + + sizes[0] = 2.0; + sizes[1] = 1.5; + sizes[2] = 0.5; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlashbangSparks2Emitter) +{ + ejectionPeriodMS = 6; + periodVarianceMS = 1; + ejectionVelocity = 30.0; + velocityVariance = 10.0; + ejectionOffset = 0; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeFlashbangSparks2Particle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(LifelikeFlashbangSparks1Particle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark3"; + lifetimeMS = 200; + lifetimeVarianceMS = 20; + useInvAlpha = false; + + colors[0] = "1.0 0.9 0.8 1"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "1.0 0.9 0.8 0.0"; + + sizes[0] = 1; + sizes[1] = 3.5; + sizes[2] = 6; + + times[0] = 0.0; + times[1] = 0.5; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeFlashbangSparks1Emitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 17; + velocityVariance = 5; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeFlashbangSparks1Particle"; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + +datablock ExplosionData(LifelikeFlashbangExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 70; + + // Volume + particleEmitter = LifelikeFlashbangGlowEmitter; + particleDensity = 10; + particleRadius = 2; + + // Point emission + emitter[0] = LifelikeFlashbangSmokeEmitter; + emitter[1] = LifelikeFlashbangPointBurstEmitter; + emitter[2] = LifelikeFlashbangSparks1Emitter; + emitter[3] = LifelikeFlashbangSparks2Emitter; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 3.0; + + lightStartRadius = 10.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "1 0.9 0.8"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_GroundHitLarge.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_GroundHitLarge.cs new file mode 100644 index 000000000..834321a24 --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_GroundHitLarge.cs @@ -0,0 +1,208 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Large Ground Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_GroundHitLarge.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + + +datablock ParticleData(LifelikeGroundHitLargePointBurstParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/PointBurst"; + lifetimeMS = 350; + lifetimeVarianceMS = 0; + spinRandomMin = -20.0; + spinRandomMax = 20.0; + + colors[0] = "1.0 0.9 0.8 1"; + colors[1] = "0.8 0.4 0.0 0.2"; + colors[2] = "0.8 0.4 0.0 0.0"; + + sizes[0] = 8; + sizes[1] = 25; + sizes[2] = 2; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeGroundHitLargePointBurstEmitter) +{ + ejectionPeriodMS = 40; + periodVarianceMS = 5; + ejectionVelocity = 0; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + particles = "LifelikeGroundHitLargePointBurstParticle"; + blendStyle = "ADDITIVE"; +}; + + +datablock ParticleData(LifelikeGroundHitLargeSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke2"; + gravityCoefficient = 0.5; + lifetimeMS = 3000; + lifetimeVarianceMS = 500; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.3 0.2 0.1 0"; + colors[1] = "0.6 0.5 0.4 1"; + colors[2] = "0.6 0.5 0.4 0"; + + sizes[0] = 4; + sizes[1] = 14; + sizes[2] = 25; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeGroundHitLargeSmokeEmitter) +{ + ejectionPeriodMS = 15; + periodVarianceMS = 5; + ejectionVelocity = 10; + velocityVariance = 5; + thetaMin = 0; + thetaMax = 50; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + particles = "LifelikeGroundHitLargeSmokeParticle"; + blendStyle = "NORMAL"; +}; + + +datablock ParticleData(LifelikeGroundHitLargeDirtDebrisParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/dirtDebris"; + //dragCoefficient = 4; + gravityCoefficient = 3; + lifetimeMS = 1500; + lifetimeVarianceMS = 500; + spinRandomMin = -40.0; + spinRandomMax = 40.0; + + colors[0] = "1 1 1 1"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.9 0.8 0.7 0"; + + sizes[0] = 5; + sizes[1] = 10; + sizes[2] = 14; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeGroundHitLargeDirtDebrisEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 1; + ejectionVelocity = 30.0; + velocityVariance = 10.0; + ejectionOffset = 0; + thetaMin = 0; + thetaMax = 40; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeGroundHitLargeDirtDebrisParticle"; + blendStyle = "NORMAL"; +}; + + +datablock ParticleData(LifelikeGroundHitLargeDirtBlastParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/dirtBlast1"; + lifetimeMS = 850; + lifetimeVarianceMS = 50; + gravityCoefficient = 1; + + colors[0] = "0.6 0.5 0.4 1"; + colors[1] = "0.6 0.5 0.4 1"; + colors[2] = "0.6 0.5 0.4 0"; + + sizes[0] = 5; + sizes[1] = 30; + sizes[2] = 30; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeGroundHitLargeDirtBlastEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 2; + ejectionVelocity = 20; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 50; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeGroundHitLargeDirtBlastParticle"; + blendStyle = "NORMAL"; +}; + + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + + +datablock ExplosionData(LifelikeGroundHitLargeExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 200; + + // Volume + particleEmitter = LifelikeGroundHitLargeSmokeEmitter; + particleDensity = 5; + particleRadius = 3; + + // Point emission + emitter[0] = LifelikeGroundHitLargeSmokeEmitter; + emitter[1] = LifelikeGroundHitLargePointBurstEmitter; + emitter[2] = LifelikeGroundHitLargeDirtBlastEmitter; + emitter[3] = LifelikeGroundHitLargeDirtDebrisEmitter; + + // Sub explosion objects + //subExplosion[0] = LifelikeGroundHitLargeExplosion; + + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 20.0; + + lightStartRadius = 20.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_GroundHitSmall.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_GroundHitSmall.cs new file mode 100644 index 000000000..d2f796e87 --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_GroundHitSmall.cs @@ -0,0 +1,204 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Small Ground Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_GroundHitSmall.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + + +datablock ParticleData(LifelikeGroundHitSmallPointBurstParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/PointBurst"; + lifetimeMS = 350; + lifetimeVarianceMS = 0; + spinRandomMin = -20.0; + spinRandomMax = 20.0; + + colors[0] = "1.0 0.9 0.8 1"; + colors[1] = "0.8 0.4 0.0 0.2"; + colors[2] = "0.8 0.4 0.0 0.0"; + + sizes[0] = 4; + sizes[1] = 13; + sizes[2] = 1; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeGroundHitSmallPointBurstEmitter) +{ + ejectionPeriodMS = 60; + periodVarianceMS = 5; + ejectionVelocity = 0; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + particles = "LifelikeGroundHitSmallPointBurstParticle"; + blendStyle = "ADDITIVE"; +}; + + +datablock ParticleData(LifelikeGroundHitSmallSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke2"; + gravityCoefficient = 0.5; + lifetimeMS = 1500; + lifetimeVarianceMS = 500; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.3 0.2 0.1 0"; + colors[1] = "0.6 0.5 0.4 1"; + colors[2] = "0.6 0.5 0.4 0"; + + sizes[0] = 2; + sizes[1] = 7; + sizes[2] = 12.5; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeGroundHitSmallSmokeEmitter) +{ + ejectionPeriodMS = 40; + periodVarianceMS = 5; + ejectionVelocity = 6; + velocityVariance = 3; + thetaMin = 0; + thetaMax = 50; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + particles = "LifelikeGroundHitSmallSmokeParticle"; + blendStyle = "NORMAL"; +}; + + +datablock ParticleData(LifelikeGroundHitSmallDirtDebrisParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/dirtDebris"; + //dragCoefficient = 4; + gravityCoefficient = 3; + lifetimeMS = 1200; + lifetimeVarianceMS = 500; + spinRandomMin = -40.0; + spinRandomMax = 40.0; + + colors[0] = "1 1 1 1"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.9 0.8 0.7 0"; + + sizes[0] = 2; + sizes[1] = 5; + sizes[2] = 7; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeGroundHitSmallDirtDebrisEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 1; + ejectionVelocity = 20.0; + velocityVariance = 7.0; + ejectionOffset = 0; + thetaMin = 0; + thetaMax = 40; + phiReferenceVel = 0; + phiVariance = 360; + particles = "LifelikeGroundHitSmallDirtDebrisParticle"; + blendStyle = "NORMAL"; +}; + + +datablock ParticleData(LifelikeGroundHitSmallDirtBlastParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/dirtBlast1"; + lifetimeMS = 800; + lifetimeVarianceMS = 50; + gravityCoefficient = 1; + + colors[0] = "0.6 0.5 0.4 1"; + colors[1] = "0.6 0.5 0.4 1"; + colors[2] = "0.6 0.5 0.4 0"; + + sizes[0] = 1; + sizes[1] = 10; + sizes[2] = 13; + + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(LifelikeGroundHitSmallDirtBlastEmitter) +{ + ejectionPeriodMS = 30; + periodVarianceMS = 2; + ejectionVelocity = 13; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 50; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "LifelikeGroundHitSmallDirtBlastParticle"; + blendStyle = "NORMAL"; +}; + + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + + +datablock ExplosionData(LifelikeGroundHitSmallExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 150; + + // Volume + particleEmitter = LifelikeGroundHitSmallSmokeEmitter; + particleDensity = 10; + particleRadius = 1.5; + + // Point emission + emitter[0] = LifelikeGroundHitSmallSmokeEmitter; + emitter[1] = LifelikeGroundHitSmallPointBurstEmitter; + emitter[2] = LifelikeGroundHitSmallDirtBlastEmitter; + emitter[3] = LifelikeGroundHitSmallDirtDebrisEmitter; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 10.0; + + lightStartRadius = 10.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_SimpleLarge.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_SimpleLarge.cs new file mode 100644 index 000000000..005a0430a --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_SimpleLarge.cs @@ -0,0 +1,202 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Large Simple Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_SimpleLarge.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + + +datablock ParticleData(SimpleLargeSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke1"; + dragCoeffiecient = 0.0; + gravityCoefficient = -0.05; + inheritedVelFactor = 0.0; + constantAcceleration = 0.0; + lifetimeMS = 3300; + lifetimeVarianceMS = 200; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.1 0.1 0.1 1"; + colors[1] = "0.7 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0.0"; + + sizes[0] = 4; + sizes[1] = 8; + sizes[2] = 12; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(SimpleLargeSmokeEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 2; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 2; + particles = "SimpleLargeSmokeParticle"; + blendStyle = "NORMAL"; +}; + +datablock ParticleData(SimpleLargeSparksParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark1"; + lifetimeMS = 250; + lifetimeVarianceMS = 20; + + colors[0] = "1.0 0.9 0.8 0.2"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0.0"; + + sizes[0] = 1; + sizes[1] = 3; + sizes[2] = 1; + + times[0] = 0.0; + times[1] = 0.5; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(SimpleLargeSparksEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 5; + ejectionVelocity = 25; + velocityVariance = 10; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "SimpleLargeSparksParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(SimpleLargeFireballParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/fireball"; + gravityCoefficient = -0.1; + lifetimeMS = 500; + lifetimeVarianceMS = 100; + spinRandomMin = -100.0; + spinRandomMax = 100.0; + + colors[0] = "1 0.9 0.8 1"; + colors[1] = "0.9 0.5 0.1 1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 1; + sizes[1] = 7; + sizes[2] = 6; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(SimpleLargeFireballEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 3; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 2.5; + + particles = "SimpleLargeFireballParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(SimpleLargeGlowParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.3; + lifetimeMS = 400; + lifetimeVarianceMS = 100; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + + colors[0] = "0.9 0.8 1 0.4"; + colors[1] = "0.8 0.4 0.0 0.1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 7; + sizes[1] = 11; + sizes[2] = 5; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(SimpleLargeGlowEmitter) +{ + ejectionPeriodMS = 40; + periodVarianceMS = 5; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + + particles = "SimpleLargeGlowParticle"; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + +datablock ExplosionData(LifelikeSimpleLargeExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 125; + + // Volume + particleEmitter = SimpleLargeGlowEmitter; + particleDensity = 20; + particleRadius = 2; + + // Point emission + emitter[0] = SimpleLargeSmokeEmitter; + emitter[1] = SimpleLargeFireballEmitter; + emitter[2] = SimpleLargeSparksEmitter; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 20.0; + + lightStartRadius = 20.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_SimpleSmall.cs b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_SimpleSmall.cs new file mode 100644 index 000000000..e9ffdea4a --- /dev/null +++ b/Templates/Modules/RealisticVFX/Datablocks/LifelikeExp_SimpleSmall.cs @@ -0,0 +1,203 @@ +//----------------------------------------------------------------------------- +// Lifelike Effects Pack - Small Simple Explosion +// Copyright Adam deGrandis 2012 +// +// Thanks for your support! +// +//----------------------------------------------------------------------------- +//exec ("art/datablocks/LifelikeEffectsPack/LifelikeExp_SimpleSmall.cs"); + + +//----------------------------------------------------------------------------- +// Emitters +//----------------------------------------------------------------------------- + + + +datablock ParticleData(SimpleSmallSmokeParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/smoke1"; + dragCoeffiecient = 0.0; + gravityCoefficient = -0.02; + inheritedVelFactor = 0.0; + constantAcceleration = 0.0; + lifetimeMS = 3300; + lifetimeVarianceMS = 200; + spinRandomMin = -50.0; + spinRandomMax = 50.0; + + colors[0] = "0.1 0.1 0.1 1"; + colors[1] = "0.7 0.7 0.6 1"; + colors[2] = "1 0.9 0.8 0.0"; + + sizes[0] = 2; + sizes[1] = 4; + sizes[2] = 6; + + times[0] = 0.0; + times[1] = 0.1; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(SimpleSmallSmokeEmitter) +{ + ejectionPeriodMS = 20; + periodVarianceMS = 5; + ejectionVelocity = 1; + velocityVariance = 0; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0.7; + particles = "SimpleSmallSmokeParticle"; + blendStyle = "NORMAL"; +}; + +datablock ParticleData(SimpleSmallSparksParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/spark1"; + lifetimeMS = 200; + lifetimeVarianceMS = 20; + + colors[0] = "1.0 0.9 0.8 0.2"; + colors[1] = "1.0 0.9 0.8 1"; + colors[2] = "0.8 0.4 0 0.0"; + + sizes[0] = 0.5; + sizes[1] = 2; + sizes[2] = 0.5; + + times[0] = 0.0; + times[1] = 0.5; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(SimpleSmallSparksEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 5; + ejectionVelocity = 20; + velocityVariance = 10; + thetaMin = 0; + thetaMax = 70; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 0; + orientOnVelocity = true; + orientParticles = true; + particles = "SimpleSmallSparksParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(SimpleSmallFireballParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/fireball"; + gravityCoefficient = -0.1; + lifetimeMS = 500; + lifetimeVarianceMS = 100; + spinRandomMin = -100.0; + spinRandomMax = 100.0; + + colors[0] = "1 0.9 0.8 1"; + colors[1] = "0.9 0.5 0.1 1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 1; + sizes[1] = 4; + sizes[2] = 3; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(SimpleSmallFireballEmitter) +{ + ejectionPeriodMS = 10; + periodVarianceMS = 3; + ejectionVelocity = 2; + velocityVariance = 1; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + ejectionoffset = 1; + + particles = "SimpleSmallFireballParticle"; + blendStyle = "ADDITIVE"; +}; + +datablock ParticleData(SimpleSmallGlowParticle) +{ + textureName = "art/shapes/particles/LifelikeEffectsPack/flame1"; + gravityCoefficient = -0.3; + lifetimeMS = 400; + lifetimeVarianceMS = 100; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + + colors[0] = "0.9 0.8 1 0.4"; + colors[1] = "0.8 0.4 0.0 0.1"; + colors[2] = "0.8 0.4 0.0 0"; + + sizes[0] = 3; + sizes[1] = 6; + sizes[2] = 2; + + times[0] = 0.0; + times[1] = 0.3; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(SimpleSmallGlowEmitter) +{ + ejectionPeriodMS = 40; + periodVarianceMS = 5; + ejectionVelocity = 3; + velocityVariance = 2; + thetaMin = 0; + thetaMax = 120; + phiReferenceVel = 0; + phiVariance = 360; + + particles = "SimpleSmallGlowParticle"; + blendStyle = "ADDITIVE"; +}; + + + +//----------------------------------------------------------------------------- +// Explosions +//----------------------------------------------------------------------------- + + +datablock ExplosionData(LifelikeSimpleSmallExplosion) +{ + //soundProfile = YourSoundDatablock; + lifeTimeMS = 125; + + // Volume + particleEmitter = SimpleSmallGlowEmitter; + particleDensity = 20; + particleRadius = 1; + + // Point emission + emitter[0] = SimpleSmallSmokeEmitter; + emitter[1] = SimpleSmallFireballEmitter; + emitter[2] = SimpleSmallSparksEmitter; + + shakeCamera = true; + camShakeFreq = "10.0 11.0 9.0"; + camShakeAmp = "20.0 20.0 20.0"; + camShakeDuration = 1.5; + camShakeRadius = 5.0; + + lightStartRadius = 10.0; + lightEndRadius = 0.0; + lightStartColor = "1 0.9 0.8"; + lightEndColor = "0.8 0.4 0.0"; + lightStartBrightness = 2.0; + lightEndBrightness = 0.0; + +}; \ No newline at end of file diff --git a/Templates/Modules/RealisticVFX/Images/dirtBlast1.png b/Templates/Modules/RealisticVFX/Images/dirtBlast1.png new file mode 100644 index 000000000..26bb7ce34 Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/dirtBlast1.png differ diff --git a/Templates/Modules/RealisticVFX/Images/dirtDebris.png b/Templates/Modules/RealisticVFX/Images/dirtDebris.png new file mode 100644 index 000000000..4dbfc5f9a Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/dirtDebris.png differ diff --git a/Templates/Modules/RealisticVFX/Images/ember1.png b/Templates/Modules/RealisticVFX/Images/ember1.png new file mode 100644 index 000000000..fb0889dc8 Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/ember1.png differ diff --git a/Templates/Modules/RealisticVFX/Images/fireball.png b/Templates/Modules/RealisticVFX/Images/fireball.png new file mode 100644 index 000000000..aafad94ed Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/fireball.png differ diff --git a/Templates/Modules/RealisticVFX/Images/fireblast.png b/Templates/Modules/RealisticVFX/Images/fireblast.png new file mode 100644 index 000000000..df3457c45 Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/fireblast.png differ diff --git a/Templates/Modules/RealisticVFX/Images/flame1.png b/Templates/Modules/RealisticVFX/Images/flame1.png new file mode 100644 index 000000000..7c7fef5d6 Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/flame1.png differ diff --git a/Templates/Modules/RealisticVFX/Images/invisibledebris.dts b/Templates/Modules/RealisticVFX/Images/invisibledebris.dts new file mode 100644 index 000000000..8f68fef43 Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/invisibledebris.dts differ diff --git a/Templates/Modules/RealisticVFX/Images/pointBurst.png b/Templates/Modules/RealisticVFX/Images/pointBurst.png new file mode 100644 index 000000000..0cdf4ec5b Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/pointBurst.png differ diff --git a/Templates/Modules/RealisticVFX/Images/smoke1.png b/Templates/Modules/RealisticVFX/Images/smoke1.png new file mode 100644 index 000000000..be17513b3 Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/smoke1.png differ diff --git a/Templates/Modules/RealisticVFX/Images/smoke2.png b/Templates/Modules/RealisticVFX/Images/smoke2.png new file mode 100644 index 000000000..7a6437176 Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/smoke2.png differ diff --git a/Templates/Modules/RealisticVFX/Images/spark1.png b/Templates/Modules/RealisticVFX/Images/spark1.png new file mode 100644 index 000000000..cbde126bc Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/spark1.png differ diff --git a/Templates/Modules/RealisticVFX/Images/spark2.png b/Templates/Modules/RealisticVFX/Images/spark2.png new file mode 100644 index 000000000..8c6d19697 Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/spark2.png differ diff --git a/Templates/Modules/RealisticVFX/Images/spark3.png b/Templates/Modules/RealisticVFX/Images/spark3.png new file mode 100644 index 000000000..1daded89b Binary files /dev/null and b/Templates/Modules/RealisticVFX/Images/spark3.png differ diff --git a/Templates/Modules/RealisticVFX/RealisticVFX.cs b/Templates/Modules/RealisticVFX/RealisticVFX.cs new file mode 100644 index 000000000..85ca9801d --- /dev/null +++ b/Templates/Modules/RealisticVFX/RealisticVFX.cs @@ -0,0 +1,23 @@ +function RealisticVFX::onCreate(%this) +{ + return; + if(isObject(DatablockFilesList)) + { + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeEmitters.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_ComplexLarge.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_ComplexSmall.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_FirebombLarge.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_FirebombSmall.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_Flak.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_Flashbang.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_GroundHitLarge.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_GroundHitSmall.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_SimpleLarge.cs" ); + DatablockFilesList.add( "data/RalisticVFX/Datablocks/LifeLikeExp_SimpleSmall.cs" ); + } +} + +function RealisticVFX::onDestroy(%this) +{ +} + diff --git a/Templates/Modules/RealisticVFX/RealisticVFX.module b/Templates/Modules/RealisticVFX/RealisticVFX.module new file mode 100644 index 000000000..27e517302 --- /dev/null +++ b/Templates/Modules/RealisticVFX/RealisticVFX.module @@ -0,0 +1,15 @@ + + + diff --git a/Templates/Modules/TestGrids/Images/512_forestgreen_lines.png b/Templates/Modules/TestGrids/Images/512_forestgreen_lines.png new file mode 100644 index 000000000..5f6f1a105 Binary files /dev/null and b/Templates/Modules/TestGrids/Images/512_forestgreen_lines.png differ diff --git a/Templates/Modules/TestGrids/Images/512_forestgreen_lines_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/512_forestgreen_lines_ALBEDO.asset.taml new file mode 100644 index 000000000..204a9f76a --- /dev/null +++ b/Templates/Modules/TestGrids/Images/512_forestgreen_lines_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_black.png b/Templates/Modules/TestGrids/Images/Grid_512_black.png new file mode 100644 index 000000000..5e57c16c2 Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_black.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_black_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_black_ALBEDO.asset.taml new file mode 100644 index 000000000..56f9fcb4c --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_black_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_blue.png b/Templates/Modules/TestGrids/Images/Grid_512_blue.png new file mode 100644 index 000000000..2511284dd Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_blue.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_blue_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_blue_ALBEDO.asset.taml new file mode 100644 index 000000000..2aa406c61 --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_blue_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_forestgreen.png b/Templates/Modules/TestGrids/Images/Grid_512_forestgreen.png new file mode 100644 index 000000000..c5f2cd2fd Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_forestgreen.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_forestgreen_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_forestgreen_ALBEDO.asset.taml new file mode 100644 index 000000000..1a87c2d81 --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_forestgreen_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_green.png b/Templates/Modules/TestGrids/Images/Grid_512_green.png new file mode 100644 index 000000000..d2cbde68e Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_green.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_green_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_green_ALBEDO.asset.taml new file mode 100644 index 000000000..99fafb1c8 --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_green_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_grey.png b/Templates/Modules/TestGrids/Images/Grid_512_grey.png new file mode 100644 index 000000000..c4b574c76 Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_grey.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_grey_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_grey_ALBEDO.asset.taml new file mode 100644 index 000000000..57588e0b6 --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_grey_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_grey_base.png b/Templates/Modules/TestGrids/Images/Grid_512_grey_base.png new file mode 100644 index 000000000..a1e440f29 Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_grey_base.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_grey_base_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_grey_base_ALBEDO.asset.taml new file mode 100644 index 000000000..bc5eaa3ed --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_grey_base_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_orange.png b/Templates/Modules/TestGrids/Images/Grid_512_orange.png new file mode 100644 index 000000000..43c4953e8 Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_orange.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_orange_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_orange_ALBEDO.asset.taml new file mode 100644 index 000000000..cd03fb37d --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_orange_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_orange_lines.png b/Templates/Modules/TestGrids/Images/Grid_512_orange_lines.png new file mode 100644 index 000000000..51813d98c Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_orange_lines.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_orange_lines_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_orange_lines_ALBEDO.asset.taml new file mode 100644 index 000000000..5731d2960 --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_orange_lines_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/Images/Grid_512_red.png b/Templates/Modules/TestGrids/Images/Grid_512_red.png new file mode 100644 index 000000000..a9f95638a Binary files /dev/null and b/Templates/Modules/TestGrids/Images/Grid_512_red.png differ diff --git a/Templates/Modules/TestGrids/Images/Grid_512_red_ALBEDO.asset.taml b/Templates/Modules/TestGrids/Images/Grid_512_red_ALBEDO.asset.taml new file mode 100644 index 000000000..5fd1a42e2 --- /dev/null +++ b/Templates/Modules/TestGrids/Images/Grid_512_red_ALBEDO.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/TestGrids.cs b/Templates/Modules/TestGrids/TestGrids.cs new file mode 100644 index 000000000..506ae08d0 --- /dev/null +++ b/Templates/Modules/TestGrids/TestGrids.cs @@ -0,0 +1,8 @@ +function TestGrids::onCreate(%this) +{ +} + +function TestGrids::onDestroy(%this) +{ +} + diff --git a/Templates/Modules/TestGrids/TestGrids.module b/Templates/Modules/TestGrids/TestGrids.module new file mode 100644 index 000000000..0b1d90ce5 --- /dev/null +++ b/Templates/Modules/TestGrids/TestGrids.module @@ -0,0 +1,15 @@ + + + diff --git a/Templates/Modules/TestGrids/art/Grid_512_black.png b/Templates/Modules/TestGrids/art/Grid_512_black.png new file mode 100644 index 000000000..5e57c16c2 Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_black.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_blue.png b/Templates/Modules/TestGrids/art/Grid_512_blue.png new file mode 100644 index 000000000..2511284dd Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_blue.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_forestgreen.png b/Templates/Modules/TestGrids/art/Grid_512_forestgreen.png new file mode 100644 index 000000000..c5f2cd2fd Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_forestgreen.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_forestgreen_lines.png b/Templates/Modules/TestGrids/art/Grid_512_forestgreen_lines.png new file mode 100644 index 000000000..5f6f1a105 Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_forestgreen_lines.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_green.png b/Templates/Modules/TestGrids/art/Grid_512_green.png new file mode 100644 index 000000000..d2cbde68e Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_green.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_grey.png b/Templates/Modules/TestGrids/art/Grid_512_grey.png new file mode 100644 index 000000000..c4b574c76 Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_grey.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_grey_base.png b/Templates/Modules/TestGrids/art/Grid_512_grey_base.png new file mode 100644 index 000000000..a1e440f29 Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_grey_base.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_orange.png b/Templates/Modules/TestGrids/art/Grid_512_orange.png new file mode 100644 index 000000000..43c4953e8 Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_orange.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_orange_lines.png b/Templates/Modules/TestGrids/art/Grid_512_orange_lines.png new file mode 100644 index 000000000..51813d98c Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_orange_lines.png differ diff --git a/Templates/Modules/TestGrids/art/Grid_512_red.png b/Templates/Modules/TestGrids/art/Grid_512_red.png new file mode 100644 index 000000000..a9f95638a Binary files /dev/null and b/Templates/Modules/TestGrids/art/Grid_512_red.png differ diff --git a/Templates/Modules/TestGrids/art/materials.cs b/Templates/Modules/TestGrids/art/materials.cs new file mode 100644 index 000000000..ea05af987 --- /dev/null +++ b/Templates/Modules/TestGrids/art/materials.cs @@ -0,0 +1,91 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton Material( Grid512_Black_Mat ) +{ + mapTo = "Grid512_Black_Mat"; + diffuseMap[0] = "512_black"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_Blue_Mat ) +{ + mapTo = "Grid512_Blue_Mat"; + diffuseMap[0] = "512_blue"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_ForestGreen_Mat ) +{ + mapTo = "Grid512_ForestGreen_Mat"; + diffuseMap[0] = "512_forestgreen"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_ForestGreenLines_Mat ) +{ + mapTo = "Grid512_ForestGreenLines_Mat"; + diffuseMap[0] = "512_forestgreen_lines"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_Green_Mat ) +{ + mapTo = "Grid512_Green_Mat"; + diffuseMap[0] = "512_green"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_Grey_Mat ) +{ + mapTo = "Grid512_Grey_Mat"; + diffuseMap[0] = "512_grey"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_GreyBase_Mat ) +{ + mapTo = "Grid512_GreyBase_Mat"; + diffuseMap[0] = "512_grey_base"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_Orange_Mat ) +{ + mapTo = "Grid512_Orange_Mat"; + diffuseMap[0] = "512_orange"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_OrangeLines_Mat ) +{ + mapTo = "Grid512_OrangeLines_Mat"; + diffuseMap[0] = "512_orange_lines"; + materialTag0 = "TestMaterial"; +}; + +singleton Material( Grid512_Red_Mat ) +{ + mapTo = "Grid512_Red_Mat"; + diffuseMap[0] = "512_red"; + materialTag0 = "TestMaterial"; +}; diff --git a/Templates/Modules/TestGrids/materials/512_forestgreen_lines.asset.taml b/Templates/Modules/TestGrids/materials/512_forestgreen_lines.asset.taml new file mode 100644 index 000000000..66ac1bf39 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/512_forestgreen_lines.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/512_forestgreen_lines.cs b/Templates/Modules/TestGrids/materials/512_forestgreen_lines.cs new file mode 100644 index 000000000..b0939b6be --- /dev/null +++ b/Templates/Modules/TestGrids/materials/512_forestgreen_lines.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Mat_512_forestgreen_lines) { + mapTo = "512_forestgreen_lines"; + DiffuseMap[0] = "data/TestGrids/Images/512_forestgreen_lines.png"; + DiffuseMapAsset[0] = "TestGrids:512_forestgreen_lines_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_black.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_black.asset.taml new file mode 100644 index 000000000..149606116 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_black.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_black.cs b/Templates/Modules/TestGrids/materials/Grid_512_black.cs new file mode 100644 index 000000000..3aa877fb7 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_black.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_black) { + mapTo = "Grid_512_black"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_black.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_black_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_blue.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_blue.asset.taml new file mode 100644 index 000000000..b688206aa --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_blue.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_blue.cs b/Templates/Modules/TestGrids/materials/Grid_512_blue.cs new file mode 100644 index 000000000..1707faa0a --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_blue.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_blue) { + mapTo = "Grid_512_blue"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_blue.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_blue_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_forestgreen.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_forestgreen.asset.taml new file mode 100644 index 000000000..dbbf8c814 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_forestgreen.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_forestgreen.cs b/Templates/Modules/TestGrids/materials/Grid_512_forestgreen.cs new file mode 100644 index 000000000..d31fbd3bc --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_forestgreen.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_forestgreen) { + mapTo = "Grid_512_forestgreen"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_forestgreen.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_forestgreen_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_green.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_green.asset.taml new file mode 100644 index 000000000..cae05a98a --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_green.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_green.cs b/Templates/Modules/TestGrids/materials/Grid_512_green.cs new file mode 100644 index 000000000..79dbb147b --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_green.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_green) { + mapTo = "Grid_512_green"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_green.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_green_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_grey.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_grey.asset.taml new file mode 100644 index 000000000..a2441fb7d --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_grey.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_grey.cs b/Templates/Modules/TestGrids/materials/Grid_512_grey.cs new file mode 100644 index 000000000..f134179cb --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_grey.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_grey) { + mapTo = "Grid_512_grey"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_grey.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_grey_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_grey_base.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_grey_base.asset.taml new file mode 100644 index 000000000..f4c852c8c --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_grey_base.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_grey_base.cs b/Templates/Modules/TestGrids/materials/Grid_512_grey_base.cs new file mode 100644 index 000000000..5f2c1d86c --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_grey_base.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_grey_base) { + mapTo = "Grid_512_grey_base"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_grey_base.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_grey_base_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_orange.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_orange.asset.taml new file mode 100644 index 000000000..36b123d24 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_orange.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_orange.cs b/Templates/Modules/TestGrids/materials/Grid_512_orange.cs new file mode 100644 index 000000000..f14df6350 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_orange.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_orange) { + mapTo = "Grid_512_orange"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_orange.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_orange_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_orange_lines.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_orange_lines.asset.taml new file mode 100644 index 000000000..57b738af9 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_orange_lines.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_orange_lines.cs b/Templates/Modules/TestGrids/materials/Grid_512_orange_lines.cs new file mode 100644 index 000000000..bea3803bb --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_orange_lines.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_orange_lines) { + mapTo = "Grid_512_orange_lines"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_orange_lines.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_orange_lines_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/TestGrids/materials/Grid_512_red.asset.taml b/Templates/Modules/TestGrids/materials/Grid_512_red.asset.taml new file mode 100644 index 000000000..612371a78 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_red.asset.taml @@ -0,0 +1,9 @@ + diff --git a/Templates/Modules/TestGrids/materials/Grid_512_red.cs b/Templates/Modules/TestGrids/materials/Grid_512_red.cs new file mode 100644 index 000000000..9e2f2c520 --- /dev/null +++ b/Templates/Modules/TestGrids/materials/Grid_512_red.cs @@ -0,0 +1,7 @@ +//--- OBJECT WRITE BEGIN --- +singleton Material(Grid_512_red) { + mapTo = "Grid_512_red"; + DiffuseMap[0] = "data/TestGrids/Images/Grid_512_red.png"; + DiffuseMapAsset[0] = "TestGrids:Grid_512_red_ALBEDO"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/gameUI/GUIs/playGui.cs b/Templates/Modules/gameUI/GUIs/playGui.cs new file mode 100644 index 000000000..81a8d2772 --- /dev/null +++ b/Templates/Modules/gameUI/GUIs/playGui.cs @@ -0,0 +1,120 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// PlayGui is the main TSControl through which the game is viewed. +// The PlayGui also contains the hud controls. +//----------------------------------------------------------------------------- + +function PlayGui::onWake(%this) +{ + // Turn off any shell sounds... + // sfxStop( ... ); + + $enableDirectInput = "1"; + activateDirectInput(); + + // Message hud dialog + if ( isObject( MainChatHud ) ) + { + Canvas.pushDialog( MainChatHud ); + chatHud.attach(HudMessageVector); + } + + // just update the action map here + moveMap.push(); + + // hack city - these controls are floating around and need to be clamped + if ( isFunction( "refreshCenterTextCtrl" ) ) + schedule(0, 0, "refreshCenterTextCtrl"); + if ( isFunction( "refreshBottomTextCtrl" ) ) + schedule(0, 0, "refreshBottomTextCtrl"); +} + +function PlayGui::onSleep(%this) +{ + if ( isObject( MainChatHud ) ) + Canvas.popDialog( MainChatHud ); + + // pop the keymaps + moveMap.pop(); +} + +function PlayGui::clearHud( %this ) +{ + Canvas.popDialog( MainChatHud ); + + while ( %this.getCount() > 0 ) + %this.getObject( 0 ).delete(); +} + +//----------------------------------------------------------------------------- + +function refreshBottomTextCtrl() +{ + BottomPrintText.position = "0 0"; +} + +function refreshCenterTextCtrl() +{ + CenterPrintText.position = "0 0"; +} + +/*function PlayGui::onRightMouseDown(%this) +{ + %this.nocursor = true; + Canvas.checkCursor(); +} + +function PlayGui::onRightMouseUp(%this) +{ + %this.nocursor = false; + Canvas.checkCursor(); +}*/ + +/*function PlayGui::onInputEvent(%this, %device, %action, %state) +{ + if(%device $= "mouse0" && %action $= "button1") + { + if(%state == 1) + { + %this.nocursor = true; + Canvas.checkCursor(); + } + else + { + %this.nocursor = false; + Canvas.checkCursor(); + } + } + else if(%device $= "keyboard") + { + if(%action $= "w") + moveforward(%state); + else if(%action $= "a") + moveleft(%state); + else if(%action $= "s") + movebackward(%state); + else if(%action $= "d") + moveright(%state); + } +}*/ \ No newline at end of file diff --git a/Templates/Modules/gameUI/GUIs/playGui.gui b/Templates/Modules/gameUI/GUIs/playGui.gui new file mode 100644 index 000000000..e9522b42f --- /dev/null +++ b/Templates/Modules/gameUI/GUIs/playGui.gui @@ -0,0 +1,50 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GameTSCtrl(PlayGui) { + cameraZRot = "0"; + forceFOV = "0"; + reflectPriority = "1"; + renderStyle = "standard"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "1920 1080"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + helpTag = "0"; + noCursor = "1"; + + new GuiBitmapCtrl(LagIcon) { + bitmap = "data/ui/art/lagIcon.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "572 3"; + extent = "32 32"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/Modules/gameUI/gameUI.cs b/Templates/Modules/gameUI/gameUI.cs new file mode 100644 index 000000000..e52cb6890 --- /dev/null +++ b/Templates/Modules/gameUI/gameUI.cs @@ -0,0 +1,14 @@ +function gameUI::create( %this ) +{ + if (!$Server::Dedicated) + { + //guis + exec("./GUIs/playGui.gui"); + exec("./GUIs/playGui.cs"); + } +} + +function gameUI::destroy( %this ) +{ + +} \ No newline at end of file diff --git a/Templates/Modules/gameUI/gameUI.module b/Templates/Modules/gameUI/gameUI.module new file mode 100644 index 000000000..02952d63c --- /dev/null +++ b/Templates/Modules/gameUI/gameUI.module @@ -0,0 +1,15 @@ + + + \ No newline at end of file