--[[ effects.lua -- Effect configuration file for Evil Dead 3 This script supplies configuration information for various effects. The data can be stored either in a variable: coolEffectColor = { 0.5, 0.75, 0.25, 1.0 } -- R,G,B,A or in a function: function coolEffectColor() return { 0.5, 0.75, 0.25, 1.0 } -- R,G,B,A end Functions are useful for keeping state information or adding randomness Queries for physics objects should return data in one of the following formats: { mass, linearDamping, angularDamping, friction, restitution, radius } -- Sphere type { mass, linearDamping, angularDamping, friction, restitution, radiusX, radiusY, radiusZ } -- Box type Specify particle effects by name, with optional parameters (use -1 for defaults): { "effectName", additiveBlending, minLifetime, maxLifetime } C++ functions that can be called: PreloadParticle(name) -- Makes sure the specified particle effect is loaded PreloadTexture(name) -- Makes sure the specified texture is loaded Random() -- Returns a random number in the range [0,1) Random(limit) -- Returns a random number in the range [0,limit) Random(min,max) -- Returns a random number in the range [min,max) --------------- CODE BEGINS HERE -------------- ]] print( "LUA: Processing effects configuration file" ) ---------------------------------------------------------------------------- ----------------------------- Utility Functions ---------------------------- -- Returns a random integer number in the range [min,max] (note inclusive) function RandomInt(min,max) local val = Random() -- Get a value in the range [0,1) val = min + val * (max + 1 - min) -- Scale it to the range [min,max+1) return math.floor( val ) -- Integerize it and get the range [min,max] end ---------------------------------------------------------------------------- ------------------------------ Generic ------------------------------------- -- Soft limit on the number of active non-shadow decals in the world decalLimit = 64 -- Fade rate for expired decals decalDeadFade = 0.1 -- Allowable distance a decal can be away from a surface before it will be considered "floating", -- and the time it will take to fade away if it is floating decalFloatingCheck = { 0.2, 1.0 } -- Parameters used for cuttable piece dynamics: { gravity, minRotationRateInDegrees, maxRotationRateInDegrees } cuttableSettings = { -3.5, 45, 720 } -- Velocity of a cut piece function cuttableVelocity() return { Random( -0.5, 0.5 ), Random( 1.5, 3.5 ), Random( -0.5, 0.5 ) } end -- Projected shadow settings: { intensity, maxAngle (in degrees), cameraDistance } shadowSettings = { 0.4, 30, 4.0, 128 } -- Texture used for the pool of blood bloodSplatTexture = "bld_spat" -- Parameters for an expanding pool: { startSize, maxSize, expandRate, lifetime } bloodPoolParams = { 0.001, 1.5, 0.15, 40 } -- Texture used for bloody footprints bloodyFootprintTexture = "bl_foot" -- Parameters for bloody footprints: { size, trackingLifetime, decalLifetime } bloodyFootprintParams = { 0.125, 10, 40 } -- Texture used for Sam Spirit run footprints spiritFootprintTexture = "samPrint" -- Parameters for spirit footprints; { size, trackingLifetime, decalLifetime } spiritFootprintParams = { 0.125, 10, 40 } -- Texture used for Ash Rage Shockwave ashRageShockwave = "s_ring1" ---------------------------------------------------------------------------- ----------------------------- Chainsaw ------------------------------------- -- Motion trail { nearDist, farDist, sliceLength, vertexBufferSize } -- chainsawMotionTrailSettings = { 0.15, 0.75, .25, 72 } -- { initialAlpha, fadeRate } Fade rate is per frame. Assume 30Hz. -- chainsawMotionTrailAlpha = { 50, 20 } -- Texture chainsawMotionTrailTexture = "cs_swing" -- Preload any resources needed for motion trail function chainsawMotionTrailPreload() end -- Number of frames the blood trail is active chainsawBloodTrailFrames = 5 -- Particle effects -- chainsawParticleIdle = { "chs_idle" , 1, -1, -1 } chainsawParticleAttack = { "chs_idle", 1, -1, -1 } chainsawBloodParticle = "bld_sqrt" -- Blood splatter texture -- function chainsawBloodTexture() return "bld_0" .. RandomInt( 1, 4 ) end -- Process all possible resources to avoid load delays when they are used -- function chainsawPreload() end -- Calculate the size of the blood decal based on the distance from the creature to the wall -- function chainsawBloodSize( dist ) return 0.01 + dist * 0.2 -- Apply a minimum size and standard scaling factor end -- Maximum distance blood can be spattered chainsawBloodRange = 5 -- Distance from the chainsaw origin where we begin searching for walls to splatter blood. -- This is to avoid false positives in the collision detection at ground zero. chainsawBloodStartDist = 0.25 ---------------------------------------------------------------------------- --------------------------- Harpoon Gun ------------------------------------ -- Texture used for the harpoon rope effect harpoonRopeTexture = "rope" -- Harpoon rope effect { numControlPoints, numSegments, tangentFactor } -- harpoonRopeSettings1 = { 6, 32, 0.6 } -- Harpoon rope effect { ropeWidth, maxWiggleDistY, maxWiggleDistSideways, textureDensity } -- harpoonRopeSettings2 = { 0.02, 0.9, 0.475, 4.5 } ---------------------------------------------------------------------------- ----------------------------- Shotgun -------------------------------------- -- Particle effects -- shotgunBloodParticleEnter = { "bld_sml", -1, -1, -1 } shotgunBloodParticleExit = { "bld_lrg", -1, -1, -1 } shotgunWallHitParticle = "chs_hitW" -- Blood splatter texture -- function shotgunBloodTexture() return "bld_0" .. RandomInt( 1, 4 ) end -- Lifetime of a blood spatter shotgunBloodLifetime = 60 -- Texture used when the pellets hit a wall -- shotgunPelletTexture = "imgNull" -- Lifetime of a bullet hole shotgunPelletLifetime = 0 -- Zero means no fade until the limit is reached -- Calculate the size of the blood decal based on the distance from the creature to the wall -- function shotgunGetBloodSize( dist ) if (dist > 8) then return 0 end -- Limit the distance a spatter can be projected local scale = math.pow( dist, 1.35 ) -- Do a non-linear scaling local size = 0.01 + scale * 0.15 -- Apply a minimum size and standard scaling factor if (size > 0.8) then -- Clamp the result size = 0.8 end return size end ---------------------------------------------------------------------------- ------------------------ Projectile Weapons -------------------------------- -- Process all possible resources to avoid load delays when they are used -- function projweapPreload() -- Partile effects -- Textures end -- Size of a bullet hole in the wall projweapBulletHoleSize = 0.025 ---------------------------------------------------------------------------- -------------------------- Breaking Glass ---------------------------------- -- Texture used for breaking glass effect breakingGlassTexture = "whiteash" -- Glass shards will "reflect" light as they move breakingGlassLightDir = { 0.57735, 0.57735, 0.57735 } -- Determine the shared parameters for a pane of glass: { gravity, endingAltitudeFactor, minAlpha } breakingGlassParams = { -5.5, -2.0, 0.1 } -- Calculate the linear velocity for a shard of glass function breakingGlassShardLinearVelocity( distFromImpactPoint, impulse ) -- Do a quadratic falloff local force = 1 - distFromImpactPoint; return (1 - force * force) * impulse * 0.25 end -- Calculate the angular velocity for a shard of glass function breakingGlassShardAngularVelocity( distFromImpactPoint, impulse ) -- Do a linear falloff local force = 1 - distFromImpactPoint if (force < 0) then force = 0.01 end return force * impulse * 0.07216 end -- Preload resources that will be used later in order to avoid delays function breakingGlassPreload() end ---------------------------------------------------------------------------- ------------------------------ Throwables ---------------------------------- throwableDefaultModel = "thw_dynomite" throwableDefaultPhysicsObject = { 1.0, 0.8, 0.20, 0.65, 0.1, 0.30, 0.40, 0.30 } throwableDefaultParticleEffect = { "tnt_lit", 1 } throwableDefaultAngularVel = { 7.0, 6.0, 9.0 } ---------------------------------------------------------------------------- ------------------------------ Severing ---------------------------------- severingFXDust = { "hit_bone", 0 } severingFXBloodRed = { "bld_spry", 0, 0, -1 } severingFXBloodBlue = { "bld_burst", 0 } severingFXBloodBlack = { "smk_car", 0 } severingFXBloodGreen = { "mi_steamL", 0 } severingFXBlunt = { "hit_soft", 0 } ---------------------------------------------------------------------------- ----------------------------- Collectibles --------------------------------- -- Particle effects -- smallHealthEffect = "pupsh_fx" smallMoneyEffect = "pupsm_fx" ---------------------------------------------------------------------------- -------------------------------- Water ------------------------------------- waterEnterEffect = "wtr_splash" waterExitEffect = "wtr_splshExt" waterWadingEffect = "my_null" waterRippleTexture = "wtrWake" -- Lifetime is in seconds. waterRippleLifetime = 1.75 -- Minimum and Maximum Sizes are in world space units, and are the starting and -- end sizes of the ripples. waterWakeMinimumSize = 0.33 waterWakeMaximumSize = 2.50 -- Maximum alpha is used when moving quickly through water, while Minimum alpha -- is used when standing still in water. waterWakeMaximumAlpha = 64 waterWakeMinimumAlpha = 32 -- Ripple delay is specified in seconds. Minimum delay is used when moving -- quickly through water, while Maximum delay is used when standing still in -- water. waterWakeMinimumRippleDelay = 0.15 waterWakeMaximumRippleDelay = 1.00 ---------------------------------------------------------------------------- ----------------------- Weaponeer Motion Trail ----------------------------- -- Motion trail { nearDist, farDist, sliceLength, vertexBufferSize } -- weaponeerMotionTrailSettings = { 0.15, 0.75, .25, 72 } -- { initialAlpha, fadeRate } Fade rate is per frame. Assume 30Hz. -- weaponeerMotionTrailAlpha = { 50, 20 } -- Texture weaponeerMotionTrailTexture = "cs_swing" -- Preload any resources needed for motion trail function weaponeerMotionTrailPreload() end ----------------------------------------------------------------------------